/* Cuvântul zilei — Romanian Wordle (js/cuvantul-zilei.js).
   Theme-aware like the other game pages: tokens on :root, redefined under body.dark-theme;
   body.cz-cb switches to the colour-blind palette (orange / blue). */
:root {
    --cz-accent: #15803d;
    --cz-accent-ink: #ffffff;
    --cz-page-bg: #f4f6f3;
    --cz-card-bg: #ffffff;
    --cz-card-border: #dfe5dc;
    --cz-muted: #5f6b5c;
    --cz-shadow: 0 10px 30px rgba(20, 60, 20, .08);
    --cz-tile-border: #d3d8d0;
    --cz-tile-filled: #8b958a;
    --cz-tile-text: #1f2a1e;
    --cz-g: #4f9a4a;
    --cz-y: #c9a227;
    --cz-b: #7b8279;
    --cz-on: #ffffff;
    --cz-key: #dfe4dc;
    --cz-key-text: #1f2a1e;
}

body.dark-theme {
    --cz-accent: #4ade80;
    --cz-accent-ink: #052e12;
    --cz-page-bg: #111512;
    --cz-card-bg: #1a201b;
    --cz-card-border: #2e372f;
    --cz-muted: #a3b0a2;
    --cz-shadow: 0 10px 30px rgba(0, 0, 0, .4);
    --cz-tile-border: #3a433b;
    --cz-tile-filled: #6b766b;
    --cz-tile-text: #f2f5f1;
    --cz-g: #4a8f45;
    --cz-y: #b59224;
    --cz-b: #3d443e;
    --cz-key: #4b544c;
    --cz-key-text: #f2f5f1;
}

body.cz-cb {
    --cz-g: #f5793a;
    --cz-y: #85c0f9;
}
body.cz-cb .cz-tile.is-y, body.cz-cb .cz-key.is-y, body.cz-cb .cz-swatch.is-y { color: #10263a; }

/* clip, not hidden: the site-wide `body { overflow-x: hidden }` would kill position: sticky. */
.cz-body, body.cz-body#page-top {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--cz-page-bg);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: clip;
}
.cz-main { padding-top: 92px; padding-bottom: 40px; }
.cz-wrap { max-width: 520px; }

.cz-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin: 6px 0 8px; border-radius: 16px; background: var(--cz-card-bg); border: 1px solid var(--cz-card-border); }
.cz-seg { min-height: 44px; padding: 6px 8px; border: 0; border-radius: 12px; background: transparent; color: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; touch-action: manipulation; display: flex; align-items: center; justify-content: center; gap: 7px; }
.cz-seg[aria-checked="true"] { background: var(--cz-accent); color: var(--cz-accent-ink); }

.cz-head { text-align: center; margin: 4px 0 10px; }
.cz-head h1 { font-family: inherit; font-style: normal; font-weight: 800; font-size: clamp(1.5rem, 6vw, 2rem); margin: 0; }
.cz-sub { color: var(--cz-muted); margin: 2px 0 0; font-size: .92rem; min-height: 1.4em; }

/* ---- board ---- */
.cz-stage { position: relative; display: flex; justify-content: center; }
.cz-board { display: grid; grid-template-rows: repeat(6, 1fr); gap: 6px; width: min(100%, 330px); }
.cz-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cz-row.is-shake { animation: cz-shake .4s; }
.cz-tile { aspect-ratio: 1; display: grid; place-items: center; border: 2px solid var(--cz-tile-border); border-radius: 6px; font-size: clamp(1.5rem, 8vw, 2rem); font-weight: 800; color: var(--cz-tile-text); text-transform: uppercase; user-select: none; line-height: 1; }
.cz-tile.is-filled { border-color: var(--cz-tile-filled); }
.cz-tile.is-pop { animation: cz-pop .12s ease-out; }
.cz-tile.is-g, .cz-tile.is-y, .cz-tile.is-b { color: var(--cz-on); border-color: transparent; }
.cz-tile.is-g { background: var(--cz-g); }
.cz-tile.is-y { background: var(--cz-y); }
.cz-tile.is-b { background: var(--cz-b); }
.cz-tile.is-flip { animation: cz-flip .32s ease-in-out; }
.cz-tile.is-win { animation: cz-bounce .5s ease-out both; }

.cz-toast { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 3; max-width: 92%; padding: 10px 16px; border-radius: 10px; background: var(--text-color); color: var(--cz-page-bg); font-weight: 700; font-size: .95rem; text-align: center; box-shadow: 0 8px 20px rgba(0, 0, 0, .25); pointer-events: none; }
body.dark-theme .cz-toast { background: #f2f5f1; color: #111512; }
.cz-toast.is-show { animation: cz-fade .2s ease-out; }
.cz-toast[hidden] { display: none; }
.cz-loading { text-align: center; color: var(--cz-muted); font-weight: 600; margin: 8px 0 0; }

/* ---- result ---- */
.cz-result { margin: 14px 0 4px; padding: 14px 14px 12px; border-radius: 18px; background: var(--cz-card-bg); border: 1px solid var(--cz-card-border); box-shadow: var(--cz-shadow); text-align: center; animation: cz-fade .3s ease-out; }
.cz-result[hidden] { display: none; }
.cz-result h2 { font-family: inherit; font-style: normal; font-weight: 800; font-size: 1.35rem; margin: 0 0 4px; color: var(--text-color); }
.cz-result-word-wrap { margin: 0 0 10px; color: var(--cz-muted); }
.cz-result-word { color: var(--text-color); font-size: 1.2rem; letter-spacing: .06em; }
.cz-dex { margin-left: 6px; font-size: .88rem; color: var(--cz-accent); white-space: nowrap; }
.cz-result-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.cz-countdown { margin: 10px 0 0; color: var(--cz-muted); font-size: .9rem; }
.cz-countdown[hidden] { display: none; }
.cz-countdown b { font-variant-numeric: tabular-nums; color: var(--text-color); }

/* ---- keyboard ---- */
.cz-kb { margin: 14px auto 6px; max-width: 500px; display: flex; flex-direction: column; gap: 7px; user-select: none; -webkit-user-select: none; }
.cz-kb-row { display: flex; gap: 5px; justify-content: center; }
.cz-kb-row:nth-child(2) { padding: 0 4.5%; }
.cz-key { flex: 1 1 0; min-width: 0; height: 56px; border: 0; border-radius: 7px; background: var(--cz-key); color: var(--cz-key-text); font-weight: 700; font-size: 1.05rem; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; padding: 0; transition: background-color .2s; }
.cz-key-wide { flex: 1.55 1 0; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; }
.cz-key[data-key="back"] { font-size: 1.3rem; }
.cz-key:active { filter: brightness(.9); }
.cz-key:focus-visible { outline: 2px solid var(--cz-accent); outline-offset: 2px; }
.cz-key.is-g { background: var(--cz-g); color: var(--cz-on); }
.cz-key.is-y { background: var(--cz-y); color: var(--cz-on); }
.cz-key.is-b { background: var(--cz-b); color: var(--cz-on); opacity: .85; }

/* ---- buttons, panels ---- */
.cz-btn { min-height: 46px; border-radius: 12px; border: 1px solid var(--cz-card-border); background: var(--cz-card-bg); color: inherit; font-weight: 700; font-size: .95rem; padding: 8px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; touch-action: manipulation; }
.cz-btn:hover { border-color: var(--cz-accent); }
.cz-btn[hidden] { display: none; }
.cz-btn-primary { background: var(--cz-accent); border-color: var(--cz-accent); color: var(--cz-accent-ink); }
.cz-btn:focus-visible, .cz-link:focus-visible, .cz-seg:focus-visible { outline: 2px solid var(--cz-accent); outline-offset: 2px; }
.cz-tools { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 14px; }
.cz-link { border: 0; background: none; color: var(--cz-accent); font-weight: 600; font-size: .9rem; padding: 8px 4px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.cz-link span { display: inline-flex; align-items: center; gap: 6px; }
.cz-link span[hidden] { display: none; }
.cz-link[aria-pressed="true"]#cz-cb { text-decoration: underline; text-underline-offset: 3px; }

.cz-panel { padding: 14px 16px; border-radius: 16px; background: var(--cz-card-bg); border: 1px solid var(--cz-card-border); margin-bottom: 12px; }
.cz-panel h2 { font-family: inherit; font-style: normal; font-size: 1.1rem; font-weight: 800; margin: 0 0 10px; color: var(--text-color); }
.cz-panel h3 { font-family: inherit; font-style: normal; font-size: .9rem; font-weight: 700; color: var(--cz-muted); margin: 14px 0 6px; }
.cz-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.cz-stat b { display: block; font-size: 1.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cz-stat span { display: block; font-size: .74rem; color: var(--cz-muted); line-height: 1.2; }
.cz-dist { display: flex; flex-direction: column; gap: 4px; }
.cz-dist-row { display: flex; align-items: center; gap: 6px; font-size: .85rem; }
.cz-dist-n { width: 1em; text-align: center; font-weight: 700; }
.cz-dist-bar { min-width: 22px; padding: 1px 7px; border-radius: 4px; background: var(--cz-b); color: var(--cz-on); font-weight: 700; text-align: right; }
.cz-dist-bar.is-now { background: var(--cz-g); }
.cz-practice-stat { margin: 10px 0 0; color: var(--cz-muted); font-size: .85rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px; }

.cz-help { padding: 12px 16px; border-radius: 14px; background: var(--cz-card-bg); border: 1px solid var(--cz-card-border); }
.cz-help summary { font-weight: 700; cursor: pointer; }
.cz-help ul { margin: 10px 0 8px; padding-left: 20px; line-height: 1.55; }
.cz-help p { margin: 0; color: var(--cz-muted); font-size: .9rem; }
.cz-example { display: flex; gap: 5px; margin: 4px 0 4px 20px; }
.cz-example .cz-tile { width: 40px; font-size: 1.2rem; }
.cz-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; }
.cz-swatch.is-g { background: var(--cz-g); }
.cz-swatch.is-y { background: var(--cz-y); }
.cz-swatch.is-b { background: var(--cz-b); }
.cz-credit { color: var(--cz-muted); font-size: .78rem; text-align: center; margin: 12px 0 0; line-height: 1.5; }
.cz-credit a, .cz-powered a { color: var(--cz-accent); }
.cz-powered { text-align: center; color: var(--cz-muted); font-size: .85rem; margin: 18px 0 0; }

@keyframes cz-pop { 50% { transform: scale(1.1); } }
@keyframes cz-flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes cz-bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } 70% { transform: translateY(3px); } }
@keyframes cz-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes cz-fade { from { opacity: 0; } }

@media (max-width: 420px) {
    .cz-main { padding-top: 84px; }
    .cz-board { width: min(100%, 300px); gap: 5px; }
    .cz-row { gap: 5px; }
    .cz-kb { gap: 6px; }
    .cz-kb-row { gap: 4px; }
    .cz-key { height: 54px; font-size: 1rem; }
    .cz-key-wide { font-size: .68rem; }
    .cz-stat b { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
    .cz-tile.is-pop, .cz-tile.is-flip, .cz-tile.is-win, .cz-row.is-shake, .cz-toast.is-show, .cz-result { animation: none; }
}
