/* The Chess Clock page (/clock): setup screens and the clock itself. Uses the brand colors and type from style.css. */
.ck-body { background: var(--bg); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.ck-app { flex: 1; width: 100%; max-width: 600px; margin: 0 auto; padding: 48px 16px 12px; }
@media (max-width: 820px) { .ck-app { padding-top: 26px; } }
.ck-foot { margin-top: 16px; }

/* ---- setup ---- */
.ck-h { display: flex; align-items: center; gap: 10px; margin: 2px 0 8px; } .ck-h h2 { font-size: 24px; margin: 0; }
.ck-circ { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; box-shadow: 3px 3px 0 var(--purple); cursor: pointer; flex: none; padding: 0; font: inherit; }
.ck-circ:hover, .ck-circ:focus-visible { background: var(--yellow); } .ck-circ:disabled { opacity: .4; cursor: default; }
.ck-ic { display: inline-flex; width: 22px; height: 22px; } .ck-ic svg { width: 100%; height: 100%; }
.ck-callout { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: #d8f6f2; border: 2px solid var(--ink); border-radius: 16px; padding: 9px 12px; font-size: 14px; font-weight: 600; margin: 4px 0 2px; }
.ck-callout .ck-ic { width: 20px; height: 20px; flex: none; } .ck-callout span.t { flex: 1; } .ck-callout b { white-space: nowrap; }
.ck-lbl { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 7px; font: 700 12px 'Inter', sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--purple-ink); } .ck-lbl small { font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--ink-muted); font-size: 12px; }
.ck-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ck-chip { border: 2px solid var(--ink); border-radius: 999px; padding: 7px 14px; background: #fff; color: var(--ink); font: 800 16px 'Inter', sans-serif; font-variant-numeric: tabular-nums; box-shadow: 2px 2px 0 var(--purple); cursor: pointer; }
.ck-chip:hover, .ck-chip:focus-visible { background: #fff3c9; } .ck-chip.on { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); }
.ck-chips.s .ck-chip { font-size: 13px; padding: 4px 11px; font-weight: 700; box-shadow: none; } .ck-chips.s .ck-chip.on { box-shadow: none; }
.ck-sum { margin: 16px 0 4px; text-align: center; font-size: 15px; font-weight: 600; color: #4a3f5c; min-height: 1.4em; }
.ck-start { position: sticky; bottom: 0; padding: 14px 0 max(14px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 28%); margin-top: 14px; z-index: 5; }
.ck-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--ink); border-radius: 999px; padding: 10px 18px; font: 700 15px 'Inter', sans-serif; background: #fff; color: var(--ink); box-shadow: 3px 3px 0 var(--purple); cursor: pointer; text-decoration: none; white-space: nowrap; }
.ck-btn:hover, .ck-btn:focus-visible { background: #fff3c9; } .ck-btn.y { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); } .ck-btn.y:hover { background: #ffd966; }
.ck-btn.big { width: 100%; padding: 16px; font-size: 19px; } .ck-btn.sm { padding: 5px 12px; font-size: 13px; box-shadow: 2px 2px 0 var(--purple); }
.ck-btn .ck-ic { width: 20px; height: 20px; }
.ck-val { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; } .ck-val .ck-circ { width: 46px; height: 46px; }
.ck-val b { font: 800 46px 'Inter', sans-serif; letter-spacing: -.03em; font-variant-numeric: tabular-nums; } .ck-val small { font: 700 16px 'Fredoka', sans-serif; color: var(--ink-muted); margin-left: 5px; }
.ck-val div { text-align: center; }
.ck-range { width: 100%; margin: 6px 0 2px; accent-color: var(--purple); height: 28px; }
.ck-ends { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--ink-muted); margin: 0 2px 10px; }
.ck-more { margin-top: 18px; border: 2px solid var(--border); border-radius: 16px; background: #fffaf0; padding: 0; }
.ck-more summary { list-style: none; cursor: pointer; padding: 12px 14px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; } .ck-more summary::-webkit-details-marker { display: none; }
.ck-more summary small { display: block; font-weight: 500; color: var(--ink-muted); font-size: 12.5px; } .ck-more[open] summary .chev { transform: rotate(180deg); }
.ck-more .body { padding: 2px 14px 12px; }
.ck-tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 2px solid var(--border); font-weight: 700; font-size: 15px; } .ck-tog small { display: block; font-weight: 500; font-size: 12.5px; color: var(--ink-muted); }
.ck-tog input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 99px; border: 2px solid var(--ink); background: #fff; position: relative; flex: none; cursor: pointer; margin: 0; }
.ck-tog input[type=checkbox]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: left .15s; }
.ck-tog input[type=checkbox]:checked { background: var(--teal); } .ck-tog input[type=checkbox]:checked::after { left: 22px; background: #fff; border: 2px solid var(--ink); width: 20px; height: 20px; top: 1px; box-sizing: border-box; }
.ck-tog input[type=checkbox]:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.ck-odds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 10px; } .ck-odds label { font-size: 13px; font-weight: 700; display: block; } .ck-odds input { width: 100%; margin-top: 4px; }
.ck-seg { display: flex; gap: 6px; } .ck-seg button { flex: 1; border: 2px solid var(--ink); border-radius: 12px; background: #fff; padding: 7px 4px; font: 700 13px 'Inter', sans-serif; cursor: pointer; color: var(--ink); } .ck-seg button.on { background: var(--ink); color: #fff; }
.ck-noscript { margin: 40px auto; max-width: 440px; text-align: center; }

/* ---- the clock ---- */
body.ck-playing nav.ck-top, body.ck-playing .ck-foot { display: none; }
body.ck-playing { overflow: hidden; }
.ck-app.playing { position: fixed; inset: 0; max-width: none; padding: 0; margin: 0; z-index: 20; background: var(--bg); }
.ck-play { position: relative; height: 100%; display: grid; gap: 0; padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
.ck-play[data-layout="face"] { grid-template-rows: 1fr 1fr; } .ck-play[data-layout="face"] .ck-s1 { order: 1; } .ck-play[data-layout="face"] .ck-s0 { order: 2; }
.ck-play[data-layout="side"] { grid-template-columns: 1fr 1fr; } .ck-play[data-layout="side"] .ck-s0 { order: 1; } .ck-play[data-layout="side"] .ck-s1 { order: 2; }
.ck-s { position: relative; margin: 6px; border: 3px solid var(--ink); border-radius: 30px; background: #fff; box-shadow: 6px 6px 0 rgba(28,19,41,.16); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); font: inherit; padding: 8px; overflow: hidden; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.ck-play[data-layout="face"] .ck-s1 .ck-in { transform: rotate(180deg); }
.ck-in { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; pointer-events: none; }
.ck-who { display: flex; align-items: center; gap: 8px; font: 700 clamp(15px, 2.6vmin, 22px) 'Fredoka', sans-serif; }
.ck-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; display: inline-block; } .ck-dot.b { background: currentColor; } .ck-dot.w { background: #fff; border-color: var(--ink); }
.ck-time { font: 800 min(24vw, 15vh) 'Inter', sans-serif; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: #5e5870; white-space: nowrap; }
.ck-play[data-layout="side"] .ck-time { font-size: min(15vw, 26vh); }
.ck-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 14px; font-weight: 700; color: var(--ink-muted); }
.ck-mv { display: inline-flex; align-items: baseline; gap: 7px; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 14px 4px; background: rgba(255,255,255,.78); color: var(--ink); font: 700 clamp(11px, 1.8vmin, 14px) 'Inter', sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.ck-mv b { font: 700 clamp(22px, 4vmin, 34px)/1 'Fredoka', sans-serif; letter-spacing: 0; }
.ck-hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-muted); letter-spacing: .06em; text-transform: uppercase; pointer-events: none; }
.ck-play[data-layout="face"] .ck-s1 .ck-hint { bottom: auto; top: 14px; transform: rotate(180deg); }
.ck-s.on { background: var(--yellow); box-shadow: 7px 7px 0 var(--purple); } .ck-s.on .ck-time { color: var(--ink); } .ck-s.on .ck-meta { color: #4a3a00; }
.ck-s.warn { background: var(--orange); box-shadow: 7px 7px 0 var(--ink); } .ck-s.warn .ck-time, .ck-s.warn .ck-who { color: var(--ink); } .ck-s.warn .ck-meta { color: #5a2a00; }
.ck-s.low, .ck-s.fast { background: #ff5d52; box-shadow: 0 0 0 5px rgba(255,93,82,.22), 7px 7px 0 var(--ink); }
.ck-s.low .ck-time, .ck-s.fast .ck-time { color: #fff; text-shadow: 2px 2px 0 rgba(28,19,41,.22); } .ck-s.low .ck-who, .ck-s.fast .ck-who, .ck-s.low .ck-meta, .ck-s.fast .ck-meta { color: var(--ink); }
.ck-s.low .ck-mv, .ck-s.fast .ck-mv { background: rgba(255,255,255,.78); border-color: var(--ink); color: var(--ink); }
/* the soft pulse in the last 10 seconds, twice as fast in the last 3, and none for anyone who asked for less motion */
.ck-s.pulse { animation: ck-soft 1s ease-in-out infinite; } .ck-s.pulse.fast { animation-duration: .5s; }
@keyframes ck-soft { 0%, 100% { background: #ff5d52; box-shadow: 0 0 0 5px rgba(255,93,82,.22), 7px 7px 0 var(--ink); } 50% { background: #ff8378; box-shadow: 0 0 0 15px rgba(255,93,82,.10), 7px 7px 0 var(--ink); } }
body.ck-calm .ck-s.pulse { animation: none; }
@media (prefers-reduced-motion: reduce) { .ck-s.pulse { animation: none; } }
/* the result: pink with a big 0 for the side whose flag fell, light teal with a big 1 for the other */
.ck-res { display: none; flex-direction: column; align-items: center; gap: 2px; width: 100%; pointer-events: none; }
.ck-s.is-over .ck-norm { display: none; } .ck-s.is-over .ck-res { display: flex; }
.ck-s.out { background: var(--pink); box-shadow: 7px 7px 0 var(--ink); } .ck-s.win { background: #c9f2ee; box-shadow: 7px 7px 0 var(--teal); }
.ck-play[data-layout="face"] .ck-s1 .ck-res { transform: rotate(180deg); }
.ck-score { font: 700 min(34vw, 20vh)/.85 'Fredoka', sans-serif; letter-spacing: -.02em; } .ck-play[data-layout="side"] .ck-score { font-size: min(24vw, 36vh); }
.ck-s.out .ck-score { color: #fff; text-shadow: 5px 5px 0 var(--ink); } .ck-s.win .ck-score { color: var(--ink); text-shadow: 5px 5px 0 var(--teal); }
.ck-verdict { display: flex; align-items: center; gap: 10px; font: 700 clamp(18px, 3.2vmin, 26px) 'Fredoka', sans-serif; line-height: 1.05; text-align: left; } .ck-s.out .ck-verdict { color: var(--ink); }
.ck-verdict small { display: block; font: 600 13px 'Inter', sans-serif; opacity: .92; margin-top: 2px; }
.ck-badge { width: 42px; height: 42px; border-radius: 50%; border: 2.5px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; flex: none; } .ck-badge .ck-ic { width: 22px; height: 22px; }
.ck-s.out .ck-badge { background: var(--ink); color: #fff; } .ck-s.win .ck-badge { background: var(--yellow); color: var(--ink); }
.ck-brow { display: flex; align-items: center; gap: 14px; margin-top: 6px; } .ck-brow .t { font: 800 clamp(26px, 4.5vmin, 36px) 'Inter', sans-serif; letter-spacing: -.03em; font-variant-numeric: tabular-nums; } .ck-s.out .ck-brow .t { color: var(--ink); }
.ck-s.out .ck-mv { background: rgba(255,255,255,.78); border-color: var(--ink); color: var(--ink); }
/* the control bar between the two sides */
.ck-bar { position: absolute; z-index: 4; display: flex; gap: 10px; background: #fff; border: 2.5px solid var(--ink); border-radius: 999px; padding: 7px 12px; box-shadow: 4px 4px 0 var(--purple); }
.ck-play[data-layout="face"] .ck-bar { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.ck-play[data-layout="side"] .ck-bar { left: 50%; top: max(18px, env(safe-area-inset-top)); transform: translateX(-50%); }
.ck-rb { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; } .ck-rb:hover, .ck-rb:focus-visible { background: var(--yellow); } .ck-rb.on { background: var(--ink); color: #fff; } .ck-rb:disabled { opacity: .35; cursor: default; } .ck-rb .ck-ic { width: 21px; height: 21px; }
.ck-tip { position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--ink); color: #fff; font: 700 13px 'Inter', sans-serif; padding: 6px 14px; border-radius: 999px; pointer-events: none; }
.ck-tip[hidden] { display: none; }
.ck-play[data-layout="face"] .ck-tip { transform: translateX(-50%) rotate(0deg); }
.ck-bar .ck-btn { padding: 9px 18px; box-shadow: 3px 3px 0 var(--purple); } .ck-bar .ck-btn.y { box-shadow: 3px 3px 0 var(--ink); }
.ck-ready .ck-hint { display: block; } .ck-play:not(.ck-ready) .ck-hint { display: none; }
/* paused and settings sheets */
.ck-veil { position: absolute; inset: 0; background: rgba(28,19,41,.55); z-index: 8; display: flex; align-items: center; justify-content: center; padding: 14px; overflow-y: auto; }
.ck-sheet { width: 100%; max-width: 560px; max-height: 100%; overflow-y: auto; background: #fff; border: 3px solid var(--ink); border-radius: 28px; box-shadow: 8px 8px 0 var(--ink); padding: 20px 22px; }
.ck-sheet h2 { font-size: 28px; margin: 0; } .ck-sheet .sub { font-size: 14px; color: var(--ink-muted); font-weight: 600; margin: 3px 0 0; }
.ck-sheet .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ck-adj { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; } .ck-adj > div { border: 2px solid var(--border); border-radius: 18px; padding: 10px 12px; background: #fffaf0; }
.ck-adj .nm { display: flex; align-items: center; gap: 8px; font: 700 15px 'Fredoka', sans-serif; } .ck-adj .tt { font: 800 32px 'Inter', sans-serif; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: 2px 0 8px; }
.ck-adj .row { display: flex; gap: 6px; flex-wrap: wrap; } .ck-adj .row + .row { margin-top: 8px; align-items: center; font: 700 13px 'Inter', sans-serif; }
.ck-sheet .actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.ck-sheet .actions .armed { font: 700 13px 'Inter', sans-serif; color: var(--ink); background: #fff3c9; border: 2px solid var(--ink); border-radius: 999px; padding: 5px 12px; }
.ck-sheet .ck-tog:first-of-type { border-top: 0; }
@media (max-width: 380px) { .ck-adj { grid-template-columns: 1fr; } }
