/* conquest.css — „დაპყრობის" თამაში. მოთამაშეების ფერები: p0 წითელი, p1 მწვანე, p2 ლურჯი. */
.cq-body { --p0: #d2453a; --p0-l: #f3c2b9; --p1: #2f9e5b; --p1-l: #bfe3c8; --p2: #2f6a9e; --p2-l: #bcd4ea; --land: #f4ecdc; --sea: #dcebea; }
.cq-page { padding-top: 20px; padding-bottom: 48px; }

/* ---------- შესვლა ---------- */
.cq-setup { max-width: 920px; margin: 0 auto; display: grid; gap: 16px; }
.cq-hero { text-align: center; padding: 18px 0 4px; }
.cq-hero h1 { font-size: clamp(30px, 6vw, 44px); margin-bottom: 8px; }
.cq-hero p { max-width: 560px; margin: 0 auto; font-size: 16px; }
.cq-kicker { font-size: 12px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--accent-text); margin-bottom: 6px; }
.cq-identity { display: flex; align-items: center; gap: 16px; padding: 16px; }
.cq-avatar-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; cursor: pointer; color: var(--primary); font-size: 12.5px; font-weight: 700; padding: 0; }
.cq-name-field { flex: 1; min-width: 0; }
.cq-picker[hidden] { display: none; }
.cq-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.cq-mode { display: flex; flex-direction: column; gap: 8px; padding: 18px; }
.cq-mode h3 { margin: 0; font-size: 18px; }
.cq-mode p { flex: 1; margin: 0; font-size: 14px; }
.cq-mode-emoji { font-size: 30px; line-height: 1; }
.cq-mode-focus { outline: 3px solid var(--accent); }
.cq-join-row { display: flex; gap: 8px; }
.cq-code-input { text-transform: uppercase; letter-spacing: 3px; font-weight: 800; min-width: 0; flex: 1; }
.cq-rules { margin-top: 10px; }
.cq-rules h2 { font-size: 22px; }
.cq-rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.cq-rule { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.cq-rule h3 { font-size: 15.5px; margin: 6px 0 4px; }
.cq-rule p { font-size: 13.5px; margin: 0; }
.cq-rule-emoji { font-size: 24px; }
.cq-credit { font-size: 12.5px; margin-top: 12px; text-align: center; }

/* ---------- თამაში ---------- */
.cq-game { display: grid; gap: 10px; max-width: 1040px; margin: 0 auto; }
.cq-topbar { display: flex; align-items: center; gap: 10px; }
.cq-phase { flex: 1; font-weight: 800; font-size: 17px; }
.cq-conn { font-size: 13px; font-weight: 700; color: var(--warning); }
.cq-players { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cq-player { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-top: 5px solid var(--pc, var(--border)); border-radius: 12px; min-width: 0; transition: box-shadow .2s, transform .2s; }
.cq-player.p0 { --pc: var(--p0); } .cq-player.p1 { --pc: var(--p1); } .cq-player.p2 { --pc: var(--p2); }
.cq-player.me { background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 10%, var(--surface)), var(--surface)); }
.cq-player.active { box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 45%, transparent); transform: translateY(-1px); }
.cq-player.out { opacity: .5; }
.cq-player.empty { border-style: dashed; justify-content: center; text-align: center; }
.cq-player-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cq-player-info strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cq-player-info span { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cq-player-score { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.cq-player-score b { font-size: 18px; font-variant-numeric: tabular-nums; }
.cq-towers { color: var(--pc); font-size: 13px; letter-spacing: 1px; }

.cq-board { position: relative; background: var(--sea); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cq-map-wrap { position: relative; }
.cq-map { display: block; width: 100%; height: auto; min-height: 280px; }
.cq-region { fill: var(--land); stroke: #8a6a48; stroke-width: 1.4; stroke-linejoin: round; transition: fill .35s; }
.cq-region.own.p0 { fill: var(--p0-l); } .cq-region.own.p1 { fill: var(--p1-l); } .cq-region.own.p2 { fill: var(--p2-l); }
.cq-region.conquered.p0 { fill: color-mix(in srgb, var(--p0) 55%, var(--p0-l)); }
.cq-region.conquered.p1 { fill: color-mix(in srgb, var(--p1) 55%, var(--p1-l)); }
.cq-region.conquered.p2 { fill: color-mix(in srgb, var(--p2) 55%, var(--p2-l)); }
.cq-region.candidate { stroke: #3a2c1c; stroke-width: 2.4; stroke-dasharray: 6 4; }
.cq-region.pickable { cursor: pointer; stroke: #1f1a14; stroke-width: 3; animation: cq-pulse 1.1s ease-in-out infinite; }
.cq-region.pickable:not(.own) { fill: #ffe9a8; }
.cq-region.pickable.own { filter: saturate(1.6); }
.cq-region.pickable:hover { filter: brightness(.9); }
.cq-region.chosen { filter: brightness(.85); }
.cq-region.target { stroke: #1f1a14; stroke-width: 3.5; animation: cq-pulse 0.8s ease-in-out infinite; }
@keyframes cq-pulse { 50% { stroke-opacity: .35; } }
.cq-labels { pointer-events: none; }
.cq-label text { text-anchor: middle; paint-order: stroke; stroke: rgba(255, 253, 249, .85); stroke-width: 3.5px; stroke-linejoin: round; }
.cq-name { font-size: 15px; font-weight: 700; fill: #3a2c1c; }
.cq-castle { display: none; stroke: #2b2118; stroke-width: 1.6; stroke-linejoin: round; }
.cq-castle.show { display: inline; }
.cq-castle.p0 { fill: var(--p0); } .cq-castle.p1 { fill: var(--p1); } .cq-castle.p2 { fill: var(--p2); }
.cq-castle .cq-gate { fill: #2b2118; }
.cq-castle .cq-tower.down { fill: #fffdf9; stroke-dasharray: 3 2; opacity: .55; }
.cq-ring { display: none; fill: rgba(207, 74, 62, .16); stroke: var(--danger); stroke-width: 3; stroke-dasharray: 7 5; }
.cq-ring.show { display: inline; animation: cq-spin 3s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes cq-spin { to { transform: rotate(360deg); } }
.cq-value { font-size: 12.5px; font-weight: 800; fill: #5c4630; }

.cq-banner { display: none; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 3; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px; box-shadow: var(--shadow); font-size: 14.5px; width: max-content; max-width: calc(100% - 20px); text-align: center; align-items: center; gap: 6px; }
.cq-banner.show { display: flex; }
.cq-banner b { white-space: nowrap; }
.cq-banner.mine { background: #fff4d9; border-color: var(--accent); }
.cq-secs { display: inline-block; min-width: 26px; font-weight: 800; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.cq-chip { display: inline-block; padding: 1px 9px; border-radius: 999px; color: #fff; font-weight: 700; font-size: .92em; max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.cq-chip.p0 { background: var(--p0); } .cq-chip.p1 { background: var(--p1); } .cq-chip.p2 { background: var(--p2); }

.cq-timer { height: 6px; background: var(--surface-2); }
.cq-timer-fill { height: 100%; width: 0; background: var(--primary); transition: background .3s; }
.cq-timer-fill.low { background: var(--danger); }

.cq-overlay { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(43, 38, 32, .28); backdrop-filter: blur(1.5px); overflow-y: auto; }
.cq-overlay[hidden] { display: none; }
.cq-card { width: min(560px, 100%); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 18px; display: grid; gap: 10px; text-align: center; animation: cq-pop .22s ease-out; }
@keyframes cq-pop { from { transform: scale(.96); opacity: 0; } }
.cq-card h2 { margin: 0; font-size: 19px; }
.cq-card p { margin: 0; }
.cq-room-code { font-size: 38px; font-weight: 900; letter-spacing: 8px; color: var(--primary); }
.cq-lobby-count { font-weight: 700; color: var(--text); }
.cq-wait { font-size: 14px; }
.cq-attack { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; font-weight: 700; font-size: 14px; }
.cq-q-meta { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-dim); }
.cq-cat { background: var(--primary-light); color: var(--primary-dark); border-radius: 999px; padding: 2px 10px; font-weight: 700; }
.cq-q { font-size: clamp(17px, 2.4vw, 21px) !important; line-height: 1.35; }
.cq-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cq-option { display: flex; align-items: center; gap: 8px; text-align: start; padding: 11px 12px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); font-size: 15px; font-weight: 600; color: var(--text); cursor: pointer; min-height: 52px; }
button.cq-option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-light); }
.cq-option:disabled { cursor: default; opacity: .7; }
.cq-option.picked { opacity: 1 !important; border-color: var(--primary); background: var(--primary-light); }
.cq-opt-letter { flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; font-size: 13px; }
.cq-options.reveal .cq-option { cursor: default; }
.cq-option.correct { border-color: var(--success); background: var(--success-bg); }
.cq-option.correct .cq-opt-letter { background: var(--success); color: #fff; }
.cq-option.wrong { border-color: var(--danger); background: var(--danger-bg); }
.cq-who { margin-inline-start: auto; display: flex; gap: 2px; }
.cq-who .game-avatar { width: 26px; height: 26px; border-radius: 9px; }
.cq-num { display: flex; gap: 8px; }
.cq-num-input { flex: 1; min-width: 0; font-size: 20px; font-weight: 700; text-align: center; }
.shake { animation: cq-shake .35s; }
@keyframes cq-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.cq-answered { display: flex; justify-content: center; gap: 10px; }
.cq-ans { display: flex; align-items: center; gap: 4px; font-weight: 800; color: var(--text-dim); opacity: .55; }
.cq-ans.done { opacity: 1; color: var(--success); }
.cq-ans .game-avatar { width: 30px; height: 30px; border-radius: 10px; }
.cq-watch { font-size: 14.5px; }
.cq-correct { font-size: 15px; }
.cq-correct b { font-size: 22px; color: var(--success); }
.cq-ranking, .cq-standings { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cq-ranking li, .cq-standings li { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "av name val" "av sub sub"; align-items: center; column-gap: 10px; text-align: start; padding: 7px 10px; border-radius: 12px; background: var(--surface-2); border-inline-start: 5px solid var(--pc); }
.cq-ranking li.p0, .cq-standings li.p0 { --pc: var(--p0); } .cq-ranking li.p1, .cq-standings li.p1 { --pc: var(--p1); } .cq-ranking li.p2, .cq-standings li.p2 { --pc: var(--p2); }
.cq-ranking li.first { background: #fff4d9; }
.cq-ranking .game-avatar { grid-area: av; }
.cq-rank-name { grid-area: name; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cq-ranking b, .cq-standings b { grid-area: val; font-size: 17px; font-variant-numeric: tabular-nums; }
.cq-ranking small, .cq-standings small { grid-area: sub; color: var(--text-dim); font-size: 12px; }
.cq-standings li { grid-template-areas: "av name val" "av sub sub"; font-size: 15px; }
.cq-standings li > span:first-child { grid-area: av; font-size: 22px; }
.cq-missing { font-size: 13px; }
.cq-outcome { font-weight: 800; color: var(--accent-text); background: #fff4d9; border-radius: 10px; padding: 8px 10px; }
.cq-battle-emoji { font-size: 46px; line-height: 1; }
.cq-battle.won h2 { color: var(--text); }
.cq-tb-q { font-size: 14px; }
.cq-you-won { font-weight: 800; color: var(--success); }
.cq-end-avatar { display: flex; justify-content: center; }
.cq-end-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.cq-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--text-dim); }
.cq-log li:first-child { color: var(--text); font-weight: 600; }

@media (max-width: 640px) {
  .cq-page { padding-top: 10px; padding-left: 10px; padding-right: 10px; }
  .cq-player { flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 6px 4px; }
  .cq-player .game-avatar { display: none; }
  .cq-player-info strong { font-size: 12.5px; max-width: 100%; }
  .cq-player-info span { display: none; }
  .cq-player-score { align-items: center; }
  .cq-options { grid-template-columns: 1fr; }
  .cq-option { min-height: 44px; padding: 8px 10px; font-size: 14.5px; }
  .cq-name { font-size: 20px; stroke-width: 5px; }
  .cq-map { min-height: 0; }
  .cq-phase { font-size: 15px; }
  .cq-castle { transform: scale(1.3); }
  .cq-value { display: none; }
  /* ვიწრო ეკრანზე ოვერლეი რუკის ქვემოთ ჩნდება და არა მის თავზე */
  .cq-overlay { position: static; background: none; backdrop-filter: none; padding: 10px; }
  .cq-card { box-shadow: none; border: 1px solid var(--border); }
  .cq-banner { position: static; transform: none; margin: 8px; border-radius: 12px; justify-content: center; flex-wrap: wrap; }
}

/* ბრძოლის შედეგი რუკის ქვემოთ, დაბურვის გარეშე — რომ მხარის ფერის შეცვლა გამოჩნდეს */
.cq-overlay.kind-battleResult { background: none; backdrop-filter: none; align-items: flex-end; pointer-events: none; }
.cq-overlay.kind-battleResult .cq-card { pointer-events: auto; }
.cq-battle:not(:has(.cq-ranking)) { width: min(460px, 100%); grid-template-columns: auto 1fr; text-align: start; align-items: center; }
.cq-battle:not(:has(.cq-ranking)) .cq-battle-emoji { font-size: 36px; grid-row: span 2; }

/* მხარის არჩევა ღილაკებით (რუკის ქვემოთ, მხოლოდ საკუთარი სვლისას) */
.cq-picklist { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 8px 10px 10px; background: #fff4d9; border-top: 1px solid var(--accent); }
.cq-picklist[hidden] { display: none; }
.cq-pick-btn { border: 2px solid #8a6a48; background: var(--land); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.cq-pick-btn.p0 { background: var(--p0-l); border-color: var(--p0); } .cq-pick-btn.p1 { background: var(--p1-l); border-color: var(--p1); } .cq-pick-btn.p2 { background: var(--p2-l); border-color: var(--p2); }
.cq-pick-btn small { font-weight: 600; color: var(--text-dim); }
.cq-pick-btn:hover:not(:disabled) { filter: brightness(.93); }
.cq-pick-btn:disabled { opacity: .5; cursor: default; }
.cq-pick-btn.chosen { opacity: 1; outline: 3px solid var(--accent); }
.cq-live { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--success); }
.cq-live[hidden] { display: none; }
.cq-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: cq-pulse-dot 1.4s ease-in-out infinite; }
@keyframes cq-pulse-dot { 50% { opacity: .3; } }

/* მსოფლიოს რუკა: წვრილი საზღვრები; დესკტოპზე სიმაღლე, რომ კითხვის ბარათი დაეტიოს */
.cq-map.map-world .cq-region { stroke-width: .7; }
.cq-map.map-world .cq-region.pickable, .cq-map.map-world .cq-region.target { stroke-width: 2; }
.cq-map.map-world .cq-region.candidate { stroke-width: 1.4; stroke-dasharray: 4 3; }
@media (min-width: 641px) { .cq-map.map-world { min-height: 420px; } }

/* პარამეტრები: რუკა და თემა */
.cq-settings { display: grid; gap: 12px; padding: 14px 16px; }
.cq-setting { display: grid; gap: 6px; }
.cq-setting-label { font-size: 13px; font-weight: 800; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; }
.cq-setting-hint { font-size: 12px; color: var(--text-dim); }
.cq-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.cq-seg-btn { border: 2px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: baseline; gap: 6px; }
.cq-seg-btn small { font-weight: 600; color: var(--text-dim); font-size: 12px; }
.cq-seg-btn[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.cq-lobby-info { font-size: 14px; font-weight: 700; }
.cq-sound { min-width: 40px; }
.cq-rating-gain { font-weight: 800; color: var(--accent-text); }

/* რეიტინგი */
.cq-leaderboard { padding: 16px; display: grid; gap: 12px; }
.cq-lb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cq-lb-head h2 { margin: 0; font-size: 22px; }
.cq-lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cq-lb li { display: grid; grid-template-columns: 30px auto 1fr auto auto; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.cq-lb li:nth-child(-n+3) { background: #fff4d9; }
.cq-lb-rank { text-align: center; font-weight: 800; }
.cq-lb-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cq-lb-meta { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; }
.cq-lb b { font-size: 17px; min-width: 28px; text-align: end; }
.cq-lb .game-avatar { width: 30px; height: 30px; border-radius: 10px; }
.cq-lb-empty, .cq-lb-note { font-size: 13.5px; margin: 0; }
.cq-mystats[hidden] { display: none; }
.cq-mystats h3 { font-size: 15px; margin: 0 0 8px; }
.cq-mystats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cq-mystats-grid > div { background: var(--primary-light); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.cq-mystats-grid b { font-size: 20px; color: var(--primary-dark); }
.cq-mystats-grid span { font-size: 11.5px; color: var(--text-dim); }
@media (max-width: 640px) {
  .cq-lb li { grid-template-columns: 26px auto 1fr auto; }
  .cq-lb-meta { display: none; }
  .cq-mystats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cq-map.map-world .cq-name { font-size: 26px; }
}

/* ევროპის რუკის რუხი კონტექსტი (არ თამაშდება) */
.cq-context { fill: #e9e4d8; stroke: #c4b8a3; stroke-width: .7; pointer-events: none; }
.cq-map.map-europe .cq-region { stroke-width: 1; }

/* რუკის გადიდება */
.cq-map { touch-action: pan-y; }
.cq-map.zoomed { touch-action: none; cursor: grab; }
.cq-zoom { position: absolute; right: 8px; bottom: 8px; z-index: 2; display: flex; flex-direction: column; gap: 4px; }
.cq-zoom-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 18px; font-weight: 800; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }
.cq-zoom-btn:hover { background: var(--primary-light); }
.cq-zoom-btn[hidden] { display: none; }

/* ემოჯი-რეაქციები */
.cq-reactions { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.cq-react-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-size: 20px; cursor: pointer; transition: transform .1s; }
.cq-react-btn:hover { transform: translateY(-2px); }
.cq-react-btn:active { transform: scale(.92); }
.cq-fly { position: absolute; z-index: 60; font-size: 34px; pointer-events: none; transform: translateX(-50%); animation: cq-fly 1.6s ease-out forwards; }
@keyframes cq-fly { 0% { opacity: 0; transform: translate(-50%, 0) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -20px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -110px) scale(1); } }

/* ტურნირი */
.cq-tournament { padding: 16px; display: grid; gap: 10px; border: 2px solid var(--accent); background: linear-gradient(135deg, #fff7e3, var(--surface)); }
.cq-tournament[hidden] { display: none; }
.cq-tournament.live { box-shadow: 0 0 0 4px rgba(240, 181, 74, .25), var(--shadow); }
.cq-t-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.cq-t-head h2 { margin: 0 0 4px; font-size: 22px; }
.cq-t-head p { margin: 0; font-size: 14px; max-width: 560px; }
.cq-t-champ { margin: 0; font-weight: 700; color: var(--accent-text); font-size: 14px; }

/* AI-კომპლექტები */
.cq-ai { padding: 16px; display: grid; gap: 10px; }
.cq-ai[hidden] { display: none; }
.cq-ai h2 { margin: 0; font-size: 22px; }
.cq-ai > p { margin: 0; font-size: 14px; }
.cq-ai-form { display: flex; gap: 8px; align-items: stretch; }
.cq-ai-topic { flex: 1; min-width: 0; resize: vertical; font: inherit; }
.cq-ai-status { margin: 0; font-size: 13.5px; font-weight: 600; }
.cq-ai-status:empty { display: none; }
.cq-ai-list { display: grid; gap: 6px; }
.cq-ai-item { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; }
.cq-ai-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cq-ai-item-head small { color: var(--text-dim); }
.cq-ai-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cq-ai-preview { margin: 8px 0 0; padding-inline-start: 20px; font-size: 13.5px; display: grid; gap: 4px; max-height: 320px; overflow-y: auto; }
.cq-ai-preview small { color: var(--text-dim); }

/* მიღწევები */
.cq-achievements { padding: 16px; }
.cq-achievements h2 { margin: 0 0 10px; font-size: 22px; }
.cq-ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 8px; }
.cq-ach { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 8px; border-radius: 12px; background: var(--surface-2); filter: grayscale(1); opacity: .55; }
.cq-ach.got { filter: none; opacity: 1; background: #fff4d9; border: 1px solid var(--accent); }
.cq-ach-emoji { font-size: 26px; line-height: 1.1; }
.cq-ach strong { font-size: 13.5px; }
.cq-ach small { font-size: 11.5px; color: var(--text-dim); }
.cq-new-ach { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.cq-new-ach > strong { width: 100%; color: var(--accent-text); }
.cq-new-ach .cq-ach { flex-direction: row; padding: 6px 10px; animation: cq-pop .3s ease-out; }

@media (max-width: 640px) {
  .cq-ai-form { flex-direction: column; }
  .cq-zoom-btn { width: 38px; height: 38px; }
}
/* მაღალი რუკა (ევროპა) დესკტოპზე ეკრანს არ უნდა გასცდეს */
@media (min-width: 641px) { .cq-map.map-europe { max-height: 70vh; } }

/* ჯარისკაცები მხარეებზე (ვაჟი და ქალი) — მფლობელის ფერში */
.cq-soldiers { display: none; }
.cq-soldiers.show { display: inline; animation: cq-march .45s ease-out; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes cq-march { from { transform: scale(.2); opacity: 0; } }
.cq-sol { stroke: #2b2118; stroke-width: 1.1; stroke-linejoin: round; stroke-linecap: round; }
.cq-sol-m { transform: translate(-12px, -10px); }
.cq-sol-f { transform: translate(12px, -10px); }
.cq-soldiers.beside-castle .cq-sol-m { transform: translate(-32px, -8px); }
.cq-soldiers.beside-castle .cq-sol-f { transform: translate(32px, -8px); }
.cq-soldiers.p0 .cq-uni { fill: var(--p0); }
.cq-soldiers.p1 .cq-uni { fill: var(--p1); }
.cq-soldiers.p2 .cq-uni { fill: var(--p2); }
.cq-skin { fill: #f2cfaa; }
.cq-boot { fill: #3a2c1c; stroke: none; }
.cq-belt { stroke: #f4d9a8; stroke-width: 1.4; fill: none; }
.cq-spear, .cq-bow { fill: none; stroke: #6b4a2b; stroke-width: 1.6; }
.cq-string { stroke: #d9cbb4; stroke-width: .7; fill: none; }
.cq-tip { fill: #b9c2c9; }
.cq-crest { stroke: #c4362c; stroke-width: 2.2; }
.cq-hair { fill: none; stroke: #5a3a1e; stroke-width: 2.4; }
/* ჯარისკაცების თავზე სახელი წაკითხვადი რჩება */
.cq-label .cq-name, .cq-label .cq-value { position: relative; }
.cq-continues { font-weight: 800; color: var(--danger); }

/* Engraved atlas and fortress identity. */
.cq-body { --p0:#65507f; --p0-l:#e2daed; --p1:#ae7a20; --p1-l:#f1dfae; --p2:#276b73; --p2-l:#c7e3e0; --land:#f1e6ce; --sea:#d9e5df; --primary:#342743; --primary-dark:#231e3a; --primary-light:#ede7f1; }
.cq-hero { position:relative; min-height:270px; text-align:left; padding:42px 45% 32px 28px; overflow:hidden; border-radius:22px; background:#f8f3e9; border:1px solid #dacdb4; }
.cq-hero-art { position:absolute; right:0; top:0; width:48%; height:100%; object-fit:cover; mask-image:linear-gradient(to right,transparent,#000 20%); }
.cq-hero h1 { font-size:clamp(28px,4vw,42px); }
.cq-hero p { font-size:14px; line-height:1.7; }
.cq-game { max-width:1160px; gap:14px; }
.cq-topbar { padding:10px 14px; background:#fffdf7; border:1px solid #ddd2bc; border-radius:14px; }
.cq-player { border-top-width:3px; border-radius:16px; padding:12px; box-shadow:0 3px 12px #33283d08; }
.cq-player .game-avatar { border:2px solid var(--pc); border-radius:12px; }
.cq-player.active { box-shadow:0 0 0 2px var(--pc),0 6px 20px #33283d18; }
.cq-player-score b { font-size:23px; color:var(--pc); }
.cq-board { border:4px solid #c7b488; border-radius:20px; box-shadow:0 10px 30px #4434231a,inset 0 0 0 1px #fffc; }
.cq-map-wrap { background:radial-gradient(ellipse at center,#eef1df,var(--sea)); }
.cq-region { stroke:#92805c; stroke-width:1.2; filter:drop-shadow(0 2px 1px #51412c25); }
.cq-region.pickable { stroke:#79602e; stroke-width:2.5; animation:cq-pulse 2s ease-in-out infinite; }
.cq-region.pickable:not(.own) { fill:#f7ebc8; }
.cq-region.selected { stroke:#231e3a; stroke-width:4; stroke-dasharray:none; animation:none; filter:brightness(1.07) drop-shadow(0 0 5px #d3a548); }
.cq-region:focus-visible { outline:none; stroke:#231e3a; stroke-width:4; }
.cq-name { fill:#342d26; stroke:#fffcf1; font-size:14px; stroke-width:4px; }
.cq-castle { fill:#e4d5b7!important; stroke:#665339; filter:drop-shadow(0 2px 1px #30271750); }
.cq-flag-pole { fill:none; stroke:#665339; }
.cq-castle.p0 .cq-flag,.cq-castle.p0 .cq-roof { fill:var(--p0); }
.cq-castle.p1 .cq-flag,.cq-castle.p1 .cq-roof { fill:var(--p1); }
.cq-castle.p2 .cq-flag,.cq-castle.p2 .cq-roof { fill:var(--p2); }
.cq-castle .cq-roof { stroke-width:1; }
.cq-map-hint { margin:0; padding:8px 14px; font-size:11px; color:#71644e; background:#f4ebd7; }
.cq-selection { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px; background:#fff9e9; border-top:1px solid #dcc591; }
.cq-selection[hidden] { display:none; }
.cq-selection>div { display:grid; gap:4px; }
.cq-selection span { font-size:12px; color:var(--text-dim); }
.cq-selection .btn { min-height:44px; }
.cq-picklist { background:#f5eddb; border-color:#ddcfae; gap:8px; }
.cq-pick-btn { border-width:1px; padding:9px 14px; min-height:44px; }
.cq-card { background:#fffdf7; border:1px solid #ddcfb4; border-radius:18px; padding:24px; }
.cq-q { line-height:1.65; }
.cq-option { border-width:1px; min-height:52px; background:#faf7ef; }
.cq-zoom-btn { width:42px; height:42px; border-color:#c6b78f; }
@media(max-width:640px) {
 .cq-hero { padding:22px; padding-top:180px; }
 .cq-hero-art { width:100%; height:165px; mask-image:linear-gradient(to bottom,#000 75%,transparent); }
 .cq-players { gap:6px; } .cq-player { padding:8px 4px; }
 .cq-player .game-avatar { display:block; width:28px; height:28px; }
 .cq-player-score b { font-size:18px; }
 .cq-board { border-width:2px; border-radius:14px; }
 .cq-name { font-size:19px; }
 .cq-selection { align-items:stretch; flex-direction:column; }
 .cq-card { padding:18px; }
 .cq-map-hint { font-size:10px; }
}
@media(prefers-reduced-motion:reduce) { .cq-body * { animation:none!important; transition:none!important; } }

.cq-flag { transition:fill .4s; }
.cq-label.cq-captured .cq-castle,.cq-label.cq-captured .cq-soldiers { animation:cq-capture .8s ease-out; transform-box:fill-box; transform-origin:center; }
@keyframes cq-capture { 30% { filter:drop-shadow(0 0 8px #e5b950); opacity:.65; } }
@media(max-width:640px) { .cq-zoom { top:8px; bottom:auto; } }
/* Raised tabletop terrain and sculpted miniatures. */
.cq-depth,.cq-terrain { pointer-events:none; }
.cq-depth { filter:drop-shadow(0 5px 4px #3b352940); }
.cq-region { stroke:#fff1c4; stroke-width:1.6; filter:drop-shadow(0 -1px 0 #fff6da); }
.cq-region.own.p0 { fill:#b6a4c6; } .cq-region.own.p1 { fill:#e8cc84; } .cq-region.own.p2 { fill:#83b3ac; }
.cq-map.map-world .cq-region,.cq-map.map-europe .cq-region { stroke-width:.8; }
.cq-region.selected,.cq-region:focus-visible { stroke:#231e3a; stroke-width:4; }
.cq-terrain { opacity:.65; }
.cq-castle { stroke:#665339; stroke-width:.7; }
.cq-stone,.cq-keep { fill:url(#cq-stone-light); }
.cq-stone-side { fill:#9c8864; }
.cq-plinth { fill:#d9c9a4; }
.cq-mini-shadow { fill:#30281d; opacity:.22; stroke:none; }
.cq-masonry { fill:none; stroke:#8d7957; stroke-width:.5; opacity:.65; }
.cq-window { fill:none; stroke:#4f4738; stroke-width:1.4; }
.cq-emblem { fill:none; stroke:#f7e1a1; stroke-width:1; }
.cq-tower.down { opacity:.3; filter:grayscale(1); }
.cq-sol { stroke:#584a37; stroke-width:.65; }
.cq-sol-m { transform:translate(-14px,-13px); }
.cq-sol-f { transform:translate(14px,-13px); }
.cq-soldiers.beside-castle .cq-sol-m { transform:translate(-38px,-8px); }
.cq-soldiers.beside-castle .cq-sol-f { transform:translate(38px,-8px); }
.cq-mail,.cq-helmet { fill:#a8aaa1; }
.cq-metal-light { stroke:#eeeedf; fill:none; }
.cq-fold { stroke:#fff3; stroke-width:.7; fill:none; }
.cq-soldiers { filter:drop-shadow(1px 2px 1px #33281a35); }
.cq-label .cq-name { stroke:#fff8e8; }
@media(max-width:640px) { .cq-terrain { opacity:.4; } }
/* Detailed diorama surface, kept separate from interactive geographic geometry. */
.cq-terrain { opacity:.85; mix-blend-mode:multiply; }
.cq-relief-borders { pointer-events:none; fill:none; stroke:#ead49b; stroke-width:1.3; stroke-linejoin:round; }
.cq-map.map-world .cq-relief-borders { stroke-width:.6; }
.cq-depth { filter:drop-shadow(0 7px 5px #3b352955); }
.cq-region { fill:#e7d6ae; }
.cq-region.own.p0 { fill:#aa91c5; } .cq-region.own.p1 { fill:#efc566; } .cq-region.own.p2 { fill:#69b4ad; }
.cq-region.conquered.p0 { fill:#9573b3; } .cq-region.conquered.p1 { fill:#e4b342; } .cq-region.conquered.p2 { fill:#50a59c; }
.cq-castle { filter:drop-shadow(1px 3px 2px #30271765); }
.cq-strength .cq-tower { fill:#f4d075; stroke:#574528; stroke-width:.7; }
.cq-strength .cq-tower.down { fill:#544d43; opacity:.45; stroke-dasharray:none; }
.cq-soldiers.beside-castle .cq-troop-image { transform:translate(-44px,5px); }
.cq-soldiers.p1 .cq-troop-image { filter:hue-rotate(130deg); }
.cq-soldiers.p2 .cq-troop-image { filter:hue-rotate(-80deg); }
.cq-name { stroke-width:5px; font-weight:800; fill:#28231b; }
@media(max-width:640px) { .cq-terrain { opacity:.72; } .cq-name { stroke-width:6px; } }
/* Keep touch selection feedback and its confirmation visible while viewing the map. */
.cq-subject-select { width:100%; min-height:48px; max-width:520px; }
.cq-pick-btn { min-height:44px; touch-action:manipulation; }
.cq-pick-btn.selected { outline:3px solid #5c4281; outline-offset:1px; background:#ece4f5; }
.cq-selection .btn { min-height:48px; touch-action:manipulation; }
@media(max-width:640px) {
 .cq-selection:not([hidden]) { position:fixed; z-index:90; left:12px; right:12px; bottom:max(12px,env(safe-area-inset-bottom)); margin:0; padding:14px; flex-direction:row; align-items:center; box-shadow:0 8px 35px #231e3a40; background:#fffaf0; border:2px solid #6b4b89; border-radius:18px; gap:12px; }
 .cq-selection:not([hidden])>div { min-width:0; }
 .cq-selection strong { font-size:15px; }
 .cq-selection .btn { flex-shrink:0; max-width:48%; white-space:normal; }
 .cq-game:has(.cq-selection:not([hidden])) { padding-bottom:100px; }
}
.cq-selection-outline { fill:none; stroke:#5c4281; stroke-width:7; stroke-linejoin:round; pointer-events:none; filter:drop-shadow(0 0 3px #fff4cf); }
.cq-region:focus { outline:none; }
.cq-view-mode { font-size:13px; font-weight:700; color:#5c4281; }
.cq-spectator-mode { border:2px solid #c7b5dc; }
.cq-spectator-question .cq-option { cursor:default; }
@media(max-width:640px) { .cq-topbar { flex-wrap:wrap; } .cq-view-mode { width:100%; order:-1; } }

/* The historic plate retains its proportions and engraved details. */
.cq-map.map-ancient {aspect-ratio:1500 / 1026; min-height:0; background:#d4c4a0; border-radius:12px;}
.map-ancient .cq-depth,.map-ancient .cq-terrain,.map-ancient .cq-relief-borders {display:none;}
.map-ancient .cq-region {fill:#d3b470;fill-opacity:.16;stroke:#71583d;stroke-width:1.8;filter:none;}
.map-ancient .cq-region.own {fill-opacity:.48;}
.map-ancient .cq-region.pickable,.map-ancient .cq-region.selected {fill-opacity:.65;stroke:#fff0b3;stroke-width:4;}
.map-ancient .cq-name {fill:#241c17;stroke:#f4e7c9;stroke-width:5;paint-order:stroke;font-weight:800;}
.map-ancient .cq-value {fill:#34281b;stroke:#f4e7c9;stroke-width:3;paint-order:stroke;}
.cq-atlas-note {padding:12px 18px;margin:0;color:var(--text-muted);font-size:.85rem;}
@media(max-width:600px){.map-ancient .cq-name {font-size:21px;}.cq-atlas-note {font-size:.75rem;padding:8px 12px;}}

/* One-screen arena: the SVG contains its map without stretching. */
body.cq-playing {height:100dvh;overflow:hidden;}
.cq-playing #app-header {display:none;}
.cq-playing .cq-page {height:100dvh;width:100%;max-width:none;padding:8px;margin:0;}
.cq-playing #root {height:100%;}
.cq-playing .cq-game {height:100%;display:grid;grid-template-rows:auto auto minmax(0,1fr);gap:6px;}
.cq-playing .cq-players {margin:0;}
.cq-playing .cq-player {padding:6px 10px;}
.cq-playing .cq-board {min-height:0;display:flex;flex-direction:column;}
.cq-playing .cq-map-wrap {min-height:0;flex:1;overflow:hidden;}
.cq-playing .cq-map {height:100%;width:100%;min-height:0;aspect-ratio:auto;}
.cq-playing .cq-atlas-note,.cq-playing .cq-map-hint {display:none;}
.cq-playing .cq-picklist {margin:0;padding:4px 8px;display:flex;flex-wrap:nowrap;overflow-x:auto;flex-shrink:0;max-height:44px;}
.cq-playing .cq-picklist[hidden],.cq-playing .cq-selection[hidden] {display:none;}
.cq-playing .cq-pick-btn {white-space:nowrap;flex-shrink:0;}
.cq-playing .cq-selection {flex-shrink:0;margin:0;padding:6px 12px;}
.cq-playing .cq-overlay {overflow:auto;padding:12px;}
.cq-region.walled {stroke:#efe1a7;stroke-width:5;stroke-dasharray:7 3;}
@media(max-width:600px){.cq-playing .cq-page{padding:4px;}.cq-playing .cq-topbar{padding:5px;gap:4px;}.cq-playing .cq-topbar .cq-view-mode{display:none;}.cq-playing .cq-topbar button{font-size:11px;padding:5px;}.cq-playing .cq-player{padding:5px;}.cq-playing .cq-players{gap:4px;}.cq-playing .cq-player-name{font-size:12px;}.cq-playing .cq-banner{font-size:12px;max-width:calc(100% - 90px);}.cq-playing .cq-selection{font-size:12px;padding:4px 8px;}.cq-playing .cq-selection button{font-size:12px;}.cq-playing .cq-overlay{padding:6px;}}

.map-mercator .cq-depth,.map-mercator .cq-terrain,.map-mercator .cq-relief-borders{display:none;}
.map-mercator .cq-region{fill:#edc26b;fill-opacity:.08;stroke:#815f35;stroke-width:.8;filter:none;}
.map-mercator .cq-region.own{fill-opacity:.6;}
.map-mercator .cq-region.pickable{fill-opacity:.55;stroke:#fff2ad;stroke-width:2;}
.map-mercator .cq-name{fill:#201b16;stroke:#fae8b8;stroke-width:3;paint-order:stroke;}
.map-mercator .cq-value{fill:#211b18;stroke:#fae8b8;stroke-width:2;paint-order:stroke;}
.map-mercator .cq-region.walled{stroke:#fff4b8;stroke-width:3;stroke-dasharray:4 2;}

.cq-playing .cq-log,.cq-playing .cq-reactions{display:none;}
.cq-playing .cq-overlay{position:absolute;inset:0;background:#18202d55;align-items:center;justify-content:center;}
.cq-playing .cq-card{max-height:100%;overflow-y:auto;margin:0;}

.cq-playing .cq-map-wrap:has(.map-mercator){background:#073d4a;}
@media(max-height:500px){.cq-playing .cq-player .cq-player-info span{display:none;}.cq-playing .cq-player{padding:3px 8px;}.cq-playing .cq-player-score b{font-size:16px;}.cq-playing .cq-topbar{padding:3px 8px;}.cq-playing .cq-avatar{width:28px;height:28px;}}

.cq-playing .cq-game{width:100%;max-width:none;margin:0;}
