@font-face{font-family:'Barlow';font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/barlow-400-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Barlow';font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/barlow-400-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'Barlow';font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/barlow-500-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Barlow';font-style:normal;font-weight:500;font-display:swap;src:url(/fonts/barlow-500-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'Barlow';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/barlow-600-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Barlow';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/barlow-600-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'Barlow Condensed';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/barlow-condensed-600-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF}
@font-face{font-family:'Barlow Condensed';font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/barlow-condensed-600-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}

:root {
  --bg: #eef2f5; --surface: #fff; --ink: #14283b; --muted: #56687a; --line: #cbd5de;
  --brand: #2e6da4; --brand-ink: #fff; --brand-strong: #245a89; --accent: #a87714; --danger: #b93227;
  --cloth: #2e6da4; --cloth-deep: #245a89; --rail: #3b2a20; --rail-light: #5a4030;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #0f1b28; --surface: #172a3d; --ink: #e9eff4; --muted: #9db0c2; --line: #2b4259;
  --brand: #4c90cc; --brand-ink: #0b1622; --brand-strong: #6aa6dc; --accent: #e3b34a; --danger: #f0776b;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.5 var(--body); -webkit-font-smoothing: antialiased;
}
#app { min-height: 100dvh; display: flex; flex-direction: column; }
h1, h2 { font-family: var(--display); font-weight: 600; line-height: 1.05; margin: 0; text-align: center; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 9vw, 4.25rem); letter-spacing: -0.01em; }
h2 { font-size: 1.75rem; }
p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.icon { width: 1.25em; height: 1.25em; flex: none; }
.muted { color: var(--muted); }
.center { text-align: center; }
.noscript { padding: 2rem; text-align: center; }

/* Üst çubuk */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  width: 100%; max-width: 62rem; margin: 0 auto; padding: 0.75rem 1rem;
}
.brand {
  font: 600 1.75rem/1 var(--display); text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.75rem; flex: none;
}
.brand::before {
  content: ''; width: 0.85em; height: 0.85em; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, var(--ink) 0 26%, var(--surface) 28% 100%);
  box-shadow: 0 0 0 0.12em var(--brand);
}
.top-nav { display: flex; align-items: center; justify-content: flex-end; gap: 0.25rem; min-width: 0; flex: 1; }
.top-nav > .me { min-width: 0; flex: 0 1 auto; }
.top-nav > .lang, .top-nav > .icon-btn { flex: none; }
.top-nav > a, .icon-btn, .lang {
  min-height: 2.75rem; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0 0.7rem;
  border: 0; border-radius: 0.6rem; background: none; text-decoration: none; font-weight: 500; cursor: pointer;
}
.top-nav > a:hover, .icon-btn:hover, .lang:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.top-nav > a.current { color: var(--brand-strong); }
.lang { appearance: none; -webkit-appearance: none; padding-right: 0.7rem; max-width: 7.5rem; }
.me-name { max-width: 12ch; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Sayfa */
.page { width: 100%; max-width: 54rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; display: flex; flex-direction: column; gap: 1.25rem; }
.page.narrow { max-width: 34rem; }
.lead { text-align: center; color: var(--muted); max-width: 44ch; margin: -0.5rem auto 0.25rem; text-wrap: balance; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 0.9rem; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.box.center { align-items: center; }
.banner { background: var(--accent); color: #14283b; text-align: center; padding: 0.5rem 1rem; font-weight: 500; }
.foot { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.25rem 1.5rem; padding: 1.25rem 1rem 1.75rem; color: var(--muted); font-size: 0.9375rem; }
.foot a { padding: 0.7rem 0.25rem; }

/* Düğmeler ve formlar */
.btn {
  min-height: 3rem; padding: 0 1.1rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border: 1px solid var(--line); border-radius: 0.65rem; background: var(--surface); font-weight: 600; cursor: pointer;
  text-align: center; text-decoration: none;
}
.btn:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); font-weight: 500; }
.btn.quiet:hover { color: var(--ink); }
.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.field {
  width: 100%; min-height: 3rem; padding: 0 0.85rem; border: 1px solid var(--line); border-radius: 0.65rem;
  background: var(--bg); font-size: 1rem;
}
.form { display: flex; flex-direction: column; gap: 0.9rem; }
.form-field { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; }
.form-field small { color: var(--muted); font-weight: 400; font-size: 0.875rem; }

/* Lobi */
.game-card { padding: 0.75rem; gap: 0.75rem; }
.hero-table { width: 100%; aspect-ratio: 2 / 1.08; display: block; border-radius: 0.6rem; background: var(--rail); }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.panel { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; padding: 0.75rem 0.25rem 0.5rem; text-align: center; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; width: 100%; }
.btn.level { flex-direction: column; gap: 0.1rem; padding: 0.7rem 0.5rem; min-height: 4.25rem; }
.btn.level strong { font: 600 1.4rem/1.1 var(--display); }
.btn.level span { font-weight: 400; font-size: 0.875rem; color: var(--muted); }
.pulse { display: flex; gap: 0.5rem; }
.pulse i { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--brand); animation: pulse 1.2s ease-in-out infinite; }
.pulse i:nth-child(2) { animation-delay: 0.2s; }
.pulse i:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

/* Hesap ve sıralama */
.stats { flex-direction: row; justify-content: space-around; text-align: center; }
.stat { display: flex; flex-direction: column; min-width: 0; }
.stat strong { font: 600 2.25rem/1 var(--display); color: var(--brand-strong); }
.stat span { color: var(--muted); font-size: 0.9375rem; }
.table-wrap { overflow-x: auto; }
.board { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.board th, .board td { padding: 0.6rem 0.5rem; text-align: left; border-bottom: 1px solid var(--line); }
.board th { font-weight: 600; color: var(--muted); font-size: 0.9375rem; }
.board .num { text-align: right; }
.board tbody tr:last-child td { border-bottom: 0; }
.board td:nth-child(2) { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.prose { gap: 0.9rem; }
.prose p { max-width: 65ch; }

/* Bildirim ve iletişim kutusu */
.toasts { position: fixed; left: 0; right: 0; bottom: max(1rem, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; pointer-events: none; z-index: 50; padding: 0 1rem; }
.toast { background: var(--ink); color: var(--bg); padding: 0.7rem 1rem; border-radius: 0.65rem; font-weight: 500; max-width: 32rem; text-align: center; }
.dialog { border: 1px solid var(--line); border-radius: 0.9rem; background: var(--surface); color: var(--ink); padding: 1.25rem; max-width: min(26rem, calc(100vw - 2rem)); text-align: center; }
.dialog::backdrop { background: rgb(8 16 26 / 0.6); }
.dialog p { margin-bottom: 1rem; }

@media (max-width: 40rem) {
  .actions, .levels { grid-template-columns: 1fr; }
  .top-nav > a:not(.me) { display: none; }
  .top { padding: 0.5rem 0.75rem; }
  .top-nav > a, .icon-btn, .lang { padding: 0 0.5rem; }
  .lang { max-width: 6.5rem; }
  .foot { padding-bottom: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse i { animation: none; opacity: 0.7; }
  .btn:active { transform: none; }
}

/* ---------- Oyun ekranı ---------- */
body.in-game { overflow: hidden; overscroll-behavior: none; background: #0b1622; }
.stage {
  position: fixed; inset: 0; display: flex; flex-direction: column; color: #e9eff4; background: #0b1622;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  --ink: #e9eff4; --muted: #9db0c2; --line: #2b4259; --surface: #172a3d; --bg: #0f1b28; --brand: #4c90cc; --brand-ink: #0b1622; --brand-strong: #6aa6dc; --accent: #e3b34a;
  color-scheme: dark; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.hud {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: 'p0 p1' 'status tools';
  gap: 0.4rem 0.5rem; padding: 0.5rem 0.6rem 0.4rem; align-items: center;
}
.chip {
  position: relative; min-width: 0; padding: 0.4rem 0.6rem 0.55rem; border-radius: 0.6rem; background: #172a3d; border: 1px solid #2b4259;
  display: flex; flex-direction: column; gap: 0.3rem; overflow: hidden;
}
.chip:nth-child(1) { grid-area: p0; }
.chip:nth-child(2) { grid-area: p1; }
.chip.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chip-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.chip-group { display: flex; gap: 0.2rem; min-height: 0.95rem; align-items: center; }
.chip-open { color: var(--muted); font-size: 0.875rem; line-height: 1; }
.chip-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--left, 0) * 100%); background: var(--accent); }
.mini { width: 0.85rem; height: 0.85rem; border-radius: 50%; flex: none; background: var(--c); box-shadow: inset -1px -2px 2px rgb(0 0 0 / 0.35); }
.mini.stripe { background: linear-gradient(#f7f5ee 0 24%, var(--c) 24% 76%, #f7f5ee 76%); }
.mini.off { opacity: 0.22; }
.mini.c1 { --c: #f2c230; } .mini.c2 { --c: #3d4fd0; } .mini.c3 { --c: #d23b2f; } .mini.c4 { --c: #8a57c4; }
.mini.c5 { --c: #ee7f2b; } .mini.c6 { --c: #1f8a5b; } .mini.c7 { --c: #a43a3a; } .mini.c8 { --c: #05070a; box-shadow: inset 0 0 0 1px #56687a; }
.status { grid-area: status; min-width: 0; font-size: 0.9375rem; line-height: 1.25; color: #c9d6e2; min-height: 2.5em; display: flex; align-items: center; }
.tools { grid-area: tools; display: flex; justify-content: flex-end; gap: 0.15rem; }
.stage .icon-btn { min-height: 2.75rem; min-width: 2.75rem; justify-content: center; padding: 0; color: #e9eff4; }
.stage .icon-btn:disabled { opacity: 0.35; cursor: default; }
.play { flex: 1; min-height: 0; display: flex; gap: 0.4rem; padding: 0 0.4rem 0.5rem; }
.table { flex: 1; min-width: 0; height: 100%; display: block; touch-action: none; border-radius: 0.5rem; }
.table:focus-visible { outline-offset: -3px; }
.power {
  position: relative; flex: none; width: 3.25rem; border-radius: 0.75rem; background: #172a3d; border: 1px solid #2b4259;
  touch-action: none; cursor: ns-resize; overflow: hidden;
}
.power.idle { opacity: 0.4; cursor: default; }
.power-fill {
  position: absolute; left: 0; right: 0; top: 0; height: calc(var(--p, 0) * 100%);
  background: linear-gradient(#e3b34a, #d2562f);
}
.power-fill::after {
  content: ''; position: absolute; left: 0.35rem; right: 0.35rem; bottom: -0.3rem; height: 0.6rem; border-radius: 0.3rem; background: #f7f5ee;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.5);
}
.power-label {
  position: absolute; left: 50%; bottom: 0.75rem; writing-mode: vertical-rl; transform: translateX(-50%) rotate(180deg);
  font-size: 0.8125rem; color: #9db0c2; pointer-events: none;
}
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgb(8 16 26 / 0.72); }
.overlay[hidden] { display: none; }
.result { width: min(24rem, 100%); align-items: center; text-align: center; }
.spin-pad {
  position: relative; width: 9rem; height: 9rem; margin: 0 auto 1rem; border-radius: 50%; touch-action: none; cursor: crosshair;
  background: radial-gradient(circle at 38% 34%, #fff, #e4e0d2 60%, #b9b4a2);
}
.spin-dot {
  position: absolute; left: 50%; top: 50%; width: 1.4rem; height: 1.4rem; margin: -0.7rem; border-radius: 50%; background: #d23b2f;
  transform: translate(calc(var(--x, 0) * 3.6rem), calc(var(--y, 0) * 3.6rem)); pointer-events: none;
}

@media (orientation: landscape) {
  .hud { grid-template-columns: minmax(0, 13rem) 1fr minmax(0, 13rem) auto; grid-template-areas: 'p0 status p1 tools'; padding: 0.35rem 0.6rem; }
  .status { justify-content: center; text-align: center; min-height: 0; }
}
@media (orientation: landscape) and (max-height: 32rem) {
  .chip { padding: 0.25rem 0.5rem 0.4rem; gap: 0.2rem; }
  .chip-name { font-size: 0.9375rem; }
  .status { font-size: 0.875rem; }
  .play { padding-bottom: 0.3rem; }
}
