/* Ciocnit ouă — painted Easter eggs in 3D, tapped end to end (js/ciocnit-oua.js).
   Theme-aware like the other game pages: tokens on :root, redefined under body.dark-theme. */
:root {
    --co-accent: #9f1239;
    --co-accent-2: #be123c;
    --co-accent-soft: #fde7ec;
    --co-on-accent: #ffffff;
    --co-page-bg: #faf4ec;
    --co-card-bg: #ffffff;
    --co-card-border: #eadbc9;
    --co-muted: #6e5a4a;
    --co-shadow: 0 10px 30px rgba(90, 30, 20, .12);
    --co-stage-bg: #ead8c0;
    --co-ok: #16a34a;
    --co-bad: #dc2626;
    --co-gold: #c2770a;
    --co-bubble: #ffffff;
    --co-bubble-ink: #3b1d12;
    --co-overlay: rgba(40, 12, 8, .55);
}

body.dark-theme {
    --co-accent: #fb7185;
    --co-accent-2: #f43f5e;
    --co-accent-soft: #3d1420;
    --co-on-accent: #2a0610;
    --co-page-bg: #15100e;
    --co-card-bg: #201916;
    --co-card-border: #3b2f29;
    --co-muted: #bfa996;
    --co-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --co-stage-bg: #2a1d16;
    --co-ok: #4ade80;
    --co-bad: #f87171;
    --co-gold: #fbbf24;
    --co-bubble: #fff7ee;
    --co-bubble-ink: #3b1d12;
    --co-overlay: rgba(0, 0, 0, .62);
}

/* clip, not hidden: the site-wide `body { overflow-x: hidden }` makes <body> a scroll
   container that never scrolls, which silently kills any position: sticky inside. */
.co-body, body.co-body#page-top {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--co-page-bg);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: clip;
}
.co-main { padding-top: 92px; padding-bottom: 40px; }
.co-game .container, .co-hero .container { max-width: 980px; }

/* ---- hero ---- */
.co-hero { text-align: center; padding: 4px 0 8px; }
.co-hero h1 { font-weight: 800; font-size: clamp(1.6rem, 5vw, 2.2rem); margin-bottom: 4px; }
.co-hero-icon { color: var(--co-accent); }
.co-lead { margin: 0 auto; max-width: 620px; color: var(--co-muted); font-size: .98rem; line-height: 1.45; }
body.co-playing .co-hero { display: none; }
body.co-playing .co-main { padding-top: 14px; }

/* ---- buttons ---- */
.co-btn { min-height: 48px; padding: 8px 16px; border-radius: 14px; border: 1px solid var(--co-card-border); background: var(--co-card-bg); color: inherit; font-weight: 700; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; touch-action: manipulation; transition: background .15s, border-color .15s, transform .1s; }
.co-btn:hover { border-color: var(--co-accent); }
.co-btn:active { transform: scale(.98); }
.co-btn[hidden] { display: none; }
.co-btn:disabled { opacity: .5; cursor: default; transform: none; }
.co-btn-primary { background: var(--co-accent); border-color: var(--co-accent); color: var(--co-on-accent); }
.co-btn-primary:hover { background: var(--co-accent-2); border-color: var(--co-accent-2); }
.co-btn-ghost { background: transparent; border-color: transparent; color: var(--co-muted); }
.co-wide { width: 100%; }
.co-btn:focus-visible, .co-chip:focus-visible, .co-mode:focus-visible, .co-swatch:focus-visible, .co-motif:focus-visible, .co-round:focus-visible { outline: 3px solid var(--co-accent); outline-offset: 2px; }

.co-wrap { display: grid; gap: 14px; align-items: start; }
@media (min-width: 900px) {
    .co-wrap { grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); }
    /* while you paint the egg on a desktop, the 3D egg stays in view */
    body:not(.co-playing) .co-arena { position: sticky; top: 78px; }
    .co-wrap > .co-arena { grid-row: span 3; }
    body.co-playing .co-wrap { grid-template-columns: minmax(0, 1.35fr) minmax(280px, .8fr); }
}

/* ---- arena ---- */
.co-arena { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.co-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; column-gap: 10px; row-gap: 1px; min-height: 50px; padding: 5px 12px; border-radius: 14px; background: var(--co-card-bg); border: 1px solid var(--co-card-border); }
body:not(.co-playing) .co-bar { display: none; }
.co-roles { grid-column: 1 / -1; margin: 0; text-align: center; color: var(--co-muted); font-size: .8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.2em; }
.co-side { min-width: 0; display: flex; align-items: center; gap: 6px; }
.co-side.is-right { justify-content: flex-end; }
.co-side-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; font-size: .95rem; }
.co-side.is-turn .co-side-name { color: var(--co-accent); }
.co-ends { display: inline-flex; gap: 3px; flex: none; }
.co-end { position: relative; width: 16px; height: 21px; border-radius: 50% 50% 50% 50% / 38% 38% 62% 62%; background: var(--co-egg, #b3122a); box-shadow: inset -2px -3px 0 rgba(0, 0, 0, .18); }
.co-end.is-dos { transform: rotate(180deg); }
.co-end::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 45%; border-radius: 50% 50% 0 0 / 80% 80% 0 0; border-bottom: 2px solid rgba(255, 255, 255, .55); }
.co-end.is-cracked { background: repeating-linear-gradient(120deg, var(--co-egg, #b3122a) 0 4px, #f4ecdf 4px 5px); opacity: .55; }
.co-end.is-cracked::after { border-bottom-style: dashed; }
.co-tools { position: absolute; top: 10px; right: 10px; z-index: 4; display: flex; gap: 6px; }
.co-round { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(30, 14, 8, .5); color: #fff; font-size: 15px; cursor: pointer; touch-action: manipulation; }
.co-round:hover { background: rgba(30, 14, 8, .7); }
.co-round[hidden], .co-round span[hidden] { display: none; }

.co-stage { position: relative; width: 100%; aspect-ratio: 16 / 11; max-height: calc(100vh - 250px); min-height: 320px; border-radius: 18px; overflow: hidden; background: var(--co-stage-bg); box-shadow: var(--co-shadow); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
@media (max-width: 899px) {
    .co-stage { aspect-ratio: auto; height: clamp(300px, 54vh, 540px); max-height: none; }
    body:not(.co-playing) .co-stage { height: clamp(240px, 38vh, 360px); }
}
.co-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.co-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 12px; text-align: center; color: var(--co-muted); font-weight: 700; }
.co-loading[hidden] { display: none; }
.co-bubble { position: absolute; z-index: 3; margin: 0; padding: 8px 14px; max-width: 70%; border-radius: 16px; background: var(--co-bubble); color: var(--co-bubble-ink); font-weight: 800; font-size: clamp(.95rem, 3.6vw, 1.15rem); box-shadow: 0 6px 18px rgba(0, 0, 0, .22); opacity: 0; transform: scale(.85); transition: opacity .2s, transform .2s; pointer-events: none; }
.co-bubble.is-on { opacity: 1; transform: none; }
.co-bubble small { display: block; font-weight: 600; font-size: .72em; opacity: .7; }
.co-bubble.is-top { left: 12px; top: 58px; border-bottom-left-radius: 4px; }
.co-bubble.is-bottom { right: 12px; top: 38%; border-bottom-right-radius: 4px; }
.co-banner { position: absolute; left: 50%; top: 40%; z-index: 4; transform: translate(-50%, -50%) scale(.9); margin: 0; padding: 10px 22px; border-radius: 18px; max-width: 92%; text-align: center; color: #fff; font-weight: 900; font-size: clamp(1.3rem, 6.5vw, 2.2rem); line-height: 1.15; text-shadow: 0 3px 12px rgba(0, 0, 0, .45); background: linear-gradient(135deg, rgba(190, 18, 60, .92), rgba(194, 65, 12, .92)); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.co-banner.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.co-banner small { display: block; font-size: .5em; font-weight: 700; opacity: .92; }
.co-banner.is-good { background: linear-gradient(135deg, rgba(22, 163, 74, .92), rgba(13, 148, 136, .92)); }
.co-banner.is-calm { background: linear-gradient(135deg, rgba(87, 83, 78, .9), rgba(68, 64, 60, .9)); }

.co-gauge { position: absolute; left: 50%; bottom: 8px; z-index: 2; width: min(210px, 54%); transform: translateX(-50%); overflow: visible; opacity: 0; transition: opacity .2s; pointer-events: none; }
.co-gauge.is-on { opacity: 1; }
.co-g-track { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 13; stroke-linecap: round; }
.co-g-ok { fill: none; stroke: #16a34a; stroke-width: 13; }
.co-g-bad { fill: none; stroke: #dc2626; stroke-width: 13; opacity: .8; }
.co-g-needle { stroke: #1c1917; stroke-width: 5; stroke-linecap: round; }
.co-g-hub { fill: #1c1917; }
.co-gauge.is-locked .co-g-needle, .co-gauge.is-locked .co-g-hub { stroke: #9f1239; fill: #9f1239; }
.co-power { position: absolute; right: 12px; top: 50%; z-index: 2; width: 16px; height: 46%; transform: translateY(-50%); border-radius: 9px; background: rgba(255, 255, 255, .5); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25); overflow: hidden; opacity: 0; transition: opacity .2s; pointer-events: none; }
.co-power.is-on { opacity: 1; }
.co-power-ok { position: absolute; left: 0; right: 0; bottom: 50%; height: 25%; background: rgba(22, 163, 74, .55); box-shadow: inset 0 2px 0 #16a34a, inset 0 -2px 0 #16a34a; }
.co-power-fill { position: absolute; left: 3px; right: 3px; bottom: 3px; height: 0; border-radius: 6px; background: linear-gradient(0deg, #f59e0b, #dc2626); }
.co-hint { position: absolute; left: 50%; top: 58px; z-index: 2; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(30, 14, 8, .62); color: #fff; font-weight: 700; font-size: .84rem; white-space: nowrap; pointer-events: none; max-width: 94%; overflow: hidden; text-overflow: ellipsis; }
.co-hint[hidden] { display: none; }
.co-hint-icon { display: inline-block; animation: co-press 1.4s ease-in-out infinite; }
@keyframes co-press { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(4px) scale(.92); } }
.co-pause-btn { position: absolute; left: 10px; bottom: 10px; z-index: 3; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(30, 14, 8, .5); color: #fff; display: grid; place-items: center; cursor: pointer; }
.co-pause-btn[hidden] { display: none; }
.co-paused { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(20, 8, 4, .45); }
.co-paused[hidden] { display: none; }

.co-controls { display: flex; gap: 8px; }
.co-controls[hidden] { display: none; }
.co-tap { flex: 1; min-height: 60px; font-size: 1.1rem; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.co-tap.is-down { transform: scale(.97); background: var(--co-accent-2); }
.co-tap:disabled { background: var(--co-card-bg); border-color: var(--co-card-border); color: var(--co-muted); opacity: 1; }
.co-status { margin: 0; min-height: 2.7em; text-align: center; color: var(--co-muted); font-size: .92rem; line-height: 1.35; }

/* full screen: the arena fills the screen */
.co-arena:fullscreen, .co-arena:-webkit-full-screen { background: var(--co-page-bg); padding: 10px; justify-content: center; }
.co-arena:fullscreen .co-stage, .co-arena:-webkit-full-screen .co-stage { flex: 1; height: auto; max-height: none; aspect-ratio: auto; }
.co-arena.is-max { position: fixed; inset: 0; z-index: 1050; background: var(--co-page-bg); padding: 10px; }
.co-arena.is-max .co-stage { flex: 1; height: auto; max-height: none; aspect-ratio: auto; }
body.co-max { overflow: hidden; }

/* ---- setup ---- */
.co-setup { padding: 16px; border-radius: 18px; background: var(--co-card-bg); border: 1px solid var(--co-card-border); box-shadow: var(--co-shadow); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.co-setup[hidden], .co-field[hidden], .co-chips[hidden] { display: none; }
.co-setup-title { margin: 0; font-size: 1.3rem; font-weight: 800; text-align: center; }
.co-field { display: flex; flex-direction: column; gap: 6px; }
.co-label { font-weight: 700; font-size: .92rem; color: var(--co-muted); }
.co-sublabel { font-weight: 700; font-size: .82rem; color: var(--co-muted); margin-top: 4px; }
.co-note { color: var(--co-muted); font-size: .82rem; line-height: 1.4; }
.co-modes { display: grid; gap: 8px; }
.co-mode { display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; min-height: 58px; padding: 7px 12px; border-radius: 14px; border: 1px solid var(--co-card-border); background: var(--co-page-bg); color: inherit; cursor: pointer; touch-action: manipulation; }
.co-mode-icon { grid-row: 1 / 3; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; background: var(--co-card-bg); color: var(--co-accent); border: 1px solid var(--co-card-border); }
.co-mode strong { font-size: 1rem; }
.co-mode small { color: var(--co-muted); font-size: .8rem; }
.co-mode[aria-checked="true"] { border-color: var(--co-accent); background: var(--co-accent-soft); box-shadow: inset 0 0 0 1px var(--co-accent); }
.co-mode[aria-checked="true"] .co-mode-icon { background: var(--co-accent); color: var(--co-on-accent); border-color: var(--co-accent); }
.co-chips { display: flex; gap: 6px; }
.co-chip { flex: 1; min-width: 0; min-height: 46px; border-radius: 12px; border: 1px solid var(--co-card-border); background: var(--co-page-bg); color: inherit; font-weight: 800; font-size: 1rem; cursor: pointer; touch-action: manipulation; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px; }
.co-chip[aria-checked="true"] { background: var(--co-accent); border-color: var(--co-accent); color: var(--co-on-accent); }
.co-names { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.co-name { margin: 0; }
.co-name input { width: 100%; min-width: 0; min-height: 46px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--co-card-border); background: var(--co-page-bg); color: inherit; font-size: 1rem; }
.co-name input:focus { outline: 2px solid var(--co-accent); outline-offset: 1px; }
.co-swatches { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.co-swatch { aspect-ratio: 1; max-height: 50px; width: 100%; border-radius: 50%; border: 3px solid var(--co-card-bg); box-shadow: 0 0 0 1px var(--co-card-border); background: var(--sw); cursor: pointer; touch-action: manipulation; padding: 0; }
.co-swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--co-accent); }
.co-motifs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.co-motif { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 3px 6px; border-radius: 12px; border: 1px solid var(--co-card-border); background: var(--co-page-bg); color: inherit; cursor: pointer; touch-action: manipulation; font-size: .74rem; font-weight: 700; line-height: 1.1; min-width: 0; }
.co-motif canvas { width: 100%; max-width: 64px; aspect-ratio: 4 / 5; border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%; display: block; }
.co-motif span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-motif[aria-checked="true"] { border-color: var(--co-accent); background: var(--co-accent-soft); box-shadow: inset 0 0 0 1px var(--co-accent); }

/* ---- bracket ---- */
.co-bracket { padding: 12px; border-radius: 16px; background: var(--co-card-bg); border: 1px solid var(--co-card-border); min-width: 0; }
.co-bracket[hidden], .co-actions[hidden] { display: none; }
.co-bracket h3 { margin: 0 0 8px; font-size: 1rem; font-weight: 800; text-align: center; }
.co-rounds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.co-round-col { display: flex; flex-direction: column; justify-content: space-around; gap: 6px; min-width: 0; }
.co-round-col h4 { margin: 0; font-size: .74rem; font-weight: 800; color: var(--co-muted); text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.co-pair { display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: 10px; background: var(--co-page-bg); }
.co-pair.is-me { box-shadow: inset 0 0 0 2px var(--co-accent); }
.co-pl { display: flex; align-items: center; gap: 4px; font-size: .78rem; line-height: 1.2; min-width: 0; color: var(--co-muted); }
.co-pl b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.co-pl.is-win { color: var(--text-color); }
.co-pl.is-win b { font-weight: 900; }
.co-pl .co-dot { width: 9px; height: 11px; flex: none; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%; background: var(--c); }
.co-champ { margin: 8px 0 0; text-align: center; font-weight: 800; color: var(--co-gold); }
.co-actions { display: flex; justify-content: center; }
.co-actions .co-btn { min-width: 170px; }

.co-record { margin: 4px 0 0; text-align: center; color: var(--co-muted); font-size: .9rem; }
.co-record:empty { display: none; }
.co-reset-wrap { text-align: center; margin: 0; }
.co-reset-wrap[hidden] { display: none; }
.co-link { border: 0; background: none; padding: 6px; color: var(--co-muted); font-size: .85rem; text-decoration: underline; cursor: pointer; }

/* ---- help ---- */
.co-help { padding: 12px 14px; border-radius: 14px; background: var(--co-card-bg); border: 1px solid var(--co-card-border); min-width: 0; }
.co-help summary { font-weight: 700; cursor: pointer; min-height: 32px; }
.co-help ul { margin: 10px 0 4px; padding-left: 20px; line-height: 1.55; }
.co-help li { margin-bottom: 4px; }
.co-g-word { color: var(--co-ok); font-weight: 800; }
.co-credit { margin: 8px 0 0; font-size: .82rem; color: var(--co-muted); }
.co-credit a, .co-powered a { color: var(--co-accent); }
.co-powered { text-align: center; color: var(--co-muted); font-size: .85rem; margin: 22px 0 0; }

/* ---- dialog ---- */
.co-overlay { position: fixed; inset: 0; z-index: 1060; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--co-overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); overflow-y: auto; }
.co-overlay[hidden] { display: none; }
.co-dialog { width: 100%; max-width: 380px; margin: auto; display: flex; flex-direction: column; gap: 10px; padding: 20px 16px; border-radius: 20px; background: var(--co-card-bg); border: 1px solid var(--co-card-border); box-shadow: var(--co-shadow); color: var(--text-color); text-align: center; }
.co-dialog h2 { margin: 0; font-weight: 800; font-size: 1.4rem; overflow-wrap: anywhere; }
.co-dialog-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 24px; color: #fff; background: linear-gradient(135deg, #e11d48, #9f1239); }
.co-dialog-icon.is-win { background: linear-gradient(135deg, #f59e0b, #c2410c); }
.co-over-sub { margin: 0; color: var(--co-muted); font-size: .95rem; line-height: 1.4; }
.co-over-sub:empty { display: none; }
.co-dialog-actions { display: grid; gap: 8px; }

@media (max-width: 899px) {
    .co-main { padding-top: 84px; }
}
@media (max-width: 420px) {
    .co-setup { padding: 12px; }
    .co-bar { padding: 5px 8px; column-gap: 6px; }
    .co-side-name { font-size: .88rem; }
    .co-round { width: 38px; height: 38px; font-size: 14px; }
    .co-tools { gap: 5px; top: 8px; right: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .co-hint-icon { animation: none; }
    .co-banner, .co-bubble { transition: none; }
}
