/* Partituras: papel de pauta, tinta azul-escura e um lacre carmim.
   O elemento de destaque é a pauta: ela é a área de envio e o indicador de progresso. */

:root {
  --paper: #f1f4f2;
  --panel: #ffffff;
  --ink: #1d2a3a;
  --ink-soft: #55657a;
  --staff: #b9c4cf;
  --line: #d5dce3;
  --accent: #b02a42;
  --accent-ink: #ffffff;
  --ok: #2f6b4f;
  --focus: #1f5fd1;
  --staff-gap: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131820;
    --panel: #1b222c;
    --ink: #e7ecf2;
    --ink-soft: #9fb0c3;
    --staff: #3b4756;
    --line: #2a3441;
    --accent: #e0627a;
    --accent-ink: #1a0a0e;
    --ok: #6cc29a;
    --focus: #7aa7ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

[hidden] { display: none !important; }

.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}
.page.narrow { max-width: 24rem; padding-top: 18vh; }

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 2rem;
  line-height: 1.1;
}
h2 { font-size: 1.05rem; }

.top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.lede { margin: 0.5rem 0 1.5rem; color: var(--ink-soft); max-width: 36rem; }
.hint { margin: 0.5rem 0 0; color: var(--ink-soft); font-size: 0.92rem; max-width: 40rem; }
.hint.small { font-size: 0.85rem; margin-top: 1rem; }
.error { margin: 0.75rem 0 0; color: var(--accent); font-weight: 500; }

/* ------------------------------------------------------------- botões */

.button, button {
  font: inherit;
  cursor: pointer;
}

.button {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
}
.button:hover { filter: brightness(1.08); }

.quiet {
  padding: 0.4rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--ink-soft);
}
.quiet:hover { color: var(--ink); border-color: var(--line); }

.danger:hover { color: var(--accent); border-color: var(--accent); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ------------------------------------------------------------- a pauta */

.staff {
  position: relative;
  display: block;
  height: calc(var(--staff-gap) * 4 + 1px);
  background:
    linear-gradient(var(--staff), var(--staff)) 0 0 / 100% 1px no-repeat,
    linear-gradient(var(--staff), var(--staff)) 0 calc(var(--staff-gap) * 1) / 100% 1px no-repeat,
    linear-gradient(var(--staff), var(--staff)) 0 calc(var(--staff-gap) * 2) / 100% 1px no-repeat,
    linear-gradient(var(--staff), var(--staff)) 0 calc(var(--staff-gap) * 3) / 100% 1px no-repeat,
    linear-gradient(var(--staff), var(--staff)) 0 calc(var(--staff-gap) * 4) / 100% 1px no-repeat;
}

.note {
  position: absolute;
  top: calc(var(--staff-gap) * 2 - 8px);
  left: 0;
  width: 20px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  transform: rotate(-20deg);
}
.note::after { /* haste */
  content: "";
  position: absolute;
  right: 0;
  bottom: 7px;
  width: 2px;
  height: 38px;
  background: var(--accent);
}
.note.hollow { background: var(--panel); border: 2px solid var(--accent); }
.note.hollow::after { right: -2px; bottom: 5px; }
.note.rest-end { left: calc(100% - 22px); background: var(--ok); }
.note.rest-end::after { background: var(--ok); }

@keyframes slide {
  from { left: 0; }
  to   { left: calc(100% - 22px); }
}
.note.moving { animation: slide 4.5s cubic-bezier(.45, .05, .55, .95) infinite alternate; }

@media (prefers-reduced-motion: reduce) {
  .note.moving { animation: none; left: 40%; }
}

/* ------------------------------------------------------------- envio */

.drop {
  display: grid;
  gap: 1rem;
  padding: 1.5rem 1.25rem 1.25rem;
  border: 2px dashed var(--staff);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); }
.drop.over { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.drop-text { display: grid; gap: 0.15rem; }
.drop-text span { color: var(--ink-soft); font-size: 0.92rem; }
.drop .staff { margin-top: 0.25rem; }

/* ------------------------------------------------------------- em andamento */

.active {
  margin-top: 1.25rem;
  padding: 1.1rem 1.25rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.active-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.active-head strong { overflow-wrap: anywhere; }
.active-head span { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.active .staff { margin: 1.25rem 0 0.5rem; }
.active .step { margin: 0.5rem 0 0; color: var(--ink-soft); font-size: 0.9rem; overflow-wrap: anywhere; }

/* ------------------------------------------------------------- prévia */

.viewer {
  margin-top: 1.5rem;
  scroll-margin-top: 1rem;
}
.viewer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.viewer-bar h2 { overflow-wrap: anywhere; }
.viewer-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }

.sheet {
  margin-top: 0.75rem;
  padding: 1rem;
  min-height: 8rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff; /* partitura sempre em papel branco, mesmo no tema escuro */
  color: #000;
}

/* ------------------------------------------------------------- histórico */

.history { margin-top: 2.5rem; }
.rows { list-style: none; margin: 0.5rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 1rem;
  align-items: center;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}
.row .name { font-weight: 600; overflow-wrap: anywhere; }
.row .meta { grid-column: 1; color: var(--ink-soft); font-size: 0.88rem; }
.row .actions { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; gap: 0.25rem; justify-content: flex-end; }
.row .status-error { color: var(--accent); }
.row .status-done { color: var(--ok); }
.row details { grid-column: 1 / -1; font-size: 0.85rem; color: var(--ink-soft); }
.row details pre { margin: 0.4rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.8rem; }

@media (max-width: 30rem) {
  .row { grid-template-columns: 1fr; }
  .row .actions { grid-column: 1; grid-row: auto; justify-content: flex-start; }
}

/* ------------------------------------------------------------- login */

.login { display: grid; gap: 0.5rem; margin-top: 1.5rem; }
.login input {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--staff);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}
.login .button { margin-top: 0.5rem; justify-self: start; }
