/* Charades for Kids: only what /charades/kids/ adds on top of ../style.css.
 * Palette and .btn come from Charades. Everything here is scoped under .ck or
 * a ck- class so nothing leaks back into the parent's rules. */

.ck, .ck-modal-backdrop {
  --ck-green: #10b981;
  --ck-green-dark: #059669;
  --ck-line: #e2e8f0;
  --ck-easy: #22c55e;
  --ck-med: #f59e0b;
  --ck-hard: #ef4444;
}

/* ===== Shared header bar (per HEADER_SPECS) ===== */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1100;
}
.header-left { flex: 1; min-width: 0; }
.header-right { flex-shrink: 0; min-width: 52px; }
.game-title-wrap { position: relative; display: inline-block; }
.game-title-dropdown-trigger {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
}
.game-title-heading { margin: 0; font-size: 1.4rem; font-weight: 800; color: var(--text); }
.game-title-chevron { font-size: 0.7rem; color: var(--muted); }
.game-title-dropdown {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 4px; min-width: 170px;
  background: #fff; border: 1px solid var(--ck-line); border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); z-index: 100;
}
.game-title-dropdown[aria-hidden="false"] { display: block; }
.game-nav-link { display: block; padding: 10px 14px; font-size: 0.95rem; color: var(--text); }
.game-nav-link:hover { background: var(--bg); text-decoration: none; }
.ck-sub { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }

/* ===== Scaffold: hero, secondary box, one CTA ===== */
.ck-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  min-height: min(430px, 52vh); /* reserved so screens don't jump, but never more than half a short phone */
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.ck-big { font-size: 1.55rem; font-weight: 800; line-height: 1.2; margin: 8px 0; }
.ck-mid { color: var(--muted); font-size: 1rem; max-width: 420px; margin: 0 auto; }

.ck-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-top: 12px;
}
.ck-box-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-top: 10px; font-size: 0.95rem;
}

.btn.ck-cta {
  display: block; width: 100%; margin-top: 12px; padding: 16px;
  font-size: 1.15rem; font-weight: 800; letter-spacing: 0.02em;
  background: var(--ck-green); color: #fff; border-radius: var(--radius);
}
.btn.ck-cta:hover { background: var(--ck-green-dark); }

.ck-ghost {
  display: block; width: 100%; margin-top: 8px; padding: 10px;
  background: none; border: none; color: var(--muted);
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
}
.ck-ghost:hover { color: var(--text); text-decoration: underline; }
.ck-ghost[hidden] { display: none; }
.ck-link {
  background: none; border: none; color: var(--primary); font-weight: 600;
  font-size: 0.95rem; cursor: pointer; padding: 4px 0;
}

/* ===== Pills ===== */
.ck-pill-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ck-pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: #eef2ff; color: #3730a3; font-size: 0.85rem; font-weight: 600;
}
.ck-pill.is-off { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }

/* ===== Intro ===== */
.ck-intro-pics { display: flex; justify-content: center; gap: 6px; margin-bottom: 4px; }
.ck-intro-pics img { width: 31%; max-width: 130px; height: auto; aspect-ratio: 1; }

/* ===== Card ===== */
.ck-hero-card { justify-content: flex-start; }
.ck-card-top { display: flex; justify-content: space-between; align-items: center; min-height: 34px; }
.ck-timer {
  min-width: 52px; padding: 4px 10px; border-radius: 999px;
  background: var(--text); color: #fff; font-weight: 800; font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}
.ck-timer.is-low { background: var(--ck-hard); }
.ck-ask { font-size: 1.2rem; font-weight: 800; margin: 10px 0 12px; min-height: 1.5em; }
.ck-ask.is-timeup { color: var(--ck-hard); }

/* One card per turn: a big picture with the word under it. The border color
   carries the level (green easy, amber medium, red hard), so no extra label. */
.ck-actor {
  font-size: 0.95rem; font-weight: 800; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1;
}
.ck-one {
  display: flex; flex-direction: column; align-items: center;
  margin: 8px auto 0; padding: 6px 8px 10px; width: 100%; max-width: 340px;
  border-radius: 18px; border: 4px solid var(--ck-line); background: #fff;
}
.ck-one-e { border-color: #86efac; }
.ck-one-m { border-color: #fcd34d; }
.ck-one-h { border-color: #fca5a5; }
/* Picture size follows the screen height, so short phones keep both buttons
   in view and tall phones get a bigger picture. */
.ck-one-img { display: block; width: min(290px, 40vh, 100%); aspect-ratio: 1; }
@supports (height: 1svh) { .ck-one-img { width: min(290px, 40svh, 100%); } }
.ck-one-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ck-one-word { font-size: 1.5rem; font-weight: 800; line-height: 1.15; margin-top: 2px; }

/* ===== The turn screen: ruthless about vertical space ===== */
body[data-phase="card"] .ck-sub { display: none; }
body[data-phase="card"] .header-bar { margin-bottom: 6px; }
body[data-phase="card"] .ck-panel { min-height: 0; padding: 10px 12px 12px; }
body[data-phase="card"] main#app { padding-top: 8px; }
body[data-phase="card"] .ck-actions {
  display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 10px;
}
body[data-phase="card"] .ck-actions .btn.ck-cta { margin-top: 0; }
body[data-phase="card"] .ck-actions .ck-ghost {
  order: -1; margin-top: 0; border-radius: var(--radius);
  background: #e2e8f0; color: #334155; font-size: 1.05rem; font-weight: 800;
}
body[data-phase="card"] .ck-actions .ck-ghost:hover { background: #cbd5e1; text-decoration: none; }
.ck-tip { margin-top: 8px; font-size: 0.85rem; color: var(--muted); }

/* Speed turn: running tally next to the clock. */
/* One row: category, actor's name, then score and clock pushed right. */
.ck-card-top { justify-content: flex-start; gap: 8px; min-height: 32px; }
.ck-card-top .ck-pill-cat { white-space: nowrap; flex-shrink: 0; }
.ck-card-top .ck-tally { margin-left: auto; }
.ck-tally { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }

/* Results and final scoreboard */
.ck-timesup { font-size: 1rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ck-hard); }
.ck-got {
  width: 96px; height: 96px; margin: 8px auto 0; border-radius: 50%;
  background: var(--ck-green); color: #fff; display: flex; align-items: center; justify-content: center;
}
.ck-got-num { font-size: 3rem; font-weight: 900; line-height: 1; }
.ck-results { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; max-height: 170px; overflow-y: auto; }
.ck-result { padding: 4px 10px; border-radius: 999px; font-size: 0.9rem; font-weight: 600; }
.ck-result.is-got { background: #ecfdf5; color: #065f46; }
.ck-result.is-skip { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }
.ck-scores { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 14px; }
.ck-score-chip { padding: 4px 10px; border-radius: 999px; background: #f1f5f9; font-size: 0.9rem; }
.ck-standings { list-style: none; padding: 0; margin: 10px auto 0; width: 100%; max-width: 320px; text-align: left; }
.ck-standings li {
  display: flex; justify-content: space-between; padding: 8px 12px; margin-bottom: 6px;
  border-radius: 10px; background: #f8fafc; font-size: 1.05rem;
}
.ck-standings li.is-top { background: #fef9c3; font-weight: 800; }
.btn.ck-cta:disabled { opacity: 0.55; }

/* Level pills: green easy, amber medium, red hard. */
.ck-lvl {
  display: inline-block; vertical-align: middle;
  font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: 999px; color: #fff;
}
.ck-lvl-e { background: var(--ck-easy); }
.ck-lvl-m { background: var(--ck-med); }
.ck-lvl-h { background: var(--ck-hard); }
.ck-pass-level { margin: 2px 0 8px; }
.ck-pass-level .ck-lvl { font-size: 0.85rem; padding: 4px 12px; }

/* Start screen: player stepper under START, then the Settings card (the
   15 Words or Less pattern). Everything here is a button. */
.ck-stepper-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.ck-step {
  width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid #d1d5db;
  background: #fff; font: inherit; font-size: 1.2rem; font-weight: 700; color: var(--text); cursor: pointer;
}
.ck-step:disabled { opacity: 0.35; cursor: default; }
.ck-step-label { font-weight: 700; min-width: 5.5em; text-align: center; }
.ck-howto { display: block; margin: 6px auto 0; }
.ck-link { text-decoration: underline; }
.ck-settings-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px 12px; margin-top: 12px;
}
.ck-settings-card[hidden] { display: none; }
.ck-settings-gear {
  display: inline-flex; align-items: center; gap: 6px; width: 100%; padding: 2px 0 8px;
  border: none; background: none; font: inherit; font-size: 0.9rem; font-weight: 700;
  color: var(--muted); cursor: pointer; text-align: left;
}
.ck-settings-gear svg { width: 20px; height: 20px; fill: #059669; }
.ck-settings-gear:hover span { color: #059669; text-decoration: underline; }
.ck-settings-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ck-settings-pill {
  border: 1.5px solid #d1d5db; border-radius: 999px; background: #fff;
  font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text);
  padding: 6px 12px; cursor: pointer; text-align: left;
}
.ck-settings-pill:hover { border-color: #10b981; }

/* Intro summary */
.ck-player-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ck-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 999px; background: #f1f5f9; font-weight: 700; font-size: 0.9rem;
}
.ck-box-line { text-align: center; font-weight: 600; }
.ck-box-meta { color: var(--muted); }

/* ===== 3-2-1 countdown before each timed turn ===== */
.ck-ready { font-size: 1.5rem; font-weight: 800; }
.ck-count {
  font-size: 7rem; font-weight: 900; line-height: 1; color: var(--ck-green, #10b981);
  margin: 8px 0; font-variant-numeric: tabular-nums;
  animation: ck-pop 1s ease-out;
}
@keyframes ck-pop { 0% { transform: scale(1.4); opacity: 0.3; } 25% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ck-count { animation: none; } }

/* Wide screens: the start card fits its content (the reserved height is for phones). */
@media (min-width: 700px) {
  .ck-hero-intro { min-height: 0; padding: 20px 16px; }
}

/* ===== Pass ===== */
.ck-pass-emoji { font-size: 3.5rem; line-height: 1; }

/* ===== Below the fold ===== */
.ck-below-fold { margin-top: 28px; }
.ck-article { max-width: none; }
.ck-article h2 { font-size: 1.25rem; margin: 0 0 10px; }
.ck-steps { padding-left: 1.2em; margin: 0 0 12px; }
.ck-steps li { margin-bottom: 6px; }
.ck-details { border-top: 1px solid var(--ck-line); padding: 10px 0; }
.ck-details summary { font-weight: 700; cursor: pointer; }
.ck-details p { margin: 8px 0 0; color: #334155; }

.footer { text-align: center; padding: 20px 0 32px; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; font-size: 0.95rem; }

/* ===== Settings modal ===== */
.ck-modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 2000;
}
.ck-modal-backdrop[hidden] { display: none; }
.ck-modal {
  background: #fff; border-radius: var(--radius); padding: 18px; width: 100%; max-width: 440px;
  max-height: calc(100vh - 32px);
  /* iPhone Safari: 100vh includes the area behind the toolbars; dvh is the visible height. */
  max-height: calc(100dvh - 32px);
  overflow-y: auto; box-shadow: var(--shadow-lg);
}
/* Save & Play stays pinned to the bottom of a long sheet (the 15 Words or
   Less pattern), so it never scrolls out of reach. */
.ck-modal .ck-modal-actions {
  position: sticky; bottom: -18px; margin: 16px -18px -18px; padding: 12px 18px 16px;
  background: #fff; border-top: 1px solid var(--ck-line);
}
.ck-modal-title { margin: 0 0 8px; font-size: 1.3rem; }
.ck-modal-label { font-weight: 700; margin: 14px 0 6px; }
.ck-cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ck-cat-btn, .ck-seg button {
  padding: 10px 8px; border-radius: 10px; border: 2px solid var(--ck-line);
  background: #f8fafc; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
}
.ck-cat-btn.is-on, .ck-seg button.is-on { border-color: var(--ck-green); background: #ecfdf5; color: #065f46; }
.ck-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ck-seg-3 { grid-template-columns: repeat(3, 1fr); }
.ck-seg button.ck-seg-e.is-on { border-color: var(--ck-easy); background: #f0fdf4; color: #166534; }
.ck-seg button.ck-seg-m.is-on { border-color: var(--ck-med); background: #fffbeb; color: #92400e; }
.ck-seg button.ck-seg-h.is-on { border-color: var(--ck-hard); background: #fef2f2; color: #991b1b; }
.ck-optional { font-weight: 400; color: var(--muted); }
.ck-modal-hint { margin: 0 0 6px; font-size: 0.88rem; color: var(--muted); }
.ck-modal-hint[hidden] { display: none; }
.ck-player-row {
  display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "name seg remove";
  align-items: center; gap: 6px; margin-bottom: 8px;
}
.ck-player-row .ck-name { grid-area: name; }
.ck-player-row .ck-seg { grid-area: seg; }
.ck-player-row .ck-remove { grid-area: remove; }
@media (max-width: 440px) {
  /* Phone: name and remove on one line, the level buttons full width under it. */
  .ck-player-row { grid-template-columns: 1fr auto; grid-template-areas: "name remove" "seg seg"; }
  .ck-player-row .ck-seg-sm { grid-template-columns: repeat(3, 1fr); }
}
.ck-name {
  flex: 1; min-width: 0; padding: 9px 10px; border: 2px solid var(--ck-line);
  border-radius: 10px; font: inherit; font-size: 1rem;
}
.ck-seg-sm { grid-template-columns: repeat(3, auto); gap: 3px; flex-shrink: 0; }
.ck-seg-sm button { padding: 7px 6px; font-size: 0.78rem; border-radius: 8px; }
.ck-remove {
  flex-shrink: 0; width: 30px; height: 30px; border: none; border-radius: 50%;
  background: #f1f5f9; color: var(--muted); font-size: 1.1rem; cursor: pointer;
}
.ck-add-player { margin-top: 2px; text-align: left; color: var(--primary); padding: 6px 0; }
#sheetLevelWrap[hidden] { display: none; }
.ck-setall {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: #f8fafc;
}
.ck-setall[hidden] { display: none; }
.ck-setall-label { font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.ck-add-player[hidden] { display: none; }
.ck-account-btn { color: var(--primary); }

@media (max-width: 380px) {
  .ck-one-word { font-size: 1.35rem; }
  .ck-big { font-size: 1.35rem; }
  .ck-seg-sm button { padding: 7px 4px; font-size: 0.72rem; }
}
