/* MOTİF — Türk çini teması: krem zemin, kobalt mavi, altın çerçeve.
   Portalın diğer yedi oyunu koyu; bu bilinçli olarak AÇIK tema. */

:root {
  --paper: #f3ede0;
  --paper2: #e9e0cd;
  --panel: #fffdf6;
  --line: #d6cbb2;
  --ink: #3a3226;
  --dim: #8a7d68;
  --red: #c0392b;
  --margin: #e07a6a;
  --blue: #1f5fa8;
  --good: #1f8a52;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--paper2);
  color: var(--ink);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#game { position: relative; height: 100dvh; display: flex; flex-direction: column; background: var(--paper2); }
.hidden { display: none !important; }

/* ---------- Üst çubuk ---------- */
#topbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 7px 12px;
  background: linear-gradient(180deg, #fffdf6, #f1ead8);
  border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand .logo { font-size: 20px; }
.brand .bTitle {
  font-weight: 800; letter-spacing: 3px; font-size: 15px; color: var(--ink);
}
.stats { display: flex; gap: 6px; flex: 1 1 auto; justify-content: center; flex-wrap: wrap; }
.stat {
  min-width: 62px; padding: 3px 10px;
  border: 1.5px solid var(--line); border-radius: 8px;
  background: #fffdf6; text-align: center; line-height: 1.15;
}
.stat.wide { min-width: 110px; }
.stat b { display: block; font-size: 8.5px; letter-spacing: 1.3px; color: var(--dim); font-weight: 800; }
.stat span { display: block; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tools { display: flex; gap: 6px; align-items: center; }
.tools button {
  width: 32px; height: 32px; padding: 0;
  border: 1.5px solid var(--line); border-radius: 8px;
  background: #fffdf6; color: var(--ink);
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.tools button.wideBtn { width: auto; padding: 0 12px; font-size: 12px; }
.tools button:hover { background: #fff; border-color: var(--blue); }


/* ---------- Arena ---------- */
/* Tuval MUTLAK konumlu: böylece kendi boyutu ebeveynin düzenini hiç
   etkilemez ve ResizeObserver geri besleme döngüsü oluşamaz. */
#arena { position: relative; flex: 1 1 auto; min-height: 0; touch-action: none; overflow: hidden; }
#cv { position: absolute; inset: 0; display: block; }


/* ---------- Giriş / kurulum ---------- */
#titleScreen {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(110,160,200,.22) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(90deg, rgba(110,160,200,.22) 0 1px, transparent 1px 26px);
  padding: 16px; overflow-y: auto;
}
.tBox { text-align: center; max-width: 470px; width: 100%; }
.tLogo { font-size: 52px; }
.tBox h1 {
  font-size: 40px; font-weight: 900; letter-spacing: 6px; color: var(--ink);
  text-shadow: 2px 2px 0 rgba(212,52,42,.18);
}
.tSub {
  color: var(--red); letter-spacing: 3px; font-size: 11.5px;
  font-weight: 800; text-transform: uppercase; margin-top: 2px;
}
.tClaim {
  margin-top: 12px; font-size: 12.5px; line-height: 1.6; color: var(--dim);
  border: 2px dashed var(--line); border-radius: 10px; padding: 9px 12px;
  background: rgba(255,253,246,.7);
}
.tClaim b { color: var(--ink); }
.setupH { font-size: 15px; font-weight: 800; margin-top: 18px; }
.cntLbl { font-size: 11px; color: var(--dim); font-weight: 700; margin-top: 8px; letter-spacing: 1px; }
.countRow { display: flex; gap: 5px; justify-content: center; margin-top: 6px; }
.cntBtn {
  width: 34px; height: 34px; padding: 0; font-size: 14px; font-weight: 800;
  border: 2px solid var(--line); border-radius: 9px; background: #fffdf6;
  color: var(--ink); cursor: pointer;
}
.cntBtn.on { border-color: var(--red); background: #fdeeec; color: var(--red); }


.tBtns { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* ---------- Düğmeler ---------- */
button {
  font-family: inherit; font-size: 14px; font-weight: 700;
  padding: 11px 18px; border-radius: 10px;
  border: 2px solid var(--line); background: #fffdf6; color: var(--ink);
  cursor: pointer; transition: filter .12s ease, transform .1s ease;
}
button:hover { filter: brightness(1.03); }
button:active { transform: translateY(1px); }
button.primary { border-color: var(--red); background: var(--red); color: #fff; font-weight: 800; }
button.ghost { background: transparent; color: var(--dim); border-style: dashed; }
button:disabled { opacity: .42; cursor: default; transform: none; }

/* ---------- Örtü / modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(50,42,30,.55); padding: 16px;
}
.modal {
  width: min(440px, 100%); max-height: 100%; overflow-y: auto;
  background: var(--panel); border: 2px solid var(--line); border-radius: 16px;
  padding: 20px; box-shadow: 0 16px 44px rgba(60,48,30,.35);
}
.modal h3 { font-size: 19px; font-weight: 900; text-align: center; margin-bottom: 10px; }
#modalBody { font-size: 13.5px; line-height: 1.65; color: #57503f; }
#modalBody p + p { margin-top: 7px; }
#modalBody b { color: var(--ink); }
#modalActions { display: flex; flex-direction: column; gap: 7px; margin-top: 16px; }

/* ---------- Oyun sonu ---------- */
.ovWinner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 4px 0 8px; padding: 12px 16px;
  border: 3px solid; border-radius: 14px;
  background: rgba(255,253,246,.9);
}
.ovWinner .ovCup { font-size: 30px; }
.ovWinner .ovName { font-size: 26px; font-weight: 900; letter-spacing: .5px; }
.ovLead { text-align: center; font-size: 13.5px; font-weight: 700; }
.ovLead.good { color: var(--good); }
.ovLead.dim { color: var(--dim); }
.ovSub { text-align: center; font-size: 11.5px; color: var(--dim); margin-top: 12px; letter-spacing: .5px; }
.ovRank { font-size: 11px; font-weight: 800; color: var(--dim); min-width: 18px; }
.ovRow.win { border-color: var(--good); background: #eaf7ef; }
.ovList { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.ovRow {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px; background: #f6f1e3;
  border: 1.5px solid var(--line); font-size: 13px; font-weight: 700;
}
.ovRow i { width: 11px; height: 11px; border-radius: 3px; }
.ovRow span { flex: 1 1 auto; }
.ovRow b { font-variant-numeric: tabular-nums; }
.ovRow.dead { opacity: .45; text-decoration: line-through; }

/* ---------- Bildirimler ---------- */
#toasts {
  position: fixed; left: 50%; top: 78px; transform: translateX(-50%);
  z-index: 70; display: flex; flex-direction: column; gap: 5px;
  align-items: center; pointer-events: none;
}
.toast {
  padding: 7px 15px; border-radius: 999px;
  background: rgba(255,253,246,.97); border: 2px solid var(--line);
  font-size: 12.5px; font-weight: 700; color: var(--ink);
  box-shadow: 0 3px 10px rgba(90,75,50,.18);
  animation: toastIn .2s ease-out;
}
.toast.good { border-color: var(--good); color: var(--good); }
.toast.err { border-color: var(--red); color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: none; } }

/* ---------- Küçük ekran ---------- */
@media (max-width: 640px) {
  .brand .bTitle { display: none; }
  #topbar { gap: 7px; padding: 6px 8px; }
  .stat { min-width: 50px; padding: 2px 7px; }
  .stat span { font-size: 14px; }
  .stat.wide { min-width: 86px; }
  .tools button.wideBtn { display: none; }
  .stand { font-size: 10px; padding: 2px 7px; }
  .betRow label { min-width: 0; flex: 1 1 100%; }
  .tBox h1 { font-size: 31px; letter-spacing: 4px; }
  .sName { flex: 0 0 46px; font-size: 10px; }
  .sBtn { font-size: 10px; padding: 5px 2px; }
  .slot { flex-wrap: wrap; }
  .sCountry { flex: 1 1 80px; font-size: 11px; }
  .sOpts { flex: 1 1 100%; }
}

/* ---------- Motif'e özgü ---------- */
#arena { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; touch-action: none; cursor: crosshair; }
#cv { position: absolute; inset: 0; display: block; }
#timeVal { color: var(--blue); }
#fillVal { color: var(--good); }
#actionBar { flex: 0 0 auto; display: flex; gap: 8px; justify-content: center; padding: 10px 12px 14px;
  background: linear-gradient(0deg, #f1ead8, transparent); border-top: 2px solid var(--line); }
#actionBar button { min-width: 104px; }
.guarBadge { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  font-size: 11.5px; font-weight: 800; color: #17406e; background: rgba(255,253,246,.9);
  border: 1.5px solid var(--blue); border-radius: 999px; padding: 5px 14px;
  pointer-events: none; white-space: nowrap; }
.tierRow { display: flex; gap: 7px; justify-content: center; margin-top: 6px; }
.tierBtn { flex: 0 0 92px; padding: 9px 8px; font-size: 13px; }
.tierBtn.on { border-color: var(--blue); background: #e4eefb; color: #17406e; }
.bigTime { text-align: center; font-size: 42px; font-weight: 900; color: var(--blue);
  font-variant-numeric: tabular-nums; margin-bottom: 6px; }
#modalBody .good { color: var(--good); font-weight: 700; }
#modalBody .dim { color: var(--dim); }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; display: block; border-radius: 2px;
  animation-name: cfall; animation-timing-function: linear; animation-fill-mode: forwards; }
@keyframes cfall { 0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: .15; } }
@media (max-width: 620px) {
  .guarBadge { font-size: 10px; padding: 4px 10px; }
  #actionBar button { min-width: 0; flex: 1 1 0; padding: 11px 6px; font-size: 12.5px; }
}
