/* ========= PATRIOTUS · Azərbaycan — vizual tema ========= */
:root {
  --sea-1: #12454f;
  --sea-2: #0a2f38;
  --parch-1: #f3e6c4;
  --parch-2: #e0c99a;
  --ink: #2b2118;
  --gold: #c9a227;
  --gold-light: #f2d688;
  --red: #b8434e;
  --panel: rgba(20, 42, 48, 0.92);
  --panel-line: rgba(242, 214, 136, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Georgia, 'Times New Roman', serif;
  background:
    radial-gradient(1200px 700px at 70% -10%, #1d5f6e55, transparent),
    linear-gradient(160deg, var(--sea-1), var(--sea-2) 70%);
  color: var(--parch-1);
  overflow: hidden;
  user-select: none;
}
.hidden { display: none !important; }
.dim { opacity: 0.75; }
.small { font-size: 12px; }
.spacer { flex: 1; }

.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
#app { position: fixed; inset: 0; }

/* ---------- düymələr ---------- */
.btn {
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0.4px;
  color: var(--parch-1);
  background: linear-gradient(180deg, #2a5a66, #173f49);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: 0 3px 10px #0006, inset 0 1px 0 #ffffff22;
  transition: transform 0.12s, filter 0.15s, box-shadow 0.15s;
}
.btn:hover { filter: brightness(1.18); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.gold {
  background: linear-gradient(180deg, #e8c25a, #a87f16);
  color: #241a05;
  font-weight: bold;
  border-color: #f7e3a1;
  text-shadow: 0 1px 0 #ffe9a866;
}
.btn.big { font-size: 19px; padding: 14px 30px; border-radius: 14px; width: 300px; }
.btn.icon { padding: 7px 10px; border-radius: 9px; }
.btn.ghost { background: transparent; border-color: #ffffff33; }

.inp {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--parch-1), var(--parch-2));
  border: 1px solid #00000055;
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
  width: 100%;
}
.inp:focus { box-shadow: 0 0 0 3px #c9a22755; }
.code-inp { text-transform: uppercase; letter-spacing: 6px; font-weight: bold; text-align: center; }

/* ---------- ana menyu ---------- */
.menu-wrap { display: flex; flex-direction: column; align-items: center; gap: 26px; animation: rise 0.7s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
.title-card {
  text-align: center;
  padding: 34px 60px 28px;
  background:
    radial-gradient(ellipse at 50% 0%, #fff8e055, transparent 70%),
    linear-gradient(175deg, var(--parch-1), var(--parch-2));
  color: var(--ink);
  border-radius: 6px;
  border: 2px solid #8a6d2f;
  box-shadow: 0 14px 40px #000a, inset 0 0 60px #a8823c33;
  position: relative;
}
.title-ribbon {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(-1.2deg);
  background: linear-gradient(180deg, #8c2f39, #6d1f28);
  color: var(--gold-light);
  font-size: 12px; letter-spacing: 3px;
  padding: 6px 22px; border-radius: 4px;
  box-shadow: 0 4px 10px #0007;
}
.game-title {
  font-size: 64px; letter-spacing: 10px; line-height: 1;
  color: #6d1f28;
  text-shadow: 0 2px 0 #f7e3a1, 0 5px 14px #00000044;
}
.tagline { margin-top: 10px; font-style: italic; font-size: 17px; color: #4a3a22; }
.menu-map-hint { margin-top: 12px; font-size: 12px; letter-spacing: 2px; color: #7a6437; }
.menu-buttons { display: flex; flex-direction: column; gap: 12px; }
.menu-foot { display: flex; align-items: center; gap: 14px; opacity: 0.85; }
.ver { font-size: 12px; letter-spacing: 1px; }

/* ---------- lobbi ---------- */
.lobby-wrap {
  width: min(560px, 92vw); max-height: 86vh; max-height: 86dvh; overflow: auto;
  padding: 26px 30px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 16px;
  box-shadow: 0 18px 50px #000a;
  animation: rise 0.4s ease;
}
.lobby-wrap h2 { color: var(--gold-light); letter-spacing: 2px; margin-bottom: 12px; font-size: 26px; }
.slot-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.slot-row {
  display: flex; align-items: center; gap: 10px;
  background: #ffffff10; border: 1px solid #ffffff14;
  padding: 8px 10px; border-radius: 10px;
}
.slot-name { flex: 1; font-size: 16px; }
.pdot { width: 16px; height: 16px; border-radius: 50%; flex: none; box-shadow: 0 0 8px #0008 inset; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--parch-1); cursor: pointer; }
.chk input { accent-color: var(--gold); width: 16px; height: 16px; }
.lvl-sel {
  width: auto; min-width: 112px; padding: 5px 8px; font-size: 13px;
  border-radius: 8px; cursor: pointer;
}
.lvl-sel option { background: var(--parch-1); color: var(--ink); }
.lobby-btns { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.fld { display: block; margin: 12px 0; font-size: 14px; color: var(--gold-light); }
.fld .inp { margin-top: 6px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: #ffffff66; font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #ffffff22; }
.room-code {
  text-align: center; font-size: 18px; padding: 12px;
  background: #00000044; border: 1px dashed var(--gold);
  border-radius: 10px; letter-spacing: 2px;
}
.room-code b { font-size: 30px; color: var(--gold-light); letter-spacing: 8px; margin-left: 8px; }
.tag-ai, .tag-you {
  font-style: normal; font-size: 10px; letter-spacing: 1px;
  background: #ffffff22; border-radius: 4px; padding: 2px 5px; vertical-align: middle;
}
.tag-you { background: var(--gold); color: #241a05; font-weight: bold; }

/* ---------- oyun ekranı ---------- */
#screen-game { flex-direction: column; align-items: stretch; }
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px;
  background: linear-gradient(180deg, #0d333c, #0a2a32);
  border-bottom: 1px solid var(--panel-line);
  box-shadow: 0 4px 16px #0008;
  z-index: 5;
}
#game-title-small { font-size: 18px; letter-spacing: 3px; color: var(--gold-light); }
#topbar-btns { display: flex; gap: 8px; }

#game-layout { flex: 1; display: flex; min-height: 0; }
#board-wrap { flex: 1; position: relative; min-width: 0; }
#board { width: 100%; height: 100%; display: block; }

/* hüceyrələr */
.cell {
  stroke-width: 1.6;
  cursor: pointer;
  transition: fill 0.5s, filter 0.2s;
  transform-box: fill-box; transform-origin: center;
}
.cell:hover { filter: brightness(1.22) saturate(1.1); }
.cell.neutral { filter: saturate(0.7); }
.cell.sel {
  stroke: #fff !important; stroke-width: 2.6;
  stroke-dasharray: 7 5;
  animation: dashmove 1s linear infinite;
  filter: brightness(1.25);
}
@keyframes dashmove { to { stroke-dashoffset: -24; } }
.cell.target { animation: targetpulse 1.1s ease-in-out infinite; cursor: crosshair; }
@keyframes targetpulse {
  0%, 100% { filter: brightness(1.05); }
  50% { filter: brightness(1.5) drop-shadow(0 0 6px #ff5544); }
}
.cell.placeable { animation: placepulse 1.6s ease-in-out infinite; }
@keyframes placepulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.28) drop-shadow(0 0 5px #ffe9a8); }
}
.cell.shake { animation: shake 0.5s; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, -2px); }
  80% { transform: translate(2px, 2px); }
}

.waves .wave { fill: none; stroke: #bfe8ee; stroke-width: 2; animation: drift 14s linear infinite; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(120px); } }

.sealink { fill: none; stroke: #f2d68899; stroke-width: 2; stroke-dasharray: 6 6; animation: dashmove 2s linear infinite; }

/* dəniz dekorasiyaları */
.sea-label {
  font-family: Georgia, serif; font-size: 21px; letter-spacing: 4px;
  fill: #bfe8ee; opacity: 0.4; font-style: italic;
}
.cart-box { fill: #f3e6c4; stroke: #8a6d2f; stroke-width: 2; opacity: 0.92; }
.cart-title {
  font-family: Georgia, serif; font-size: 17px; font-weight: bold;
  fill: #6d1f28; letter-spacing: 4px;
}
.cart-sub { font-family: Georgia, serif; font-size: 11px; fill: #7a6437; letter-spacing: 3px; }
.cartouche { filter: drop-shadow(0 3px 6px #0008); }
.comp-ring { fill: #f3e6c422; stroke: #f2d68866; stroke-width: 1.5; }
.comp-needle { fill: #b8434ecc; }
.comp-needle2 { fill: #f3e6c488; }
.comp-n { font-size: 12px; fill: #f2d688aa; font-family: Georgia, serif; }
.compass { opacity: 0.75; }

.tname {
  font-size: 10.5px; font-family: Georgia, serif;
  fill: #fff; paint-order: stroke; stroke: #00000088; stroke-width: 2.4px;
  letter-spacing: 0.3px; pointer-events: none;
}
.badge-c { fill: url(#badgeGrad); fill: #f3e6c4; stroke: #2b2118; stroke-width: 1.4; }
.badge-n { font-size: 12px; font-weight: bold; fill: #2b2118; font-family: Georgia, serif; }
.badge { transition: opacity 0.3s; }

.atk-line { fill: none; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 200; opacity: 0.9; filter: drop-shadow(0 0 4px #000); }
.fort-line { fill: none; stroke-width: 3; stroke-dasharray: 5 7; stroke-linecap: round; animation: dashmove 1s linear infinite; opacity: 0.85; }
.flash { pointer-events: none; }

/* banner & toast */
#turn-banner {
  position: absolute; top: 12%; left: 50%; transform: translateX(-50%);
  pointer-events: none; font-size: 30px; letter-spacing: 3px; white-space: nowrap;
  opacity: 0;
}
#turn-banner.show { animation: bannerin 2.6s ease; }
@keyframes bannerin {
  0% { opacity: 0; transform: translateX(-50%) scale(0.7); }
  12% { opacity: 1; transform: translateX(-50%) scale(1.05); }
  20% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
#toast {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #6d1f28ee; color: var(--gold-light);
  padding: 9px 18px; border-radius: 10px; font-size: 14px;
  border: 1px solid #f2d68855; box-shadow: 0 6px 18px #000a;
  opacity: 0; transition: all 0.25s; pointer-events: none; max-width: 80%;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* yan panel */
#sidepanel {
  width: 300px; flex: none;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px;
  background: var(--panel);
  border-left: 1px solid var(--panel-line);
  overflow: hidden;
}
.side-block h3 {
  font-size: 12px; letter-spacing: 2px; color: var(--gold);
  border-bottom: 1px solid var(--panel-line); padding-bottom: 4px; margin-bottom: 6px;
}
.side-block.grow { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#players-box { display: flex; flex-direction: column; gap: 6px; }
.prow {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px 7px 13px; border-radius: 9px; font-size: 13px;
  background: linear-gradient(180deg, #ffffff0d, #ffffff05);
  border: 1px solid #ffffff12;
}
.prow .pbar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.prow.active {
  background: linear-gradient(90deg, #c9a22733, #c9a22711);
  border-color: var(--gold); box-shadow: 0 0 12px #c9a22733;
}
.prow.active::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, #ffffff22 50%, transparent 70%);
  animation: shine 2.4s linear infinite;
}
@keyframes shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.prow.dead { opacity: 0.4; filter: grayscale(0.8); text-decoration: line-through; }
.prow.dc .pname { color: #9aa3b2; }
.tag-dc {
  font-style: normal; font-size: 11px; vertical-align: middle;
  filter: grayscale(1); opacity: 0.9;
}
.pname { flex: 1; }
.pstats { display: flex; gap: 4px; }
.pstat {
  font-size: 10.5px; background: #ffffff14; border: 1px solid #ffffff14;
  border-radius: 5px; padding: 2px 5px; white-space: nowrap;
}
.pstat b { color: var(--gold-light); }
#cont-box { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 12px; }
.cont-line {
  display: flex; justify-content: space-between; align-items: center;
  background: #ffffff08; border-radius: 5px; padding: 3px 7px;
}
.cont-line span { display: flex; align-items: center; gap: 5px; }
.cont-line b { color: var(--gold-light); }
.c-own { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 6px #ffffff66; }
#log-box { flex: 1; overflow-y: auto; font-size: 12px; display: flex; flex-direction: column; gap: 3px; padding-right: 4px; }
.logline {
  opacity: 0.9; border-left: 2px solid #ffffff22; padding: 2px 6px;
  border-radius: 0 4px 4px 0; background: #ffffff05;
}
.logline.lh { color: var(--gold-light); font-weight: bold; border-left-color: var(--gold); background: #c9a22714; margin-top: 4px; }
.logline.lc { border-left-color: #e0a53a; }
.logline.lk { border-left-color: #9d7bd8; }
.logline.lm { border-left-color: #5fb3a1; }
.logline.lb { border-left-color: #d0876a; }
.logline.ld { border-left-color: #b8434e; color: #ff9d9d; }
#log-box::-webkit-scrollbar { width: 6px; }
#log-box::-webkit-scrollbar-thumb { background: #ffffff33; border-radius: 3px; }

#action-bar {
  border-top: 1px solid var(--panel-line); padding-top: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.phase-info { font-size: 14px; color: var(--parch-1); }
.phase-info b { color: var(--gold-light); }
.phase-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.wait { font-size: 13px; font-style: italic; opacity: 0.7; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

/* ---------- modallar ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: #000a; backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  animation: fadein 0.2s;
}
@keyframes fadein { from { opacity: 0; } }
.modal {
  width: min(480px, 92vw); max-height: 84vh; max-height: 84dvh; overflow: auto;
  background: linear-gradient(175deg, var(--parch-1), var(--parch-2));
  color: var(--ink);
  border-radius: 14px; border: 2px solid #8a6d2f;
  box-shadow: 0 20px 60px #000c;
  animation: pop 0.25s cubic-bezier(.2, 1.4, .5, 1);
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid #8a6d2f55;
}
.modal-head h3 { color: #6d1f28; letter-spacing: 1px; }
.modal-x { background: none; border: none; font-size: 18px; cursor: pointer; color: #6d1f28; }
.modal-body { padding: 16px 18px; }
.modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.modal .btn { background: linear-gradient(180deg, #4a707c, #2a505b); }
.modal .btn.gold { background: linear-gradient(180deg, #e8c25a, #a87f16); }

.rules h4 { margin: 12px 0 4px; color: #6d1f28; }
.rules p { font-size: 14px; line-height: 1.5; }

/* səs parametrləri */
.set-row { display: flex; align-items: center; gap: 12px; margin: 14px 0; font-size: 14px; color: #4a3520; }
.set-row span { flex: 0 0 128px; color: #4a3520; }
.set-row input[type="range"] { flex: 1; accent-color: #a87f16; height: 22px; cursor: pointer; }
.set-row b { flex: 0 0 42px; text-align: right; color: #6d1f28; font-size: 13px; }
.set-music-on { margin: 6px 0 2px; color: #4a3520; }

/* kartlar */
.card-hand { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 6px 2px; }
.gcard {
  position: relative; width: 104px; height: 142px; padding: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-align: center;
  background: linear-gradient(170deg, #fff8e0, #e6cf9e);
  border: 2px solid #8a6d2f; border-radius: 10px; cursor: pointer;
  box-shadow: 0 4px 10px #0005, inset 0 0 0 3px #fff8e0, inset 0 0 0 4px #8a6d2f55;
  transition: transform 0.16s, box-shadow 0.16s;
  animation: dealin 0.35s cubic-bezier(.2, 1.3, .5, 1) both;
}
@keyframes dealin { from { transform: translateY(26px) rotate(4deg); opacity: 0; } }
.gcard:hover {
  transform: translateY(-5px) rotate(-1deg);
  box-shadow: 0 10px 20px #0006, inset 0 0 0 3px #fff8e0, inset 0 0 0 4px #8a6d2f55;
}
.gcard.picked {
  border-color: #6d1f28; transform: translateY(-6px);
  box-shadow: 0 0 0 3px #b8434e66, 0 10px 22px #0007, inset 0 0 0 3px #fff8e0, inset 0 0 0 4px #6d1f2855;
}
.gcard-corner { position: absolute; font-size: 13px; opacity: 0.85; }
.gcard-corner.tl { top: 5px; left: 7px; }
.gcard-corner.br { bottom: 5px; right: 7px; transform: rotate(180deg); }
.gcard-sym { font-size: 38px; filter: drop-shadow(0 2px 2px #0004); }
.gcard-name {
  font-size: 12.5px; font-weight: bold; color: #3a2a1a; margin-top: 4px;
  background: #ffffff55; border-radius: 5px; padding: 2px 6px; max-width: 92px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gcard-symname { font-size: 10px; letter-spacing: 1px; color: #7a6437; text-transform: uppercase; }
.gcard-check {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
  background: #6d1f28; color: #f2d688; font-size: 12px;
  display: none; align-items: center; justify-content: center; box-shadow: 0 2px 6px #0008;
}
.gcard.picked .gcard-check { display: flex; animation: pop 0.2s; }
.cards-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.cards-pick {
  font-weight: bold; color: #6d1f28; background: #ffffff66;
  border: 1px dashed #8a6d2f88; border-radius: 6px; padding: 3px 10px; font-size: 13px;
}
.cards-pick.full { background: #6d1f28; color: #f2d688; border-style: solid; }
.cards-empty { text-align: center; padding: 18px 0; font-size: 15px; line-height: 1.6; }

/* zər */
.dice-overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 60;
  background: radial-gradient(640px 360px at 50% 50%, #00000066, transparent 75%);
}
.dice-overlay.fade { opacity: 0; transition: opacity 0.5s; }
.dice-box {
  position: relative;
  display: flex; align-items: stretch; gap: 22px;
  background: linear-gradient(180deg, #12454fee, #0a2f38f2);
  border: 1px solid var(--panel-line);
  padding: 20px 30px 16px; border-radius: 18px;
  box-shadow: 0 18px 60px #000d, inset 0 1px 0 #ffffff22;
  animation: pop 0.3s cubic-bezier(.2, 1.5, .5, 1);
}
.dice-box::before {
  content: ''; position: absolute; inset: 5px;
  border: 1px dashed #f2d68833; border-radius: 13px; pointer-events: none;
}
.dice-col { text-align: center; min-width: 128px; }
.dice-col h4 {
  font-size: 15px; margin-bottom: 10px; letter-spacing: 0.5px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.dice-col h4 i {
  font-style: normal; font-size: 9px; letter-spacing: 2px; opacity: 0.7;
  border: 1px solid currentColor; border-radius: 4px; padding: 1px 5px;
}
.dice-col.atk h4 { color: #ff9d9d; }
.dice-col.def h4 { color: #9dc4ff; }
.d-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 8px #0008; }
.dice-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 92px; }
.dice-row { display: flex; gap: 8px; justify-content: center; }
.dice-vs { font-size: 34px; color: var(--gold-light); text-shadow: 0 0 14px #c9a227aa; animation: vspulse 1s ease infinite alternate; }
@keyframes vspulse { from { transform: scale(1); } to { transform: scale(1.14); } }
.dice-result { font-size: 13px; letter-spacing: 1px; font-weight: bold; opacity: 0; white-space: nowrap; }
.dice-result.show { animation: resin 0.35s ease forwards; }
@keyframes resin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dice-result.r-atk { color: #ff9d9d; }
.dice-result.r-def { color: #9dc4ff; }
.dice-result.r-tie { color: var(--gold-light); }
.die {
  width: 52px; height: 52px; border-radius: 10px;
  background: linear-gradient(160deg, #fffdf4, #d9cbb0 70%, #c9b896);
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 7px;
  box-shadow: 0 6px 14px #000a, inset 0 -4px 8px #00000022, inset 0 2px 3px #ffffffcc;
  transition: box-shadow 0.3s, transform 0.3s, filter 0.3s;
}
.die.roll { animation: roll 0.55s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes roll {
  0% { transform: rotate(-40deg) scale(0.3) translateY(14px); opacity: 0; }
  55% { transform: rotate(180deg) scale(1.18); opacity: 1; }
  80% { transform: rotate(320deg) scale(0.94); }
  100% { transform: rotate(360deg) scale(1); }
}
.die.win { box-shadow: 0 0 0 3px #c9a22788, 0 6px 16px #000a, 0 0 18px #c9a22766; transform: translateY(-3px); }
.die.lose { filter: saturate(0.5) brightness(0.82); transform: translateY(2px); }
.pip { border-radius: 50%; margin: 2px; }
.pip.on { background: radial-gradient(circle at 35% 30%, #555, #111); box-shadow: inset 0 1px 2px #fff4; }
.dice-col.atk .pip.on { background: radial-gradient(circle at 35% 30%, #e07777, #7c1d24); box-shadow: inset 0 1px 2px #ffffff55; }
.dice-col.def .pip.on { background: radial-gradient(circle at 35% 30%, #86b3ea, #22456e); box-shadow: inset 0 1px 2px #ffffff55; }
.loss { height: 22px; margin-top: 8px; font-size: 18px; font-weight: bold; color: #ff7b7b; }
.loss.pop { animation: losspop 0.4s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes losspop { from { transform: scale(0.2); opacity: 0; } }

/* işğal modal */
.occ-route { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 2px; }
.occ-terr {
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(180deg, #fff8e0, #e6cf9e);
  border: 1.5px solid #8a6d2f; border-radius: 8px; padding: 6px 12px;
  font-weight: bold; font-size: 14px; color: #4a3520; box-shadow: 0 2px 6px #0003;
}
.occ-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 6px #0006; }
.occ-arrow { position: relative; width: 76px; height: 24px; display: flex; align-items: center; justify-content: center; }
.occ-arrow::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: repeating-linear-gradient(90deg, #8a6d2f 0 6px, transparent 6px 11px);
  animation: dashx 0.8s linear infinite;
}
@keyframes dashx { to { background-position: 11px 0; } }
.occ-arrow b {
  position: relative; font-size: 15px;
  background: linear-gradient(180deg, var(--parch-1), var(--parch-2));
  padding: 0 3px; border-radius: 4px;
  animation: march 1.4s ease-in-out infinite alternate;
}
@keyframes march { from { transform: translateX(-9px); } to { transform: translateX(9px); } }
.occ-q { text-align: center; font-size: 13px; color: #7a6437; margin: 10px 0 4px; letter-spacing: 0.5px; }
.occ-row { display: flex; align-items: center; gap: 18px; justify-content: center; margin: 10px 0 6px; }
.occ-btn {
  width: 44px; height: 44px; border-radius: 50%;
  font-size: 22px; font-weight: bold; cursor: pointer; color: #f2d688;
  background: radial-gradient(circle at 35% 30%, #3a6b78, #173f49 70%);
  border: 1px solid var(--panel-line);
  box-shadow: 0 4px 10px #0007, inset 0 1px 0 #ffffff33;
  transition: transform 0.1s, filter 0.15s;
}
.occ-btn:hover { filter: brightness(1.2); }
.occ-btn:active { transform: scale(0.92); }
.occ-numwrap { display: flex; align-items: baseline; gap: 6px; }
.occ-num {
  font-size: 44px; font-weight: bold; color: #6d1f28;
  min-width: 56px; text-align: center; text-shadow: 0 2px 0 #ffffff66;
}
.occ-num.bump { animation: bump 0.25s ease; }
@keyframes bump { 40% { transform: scale(1.25); } }
.occ-unit { font-size: 20px; opacity: 0.7; }
.occ-slider { width: 100%; accent-color: #a87f16; cursor: pointer; }
.occ-min { text-align: center; margin-top: 4px; }
.occ-ok { width: 100%; font-size: 16px; padding: 11px; }

.win-box { text-align: center; padding: 10px 0; }
.win-crown { font-size: 60px; animation: crown 1.2s ease infinite alternate; }
@keyframes crown { from { transform: translateY(0) rotate(-4deg); } to { transform: translateY(-8px) rotate(4deg); } }
.win-box h2 { margin: 8px 0; letter-spacing: 2px; }
.win-box .modal-btns { justify-content: center; }

/* ---------- responsive ---------- */
#zoom-reset {
  position: absolute; right: 10px; bottom: 10px; z-index: 6;
  display: none; font-size: 17px; padding: 8px 12px; opacity: 0.9;
}
#panel-tabs { display: none; gap: 6px; }

/* toxunuşlu cihazlar: yapışqan hover yoxdur, hədəflər böyük, lövhə jestlərlə idarə olunur */
@media (pointer: coarse) {
  #zoom-reset { display: block; }
  #board { touch-action: none; }
  .cell:hover { filter: none; }
  .btn { min-height: 40px; }
  .btn.icon { min-width: 40px; padding: 8px 10px; }
  .gcard:hover { transform: none; box-shadow: 0 4px 10px #0005, inset 0 0 0 3px #fff8e0, inset 0 0 0 4px #8a6d2f55; }
}

/* dar masaüstü */
@media (max-width: 1100px) and (min-width: 901px) {
  #sidepanel { width: 264px; }
}

/* planşet: yan-yana, dar panel */
@media (max-width: 900px) and (min-width: 561px) {
  #sidepanel { width: 230px; padding: 10px; }
  .prow { font-size: 12px; padding: 6px 7px 6px 11px; }
  .pstats { display: none; }
  .game-title { font-size: 44px; letter-spacing: 7px; }
}

/* telefon */
@media (max-width: 560px) {
  /* üst zolaq */
  #topbar { padding: 6px 10px; padding-top: calc(6px + env(safe-area-inset-top)); }
  #game-title-small { font-size: 13px; letter-spacing: 1px; }
  #gt-sub { display: none; }
  #topbar-btns { gap: 5px; }

  /* oyun düzümü: xəritə üstə, panel altda (tablarla) */
  #game-layout { flex-direction: column; }
  #board-wrap { flex: 1 1 auto; min-height: 0; }
  #sidepanel {
    width: 100%; flex: none; height: 40vh; height: 40dvh;
    border-left: none; border-top: 1px solid var(--panel-line);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 6px;
  }
  #panel-tabs { display: flex; }
  #panel-tabs .btn { flex: 1; padding: 8px 4px; font-size: 12.5px; min-height: 38px; }
  #panel-tabs .btn.on {
    background: linear-gradient(180deg, #e8c25a, #a87f16);
    color: #241a05; font-weight: bold; border-color: #f7e3a1;
  }
  #sidepanel .side-block { display: none; min-height: 0; }
  body[data-mtab="players"] #sidepanel .blk-players,
  body[data-mtab="cont"] #sidepanel .blk-cont,
  body[data-mtab="log"] #sidepanel .blk-log { display: flex; flex: 1; flex-direction: column; overflow: auto; }
  #action-bar { padding-top: 8px; }
  .phase-info { font-size: 13px; }
  .phase-btns .btn { flex: 1 1 auto; padding: 10px 8px; }

  /* ana menyu */
  .menu-wrap { gap: 20px; padding: 0 12px; }
  .title-card { padding: 26px 20px 18px; }
  .title-ribbon { font-size: 10px; letter-spacing: 2px; padding: 5px 12px; top: -11px; }
  .game-title { font-size: clamp(32px, 10.5vw, 46px); letter-spacing: 4px; }
  .tagline { font-size: 14px; }
  .menu-map-hint { font-size: 11px; letter-spacing: 1px; }
  .btn.big { width: min(300px, 86vw); font-size: 17px; padding: 13px 20px; }

  /* lobbi */
  .lobby-wrap { width: 96vw; padding: 18px 14px; }
  .lobby-wrap h2 { font-size: 22px; }
  .slot-row { flex-wrap: wrap; }
  .slot-row .name-inp { flex: 1 1 110px; width: auto; }
  .lvl-sel { min-width: 96px; }
  .lobby-btns { flex-wrap: wrap; }

  /* modallar */
  .modal { width: min(480px, 94vw); }
  .modal-body { padding: 12px 14px; }
  .modal-head { padding: 10px 14px; }
  .set-row { flex-wrap: wrap; }
  .set-row span { flex-basis: 96px; font-size: 13px; }

  /* kartlar */
  .card-hand { gap: 8px; }
  .gcard { width: 92px; height: 126px; }
  .gcard-sym { font-size: 30px; }
  .gcard-name { font-size: 11px; max-width: 80px; }

  /* zər lövhəsi */
  .dice-box { gap: 8px; padding: 14px 12px 10px; border-radius: 14px; }
  .dice-col { min-width: 74px; }
  .dice-col h4 { font-size: 12px; margin-bottom: 6px; gap: 4px; }
  .dice-mid { min-width: 48px; gap: 4px; }
  .dice-row { gap: 5px; }
  .dice-vs { font-size: 22px; }
  .die { width: 38px; height: 38px; padding: 5px; border-radius: 8px; }
  .dice-result { font-size: 11px; white-space: normal; text-align: center; }
  .loss { height: 18px; margin-top: 5px; font-size: 15px; }

  /* işğal modalı */
  .occ-route { flex-wrap: wrap; gap: 6px; }
  .occ-terr { font-size: 12px; padding: 5px 9px; }
  .occ-arrow { width: 52px; }
  .occ-num { font-size: 34px; min-width: 44px; }
  .occ-unit { font-size: 16px; }
  .occ-btn { width: 46px; height: 46px; }
  .occ-q { font-size: 12px; }

  /* banner və bildirişlər */
  #turn-banner { font-size: clamp(16px, 5.5vw, 26px); max-width: 92vw; white-space: normal; text-align: center; top: 8%; }
  #toast { max-width: 92%; font-size: 13px; bottom: 12px; }

  /* qələbə */
  .win-crown { font-size: 44px; }
  .win-box h2 { font-size: 20px; }
}

/* telefon üfüqi (landscape): panel sağda qalır */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  #game-layout { flex-direction: row; }
  #sidepanel {
    width: 240px; height: auto; flex: none;
    border-left: 1px solid var(--panel-line); border-top: none;
    padding: 8px;
  }
  #panel-tabs .btn { padding: 6px 2px; font-size: 11px; }
  .btn.big { width: min(260px, 70vw); }
}
