:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --accent: #e52d27;
  --ok: #1f8a4c;
  --wait: #b07a00;
  --no: #b3261e;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111;
    --surface: #1c1c1c;
    --text: #f2f2f2;
    --muted: #a0a0a0;
    --line: #2e2e2e;
    --ok: #3fbf74;
    --wait: #e0a72e;
    --no: #ff6b61;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
main { max-width: 1200px; margin: 0 auto; padding: 0 16px 32px; }
h1, h2, h3 { margin: 0; }
h2 { font-size: 18px; margin: 20px 0 8px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--no); }
button, input, select { font: inherit; color: inherit; }

/* ----- top bar ----- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: 12px; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo-sm, .logo {
  display: inline-grid; place-items: center;
  background: var(--accent); color: #fff; border-radius: 8px;
}
.logo-sm { width: 28px; height: 20px; font-size: 11px; }
.search { flex: 1; }
.search input, .add input, .login-box input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg);
  font-size: 16px; /* 16px stops iOS from zooming into the field */
}
.chip {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: none; color: var(--text); text-decoration: none; white-space: nowrap; cursor: pointer;
}

/* ----- tabs ----- */
.tabs { display: flex; gap: 8px; margin: 16px 0; overflow-x: auto; }
.tabs button {
  padding: 8px 16px; border-radius: 999px; border: 0;
  background: var(--line); cursor: pointer; white-space: nowrap;
}
.tabs button.active { background: var(--text); color: var(--bg); }
.badge {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px;
}

/* ----- kid grid ----- */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { display: flex; flex-direction: column; gap: 6px; cursor: default; }
.card.approved { cursor: pointer; }
.card h3 {
  font-size: 15px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card p { margin: 0; font-size: 13px; }
.card.pending .thumb, .card.rejected .thumb, .card.none .thumb { opacity: 0.75; }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dur {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 6px;
  background: rgba(0, 0, 0, 0.8); color: #fff; border-radius: 6px; font-size: 12px;
}

/* ----- pills (status + buttons) ----- */
.pill {
  align-self: flex-start;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; cursor: pointer;
}
.pill.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.pill.no { color: var(--no); border-color: currentColor; }
.pill.wait { color: var(--wait); border-color: currentColor; cursor: default; }
.pill.ask { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ----- player ----- */
#player-view { margin-top: 16px; }
#player-view h2 { margin: 12px 0 2px; }
#player-view p { margin: 0; }
.player-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player iframe, .player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.88); color: #fff;
}
.overlay-box { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; padding: 16px; }
.overlay-box p { margin: 0; font-size: 18px; }
.overlay-box .muted { color: #bbb; font-size: 14px; }
.overlay-box .pill { align-self: center; }

/* ----- parent ----- */
.add { display: flex; gap: 8px; margin-bottom: 8px; }
.add button { padding: 0 16px; border: 0; border-radius: 999px; background: var(--ok); color: #fff; cursor: pointer; }
.list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.req {
  display: flex; gap: 14px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.req-thumb { width: 200px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; flex: none; }
.req.small .req-thumb { width: 120px; }
.req-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.req-body h3 { font-size: 16px; }
.req-body p { margin: 0; font-size: 14px; }
.desc { white-space: pre-wrap; font-size: 13px; color: var(--muted); max-height: 200px; overflow: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.preview iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; }
@media (max-width: 600px) {
  .req { flex-direction: column; }
  .req-thumb, .req.small .req-thumb { width: 100%; }
}
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { color: var(--muted); font-weight: 500; }
select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }

/* ----- login ----- */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.logo { width: 64px; height: 46px; font-size: 22px; border-radius: 14px; }
.login-box button {
  width: 100%; padding: 10px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
