:root {
  --bg: #f7f2ea;
  --card: #ffffff;
  --ink: #1d1712;
  --muted: #7a6d60;
  --line: #eadfce;
  --accent: #e8751a;
  --accent-ink: #ffffff;
  --soft: #fbeedd;
  --ok: #2f8a4f;
  --ok-soft: #e3f3e8;
  --err: #c0392b;
  --shadow: 0 1px 2px rgba(40, 25, 10, .06), 0 10px 26px -16px rgba(40, 25, 10, .35);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110f;
    --card: #1f1a16;
    --ink: #f5efe6;
    --muted: #b3a594;
    --line: #2f2822;
    --accent: #f08a24;
    --accent-ink: #1b1209;
    --soft: #2d2117;
    --ok: #6fd08f;
    --ok-soft: #1c2d21;
    --err: #ff8a7a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 30px -16px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
h1, h2 { margin: 0; line-height: 1.15; }
h2 { font-size: 19px; margin: 26px 4px 10px; }
a { color: inherit; }

.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 13px; }
.meter { display: grid; gap: 4px; justify-items: end; font-size: 12px; color: var(--muted); font-weight: 650; }
.meter i { display: block; width: 92px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter b { display: block; height: 100%; background: var(--accent); }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.boot { color: var(--muted); text-align: center; margin-top: 30vh; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.empty { color: var(--muted); margin: 0 4px 6px; font-size: 15px; }
.list { display: grid; gap: 14px; }

.big-btn {
  display: grid; place-items: center; min-height: 64px; border-radius: 16px; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 18px; cursor: pointer;
}
.big-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.big-btn:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
.note-field { display: grid; gap: 6px; margin-top: 14px; font-size: 14px; font-weight: 650; color: var(--muted); }
.note-field em { font-style: normal; font-weight: 500; }
textarea, input[name="t"] {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg);
  font-size: 16px; resize: vertical; outline: none;
}
textarea:focus, input[name="t"]:focus { border-color: var(--accent); }

.uploads { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.uploads:not(:empty) { margin-top: 14px; }
.up-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.up-top b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-top span { flex: none; font-weight: 750; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 8px; margin-top: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.up.listo .bar i { background: var(--ok); }
.up.listo .up-top span { color: var(--ok); }
.up.error .up-top span, .up-err { color: var(--err); }
.up-err { display: block; margin-top: 4px; font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 750; text-decoration: underline; cursor: pointer; }

.video { padding: 0; overflow: hidden; }
.video video { display: block; width: 100%; max-height: 62vh; background: #000; }
.v-info { display: grid; gap: 4px; padding: 14px 16px 4px; }
.v-info b { font-size: 16px; overflow-wrap: anywhere; }
.v-info small { color: var(--muted); font-size: 13px; }
.v-note { margin: 4px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--soft); font-size: 14px; white-space: pre-line; }
.chip { justify-self: start; margin-top: 2px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--soft); color: var(--accent); }
.chip.listo, .chip.publicado { background: var(--ok-soft); color: var(--ok); }
.v-acts { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); flex: 1 1 100%; }
.btn.on { background: var(--ok-soft); border-color: var(--ok-soft); color: var(--ok); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); margin-left: auto; }
.btn:disabled { opacity: .7; }
.btn:active { transform: scale(.98); }

.login { margin-top: 12vh; display: grid; gap: 12px; text-align: center; }
.login h1 { font-size: 22px; }
.login p { margin: 0; color: var(--muted); }
.login form { display: grid; gap: 10px; margin-top: 6px; }

#toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 50; max-width: min(92vw, 460px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 650; font-size: 15px; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--err); color: #fff; }
