:root {
  --bg: #0b0c0f;
  --surface: #14161b;
  --surface-2: #1c1f26;
  --line: #2a2e37;
  --ink: #f2f4f7;
  --ink-2: #a8b0bd;
  --ink-3: #6f7885;

  --flag: #f5a524;
  --flag-ink: #2a1c00;
  --flag-dim: rgba(245, 165, 36, .14);

  --ai: #f97316;
  --real: #22a6b8;
  --nocue: #7c8494;

  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: #05060a;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; }

#app {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 0;
}

.phone {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (min-width: 900px) {
  #app { padding: 28px; }
  .phone {
    height: min(920px, calc(100dvh - 56px));
    border-radius: 30px;
    box-shadow: var(--shadow);
    border: 1px solid #1b1e25;
  }
}

.desknote {
  display: none;
  position: fixed; left: 32px; top: 50%; transform: translateY(-50%);
  width: min(330px, 26vw);
  color: var(--ink-2); font-size: 13px; line-height: 1.6;
}
@media (min-width: 1181px) { .desknote:not([hidden]) { display: block; } }

.desknote h1 { color: var(--ink); font-size: 19px; margin: 0 0 6px; letter-spacing: -.01em; }
.desknote p { margin: 0 0 12px; }
.desknote code { font-family: var(--mono); font-size: 12px; color: var(--flag); }

.topbar {
  position: absolute; inset: 0 0 auto 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 14px 14px 26px;
  background: linear-gradient(180deg, rgba(0,0,0,.62), rgba(0,0,0,0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { font-weight: 700; letter-spacing: -.02em; font-size: 17px; }
.brand span { color: var(--flag); }
.iconbtn {
  width: 34px; height: 34px; border-radius: 999px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.10); color: var(--ink);
  font-size: 15px; line-height: 1;
}
.iconbtn:hover { background: rgba(255,255,255,.18); }
.backbtn { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }

.feed {
  flex: 1; overflow-y: auto; scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

.post {
  position: relative;
  height: 100%; width: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  overflow: hidden; background: #000;
}

.post > img {
  width: 100%; height: 100%; object-fit: contain;
}
.post::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0,0,0,.45) 0%, rgba(0,0,0,0) 22%),
    linear-gradient(0deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,0) 42%);
}

.meta {
  position: absolute; z-index: 6; left: 14px; right: 84px; bottom: 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.meta .who { display: flex; align-items: center; gap: 9px; }
.meta .who button { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.meta .when { color: rgba(255,255,255,.62); font-size: 13px; }
.caption { font-size: 14px; line-height: 1.45; color: rgba(255,255,255,.94); }
.tags { color: rgba(255,255,255,.72); font-size: 13.5px; }

.rail {
  position: absolute; z-index: 6; right: 10px; bottom: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 17px;
}
.rail .act { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rail .glyph {
  width: 44px; height: 44px; border-radius: 999px;
  background: rgba(255,255,255,.12); display: grid; place-items: center;
  font-size: 19px; backdrop-filter: blur(6px);
}
.rail .act:hover .glyph { background: rgba(255,255,255,.2); }
.rail .n { font-size: 11.5px; color: rgba(255,255,255,.85); font-variant-numeric: tabular-nums; }
.rail .pfp {
  width: 46px; height: 46px; border-radius: 999px; object-fit: cover;
  border: 2px solid #fff; position: relative;
}
.railpfp { position: relative; }
.railpfp .dot {
  position: absolute; right: -3px; bottom: -3px;
  width: 19px; height: 19px; border-radius: 999px;
  background: var(--flag); color: var(--flag-ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  border: 2px solid #000;
}

.flag {
  position: absolute; z-index: 8; left: 14px; right: 14px; top: 58px;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 13px;
  background: rgba(20, 15, 3, .82);
  border: 1px solid rgba(245, 165, 36, .5);
  backdrop-filter: blur(14px) saturate(1.2);
  text-align: left;
  animation: flagin .34s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes flagin { from { opacity: 0; transform: translateY(-8px); } }
.flag:hover { background: rgba(32, 24, 5, .9); border-color: rgba(245,165,36,.8); }
.flag .warn {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
  background: var(--flag); color: var(--flag-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.flag .txt { flex: 1; min-width: 0; }
.flag .t1 { display: block; font-size: 13.5px; font-weight: 650; color: #ffdca3; line-height: 1.25; }
.flag .t2 { display: block; font-size: 12px; color: rgba(255, 220, 163, .66); margin-top: 2px; font-variant-numeric: tabular-nums; }
.flag .chev { color: rgba(255,220,163,.7); font-size: 17px; }

.quiet {
  position: absolute; z-index: 8; right: 14px; top: 58px;
  width: 30px; height: 30px; border-radius: 999px;
  background: rgba(255,255,255,.11); backdrop-filter: blur(10px);
  display: grid; place-items: center; font-size: 13px; color: rgba(255,255,255,.8);
}
.quiet:hover { background: rgba(255,255,255,.2); }

.profile { flex: 1; overflow-y: auto; padding: 62px 0 26px; }
.phead { padding: 8px 20px 18px; text-align: center; }
.avatarwrap { position: relative; width: 96px; margin: 0 auto 12px; }
.avatarwrap img { width: 96px; height: 96px; border-radius: 999px; object-fit: cover; }
.avatarwrap .badge {
  position: absolute; right: -2px; bottom: -2px;
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--flag); color: var(--flag-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 16px;
  border: 3px solid var(--bg); box-shadow: 0 4px 14px rgba(245,165,36,.4);
}
.avatarwrap .badge:hover { filter: brightness(1.1); }
.phead h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.phead .handle { color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.phead .bio { color: var(--ink-2); font-size: 13.5px; margin-top: 10px; }
.stats { display: flex; justify-content: center; gap: 30px; margin: 16px 0 4px; }
.stats div { text-align: center; }
.stats b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--ink-3); }

.pfpwarn {
  margin: 4px 16px 18px; padding: 12px 13px; border-radius: 13px;
  display: flex; gap: 10px; align-items: center; text-align: left;
  background: var(--flag-dim); border: 1px solid rgba(245,165,36,.34);
}
.pfpwarn .warn {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
  background: var(--flag); color: var(--flag-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.pfpwarn .t1 { display: block; font-size: 13.5px; font-weight: 650; color: #ffdca3; line-height: 1.3; }
.pfpwarn .t2 { display: block; font-size: 12px; color: rgba(255,220,163,.66); margin-top: 2px; }
.pfpwarn .chev { color: rgba(255,220,163,.7); font-size: 17px; margin-left: auto; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 0 2px 2px; }
.cell { position: relative; aspect-ratio: 3/4; overflow: hidden; background: #000; }
.cell img { width: 100%; height: 100%; object-fit: cover; }
.cell .mark {
  position: absolute; left: 5px; top: 5px;
  width: 20px; height: 20px; border-radius: 6px;
  background: var(--flag); color: var(--flag-ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
}
.cell .plays {
  position: absolute; left: 6px; bottom: 5px; font-size: 11.5px;
  color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.8); font-variant-numeric: tabular-nums;
}

.tabbar {
  display: flex; justify-content: space-around; align-items: center;
  padding: 9px 0 calc(9px + env(safe-area-inset-bottom));
  background: #000; border-top: 1px solid #14161b; z-index: 20;
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; color: var(--ink-3); }
.tabbar button .g { font-size: 17px; }
.tabbar button.on { color: var(--ink); }

.scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(3px);
  animation: fade .18s ease both;
}
@keyframes fade { from { opacity: 0; } }
[hidden] { display: none !important; }

.sheet {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 430px;
  background: var(--surface); border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--line);
  max-height: 86%; overflow-y: auto;
  animation: up .28s cubic-bezier(.2,.85,.25,1) both;
}
@keyframes up { from { transform: translate(-50%, 100%); } }
.grab { width: 38px; height: 4px; border-radius: 99px; background: #3a4049; margin: 10px auto 4px; }
.sheet .body { padding: 6px 18px 22px; }

.sheet h3 { margin: 10px 0 4px; font-size: 18px; letter-spacing: -.015em; line-height: 1.28; }
.sheet .sub { color: var(--ink-3); font-size: 12.5px; }

.gauge { margin: 16px 0 6px; }
.gauge .track {
  position: relative; height: 8px; border-radius: 99px;
  background: linear-gradient(90deg, #1d3a3f 0%, #1d3a3f 60%, #4a3410 60%, #4a3410 100%);
}
.gauge .fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--real); }
.gauge .cut {
  position: absolute; top: -5px; bottom: -5px; left: 60%;
  width: 2px; background: var(--ink); opacity: .85;
}
.gauge .labels {
  position: relative; display: flex; justify-content: space-between;
  margin-top: 7px; font-size: 11.5px; color: var(--ink-3);
}

.gauge .labels .cutlabel {
  position: absolute; transform: translateX(-50%);
  white-space: nowrap; color: var(--ink-2);
}
.gauge .big { font-size: 30px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.gauge .big.on { color: var(--flag); }
.gauge .big.off { color: var(--real); }

.note {
  margin-top: 14px; padding: 12px 13px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 12.5px; line-height: 1.55;
}
.note b { color: var(--ink); font-weight: 620; }
.note + .note { margin-top: 8px; }

.cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 16px; padding: 14px; border-radius: 13px;
  background: var(--flag); color: var(--flag-ink); font-weight: 700; font-size: 15px;
}
.cta:hover:not(:disabled) { filter: brightness(1.07); }
.cta.ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--ink-3); }
.kv b { font-weight: 600; font-family: var(--mono); font-size: 12px; }

.inspect {
  position: fixed; inset: 0; z-index: 70;
  background: #06070a; display: flex; flex-direction: column;
  animation: fade .2s ease both;
}

@media (min-width: 900px) {
  .sheet {
    --frame: min(920px, calc(100dvh - 56px));
    bottom: calc(50dvh - var(--frame) / 2);
    max-height: calc(var(--frame) * 0.86);
    border-radius: 20px 20px 29px 29px;
  }
  .inspect {
    inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 100%; max-width: 430px; height: min(920px, calc(100dvh - 56px));
    border-radius: 30px; border: 1px solid #1b1e25; overflow: hidden;
    box-shadow: var(--shadow);
  }
}
.inspect .bar {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid #171a20;
}
.inspect .bar .title { font-size: 14px; font-weight: 650; }
.inspect .bar .title small { display: block; color: var(--ink-3); font-weight: 400; font-size: 11.5px; margin-top: 2px; }
.inspect .bar .x { margin-left: auto; }

.stagewrap {

  flex: 1; display: grid; place-items: center; padding: 0;
  min-height: 0; min-width: 0;

  container-type: size;
}

.stage {
  position: relative;
  aspect-ratio: var(--ar, 1);
  width: min(100%, calc(100cqh * var(--ar, 1)));
}
.stage img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }

.heat {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1; border-radius: 8px;

}

.stage.pixelated .heat { image-rendering: pixelated; }

.stage img { filter: none; }
.stage.show-heat img { filter: brightness(.6); }
.stage:not(.show-heat) .heat, .stage:not(.show-heat) .lattice { display: none; }
.lattice { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.lattice path { fill: none; stroke: #ffffff; stroke-opacity: .25; stroke-width: .4px;
                vector-effect: non-scaling-stroke; }

.lassos path { stroke: #fff2d0; filter: drop-shadow(0 0 2px rgba(0,0,0,.95)); }
.lassos path.on { stroke: #fff; }

.box {
  position: absolute; cursor: pointer; border: 0; background: none; padding: 0;
  animation: fade .3s ease both;
  z-index: 3;
}
.box:focus-visible { outline: 2px solid #ffd489; outline-offset: 3px; border-radius: 4px; }
@keyframes pop { from { opacity: 0; transform: scale(.82); } }

.stage.picking .lassos path:not(.on) { opacity: .3; }
.stage.picking .box:not(.sel) .num { opacity: .38; }

.lassos { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; overflow: hidden; border-radius: 8px; }

.lassos path {
  fill: none; stroke: var(--flag); stroke-linejoin: round; stroke-linecap: round;
  stroke-width: calc(1.2px + var(--s, 1) * 1.5px);
  vector-effect: non-scaling-stroke;
  paint-order: stroke;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.75));
  animation: fade .34s ease both;
  transition: stroke .18s ease, stroke-width .18s ease, opacity .18s ease;
}
.lassos path.on { stroke: #ffd489; stroke-width: calc(2px + var(--s, 1) * 1.6px); }

.box .num {
  position: absolute; left: -2px; bottom: calc(100% + 3px);
  min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--flag); color: var(--flag-ink);
  font-size: 10px; font-weight: 800; line-height: 15px; text-align: center;
  border-radius: 4px; box-shadow: 0 1px 5px rgba(0,0,0,.6);
}
.box:hover .num, .box.sel .num { background: #ffd489; }

.box.num-inside .num { bottom: auto; top: 3px; left: 3px; }
.box.num-right .num { left: auto; right: -2px; }
.box.num-right.num-inside .num { left: auto; right: 3px; }

@media (prefers-reduced-motion: reduce) {
  .box, .lassos path { animation: none !important; }
}

.hint { padding: 0 18px 16px; color: var(--ink-3); font-size: 12.5px; line-height: 1.55; text-align: center; }
.hint b { color: var(--ink-2); font-weight: 600; }

.patchcard { max-height: 88%; }
.crops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.crop { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background-repeat: no-repeat; }
.crop .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 7px;
  background: linear-gradient(0deg, rgba(0,0,0,.8), rgba(0,0,0,0));
  font-size: 10.5px; color: rgba(255,255,255,.85); letter-spacing: .02em;
}

.crop .lasso { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.crop .lasso path {
  fill: none; stroke: #fff; stroke-width: 2px; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 2px rgba(0,0,0,.85));
}
.crop.region::before { content: ""; position: absolute; inset: 0; background: rgba(128,130,134,.62); }
.crop.region .lit { position: absolute; inset: 0; background-repeat: no-repeat; }

.shapenote { margin: 2px 0 0; color: var(--ink-3); font-size: 11.5px; letter-spacing: .01em; }

.verdictrow { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 99px; font-size: 12px; font-weight: 650;
  border: 1px solid currentColor;
}
.pill.ai { color: var(--ai); background: rgba(249,115,22,.12); }
.pill.real { color: var(--real); background: rgba(34,166,184,.12); }
.pill.nocue { color: var(--nocue); background: rgba(124,132,148,.12); }
.pill.plain { color: var(--ink-3); background: var(--surface-2); border-color: var(--line); font-weight: 500; }

.expl { font-size: 13.5px; line-height: 1.6; color: var(--ink); margin: 8px 0 0; }
.contents { font-size: 13px; line-height: 1.55; color: var(--ink-2); margin: 2px 0 0; }
.cues { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cues span { font-family: var(--mono); font-size: 11px; padding: 3px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.pager button { padding: 11px 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; }
.pager button:disabled { opacity: .34; cursor: default; }
.pager .of { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.about .body { padding-bottom: 26px; }
.about h4 { margin: 20px 0 6px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.about p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.62; color: var(--ink-2); }
.about p b { color: var(--ink); font-weight: 620; }
.about ul { margin: 0 0 10px; padding-left: 18px; color: var(--ink-2); font-size: 13.5px; line-height: 1.62; }
.about li { margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
  }
}

.prov { margin-top: 16px; }
.prov .kv b { text-align: right; }

.note.warn { border-color: rgba(245,165,36,.45); background: var(--flag-dim); color: #ffdca3; }
.crops { align-items: start; }
.overlay-toggle { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  color: var(--ink-2); font-size: 11px; white-space: nowrap; }
