/* The game's night palette and type, as on playtrappy.com and the game's
   own dashboard (trappy dashboard/src/app.css). */
@font-face {
  font-family: Fredoka;
  src: url("/static/Fredoka.ttf") format("truetype");
  font-display: swap;
}
:root {
  --bg: #17111f;
  --panel: #241a33;
  --raise: #2e2340;
  --line: #3d2f51;
  --text: #fff3e0;
  --muted: #b8a9c7;
  --gold: #ffc94d;
  --gold-ink: #100c18;
  --display: Fredoka, "Trebuchet MS", sans-serif;
  --mint: #62d9a6;
  --red: #ff7479;
  --blue: #8fb8ff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  padding-top: max(16px, env(safe-area-inset-top));
}
body.with-nav main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
h1, h2, .brand { font-family: var(--display); letter-spacing: -0.02em; }
h1 { font-size: 28px; line-height: 1.15; margin: 4px 0 12px; text-wrap: balance; }
h2 { font-size: 19px; margin: 24px 0 8px; }

/* The header: the hunter and the wordmark on the site's faint brick wall. */
.top { position: relative; isolation: isolate; border-bottom: 1px solid var(--line); }
.top::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: #231a2e;
  -webkit-mask: url("/static/bricks.svg") repeat; mask: url("/static/bricks.svg") repeat;
}
.top div {
  max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
}
.top img { width: 32px; height: 32px; border-radius: 8px; }
.brand { font-size: 22px; font-weight: 700; color: var(--text); text-decoration: none; line-height: 1; }
.brand span { color: var(--gold); }
.top .tag {
  font-size: 12px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
}
.big { font-family: var(--display); font-size: 30px; font-weight: 700; margin: 4px 0; }
.big .muted { font-family: system-ui, sans-serif; font-size: 15px; font-weight: 400; }
p.warn { color: var(--gold); font-weight: 600; }
p.error { color: var(--red); font-weight: 600; }
a { color: var(--gold); }
p { margin: 8px 0; }
code { font-size: 14px; background: var(--raise); padding: 1px 5px; border-radius: 4px; }
.muted, .meta { color: var(--muted); }
.meta { font-size: 14px; }
.crumb { margin: 0; font-size: 14px; }
.crumb a::before { content: "‹ "; }

/* Tabs along the bottom, where a thumb reaches. */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center;
  background: #100c18; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; max-width: 140px; min-height: 56px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px;
  border-top: 3px solid transparent;
}
.tabs a[aria-current] { color: var(--gold); border-top-color: var(--gold); }
.tabs b {
  background: var(--gold); color: var(--gold-ink);
  font-size: 12px; min-width: 20px; padding: 1px 6px; border-radius: 10px; text-align: center;
}

.flash { padding: 10px 12px; border-radius: 10px; font-weight: 600; margin: 0 0 12px; }
.flash.ok { background: #173a2e; color: var(--mint); }
.flash.err { background: #45191f; color: var(--red); }
.note { padding: 10px 12px; border-radius: 10px; background: var(--panel); overflow-wrap: anywhere; }
.note.bad { border-left: 4px solid var(--red); }
.note.warn { border-left: 4px solid var(--gold); }

/* States. */
.chip {
  display: inline-block; vertical-align: middle;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 999px;
  background: var(--raise); color: var(--muted); white-space: nowrap;
}
h1 .chip { margin-left: 6px; }
.s-draft, .s-manual { background: var(--gold); color: var(--gold-ink); }
.s-approved, .s-scheduled, .s-publishing { background: #1d3358; color: var(--blue); }
.s-published { background: #173a2e; color: var(--mint); }
.s-failed { background: #45191f; color: var(--red); }
.s-rejected { text-decoration: line-through; }

.filters { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 4px; }
.filters a {
  flex: none; min-height: 40px; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-size: 15px;
}
.filters a span { color: var(--muted); font-variant-numeric: tabular-nums; }
.filters a[aria-current] { background: var(--raise); border-color: var(--gold); }

.cards { display: grid; gap: 10px; }
.card {
  display: flex; gap: 12px; padding: 10px; min-height: 76px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  color: var(--text); text-decoration: none;
}
.card:active { background: var(--raise); }
.thumb { flex: none; width: 54px; height: 96px; border-radius: 8px; object-fit: cover; background: var(--raise); }
.thumb.empty { border: 1px dashed var(--line); background: none; }
.card-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.line, .reason { font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.line { color: var(--muted); }
.reason { color: var(--red); overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 28px 0; text-align: center; }
.empty.small { padding: 4px 0; text-align: left; font-size: 14px; }

.player {
  display: block; width: 100%; max-width: 300px; aspect-ratio: 9 / 16; margin: 12px auto;
  background: #000; border-radius: 14px;
}
.player.none { display: grid; place-items: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); }

/* Forms: big targets, no zoom on focus (16px). */
label { display: block; font-size: 14px; color: var(--muted); font-weight: 600; }
input, textarea, button, .button { font: inherit; }
input, textarea {
  width: 100%; padding: 12px; border-radius: 10px;
  background: #100c18; color: var(--text); border: 1px solid var(--line);
}
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 18px; border-radius: 12px;
  background: var(--raise); color: var(--text); border: 1px solid var(--line);
  font-weight: 700; text-decoration: none; cursor: pointer;
}
button.primary, .button.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
button.danger { color: var(--red); }
button:disabled { opacity: .45; cursor: default; }
.stack { display: grid; gap: 8px; margin: 16px 0; }
.stack > button, article > .button, p > .button { width: 100%; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.row > button, .row > .button { flex: none; }
.row > button:only-child { flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.actions form { flex: 1 1 140px; }
.actions button { width: 100%; }
.caption { white-space: pre-wrap; background: var(--panel); padding: 12px; border-radius: 10px; }
.saved { color: var(--mint); font-weight: 700; }

.panel, .manual { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 16px 0; }
.panel h2, .manual h2 { margin-top: 0; }
.steps {
  width: 28px; height: 28px; border-radius: 50%; margin: 16px 0 8px;
  display: grid; place-items: center; background: var(--raise); color: var(--gold); font-weight: 800; font-size: 14px;
}

.day h2 { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .06em; margin: 20px 0 6px; }
.day.today h2 { color: var(--gold); }
.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.slots a {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); text-decoration: none;
}
.slots time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.slots .grow { flex: 1; min-width: 0; font-weight: 600; }
.slots small { display: block; color: var(--muted); font-weight: 400; }

details { margin: 24px 0; }
summary { cursor: pointer; color: var(--muted); min-height: 44px; display: flex; align-items: center; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 8px 0; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.history { padding-left: 18px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.history time { color: var(--text); }

/* The door: the login and first-run card, the hunter on top. */
.door {
  max-width: 400px; margin: 12vh auto 0; padding: 28px 24px 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .6);
}
.door > img { display: block; width: 72px; height: 72px; margin: -64px auto 8px; border-radius: 18px; box-shadow: 0 10px 30px -8px rgba(255, 201, 77, .35); }
.door h1 { text-align: center; margin-bottom: 16px; }
.door h1 span { color: var(--gold); }

/* A video's platforms. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; }
.pchip {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--raise); color: var(--muted); text-decoration: none; white-space: nowrap;
}
.pchip b { color: var(--text); font-weight: 700; }
.pchip.s-draft, .pchip.s-manual { background: var(--gold); color: var(--gold-ink); }
.pchip.s-draft b, .pchip.s-manual b { color: var(--gold-ink); }
.pchip.s-approved, .pchip.s-scheduled, .pchip.s-publishing { background: #1d3358; color: var(--blue); }
.pchip.s-published { background: #173a2e; color: var(--mint); }
.pchip.s-failed { background: #45191f; color: var(--red); }
.pchip.s-skipped, .pchip.s-rejected { text-decoration: line-through; }
.local { color: var(--muted); font-size: .9em; }
h1 .meta { font-size: 15px; font-weight: 400; }
.panel details { margin: 8px 0; }

/* Connection states. */
.c-connected { background: #173a2e; color: var(--mint); }
.c-token-expiring, .c-awaiting-platform-approval { background: var(--gold); color: var(--gold-ink); }
.c-connection-lost { background: #45191f; color: var(--red); }
select {
  width: 100%; padding: 12px; border-radius: 10px; font: inherit;
  background: #100c18; color: var(--text); border: 1px solid var(--line);
}
form.row { margin: 12px 0; }
/* Long addresses and keys wrap instead of widening the page. */
code { overflow-wrap: anywhere; }
.panel, .panel details, .panel form { min-width: 0; max-width: 100%; }

/* Campaign links. */
.links { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 10px; }
.links a {
  display: grid; gap: 4px; padding: 12px; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  color: var(--text); text-decoration: none;
}
.links a:active { background: var(--raise); }
.links code { color: var(--gold); background: none; padding: 0; }
.chip.free { background: #173a2e; color: var(--mint); }
.chip.paid { background: #1d3358; color: var(--blue); }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick .button { text-align: center; line-height: 1.25; padding: 8px 12px; }
.howto ol { padding-left: 20px; margin: 8px 0; display: grid; gap: 6px; }
.tabs a { padding: 0 4px; font-size: 14px; }
/* The Library tab: every library video as a 9:16 tile. */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  color: var(--text); text-decoration: none;
}
.tile:active { background: var(--raise); }
.tile img { width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; background: var(--raise); display: block; }
.tile-body { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; font-size: 14px; min-width: 0; }
.tile-body .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A used video: a badge on its picture, the picture quieter. */
.tile { position: relative; }
.tile .s-used { position: absolute; top: 8px; left: 8px; background: rgba(16, 12, 24, .82); color: var(--muted); border: 1px solid var(--line); }
.tile.used img { opacity: .5; }
.chip.s-used { background: var(--raise); color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* Narrow phones: a calendar slot on two lines (its time, then the
   platform and state), as on the desktop's day cards. */
@media (max-width: 480px) {
  .slots a { flex-wrap: wrap; gap: 2px 8px; padding: 8px 12px; }
  .slots .grow { flex: 1 1 calc(100% - 72px); order: 2; }
  .slots .chip { order: 3; align-self: center; }
}

/* Only on wide screens: the sidebar, the Trappy brand in it and the tab
   icons. Phones keep the bottom tabs above. */
.tabs .side-brand, .tabs svg { display: none; }

/* Pointers: a lift on what can be opened, quick and quiet. */
@media (hover: hover) {
  .card, .tile, .links a, .slots a, .filters a, button, .button { transition: background-color .15s, border-color .15s, transform .15s, box-shadow .15s; }
  .card:hover, .links a:hover, .slots a:hover { background: var(--raise); border-color: #57436f; }
  .tile:hover { border-color: #57436f; transform: translateY(-2px); box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .7); }
  .tile:hover img { filter: brightness(1.08); }
  .filters a:hover { border-color: #57436f; }
  button:hover, .button:hover { background: #3a2c50; border-color: #57436f; }
  button.primary:hover, .button.primary:hover { background: #ffd56f; border-color: #ffd56f; }
  .tabs a:hover { color: var(--text); }
}

/* Desktop: a sidebar instead of the bottom tabs, the page wide, and each
   page's own layout (grids, the player beside the work). */
@media (min-width: 960px) {
  body.with-nav { padding-left: 248px; }
  body.with-nav .top { display: none; }
  main { max-width: 1200px; padding: 36px 48px 64px; }
  body.with-nav main { padding-bottom: 64px; }
  h1 { font-size: 34px; margin: 4px 0 18px; }
  h2 { font-size: 21px; }
  .filters { margin: 0 0 20px; padding: 0; flex-wrap: wrap; overflow: visible; }

  .tabs {
    top: 0; right: auto; width: 248px;
    flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: 20px 14px; border-top: 0; border-right: 1px solid var(--line);
    background: #120d1a;
  }
  .tabs::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
    background: #231a2e;
    -webkit-mask: url("/static/bricks.svg") repeat; mask: url("/static/bricks.svg") repeat;
  }
  .tabs { isolation: isolate; }
  .tabs a {
    flex: none; max-width: none; min-height: 44px; padding: 0 12px;
    justify-content: flex-start; gap: 12px; font-size: 15px;
    border-top: 0; border-radius: 10px;
  }
  .tabs a[aria-current] { background: var(--raise); color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
  .tabs svg { display: block; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabs b { margin-left: auto; }
  .tabs a.side-brand {
    display: flex; gap: 10px; min-height: 0; padding: 4px 10px 22px; margin-bottom: 14px;
    border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; background: none;
  }
  .side-brand img { width: 36px; height: 36px; border-radius: 9px; }
  .side-brand .brand { font-size: 24px; }
  .side-brand .tag {
    font-size: 12px; font-weight: 600; color: var(--muted);
    border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
  }

  /* Queue: cards two (then three) across, the thumbnails bigger. */
  .cards { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
  .card { padding: 12px; gap: 16px; border-radius: 16px; }
  .card .thumb { width: 72px; height: 128px; border-radius: 10px; }
  .line { font-size: 15px; }

  /* A video, from the queue or the library: the player stays put on the
     left while the caption, the posts and their actions are worked on the
     right. Buttons are as wide as their words. */
  .split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 40px; align-items: start; margin-top: 8px; }
  .split-media { position: sticky; top: 24px; }
  .split-media .player { max-width: none; margin: 0 0 12px; border: 1px solid var(--line); box-shadow: 0 24px 50px -24px rgba(0, 0, 0, .8); }
  .split-main > .stack:first-child { margin-top: 0; }
  /* The shared caption: Save and Approve side by side under it. */
  .caption-form { grid-template-columns: max-content max-content 1fr; align-items: center; column-gap: 10px; }
  .caption-form > label, .caption-form > textarea { grid-column: 1 / -1; }
  .split-main .stack > button, .split-main .stack > .row { justify-self: start; }
  .split-main .stack > button { width: auto; min-width: 220px; }
  .split-main .actions form { flex: 0 0 auto; }
  .split-main .actions button { width: auto; min-width: 160px; }
  .split-main .panel { padding: 18px 20px; }
  .split-main .panel:first-of-type { margin-top: 24px; }
  .split-main details:last-child { margin-bottom: 0; }
  .facts { margin-top: 0; font-size: 16px; gap: 10px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }

  /* Calendar: the days as a grid, the empty ones small and quiet. */
  .days { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; align-items: start; }
  .day { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
  .day.today { border-color: rgba(255, 201, 77, .55); box-shadow: inset 0 3px 0 var(--gold); }
  .day.free { background: none; border-style: dashed; }
  .day h2 { margin: 2px 2px 10px; font-size: 13px; }
  .day .empty.small { padding: 0 2px 2px; font-size: 13px; }
  /* A slot: its time (and the viewer's) on one line, the platform and
     its state on the next. */
  .day .slots a { flex-wrap: wrap; gap: 2px 8px; padding: 10px 12px; background: var(--raise); }
  .day .slots .grow { flex: 1 1 calc(100% - 72px); order: 2; }
  .day .slots .chip { order: 3; align-self: center; }
  .day .slots time, .day .slots .local { font-size: 14px; }

  /* Post by hand: the video beside its three steps. */
  .manual { display: grid; grid-template-columns: 260px minmax(0, 1fr); column-gap: 32px; padding: 20px 24px; }
  .manual > * { grid-column: 2; }
  .manual > .player { grid-column: 1; grid-row: 1 / span 40; margin: 0; max-width: none; align-self: start; }
  .manual > .button, .manual > form.stack > button { justify-self: start; min-width: 220px; }
  .manual .row { max-width: 420px; }

  /* Setup: the platforms side by side, then the library and the system. */
  .panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
  .panels.two { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
  .panels .panel { margin: 0; padding: 18px 20px; }
  .panels + .panels { margin-top: 16px; }
  .panels .panel .stack > button, .panels .panel p > .button { width: auto; justify-self: start; min-width: 160px; }

  /* Links: the list two across, forms at a readable width. */
  .links { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
  .links a { padding: 16px 18px; }
  .pick { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); max-width: 860px; }
  .pick .button { min-height: 64px; }
  main > form.stack, main > .row, main > .panel.howto { max-width: 640px; }
  main > form.stack > button { justify-self: start; min-width: 220px; }

  /* Library: bigger tiles. */
  .shelf { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
  .tile-body { padding: 10px 12px 12px; }

  .empty { padding: 64px 0; font-size: 17px; }
}

/* Small laptops and big tablets: a narrower player and margins, so the
   work beside it keeps its room. */
@media (min-width: 960px) and (max-width: 1199px) {
  main { padding: 28px 32px 56px; }
  .split { grid-template-columns: 260px minmax(0, 1fr); gap: 28px; }
  .manual { grid-template-columns: 220px minmax(0, 1fr); column-gap: 24px; }
}
