:root {
  --bg0: #0c0a22;
  --bg1: #191346;
  --bg2: #26196b;
  --panel: rgba(255, 255, 255, 0.065);
  --panel-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.11);
  --text: #f6f3ff;
  --muted: #aaa3d4;
  --gold: #ffcf4a;
  --danger: #ff5a73;
  --top: 64px;
  --r-lg: 26px;
  --r-md: 18px;
  --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --turn: #8b7bff;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: radial-gradient(1200px 800px at 15% -10%, var(--bg2) 0%, transparent 60%),
    radial-gradient(900px 700px at 110% 110%, #3a1460 0%, transparent 55%),
    linear-gradient(160deg, var(--bg1), var(--bg0) 70%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
input { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; margin-top: 6px; }
b { font-weight: 800; }
kbd {
  font-family: var(--font-body);
  font-size: 0.72em;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

/* ------------------------------------------------------------------ arka plan */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
/* Bulanıklık filtresi yerine yumuşak geçişli gradyan: telefonda çok daha hafif */
.blob {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  background: radial-gradient(circle closest-side, var(--bc), transparent);
  opacity: 0.22;
  will-change: transform;
  animation: drift 26s ease-in-out infinite alternate;
}
.b0 { --bc: #f0525a; top: -30vmax; left: -24vmax; }
.b1 { --bc: #3d7ff6; top: -26vmax; right: -28vmax; animation-delay: -6s; }
.b2 { --bc: #22b567; bottom: -32vmax; right: -22vmax; animation-delay: -12s; opacity: 0.16; }
.b3 { --bc: #f5bc22; bottom: -30vmax; left: -26vmax; animation-delay: -18s; opacity: 0.15; }
body.my-turn .bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(60vmax 60vmax at 50% 50%, color-mix(in srgb, var(--turn) 22%, transparent), transparent 70%);
  animation: breathe 2.4s ease-in-out infinite;
}
.bg-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.4px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vmax, 4vmax) scale(1.1); }
  100% { transform: translate(-4vmax, 7vmax) scale(0.95); }
}
@keyframes breathe { 50% { opacity: 0.45; } }

/* ------------------------------------------------------------------ üst çubuk */
.topbar {
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  position: relative;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 14px;
  transition: background 0.2s;
}
.brand:hover { background: rgba(255, 255, 255, 0.06); }
.brand-mark { display: grid; grid-template-columns: repeat(2, 11px); gap: 3px; transform: rotate(45deg); }
.brand-mark i { width: 11px; height: 11px; border-radius: 50%; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25); }
.brand-mark i:nth-child(1) { background: #f0525a; }
.brand-mark i:nth-child(2) { background: #3d7ff6; }
.brand-mark i:nth-child(3) { background: #f5bc22; }
.brand-mark i:nth-child(4) { background: #22b567; }
.brand-text { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: 0.2px; }
.brand-text b { font-weight: 700; color: var(--gold); }
body[data-screen='home'] .brand-text { opacity: 0; }

.room-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 14px;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.room-chip:hover { background: var(--panel-strong); }
.room-chip:active { transform: scale(0.96); }
.room-chip-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.room-chip-code { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: 2.5px; }
.room-chip svg { color: var(--muted); }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 0;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
}
.icon-btn:hover { background: var(--panel-strong); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.off { opacity: 0.45; }
.icon-btn.danger:hover { background: rgba(255, 90, 115, 0.2); color: #ffb3c0; }
.net-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 90, 115, 0.18);
  margin-right: 6px;
  transition: background 0.3s;
}
.net-dot.on { background: #3ee08f; box-shadow: 0 0 0 4px rgba(62, 224, 143, 0.16); }

/* ------------------------------------------------------------------ ekranlar */
main { position: relative; }
.screen { display: none; }
.screen.active { display: block; animation: screenIn 0.5s var(--ease-spring); }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px) scale(0.99); } }

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.04));
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px var(--line), 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.panel-title {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------------------ butonlar */
.btn {
  --b1: #ff8a5b;
  --b2: #ff4d6d;
  --b3: #b8264a;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  border: 0;
  border-radius: var(--r-md);
  padding: 13px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #fff;
  cursor: pointer;
  position: relative;
  text-align: left;
  line-height: 1.15;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.2s, background 0.2s;
}
.btn small { display: block; font-family: var(--font-body); font-weight: 700; font-size: 12.5px; opacity: 0.82; margin-top: 2px; }
.btn-ico { display: grid; place-items: center; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2)); }
.btn-ico .ico { width: 1.3em; height: 1.3em; }
.ico { display: block; flex: none; }
.tag .ico, .stat-row .ico { display: inline-block; vertical-align: -2px; }
.btn-primary, .btn-secondary {
  background: linear-gradient(180deg, var(--b1), var(--b2));
  box-shadow: 0 6px 0 var(--b3), 0 16px 30px -10px color-mix(in srgb, var(--b2) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
}
.btn-secondary { --b1: #8a7bff; --b2: #5a45ec; --b3: #3527a3; }
.btn-primary:hover:not(:disabled), .btn-secondary:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-2px); box-shadow: 0 8px 0 var(--b3), 0 20px 34px -10px color-mix(in srgb, var(--b2) 75%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn-primary:active:not(:disabled), .btn-secondary:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--b3), 0 6px 14px -6px color-mix(in srgb, var(--b2) 60%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn-ghost { background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.14); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.14); }
.btn-ghost:active { transform: scale(0.97); }
.btn:disabled { filter: grayscale(0.85) brightness(0.7); cursor: not-allowed; }
.btn-xl { padding: 17px 24px; font-size: 20px; border-radius: 22px; }
.btn-lg { padding: 14px 22px; font-size: 18px; }
.btn-sm { padding: 9px 14px; font-size: 14.5px; border-radius: 13px; gap: 8px; }
.btn:focus-visible, .icon-btn:focus-visible, .seg button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.input {
  width: 100%;
  font: 700 18px var(--font-body);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 16px;
  border: 0;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.12), inset 0 2px 6px rgba(0, 0, 0, 0.3);
  outline: none;
  transition: box-shadow 0.2s;
}
.input::placeholder { color: rgba(255, 255, 255, 0.35); }
.input:focus { box-shadow: inset 0 0 0 2px #8a7bff, 0 0 0 5px rgba(138, 123, 255, 0.2); }

/* ------------------------------------------------------------------ ana menü */
.home {
  min-height: calc(100dvh - var(--top));
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 40px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 28px 40px;
}
.hero { text-align: left; }
.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(60px, 9vw, 118px);
  line-height: 0.92;
  margin: 18px 0 18px;
  letter-spacing: -1px;
  text-shadow: 0 5px 0 #2a1f6e, 0 10px 0 rgba(0, 0, 0, 0.22), 0 24px 40px rgba(0, 0, 0, 0.4);
}
.logo span {
  background: linear-gradient(90deg, #f0525a, #f5bc22 35%, #22b567 65%, #3d7ff6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 5px 0 #2a1f6e) drop-shadow(0 10px 0 rgba(0, 0, 0, 0.2));
  text-shadow: none;
}
.tagline { font-size: 19px; color: #d7d1f7; max-width: 440px; line-height: 1.5; margin: 0; }
.tagline b { color: var(--gold); }
.hero-pawns { display: flex; gap: 16px; height: 86px; align-items: flex-end; }
.hp { position: relative; width: 42px; height: 62px; animation: hop 2.4s var(--ease-spring) infinite; }
.hp::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 12%, var(--l) 30%, var(--m) 70%, var(--d));
}
.hp::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38px;
  clip-path: polygon(30% 0, 70% 0, 100% 88%, 92% 100%, 8% 100%, 0 88%);
  background: linear-gradient(110deg, var(--l), var(--m) 45%, var(--d));
  border-radius: 0 0 12px 12px;
}
.hp.p0 { --l: #ff9499; --m: #f0525a; --d: #a92a33; }
.hp.p1 { --l: #8db4ff; --m: #3d7ff6; --d: #1f4fb0; animation-delay: 0.15s; }
.hp.p2 { --l: #6edda0; --m: #22b567; --d: #137a43; animation-delay: 0.3s; }
.hp.p3 { --l: #ffdd75; --m: #f5bc22; --d: #b9840a; animation-delay: 0.45s; }
@keyframes hop {
  0%, 60%, 100% { transform: translateY(0) scale(1, 1); }
  10% { transform: translateY(0) scale(1.1, 0.88); }
  25% { transform: translateY(-26px) scale(0.94, 1.06); }
  42% { transform: translateY(0) scale(1.08, 0.92); }
  50% { transform: translateY(0) scale(1, 1); }
}

.home-card { padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.field-label { font-size: 12.5px; font-weight: 900; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 7px; }
.avatars button {
  aspect-ratio: 1;
  font-size: 24px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), background 0.2s, box-shadow 0.2s;
  display: grid;
  place-items: center;
  padding: 0;
}
.avatars button:hover { transform: scale(1.12) rotate(-4deg); background: rgba(255, 255, 255, 0.12); }
.avatars button.sel { background: rgba(138, 123, 255, 0.35); box-shadow: inset 0 0 0 2px #a99dff, 0 6px 18px -6px #8a7bff; transform: scale(1.08); }
.home-actions { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.home-actions .btn { justify-content: flex-start; }
.home.invited #btn-quick, .home.invited #btn-create { --b1: rgba(255, 255, 255, 0.12); --b2: rgba(255, 255, 255, 0.07); --b3: rgba(0, 0, 0, 0.3); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.12), 0 4px 0 var(--b3); }
#btn-accept-invite { justify-content: center !important; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 800; margin: 4px 0 -2px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 10px; }
.code-input { text-transform: uppercase; letter-spacing: 6px; font-family: var(--font-display); font-weight: 700; text-align: center; font-size: 20px; }
.invite {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(255, 207, 74, 0.18), rgba(255, 207, 74, 0.05));
  box-shadow: inset 0 0 0 1px rgba(255, 207, 74, 0.35);
  font-weight: 700;
  margin-bottom: 4px;
}
.invite b { letter-spacing: 2px; color: var(--gold); }
.invite-badge { background: var(--gold); color: #3a2a00; font-size: 11px; font-weight: 900; padding: 3px 8px; border-radius: 8px; text-transform: uppercase; }

/* ------------------------------------------------------------------ lobi */
.lobby { max-width: 1060px; margin: 0 auto; padding: 18px 24px 40px; display: flex; flex-direction: column; gap: 22px; }
.lobby-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.eyebrow { font-size: 12.5px; font-weight: 900; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); }
.lobby-title { font-family: var(--font-display); font-size: 40px; margin: 4px 0 0; font-weight: 600; }
.code-big {
  font-weight: 700;
  letter-spacing: 5px;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--gold);
}
.share { display: flex; gap: 10px; }
.seats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.seat-card {
  position: relative;
  border-radius: var(--r-lg);
  padding: 18px 16px 18px;
  min-height: 228px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 26%, transparent), rgba(255, 255, 255, 0.04) 70%);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, transparent), 0 18px 40px -22px var(--c);
  animation: seatIn 0.5s var(--ease-spring) backwards;
}
.seat-card:nth-child(2) { animation-delay: 0.05s; }
.seat-card:nth-child(3) { animation-delay: 0.1s; }
.seat-card:nth-child(4) { animation-delay: 0.15s; }
@keyframes seatIn { from { opacity: 0; transform: translateY(16px) scale(0.95); } }
.seat-card.empty { background: rgba(255, 255, 255, 0.025); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08); }
.seat-card.empty::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px dashed color-mix(in srgb, var(--c) 45%, transparent);
  pointer-events: none;
}
.seat-card.mine { box-shadow: inset 0 0 0 2.5px var(--c), 0 0 0 5px color-mix(in srgb, var(--c) 22%, transparent), 0 24px 50px -18px var(--c); }
.seat-color { font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; display: flex; align-items: center; gap: 8px; color: var(--cl); }
.seat-dot { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 10%, var(--cl) 30%, var(--c) 70%, var(--cd)); }
.seat-avatar {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 44px;
  margin-top: 6px;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--cl) 70%, white), var(--c) 60%, var(--cd));
  box-shadow: 0 8px 0 var(--cd), 0 18px 28px -10px rgba(0, 0, 0, 0.6), inset 0 -4px 10px rgba(0, 0, 0, 0.18);
  animation: float 3.4s ease-in-out infinite;
}
.seat-avatar.empty { color: var(--muted); }
.seat-avatar.empty { background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08); filter: grayscale(0.4); opacity: 0.7; animation: none; }
@keyframes float { 50% { transform: translateY(-5px); } }
.seat-name { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin-top: 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-name.muted { color: var(--muted); font-size: 17px; }
.seat-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 24px; }
.tag { font-size: 11.5px; font-weight: 900; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); color: #ddd8ff; letter-spacing: 0.3px; white-space: nowrap; }
.tag.me { background: #fff; color: #241a5e; }
.tag.gold { background: rgba(255, 207, 74, 0.2); color: var(--gold); }
.tag.off { background: rgba(255, 90, 115, 0.2); color: #ffb3c0; }
.seat-take { margin-top: auto; background: color-mix(in srgb, var(--c) 30%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 60%, transparent); }
.seat-take:hover { background: color-mix(in srgb, var(--c) 50%, transparent); }

.lobby-bottom { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: stretch; }
.settings { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.setting-label { font-weight: 800; color: #dcd7fb; }
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, 0.25); box-shadow: inset 0 0 0 1px var(--line); }
.seg button {
  border: 0;
  background: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 14.5px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.seg button.on { background: linear-gradient(180deg, #8a7bff, #5a45ec); color: #fff; box-shadow: 0 3px 10px -3px #5a45ec; }
.seg button:not(.on):not(:disabled):hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.seg button:disabled { cursor: default; }
.settings.readonly .seg button:not(.on) { opacity: 0.5; }
.spec-list { display: flex; gap: 6px; flex-wrap: wrap; }
.start-box { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 6px 4px; }
.start-info { font-size: 16px; color: #dcd7fb; text-align: center; }
.start-box .btn { width: 100%; }
.waiting { text-align: center; color: var(--muted); font-weight: 800; padding: 18px; border-radius: 18px; background: rgba(255, 255, 255, 0.04); }
.dots i { font-style: normal; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 0%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

/* ------------------------------------------------------------------ oyun */
.game {
  display: grid;
  grid-template-columns: minmax(210px, 262px) auto minmax(210px, 262px);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: 'a0 board a1' 'log board tray' 'a3 board a2';
  gap: 16px 24px;
  justify-content: center;
  height: calc(100dvh - var(--top));
  padding: 4px 20px 18px;
}
.a0 { grid-area: a0; }
.a1 { grid-area: a1; }
.a2 { grid-area: a2; }
.a3 { grid-area: a3; }
.log-wrap { grid-area: log; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: hidden; align-self: center; max-height: 100%; height: 100%; }
.tray { grid-area: tray; align-self: center; }
.board-wrap {
  grid-area: board;
  position: relative;
  align-self: center;
  height: min(calc(100dvh - var(--top) - 26px), calc(100vw - 600px));
  aspect-ratio: 1;
  border-radius: 6.5%;
}
.board { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.45)); }
.board-fg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.board { will-change: transform; }
.board-wrap::before {
  content: '';
  position: absolute;
  inset: 0.6%;
  border-radius: 6%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  box-shadow: 0 0 0 4px var(--turn), 0 0 50px 4px color-mix(in srgb, var(--turn) 70%, transparent);
}
body.my-turn .board-wrap::before { opacity: 1; animation: glow 1.6s ease-in-out infinite; will-change: opacity; }
/* Sadece opaklık: gölgeyi her karede yeniden çizmez */
@keyframes glow { 50% { opacity: 0.45; } }
.board-wrap.shake { animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px) rotate(-0.3deg); }
  20%, 80% { transform: translate(4px, -2px) rotate(0.4deg); }
  30%, 50%, 70% { transform: translate(-7px, 2px) rotate(-0.6deg); }
  40%, 60% { transform: translate(7px, -1px) rotate(0.6deg); }
}

.turn-pill {
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translate(-50%, 50%);
  padding: 8px 16px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  background: #1d1747;
  box-shadow: inset 0 0 0 2px var(--c, #8a7bff), 0 10px 24px -8px rgba(0, 0, 0, 0.7);
  z-index: 3;
  transition: box-shadow 0.3s;
}
.turn-pill .ico { width: 17px; height: 17px; }
.turn-pill.clickable { cursor: pointer; background: linear-gradient(180deg, #ffd96b, #ffb423); color: #3a2400; box-shadow: 0 5px 0 #b77b00, 0 14px 24px -8px rgba(0, 0, 0, 0.6); }
.dot-c { width: 11px; height: 11px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent); display: inline-block; flex: none; }

/* tahta parçaları */
.piece .ring { opacity: 0; transition: opacity 0.2s; }
.piece .badge { opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.piece .hit { cursor: default; }
.piece.movable .hit { cursor: pointer; }
.piece.movable .ring { opacity: 1; }
.piece.movable .ring > circle:first-child { transform-box: fill-box; transform-origin: center; animation: ringPulse 1.2s ease-in-out infinite; }
.piece.movable .ring-dash { transform-box: fill-box; transform-origin: center; animation: spin 5s linear infinite; }
.piece.movable .pawn { animation: bob 1.2s ease-in-out infinite; }
.piece.movable:hover .pawn { animation: none; transform: translateY(-12px) scale(1.08); transition: transform 0.2s var(--ease-spring); }
.piece.selected .pawn { animation: none; transform: translateY(-16px) scale(1.12); transition: transform 0.2s var(--ease-spring); }
.piece.selected .ring > circle:first-child { animation-duration: 0.6s; }
@media (hover: hover) { .piece.movable .badge { opacity: 1; } }
.piece.dim { opacity: 0.6; transition: opacity 0.3s; }
.piece.moving { pointer-events: none; }
.piece .pawn, .piece .ring { transition: transform 0.2s; }
@keyframes ringPulse { 0%, 100% { transform: scale(0.9); opacity: 0.25; } 50% { transform: scale(1.12); opacity: 0.55; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.hint-dot { transform-box: fill-box; transform-origin: center; animation: dotIn 0.25s var(--ease-spring) backwards; }
@keyframes dotIn { from { transform: scale(0); } }
.hint-target { animation: dotIn 0.3s var(--ease-spring); }
.hint-target .spin { transform-box: fill-box; transform-origin: center; animation: spin 3s linear infinite; }
.hint-target .ghost { pointer-events: none; }
.ripple { transform-box: fill-box; transform-origin: center; animation: ripple 0.8s ease-out forwards; }
@keyframes ripple { from { transform: scale(0.6); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }

/* oyuncu kartları */
.pcard-slot { min-width: 0; align-self: center; }
.a0, .a1 { align-self: start; }
.a2, .a3 { align-self: end; }
.pcard {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 22px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 16%, rgba(255, 255, 255, 0.04)), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 28%, transparent);
  transition: transform 0.35s var(--ease-spring), box-shadow 0.35s, background 0.35s, opacity 0.3s;
}
.pcard.active {
  transform: scale(1.04);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 40%, rgba(255, 255, 255, 0.05)), color-mix(in srgb, var(--c) 10%, transparent));
  box-shadow: inset 0 0 0 2.5px var(--c), 0 16px 40px -12px var(--c);
}
.pcard.finished { opacity: 0.8; }
.pcard.offline .pc-emoji { filter: grayscale(1); opacity: 0.5; }
.pc-avatar { position: relative; width: 60px; height: 60px; flex: none; display: grid; place-items: center; }
.pc-emoji {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 27px;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--cl) 70%, white), var(--c) 60%, var(--cd));
  box-shadow: 0 4px 0 var(--cd), inset 0 -3px 8px rgba(0, 0, 0, 0.2);
}
.pcard.active .pc-emoji { animation: float 1.6s ease-in-out infinite; }
.pc-timer { position: absolute; inset: 0; transform: rotate(-90deg); }
.pc-timer circle { fill: none; stroke-width: 4.5; }
.pc-timer .trk { stroke: transparent; }
.pcard.active .pc-timer .trk { stroke: rgba(255, 255, 255, 0.12); }
.pc-timer .prog { stroke: #fff; stroke-linecap: round; }
.pc-place {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #3a2a00;
  box-shadow: 0 3px 0 #b78a0a;
  padding: 0 5px;
}
.pc-place:empty { display: none; }
.pc-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.pc-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-tags { display: flex; gap: 5px; min-height: 0; flex-wrap: wrap; }
.pc-tags:empty { display: none; }
.pc-tags .tag { font-size: 10.5px; padding: 2px 7px; }
.pc-pieces { display: flex; gap: 5px; }
.pc-pieces i { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 50%, transparent); transition: background 0.3s, transform 0.3s var(--ease-spring); }
.pc-pieces i.out { background: color-mix(in srgb, var(--c) 45%, transparent); }
.pc-pieces i.done { background: var(--c); box-shadow: 0 0 10px var(--c); transform: scale(1.12); }
.pc-bubble {
  position: absolute;
  bottom: calc(100% - 6px);
  right: 10px;
  max-width: 180px;
  padding: 7px 12px;
  border-radius: 14px 14px 4px 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  color: #1d1747;
  background: #fff;
  box-shadow: 0 0 0 2.5px var(--c), 0 10px 20px -6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}
.pc-bubble.show { animation: bubble 2.4s var(--ease-spring) forwards; }
@keyframes bubble {
  0% { opacity: 0; transform: translateY(14px) scale(0.3) rotate(-20deg); }
  12% { opacity: 1; transform: translateY(-4px) scale(1.08) rotate(2deg); }
  20% { transform: translateY(0) scale(1) rotate(0); }
  85% { opacity: 1; transform: translateY(-4px) scale(1); }
  100% { opacity: 0; transform: translateY(-16px) scale(0.9); }
}

/* zar tepsisi */
.tray { padding: 18px 16px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.tray-status { font-family: var(--font-display); font-weight: 600; font-size: 19px; display: flex; align-items: center; gap: 9px; min-height: 26px; }
.tray-hint { font-size: 13.5px; color: var(--muted); font-weight: 700; min-height: 20px; }
.tray-hint b { color: #fff; }
.hurry { color: var(--danger) !important; font-size: 1.2em; }
.dice-btn {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 30%, #2b2160), #15112f 72%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 35%, transparent), inset 0 10px 30px rgba(0, 0, 0, 0.5);
  cursor: default;
  transition: box-shadow 0.3s, transform 0.2s;
}
.dice-btn.ready { cursor: pointer; animation: readyGlow 1.4s ease-in-out infinite; }
.dice-btn.ready:hover { transform: scale(1.04); }
.dice-btn.ready:active { transform: scale(0.96); }
@keyframes readyGlow {
  0%, 100% { box-shadow: inset 0 0 0 2.5px var(--c), inset 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 0 color-mix(in srgb, var(--c) 50%, transparent); }
  50% { box-shadow: inset 0 0 0 2.5px var(--c), inset 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 12px transparent; }
}
.roll-btn { --b1: var(--cl); --b2: var(--c); --b3: var(--cd); width: 100%; justify-content: center; }
.roll-btn kbd { background: rgba(0, 0, 0, 0.18); }
.roll-btn.pulse { animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.emotes { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 4px; }
.chat-btn { display: none; }
.emotes button {
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), background 0.2s;
}
.emotes button:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.14); }
.emotes button:active { transform: scale(0.94); }

/* 3D zar */
.dice { --size: 82px; --half: 41px; --pip: #3d7ff6; width: var(--size); height: var(--size); position: relative; perspective: 520px; }
.dice-wrap { width: 100%; height: 100%; transform-style: preserve-3d; }
.dice-cube { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.78s cubic-bezier(0.16, 0.86, 0.32, 1.06); }
.dice-face {
  position: absolute;
  inset: 0;
  border-radius: 20%;
  background: radial-gradient(circle at 30% 22%, #ffffff, #f6f1e8 55%, #e3d9c8);
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.06), inset 0 -5px 12px rgba(120, 90, 40, 0.18), inset 0 3px 6px rgba(255, 255, 255, 0.9);
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 13%;
  backface-visibility: hidden;
}
.dice-face span { display: block; }
.pip {
  width: 74%;
  height: 74%;
  place-self: center;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, color-mix(in srgb, var(--pip) 55%, white), var(--pip) 55%, color-mix(in srgb, var(--pip) 65%, black));
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: background 0.4s;
}
.dice-shadow {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -16px;
  height: 14px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  filter: blur(6px);
}
.dice.tossing .dice-wrap { animation: toss 0.78s cubic-bezier(0.3, 0.7, 0.4, 1); }
.dice.tossing .dice-shadow { animation: tossShadow 0.78s cubic-bezier(0.3, 0.7, 0.4, 1); }
.dice.landed .dice-wrap { animation: land 0.3s ease-out; }
.dice.six .dice-face { box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.06), inset 0 -5px 12px rgba(120, 90, 40, 0.18), 0 0 26px color-mix(in srgb, var(--pip) 80%, transparent); }
@keyframes toss {
  0% { transform: translateY(0) scale(1); }
  28% { transform: translateY(-52px) scale(1.12); }
  56% { transform: translateY(0) scale(0.95, 1.04); }
  70% { transform: translateY(-14px) scale(1.02); }
  84% { transform: translateY(0) scale(1.03, 0.97); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes tossShadow { 28% { transform: scale(0.55); opacity: 0.4; } 56% { transform: scale(1); opacity: 1; } 70% { transform: scale(0.85); } }
@keyframes land { 40% { transform: scale(1.06, 0.94); } }

/* akış */
.log { list-style: none; margin: 0; padding: 0 4px 0 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; mask-image: linear-gradient(#000 75%, transparent); scrollbar-width: none; }
.log::-webkit-scrollbar { display: none; }
.log li { display: flex; gap: 9px; align-items: baseline; font-size: 13.5px; line-height: 1.35; color: #d7d1f7; animation: logIn 0.35s var(--ease-spring); }
.log li .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); transform: translateY(-1px); }
.log li .dot.neutral { background: var(--muted); }
@keyframes logIn { from { opacity: 0; transform: translateX(-10px); } }
.log-ico { display: inline-block; vertical-align: -2px; color: var(--c); }
.die-chip {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #fff;
  color: #1d1747;
  font-weight: 900;
  font-size: 12px;
  box-shadow: 0 2px 0 #c9bfae;
  margin: 0 2px;
}

/* ------------------------------------------------------------------ katmanlar */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  padding: 56px 16px 20px;
  background: rgba(8, 6, 26, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade 0.3s;
  overflow-y: auto;
}
@keyframes fade { from { opacity: 0; } }
.end-card, .rules-card, .confirm-card { margin: auto; }
.end-card, .rules-card { width: min(560px, 100%); padding: 28px 28px 24px; text-align: center; position: relative; animation: pop 0.55s var(--ease-spring); background: linear-gradient(180deg, #2a2070, #1a1448); }
@keyframes pop { from { opacity: 0; transform: scale(0.85) translateY(20px); } }
.end-trophy {
  width: 84px; height: 84px; margin: -64px auto 0; border-radius: 50%; display: grid; place-items: center; color: #6b4500;
  background: radial-gradient(circle at 35% 30%, #fff3c2, #ffcf4a 55%, #d99a0b);
  box-shadow: 0 6px 0 #a87006, 0 16px 34px -6px rgba(255, 190, 40, 0.55);
  animation: trophy 2.4s ease-in-out infinite;
}
@keyframes trophy { 50% { transform: translateY(-8px) rotate(-6deg) scale(1.05); } }
.end-title { font-family: var(--font-display); font-size: 34px; margin: 8px 0 22px; font-weight: 700; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 132px; animation: podIn 0.6s var(--ease-spring) backwards; }
.pod-1 { animation-delay: 0.35s; }
.pod-2 { animation-delay: 0.15s; }
.pod-3 { animation-delay: 0.5s; }
@keyframes podIn { from { opacity: 0; transform: translateY(40px); } }
.pod-avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 34px;
  position: relative;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--cl) 70%, white), var(--c) 60%, var(--cd));
  box-shadow: 0 5px 0 var(--cd);
}
.pod-1 .pod-avatar { width: 76px; height: 76px; font-size: 42px; animation: float 2s ease-in-out infinite; }
.pod-crown { position: absolute; top: -30px; color: var(--gold); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)); display: grid; }
.pod.me .pod-name::after { content: ' (sen)'; color: var(--muted); font-weight: 700; font-size: 0.8em; }
.pod-name { font-family: var(--font-display); font-weight: 600; font-size: 16px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-block {
  width: 100%;
  border-radius: 16px 16px 6px 6px;
  display: grid;
  place-items: start center;
  padding-top: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 3px 0 var(--cd);
  background: linear-gradient(180deg, var(--c), var(--cd));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3);
}
.pod-1 .pod-block { height: 130px; }
.pod-2 .pod-block { height: 96px; }
.pod-3 .pod-block { height: 70px; }
.pod-4 { width: 100%; margin-top: 10px; font-weight: 800; color: var(--muted); }
.end-stats { margin: 22px 0 18px; border-radius: 16px; background: rgba(0, 0, 0, 0.2); padding: 8px 12px; font-size: 14px; }
.stat-row { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 6px; padding: 7px 4px; align-items: center; }
.stat-row + .stat-row { border-top: 1px solid rgba(255, 255, 255, 0.06); }
.stat-row.head { color: var(--muted); font-weight: 800; font-size: 12px; }
.stat-row span:first-child { text-align: left; display: flex; align-items: center; gap: 8px; font-weight: 800; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.stat-row .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.end-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.end-card .waiting { margin-top: 12px; }

.rules-card { text-align: left; width: min(600px, 100%); }
.rules-card h2 { font-family: var(--font-display); font-size: 30px; margin: 0 0 16px; }
.rules-list { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-direction: column; gap: 10px; }
.rules-list li { display: flex; gap: 14px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); line-height: 1.45; color: #ddd8fb; }
.rules-list li > .rule-ico { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #c9c0ff; background: rgba(138, 123, 255, 0.18); }
.rules-card .btn { width: 100%; justify-content: center; }
.close { position: absolute; top: 14px; right: 14px; }

#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }
#banner { position: fixed; inset: 0; pointer-events: none; z-index: 70; display: grid; place-items: center; }
.banner { grid-area: 1 / 1; text-align: center; animation: bannerIn 0.6s var(--ease-spring); }
.banner.out { animation: bannerOut 0.45s ease-in forwards; }
.banner-text {
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
  line-height: 1;
  letter-spacing: -0.5px;
  -webkit-text-stroke: 2px color-mix(in srgb, var(--bc) 60%, black);
  text-shadow: 0 6px 0 color-mix(in srgb, var(--bc) 60%, black), 0 12px 0 rgba(0, 0, 0, 0.25), 0 0 60px var(--bc);
  paint-order: stroke fill;
}
.banner.big .banner-text { font-size: clamp(44px, 9vw, 112px); }
.banner.small .banner-text { font-size: clamp(30px, 5vw, 56px); }
.banner-sub {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 17px;
  background: rgba(10, 8, 30, 0.75);
  box-shadow: inset 0 0 0 2px var(--bc);
}
@keyframes bannerIn { 0% { opacity: 0; transform: scale(0.3) rotate(-10deg); } 60% { opacity: 1; transform: scale(1.12) rotate(2deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes bannerOut { to { opacity: 0; transform: scale(1.25) translateY(-20px); } }

#toasts {
  position: fixed;
  top: calc(var(--top) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 16px;
  background: rgba(24, 19, 60, 0.92);
  box-shadow: inset 0 0 0 1.5px var(--tc, rgba(255, 255, 255, 0.14)), 0 14px 30px -10px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  font-weight: 800;
  font-size: 14.5px;
  animation: toastIn 0.45s var(--ease-spring);
}
.toast.out { animation: toastOut 0.4s ease-in forwards; }
.toast-icon { display: grid; color: var(--tc, #c9c0ff); }
.toast-icon:empty { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(0.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(0.95); } }

.shake:not(.board-wrap) { animation: shakeX 0.4s; }
@keyframes shakeX { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

/* ------------------------------------------------------------------ duyarlı */
@media (max-width: 1180px) {
  .game { grid-template-columns: minmax(190px, 220px) auto minmax(190px, 220px); gap: 14px 16px; padding: 4px 12px 16px; }
  .board-wrap { height: min(calc(100dvh - var(--top) - 26px), calc(100vw - 500px)); }
  .dice-btn { width: 128px; height: 128px; }
}

@media (max-width: 920px) {
  :root { --top: 58px; }
  .brand-text { display: none; }
  .home { grid-template-columns: 1fr; gap: 10px; padding: 0 16px 30px; min-height: 0; }
  .hero { text-align: center; }
  .hero-pawns { justify-content: center; height: 70px; }
  .logo { font-size: clamp(54px, 15vw, 90px); margin: 10px 0 12px; }
  .tagline { margin: 0 auto; font-size: 16px; }
  .home-card { padding: 20px; }
  .avatars button { font-size: 21px; border-radius: 11px; }
  .seats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .seat-card { min-height: 200px; padding: 14px 10px; }
  .seat-avatar { width: 66px; height: 66px; font-size: 36px; }
  .lobby { padding: 8px 16px 30px; gap: 16px; }
  .lobby-title { font-size: 30px; }
  .lobby-bottom { grid-template-columns: 1fr; }

  .game {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
    grid-template-areas: 'a0 a1' 'board board' 'a3 a2' 'tray tray';
    height: auto;
    gap: 10px;
    padding: 2px 12px calc(16px + env(safe-area-inset-bottom));
  }
  .log-wrap { display: none; }
  .board-wrap { height: auto; justify-self: center; margin: 4px 0 10px; }
  .pcard-slot, .a0, .a1, .a2, .a3 { align-self: stretch; }
  .pcard { padding: 8px 10px; gap: 8px; border-radius: 18px; height: 100%; }
  .pcard.active { transform: scale(1.02); }
  .pc-avatar { width: 46px; height: 46px; }
  .pc-emoji { width: 36px; height: 36px; font-size: 20px; }
  .pc-name { font-size: 14.5px; }
  .pc-pieces i { width: 9px; height: 9px; }
  .pc-tags .tag { font-size: 9.5px; padding: 1px 6px; }
  .pc-bubble { font-size: 13px; padding: 5px 10px; }
  .tray {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas: 'dice status' 'dice btn' 'dice hint';
    gap: 6px 16px;
    text-align: left;
    padding: 14px;
    align-items: center;
  }
  .tray-status { grid-area: status; font-size: 17px; }
  .dice-btn { grid-area: dice; width: 112px; height: 112px; }
  .dice { --size: 64px; --half: 32px; }
  .roll-btn { grid-area: btn; }
  .roll-btn kbd { display: none; }
  .tray-hint { grid-area: hint; font-size: 12.5px; }
  #toasts { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); flex-direction: column-reverse; }
  .end-trophy { width: 70px; height: 70px; margin-top: -52px; }
  .pod { width: 30%; }
}

@media (max-width: 420px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .top-actions { gap: 5px; }
  .room-chip { padding: 6px 10px; gap: 6px; }
  .room-chip-label, .room-chip svg { display: none; }
  .net-dot { margin-right: 2px; }
  .icon-btn { width: 35px; height: 35px; border-radius: 11px; font-size: 16px; }
  .share .btn span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  /* Zarın döndüğünü görmek oyunun parçası: kısa da olsa dönsün */
  .dice-cube { transition-duration: 0.45s !important; }
}

/* Dokunmatik cihazlar: arka plan düz geçiş, bulanıklık görünmüyor ama GPU'yu yoruyor */
@media (hover: none) {
  .panel, .topbar, .modal, .toast { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .panel { background: linear-gradient(180deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.05)); }
}

/* Üstteki kartlarda balon aşağı açılır */
.a0 .pc-bubble, .a1 .pc-bubble { bottom: auto; top: calc(100% - 6px); border-radius: 4px 14px 14px 14px; }
.a1 .pc-bubble, .a2 .pc-bubble { right: auto; left: 10px; }
.a2 .pc-bubble { border-radius: 14px 14px 14px 4px; }

/* Çıkış onayı */
.confirm-card { width: min(400px, 100%); padding: 26px 24px 22px; text-align: center; animation: pop 0.45s var(--ease-spring); background: linear-gradient(180deg, #2a2070, #1a1448); }
.confirm-ico { width: 60px; height: 60px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; color: #ffb3c0; background: rgba(255, 90, 115, 0.16); box-shadow: inset 0 0 0 2px rgba(255, 90, 115, 0.35); }
.confirm-card h2 { font-family: var(--font-display); font-size: 25px; margin: 10px 0 6px; }
.confirm-card p { color: var(--muted); font-weight: 700; margin: 0 0 20px; line-height: 1.45; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-actions .btn { justify-content: center; }

/* Bağlantı şeridi */
.net-banner {
  position: fixed; left: 50%; top: calc(var(--top) + 6px); transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 999px;
  background: #3a1030; box-shadow: inset 0 0 0 1.5px rgba(255, 90, 115, 0.6), 0 14px 30px -10px rgba(0, 0, 0, 0.6);
  font-weight: 800; font-size: 14px; color: #ffd1da; white-space: nowrap; animation: toastIn 0.4s var(--ease-spring);
}
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid rgba(255, 209, 218, 0.3); border-top-color: #ffd1da; animation: spin 0.8s linear infinite; }

/* Süre azalınca kırmızı halka */
.pcard.hurry .pc-timer .prog { stroke: var(--danger); }
.pcard.hurry .pc-avatar { animation: hurry 0.5s ease-in-out infinite alternate; }
@keyframes hurry { to { transform: scale(1.06); } }

/* Hamle izi */
.trail { transform-box: fill-box; transform-origin: center; animation: trail 1.6s ease-out forwards; pointer-events: none; }
@keyframes trail { 0% { opacity: 0.75; transform: scale(1); } 100% { opacity: 0; transform: scale(0.3); } }

/* Mobil: her şey kaydırmadan sığar, hızlı mesajlar açılır menüde */
@media (max-width: 920px) {
  .board-wrap { width: min(100%, calc(100dvh - 372px)); min-width: 260px; }
  .tray {
    position: relative;
    z-index: 8;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: 'dice status chat' 'dice btn btn' 'dice hint hint';
    padding: 10px 12px;
    gap: 4px 14px;
  }
  .dice-btn { width: 92px; height: 92px; }
  .dice { --size: 54px; --half: 27px; }
  .tray-status { font-size: 16px; }
  .chat-btn { display: grid; grid-area: chat; width: 36px; height: 36px; border-radius: 12px; justify-self: end; }
  .chat-btn[aria-expanded='true'] { background: rgba(138, 123, 255, 0.35); }
  .emotes {
    position: absolute; right: 8px; bottom: calc(100% + 8px); z-index: 10;
    display: grid; grid-template-columns: repeat(2, auto); gap: 6px; padding: 10px;
    border-radius: 18px; background: #241c5c; box-shadow: inset 0 0 0 1px var(--line), 0 20px 40px -10px rgba(0, 0, 0, 0.7);
    opacity: 0; transform: translateY(8px) scale(0.96); pointer-events: none; transform-origin: bottom right;
    transition: opacity 0.18s, transform 0.25s var(--ease-spring); overflow: visible;
  }
  .emotes.open { opacity: 1; transform: none; pointer-events: auto; }
  .emotes button { height: 38px; font-size: 14px; }
  .roll-btn { padding: 11px 16px; }
  .home { padding-top: 18px; }
  .hero-pawns { height: 58px; gap: 12px; }
  .hp { transform-origin: bottom; scale: 0.8; }
  .logo { font-size: clamp(46px, 13vw, 84px); margin: 6px 0 10px; }
}

/* Mobil ana ekran: düğmeler ekranın ilk görünümünde kalsın */
@media (max-width: 920px) {
  .home { grid-template-columns: minmax(0, 1fr); }
  .home-card, .hero { min-width: 0; }
  .avatars { display: flex; overflow-x: auto; gap: 7px; padding: 3px 3px 6px; margin: 0 -3px; scrollbar-width: none; scroll-snap-type: x proximity; mask-image: linear-gradient(90deg, #000 88%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .avatars::-webkit-scrollbar { display: none; }
  .avatars button { flex: 0 0 42px; height: 42px; scroll-snap-align: start; }
  .home-card { gap: 8px; }
  .home-actions { gap: 12px; margin-top: 8px; }
}
@media (max-width: 920px) and (max-height: 760px) {
  .hero-pawns { display: none; }
  .logo { font-size: clamp(40px, 11vw, 64px); margin: 4px 0 8px; }
  .tagline { font-size: 14.5px; }
  .home { padding-top: 6px; }
}

.log:empty::before { content: 'Zar atışları, kırılan taşlar ve hamleler burada görünecek.'; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.45; opacity: 0.7; }

/* Sıradaki oyuncunun ev bölgesi parlar */
.zone-glow { opacity: 0; transition: opacity 0.4s; }
.zone-glow.on { animation: zoneGlow 1.5s ease-in-out infinite; }
@keyframes zoneGlow { 0%, 100% { opacity: 0.18; } 50% { opacity: 0.6; } }

/* Gidilecek kare işaretleri */
.dest-layer { pointer-events: none; }
.dest-mark { animation: dotIn 0.3s var(--ease-spring); opacity: 0.85; }
.dest-mark .spin { transform-box: fill-box; transform-origin: center; animation: spin 6s linear infinite; }

/* Kartta atılan zar */
.pc-roll {
  position: absolute; left: -6px; top: -6px; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 15px;
  color: #1d1747; background: #fff; box-shadow: 0 3px 0 #c9bfae, 0 0 0 2px var(--c);
}
.pc-roll:empty { display: none; }
.pc-roll.pop { animation: rollPop 0.45s var(--ease-spring); }
.pc-roll.six { background: var(--gold); box-shadow: 0 3px 0 #b78a0a, 0 0 14px var(--gold); }
@keyframes rollPop { from { transform: scale(0.2) rotate(-40deg); opacity: 0; } }
.pcard.shake { animation: cardHit 0.5s ease; }
@keyframes cardHit { 20% { transform: translateX(-7px) rotate(-2deg); } 40% { transform: translateX(7px) rotate(2deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* İstek beklerken */
body.pending .home-actions .btn, body.pending .join-row .btn { pointer-events: none; opacity: 0.7; }
body.pending .home-card { cursor: progress; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kazananın taşları sevinçle zıplar */
.piece.celebrate .pawn { animation: cheer 0.9s var(--ease-spring) infinite; animation-delay: var(--d, 0s); }
@keyframes cheer { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-26px) rotate(-8deg) scale(1.08); } 55% { transform: translateY(0) rotate(4deg) scale(1.04, 0.94); } }

/* Yatay telefon: yükseklik az, tahta ortada tam boy, oyuncular ve zar iki yanda; kaydırma yok */
@media (orientation: landscape) and (max-height: 560px) {
  :root { --top: 46px; }
  .topbar { padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
  .brand-text { display: none; }
  .icon-btn { width: 34px; height: 34px; border-radius: 11px; font-size: 15px; }
  .room-chip { padding: 5px 10px; }

  .game {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: 'a0 board a1' 'log board tray' 'a3 board a2';
    height: calc(100dvh - var(--top));
    gap: 8px 12px;
    padding: 2px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
  .board-wrap {
    width: auto;
    min-width: 0;
    height: calc(100dvh - var(--top) - 30px - env(safe-area-inset-bottom));
    max-width: calc(100vw - 2 * 150px);
    margin-bottom: 14px;
    margin-top: 0;
    align-self: center;
    justify-self: center;
  }
  .turn-pill { font-size: 12px; }
  .log-wrap { display: flex; padding: 8px 10px; gap: 6px; height: auto; align-self: stretch; }
  .log-wrap h3, .log-title { font-size: 10px; }
  .log li { font-size: 12px; }
  .pcard { padding: 6px 8px; gap: 7px; border-radius: 14px; }
  .pc-avatar { width: 36px; height: 36px; }
  .pc-emoji { width: 28px; height: 28px; font-size: 16px; }
  .pc-name { font-size: 13px; }
  .pc-pieces i { width: 7px; height: 7px; }

  .tray {
    position: relative;
    z-index: 8;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: 'dice status chat' 'dice btn btn' 'dice hint hint';
    gap: 4px 10px;
    padding: 8px 10px;
    min-width: 0;
    text-align: left;
    align-items: center;
    align-self: center;
  }
  .tray-status { grid-area: status; font-size: 14px; }
  .dice-btn { grid-area: dice; width: 64px; height: 64px; }
  .dice { --size: 40px; --half: 20px; }
  .roll-btn { grid-area: btn; padding: 8px 10px; font-size: 15px; min-width: 0; }
  .tray-status, .tray-hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .roll-btn kbd { display: none; }
  .tray-hint { grid-area: hint; font-size: 11px; }
  .chat-btn { display: grid; grid-area: chat; width: 30px; height: 30px; border-radius: 10px; justify-self: end; }
  .emotes {
    position: absolute; right: 6px; bottom: calc(100% + 6px); z-index: 10;
    display: grid; grid-template-columns: repeat(2, auto); gap: 6px; padding: 8px;
    border-radius: 16px; background: #241c5c; box-shadow: inset 0 0 0 1px var(--line), 0 20px 40px -10px rgba(0, 0, 0, 0.7);
    opacity: 0; transform: translateY(8px) scale(0.96); pointer-events: none; transform-origin: bottom right;
    transition: opacity 0.18s, transform 0.25s var(--ease-spring);
  }
  .emotes.open { opacity: 1; transform: none; pointer-events: auto; }
  .emotes button { height: 32px; font-size: 13px; }
}
