/* Fazan — Romanian word chain, against the phone or 2-4 players on one phone (js/fazan.js).
   Theme-aware like the other game pages: tokens on :root, redefined under body.dark-theme. */
:root {
    --fz-accent: #0f766e;
    --fz-accent-ink: #ffffff;
    --fz-accent-soft: #ccfbf1;
    --fz-page-bg: #f2f7f5;
    --fz-card-bg: #ffffff;
    --fz-card-border: #dbe7e3;
    --fz-muted: #5b6b67;
    --fz-shadow: 0 10px 30px rgba(15, 80, 70, .10);
    --fz-mark: #c2410c;
    --fz-good: #15803d;
    --fz-bad: #dc2626;
    --fz-letter: #b45309;
    --fz-input-bg: #f8fbfa;
    --fz-p0: #0d9488;
    --fz-p1: #ea580c;
    --fz-p2: #7c3aed;
    --fz-p3: #db2777;
}

body.dark-theme {
    --fz-accent: #2dd4bf;
    --fz-accent-ink: #042f2e;
    --fz-accent-soft: #123a36;
    --fz-page-bg: #0f1716;
    --fz-card-bg: #1a2524;
    --fz-card-border: #2c3d3b;
    --fz-muted: #9fb3ae;
    --fz-shadow: 0 10px 30px rgba(0, 0, 0, .4);
    --fz-mark: #fb923c;
    --fz-good: #4ade80;
    --fz-bad: #f87171;
    --fz-letter: #fbbf24;
    --fz-input-bg: #111c1b;
    --fz-p0: #2dd4bf;
    --fz-p1: #fb923c;
    --fz-p2: #a78bfa;
    --fz-p3: #f472b6;
}

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

/* ---- head ---- */
.fz-head { text-align: center; margin-bottom: 10px; }
.fz-head h1 { font-weight: 800; font-size: clamp(1.8rem, 6vw, 2.4rem); margin: 0 0 4px; display: inline-flex; align-items: center; gap: 10px; }
.fz-title-badge { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; border-radius: 10px; background: linear-gradient(135deg, var(--fz-p0), var(--fz-accent)); color: #fff; font-size: .8em; box-shadow: var(--fz-shadow); }
.fz-lead { color: var(--fz-muted); margin: 0 auto; max-width: 30em; line-height: 1.5; }

/* ---- mode + options ---- */
.fz-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin: 8px 0 10px; border-radius: 16px; background: var(--fz-card-bg); border: 1px solid var(--fz-card-border); }
.fz-seg { min-height: 46px; padding: 6px 8px; border: 0; border-radius: 12px; background: transparent; color: inherit; font-weight: 700; font-size: .92rem; line-height: 1.2; cursor: pointer; touch-action: manipulation; display: flex; align-items: center; justify-content: center; gap: 7px; }
.fz-seg[aria-checked="true"] { background: var(--fz-accent); color: var(--fz-accent-ink); }
.fz-opts { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin: 0 0 8px; }
.fz-opts[hidden], .fz-names[hidden] { display: none; }
.fz-opts-label { color: var(--fz-muted); font-weight: 600; font-size: .9rem; margin-right: 2px; }
.fz-chip { min-height: 40px; min-width: 52px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--fz-card-border); background: var(--fz-card-bg); color: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; touch-action: manipulation; }
.fz-chip[aria-checked="true"] { background: var(--fz-accent-soft); border-color: var(--fz-accent); color: var(--fz-accent); }
body.dark-theme .fz-chip[aria-checked="true"] { color: var(--fz-accent); }
.fz-seg:focus-visible, .fz-chip:focus-visible, .fz-btn:focus-visible, .fz-link:focus-visible, .fz-send:focus-visible { outline: 2px solid var(--fz-accent); outline-offset: 2px; }
.fz-opts-small .fz-chip { min-height: 36px; font-size: .84rem; padding: 4px 12px; }

.fz-names { margin: 0 0 10px; text-align: center; }
.fz-names summary { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 12px; color: var(--fz-accent); font-weight: 600; font-size: .9rem; cursor: pointer; list-style: none; }
.fz-names summary::-webkit-details-marker { display: none; }
.fz-names-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; text-align: left; }
.fz-name { display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 12px; background: var(--fz-card-bg); border: 1px solid var(--fz-card-border); margin: 0; }
.fz-name[hidden] { display: none; }
.fz-name input { flex: 1; min-width: 0; border: 0; background: transparent; color: inherit; min-height: 42px; font-size: 16px; outline: none; }

/* ---- players ---- */
.fz-players { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 4px 0 10px; }
.fz-players.n3 { grid-template-columns: repeat(3, 1fr); }
.fz-players.n4 { grid-template-columns: repeat(2, 1fr); }
.fz-player { --pc: var(--fz-p0); min-width: 0; padding: 8px 10px; border-radius: 14px; background: var(--fz-card-bg); border: 2px solid var(--fz-card-border); transition: border-color .2s, box-shadow .2s, opacity .2s; }
.fz-player.is-turn { border-color: var(--pc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 22%, transparent); }
.fz-player.is-out { opacity: .5; }
.fz-player.is-out .fz-player-name { text-decoration: line-through; }
.fz-player.is-winner { border-color: var(--fz-letter); }
.fz-player-name { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fz-letters { display: flex; gap: 4px; margin-top: 6px; }
.fz-letters span { flex: 1; max-width: 30px; height: 28px; display: grid; place-items: center; border-radius: 7px; font-weight: 800; font-size: .9rem; border: 1px dashed var(--fz-card-border); color: color-mix(in srgb, var(--fz-muted) 45%, transparent); }
.fz-letters span.is-on { background: var(--fz-letter); border: 1px solid var(--fz-letter); color: #fff; animation: fz-pop .35s cubic-bezier(.2, 1.5, .4, 1); }
body.dark-theme .fz-letters span.is-on { color: #1c1300; }
.fz-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--pc, var(--fz-p0)); flex: none; display: inline-block; }
.fz-body .c0 { --pc: var(--fz-p0); }
.fz-body .c1 { --pc: var(--fz-p1); }
.fz-body .c2 { --pc: var(--fz-p2); }
.fz-body .c3 { --pc: var(--fz-p3); }

/* ---- play card ---- */
.fz-play { position: relative; padding: 14px; border-radius: 20px; background: var(--fz-card-bg); border: 1px solid var(--fz-card-border); box-shadow: var(--fz-shadow); }
.fz-play.is-loading .fz-form, .fz-play.is-loading .fz-pass-row { opacity: .45; pointer-events: none; }
.fz-turn { --pc: var(--fz-p0); text-align: center; padding: 2px 0 8px; }
.fz-turn-name { font-weight: 800; font-size: clamp(1.3rem, 5.5vw, 1.6rem); color: var(--pc); line-height: 1.2; }
.fz-turn.is-over .fz-turn-name { color: var(--fz-letter); }
.fz-turn-sub { color: var(--fz-muted); font-weight: 600; font-size: .95rem; min-height: 1.45em; }
.fz-turn.is-thinking .fz-turn-sub::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--pc); animation: fz-blink 1s infinite; }

.fz-last { min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8px 6px; margin: 2px 0 10px; border-radius: 16px; background: var(--fz-input-bg); border: 1px solid var(--fz-card-border); }
.fz-last-by { color: var(--fz-muted); font-size: .85rem; font-weight: 600; }
.fz-last-word { font-size: clamp(1.9rem, 10vw, 2.6rem); font-weight: 800; letter-spacing: .02em; line-height: 1.15; overflow-wrap: anywhere; text-transform: uppercase; }
.fz-last-word mark { background: color-mix(in srgb, var(--fz-mark) 18%, transparent); color: var(--fz-mark); padding: 0 .08em; border-radius: 6px; }
.fz-last-empty { color: var(--fz-muted); font-weight: 600; }
.fz-last.is-pop .fz-last-word { animation: fz-pop .35s cubic-bezier(.2, 1.4, .4, 1); }

.fz-timer { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; min-height: 22px; }
.fz-timer-track { flex: 1; height: 8px; border-radius: 99px; background: var(--fz-card-border); overflow: hidden; }
.fz-timer-bar { height: 100%; width: 100%; background: var(--fz-accent); transform-origin: left center; transition: transform .1s linear, background-color .3s; }
.fz-timer.is-low .fz-timer-bar { background: var(--fz-bad); }
.fz-timer.is-low .fz-timer-txt { color: var(--fz-bad); }
.fz-timer-txt { min-width: 3.2em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--fz-muted); }
.fz-timer.is-off .fz-timer-track { opacity: .35; }
.fz-timer.is-off .fz-timer-txt { min-width: 0; font-weight: 600; }

.fz-form { display: flex; align-items: stretch; gap: 8px; }
.fz-form.is-shake { animation: fz-shake .35s; }
.fz-prefix { display: grid; place-items: center; padding: 0 12px; border-radius: 14px; background: color-mix(in srgb, var(--fz-mark) 15%, transparent); color: var(--fz-mark); font-weight: 800; font-size: 1.15rem; letter-spacing: .04em; }
.fz-prefix[hidden] { display: none; }
.fz-input { flex: 1; min-width: 0; min-height: 54px; padding: 8px 14px; border-radius: 14px; border: 2px solid var(--fz-card-border); background: var(--fz-input-bg); color: inherit; font-size: 1.25rem; font-weight: 700; outline: none; }
.fz-input:focus { border-color: var(--fz-accent); }
.fz-input:disabled { opacity: .6; }
.fz-send { width: 58px; border: 0; border-radius: 14px; background: var(--fz-accent); color: var(--fz-accent-ink); font-size: 1.2rem; cursor: pointer; touch-action: manipulation; }
.fz-send:disabled { opacity: .45; cursor: default; }
.fz-msg { min-height: 2.9em; margin: 8px 2px 4px; font-weight: 600; font-size: .95rem; line-height: 1.4; text-align: center; color: var(--fz-muted); }
.fz-msg.is-bad { color: var(--fz-bad); }
.fz-msg.is-good { color: var(--fz-good); }
.fz-msg.is-letter { color: var(--fz-letter); }
.fz-pass-row { display: flex; justify-content: center; }
.fz-loading { text-align: center; color: var(--fz-muted); font-weight: 600; margin: 10px 0 0; }

.fz-chain { list-style: none; margin: 14px 0 0; padding: 10px 0 0; border-top: 1px solid var(--fz-card-border); display: flex; flex-wrap: wrap; gap: 6px; max-height: 260px; overflow-y: auto; }
.fz-chain[hidden] { display: none; }
.fz-chain-round { flex-basis: 100%; color: var(--fz-muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.fz-chain-item { --pc: var(--fz-p0); display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; background: var(--fz-input-bg); border: 1px solid var(--fz-card-border); font-size: .92rem; }
.fz-chain-item a { color: inherit; font-weight: 700; text-decoration: none; }
.fz-chain-item a:hover { text-decoration: underline; }
.fz-chain-who { color: var(--fz-muted); font-size: .75rem; }

/* ---- overlays (inside the play card) ---- */
.fz-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: start center; padding: 48px 12px 12px; border-radius: 20px; background: color-mix(in srgb, var(--fz-page-bg) 70%, transparent); backdrop-filter: blur(2px); animation: fz-fade .2s ease-out; }
.fz-overlay[hidden] { display: none !important; }
.fz-card { width: min(100%, 340px); padding: 18px 16px 16px; border-radius: 18px; background: var(--fz-card-bg); border: 1px solid var(--fz-card-border); box-shadow: 0 16px 40px rgba(0, 0, 0, .25); text-align: center; animation: fz-pop .3s cubic-bezier(.2, 1.4, .4, 1); }
.fz-card h2 { font-family: inherit; font-style: normal; font-size: 1.3rem; font-weight: 800; margin: 0 0 6px; overflow-wrap: anywhere; color: var(--text-color); }
.fz-card p { color: var(--fz-muted); margin: 0 0 14px; font-size: .95rem; }
.fz-card p:empty { display: none; }
.fz-card-icon { font-size: 1.8rem; color: var(--fz-accent); margin-bottom: 4px; }
.fz-card-icon.is-trophy { color: var(--fz-letter); }
.fz-card-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---- buttons ---- */
.fz-btn { min-height: 46px; border-radius: 12px; border: 1px solid var(--fz-card-border); background: var(--fz-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; line-height: 1.2; }
.fz-btn:hover:not(:disabled) { border-color: var(--fz-accent); }
.fz-btn:disabled { opacity: .45; cursor: default; }
.fz-btn-primary { background: var(--fz-accent); border-color: var(--fz-accent); color: var(--fz-accent-ink); }
.fz-actions { display: flex; justify-content: center; margin: 14px 0 12px; }
.fz-actions .fz-btn { min-width: 180px; }
.fz-tools { display: flex; justify-content: center; gap: 6px 18px; flex-wrap: wrap; margin: 2px 0 4px; }
.fz-link { border: 0; background: none; color: var(--fz-accent); font-weight: 600; font-size: .9rem; padding: 8px 4px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.fz-link span { display: inline-flex; align-items: center; gap: 6px; }
.fz-link span[hidden] { display: none; }
.fz-stats { display: flex; flex-direction: column; gap: 2px; text-align: center; color: var(--fz-muted); font-size: .86rem; margin: 0 0 14px; }

.fz-help { padding: 12px 16px; border-radius: 14px; background: var(--fz-card-bg); border: 1px solid var(--fz-card-border); }
.fz-help summary { font-weight: 700; cursor: pointer; }
.fz-help ul { margin: 10px 0 8px; padding-left: 20px; line-height: 1.55; }
.fz-help li { margin-bottom: 4px; }
.fz-help p { margin: 0; color: var(--fz-muted); font-size: .9rem; }
.fz-credit { color: var(--fz-muted); font-size: .78rem; text-align: center; margin: 12px 0 0; line-height: 1.5; }
.fz-credit a, .fz-powered a { color: var(--fz-accent); }
.fz-powered { text-align: center; color: var(--fz-muted); font-size: .85rem; margin: 18px 0 0; }

@keyframes fz-pop { from { opacity: 0; transform: scale(.8); } }
@keyframes fz-fade { from { opacity: 0; } }
@keyframes fz-blink { 50% { opacity: .2; } }
@keyframes fz-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

@media (max-width: 420px) {
    .fz-main { padding-top: 88px; }
    .fz-seg { font-size: .84rem; padding: 6px 4px; gap: 5px; }
    .fz-chip { min-width: 46px; padding: 6px 11px; }
    .fz-play { padding: 12px 10px; }
    .fz-players.n3 .fz-player { padding: 7px 7px; }
    .fz-players.n3 .fz-letters { gap: 2px; }
    .fz-players.n3 .fz-letters span { height: 24px; font-size: .78rem; }
    .fz-names-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .fz-letters span.is-on, .fz-last.is-pop .fz-last-word, .fz-form.is-shake, .fz-card, .fz-overlay { animation: none; }
    .fz-turn.is-thinking .fz-turn-sub::after { animation: none; }
    .fz-timer-bar { transition: none; }
}
