:root {
  --bg: #fafaf8;
  --card: #ffffff;
  --ink: #141414;
  --mute: #77746e;
  --line: #e6e3dc;
  --accent: #8a6d3b;
  --ok: #2f7d4f;
  --bad: #b3402f;
  --r: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}
.hidden { display: none !important; }
.muted { color: var(--mute); }
.err { color: var(--bad); min-height: 1.2em; margin: 0; font-size: 14px; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 11px; color: var(--accent); margin: 0 0 6px; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; margin: 0 0 8px; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 22px; }

/* topo */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  background: rgba(250, 250, 248, .92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-size: 19px; line-height: 1.1; }
.brand small { display: block; font-family: inherit; color: var(--mute); font-size: 12px; letter-spacing: .04em; margin-top: 3px; }
.pill { font-size: 13px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--mute); max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { max-width: 560px; margin: 0 auto; padding: 18px; }

/* navegação */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: flex-end;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1; max-width: 90px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--mute); text-decoration: none; font-size: 11px; padding: 4px 0;
}
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.active { color: var(--ink); }
.tabs a.shoot {
  flex: none; width: 58px; height: 58px; margin-top: -26px; border-radius: 50%;
  background: var(--ink); color: #fff; justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
}
.tabs a.shoot svg { width: 26px; height: 26px; }

/* botões e campos */
.btn {
  appearance: none; border: 1px solid var(--ink); background: transparent; color: var(--ink);
  font: inherit; font-weight: 500; padding: 13px 18px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn.primary { background: var(--ink); color: #fff; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
input[type=text], input:not([type]), select, textarea {
  width: 100%; font: inherit; padding: 13px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
label.field { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--mute); }

/* início / feed */
.hero { padding: 6px 0 20px; }
.hero p { margin: 0; color: var(--mute); max-width: 36ch; }
.feed { display: flex; flex-direction: column; gap: 22px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.card .meta { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px 10px; font-size: 14px; }
.card .meta span { color: var(--mute); font-size: 12px; }
.card .media { display: block; width: 100%; padding: 0; border: 0; background: #ecebe6; position: relative; cursor: pointer; min-height: 120px; }
.card .media img { display: block; width: 100%; height: auto; }
.card .media .ph { aspect-ratio: 4 / 3; background: #1d1d1d; }
.card .play {
  position: absolute; inset: 0; margin: auto; width: 58px; height: 58px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); display: grid; place-items: center;
}
.card .play::after { content: ""; border-left: 16px solid #fff; border-top: 10px solid transparent; border-bottom: 10px solid transparent; margin-left: 4px; }
.card .foot { padding: 10px 14px 14px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.card .foot .tag { align-self: flex-start; font-size: 12px; color: var(--accent); border: 1px solid #e3d6bb; border-radius: 999px; padding: 2px 10px; }
.card .foot .del { align-self: flex-end; background: none; border: 0; color: var(--mute); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; padding: 0; }
.empty { text-align: center; color: var(--mute); padding: 56px 12px; border: 1px dashed var(--line); border-radius: var(--r); }
.empty .btn { margin-top: 16px; }
.sentinel { height: 1px; }

/* câmera / envio */
.choices { display: grid; gap: 12px; margin: 18px 0; }
.choices label.btn { cursor: pointer; }
.choices label.btn.primary { padding: 18px; font-size: 17px; }
.choices input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.banner { background: #f4efe3; border: 1px solid #e3d6bb; border-radius: 12px; padding: 12px 14px; font-size: 14px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.banner button { background: none; border: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.queue { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.qrow { display: flex; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.qrow .th { width: 56px; height: 56px; border-radius: 8px; background: #e7e5de center / cover no-repeat; flex: none; }
.qrow .tx { flex: 1; min-width: 0; font-size: 13px; }
.qrow .tx b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .tx span { color: var(--mute); }
.qrow.error .tx span { color: var(--bad); }
.qrow.done .tx span { color: var(--ok); }
.bar { height: 4px; background: var(--line); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .15s; }
.success { text-align: center; padding: 34px 10px; }
.success h2 { font-size: 26px; }

/* desafios */
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.item { display: flex; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.item .n { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 13px; color: var(--mute); }
.item.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.item .t { flex: 1; min-width: 0; }
.item .t b { display: block; font-weight: 500; }
.item .t span { font-size: 13px; color: var(--mute); }
.score { display: flex; gap: 10px; margin: 14px 0 6px; }
.score > div { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.score b { display: block; font-family: var(--serif); font-size: 26px; font-weight: 400; }
.score span { font-size: 12px; color: var(--mute); }

/* quiz */
.progress { display: flex; gap: 5px; margin: 6px 0 22px; }
.progress i { flex: 1; height: 3px; border-radius: 3px; background: var(--line); }
.progress i.on { background: var(--ink); }
.qtext { font-family: var(--serif); font-size: 26px; line-height: 1.2; margin: 0 0 20px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { text-align: left; font: inherit; padding: 15px 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--ink); }
.opt:disabled { cursor: default; }
.opt.ok { border-color: var(--ok); background: #eef7f1; }
.opt.bad { border-color: var(--bad); background: #fbefed; }
.feedback { margin: 18px 0; font-size: 15px; }
.feedback b.ok { color: var(--ok); }
.feedback b.bad { color: var(--bad); }

/* ranking */
.rank { display: flex; flex-direction: column; margin-top: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rank .row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.rank .row:last-child { border-bottom: 0; }
.rank .row.me { background: #f4efe3; }
.rank .pos { width: 24px; font-family: var(--serif); font-size: 20px; color: var(--mute); }
.rank .row:nth-child(-n+3) .pos { color: var(--accent); }
.rank .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .who small { display: block; color: var(--mute); font-size: 12px; }
.rank .pts { font-weight: 600; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(10, 10, 10, .96); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 78vh; border-radius: 6px; background: #000; }
.lightbox .cap { color: #fff; margin-top: 14px; text-align: center; font-size: 14px; max-width: 520px; }
.lightbox .cap small { display: block; color: #aaa; margin-top: 4px; }
.lightbox .x { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 14px; background: rgba(255, 255, 255, .14); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; }

/* entrada */
.gate { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: grid; place-items: center; padding: 22px; overflow: auto; }
.gate-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.gate-card .muted { margin: 0 0 6px; }

.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 90; max-width: 88vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
