/* ─────────────────────────────────────────────────────────────────────────────
   Vampir Köylü — arayüz stilleri
   Gece/gündüz atmosferi + responsive (dikey ve yatay). Ağır görsel cila sonra;
   bu katman "oynanabilir ve güzel" ilk sürüm.
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  --koy: #c9a227;
  --vampir: #b3123b;
  --danger: #e03e3e;
  --ok: #2e9e6b;
  --text: #f3ecd9;
  --text-dim: #b8ad93;
  --card-bg: rgba(20, 16, 28, 0.82);
  --card-border: rgba(255, 255, 255, 0.09);
  --btn-bg: rgba(255, 255, 255, 0.07);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: #0a0713;
  user-select: none;
}

.hidden {
  display: none !important;
}

/* ── Phaser köy sahnesi (arka plan) ─────────────────────────────────────────── */
.village-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(151, 205, 91, 0.95), rgba(72, 132, 53, 0.98));
}
.village-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Eski CSS sahnesi — Phaser aktifken gizli (yedek) ───────────────────────── */
.scene {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.sky {
  position: absolute;
  inset: 0;
  transition: background 2.5s ease;
  background: linear-gradient(180deg, #0b1026 0%, #1a1636 45%, #2a1e3a 100%);
}
.scene.day .sky {
  background: linear-gradient(180deg, #7db6e8 0%, #bcd9f0 55%, #e8d9b0 100%);
}
.scene.night .sky {
  background: linear-gradient(180deg, #05060f 0%, #0e0b23 50%, #1c1030 100%);
}

.stars {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 2.5s ease;
  background-image:
    radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 60% 20%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 80% 40%, #fff, transparent),
    radial-gradient(1px 1px at 35% 15%, #fff, transparent),
    radial-gradient(1px 1px at 50% 50%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 10% 45%, #fff, transparent),
    radial-gradient(1px 1px at 90% 25%, #fff, transparent);
  animation: twinkle 4s ease-in-out infinite;
}
.scene.night .stars {
  opacity: 0.9;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.4; }
}

.celestial {
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  transition: transform 2.5s ease, opacity 2.5s ease;
  top: 12%;
}
.sun {
  right: 18%;
  background: radial-gradient(circle at 40% 40%, #fff6d5, #ffcf5c 60%, #ffb020);
  box-shadow: 0 0 60px 12px rgba(255, 190, 70, 0.6);
  opacity: 0;
  transform: translateY(40px) scale(0.8);
}
.scene.day .sun {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.moon {
  left: 18%;
  background: radial-gradient(circle at 35% 35%, #fdfdf5, #d6d8e8 60%, #9ea3c4);
  box-shadow: 0 0 40px 8px rgba(200, 205, 240, 0.35);
  opacity: 0;
  transform: translateY(40px) scale(0.8);
}
.scene.night .moon {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.hills {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32%;
  background: linear-gradient(180deg, #14301f, #0a1c13);
  clip-path: polygon(0 60%, 15% 45%, 35% 58%, 55% 40%, 75% 55%, 100% 42%, 100% 100%, 0 100%);
  transition: filter 2.5s ease;
}
.scene.day .hills {
  background: linear-gradient(180deg, #3f7a4a, #245231);
}

.village {
  position: absolute;
  bottom: 6%;
  left: 0;
  right: 0;
  height: 22%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6%;
  filter: brightness(0.5);
  transition: filter 2.5s ease;
}
.scene.day .village {
  filter: brightness(1);
}
.house {
  position: relative;
  width: 12vw;
  max-width: 90px;
  height: 60%;
  background: #2a2038;
  border-radius: 3px 3px 0 0;
}
.scene.day .house {
  background: #6b4f3a;
}
.house::before {
  content: "";
  position: absolute;
  top: -22px;
  left: -6%;
  width: 112%;
  height: 24px;
  background: #1a1326;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}
.scene.day .house::before {
  background: #8a3b2e;
}
/* Gece pencere ışıkları */
.house::after {
  content: "";
  position: absolute;
  bottom: 30%;
  left: 30%;
  width: 22%;
  height: 22%;
  background: #ffcf5c;
  opacity: 0;
  box-shadow: 0 0 8px 2px rgba(255, 207, 92, 0.7);
  transition: opacity 2.5s ease;
}
.scene.night .house::after {
  opacity: 0.85;
}
.house.h1 { height: 55%; }
.house.h3 { height: 68%; }
.house.h4 { height: 50%; }

/* Gece kırmızı vurgu (tehlike hissi) */
.scene.night::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 120%, rgba(179, 18, 59, 0.18), transparent 60%);
}

/* ── Üst çubuk ───────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  background: linear-gradient(180deg, rgba(6, 4, 12, 0.85), transparent);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.phase-badge {
  font-weight: 700;
  font-size: 15px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--btn-bg);
  border: 1px solid var(--card-border);
}
.phase-badge.night { background: rgba(80, 40, 130, 0.5); }
.phase-badge.day { background: rgba(200, 150, 40, 0.35); }
.phase-badge.voting { background: rgba(179, 18, 59, 0.4); }
.round-info {
  font-size: 13px;
  color: var(--text-dim);
}
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 18px;
  min-width: 44px;
  text-align: right;
}
.timer.urgent { color: var(--danger); }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.leave-room-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(20, 16, 28, 0.65);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

/* ── Ana içerik ──────────────────────────────────────────────────────────────── */
.app {
  position: relative;
  z-index: 5;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 64px) 16px calc(var(--safe-bottom) + 64px);
  overflow-y: auto;
}

.card {
  width: 100%;
  max-width: 460px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 22px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.24) transparent;
}
.card::-webkit-scrollbar { width: 6px; }
.card::-webkit-scrollbar-track { background: transparent; }
.card::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.24); border-radius: 999px; }
body.in-room .card {
  position: relative;
  padding-top: 54px;
  background:
    linear-gradient(145deg, rgba(50, 36, 31, 0.94), rgba(18, 31, 23, 0.95));
  border-color: rgba(218, 174, 96, 0.3);
  box-shadow:
    0 22px 55px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 221, 151, 0.09),
    inset 4px 0 0 rgba(139, 86, 43, 0.22);
}
body.in-room .player-chip,
body.in-room .target-btn {
  background: linear-gradient(135deg, rgba(255, 242, 205, 0.065), rgba(94, 61, 37, 0.08));
  border-color: rgba(215, 178, 112, 0.18);
}
body.in-room .btn:not(.primary):not(.gold) {
  border-color: rgba(215, 178, 112, 0.2);
  background: rgba(255, 239, 194, 0.055);
}
.panel-toggle {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(225, 190, 126, 0.25);
  border-radius: 999px;
  background: rgba(8, 14, 10, 0.42);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.panel-toggle:hover { color: var(--text); background: rgba(255, 244, 211, 0.08); }
body.in-room .card.panel-collapsed {
  width: 154px !important;
  min-height: 48px;
  max-height: 48px;
  padding: 0 !important;
  overflow: hidden;
}
.card.panel-collapsed > :not(.panel-toggle) { display: none !important; }
.card.panel-collapsed .panel-toggle {
  inset: 7px;
  width: calc(100% - 14px);
  height: 34px;
}
.card h1 {
  margin: 0 0 6px;
  font-size: 26px;
  text-align: center;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 20px;
}
.subtitle {
  text-align: center;
  color: var(--text-dim);
  margin: 0 0 20px;
  font-size: 14px;
}

/* Formlar */
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  outline: none;
}
input[type="text"]:focus {
  border-color: var(--koy);
}
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(255, 211, 88, 0.8);
  outline-offset: 2px;
}

/* Butonlar */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--btn-bg);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(135deg, #b3123b, #7a0d29);
  border: none;
}
.btn.gold {
  background: linear-gradient(135deg, #c9a227, #9a7c15);
  border: none;
  color: #201a08;
}
.btn.ghost {
  background: transparent;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn + .btn { margin-top: 10px; }

/* Oyuncu listesi (lobi) */
.players {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  font-size: 14px;
}
.player-chip.dead {
  opacity: 0.4;
  text-decoration: line-through;
}
.player-chip .host-tag {
  font-size: 11px;
  color: var(--koy);
}
.player-chip .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6b5b8a, #2a2038);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.player-chip.disconnected .avatar { filter: grayscale(1); opacity: 0.6; }
.lobby-title {
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  margin: -4px 0 8px;
  color: #ffdc76;
}
.lobby-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  margin: -8px 0 10px;
}
.lobby-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b3123b, #e8bd32);
  transition: width .3s ease;
}
.lobby-settings {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid rgba(215, 178, 112, 0.2);
  border-radius: 12px;
  background: rgba(15, 20, 16, 0.32);
}
.lobby-settings summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  color: #f4dfaa;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}
.lobby-settings summary::-webkit-details-marker { display: none; }
.lobby-settings summary::after { content: '▾'; color: var(--text-dim); }
.lobby-settings:not([open]) summary::after { content: '▸'; }
.lobby-settings summary span {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 500;
}
.settings-section {
  padding: 10px 13px 12px;
  border-top: 1px solid rgba(215, 178, 112, 0.13);
}
.settings-section h3 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 8px;
  color: #dcc98f;
  font-size: 12px;
}
.settings-section h3 small { color: var(--text-dim); font-weight: 500; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 5px 0;
}
.setting-row + .setting-row { border-top: 1px solid rgba(255, 255, 255, 0.055); }
.setting-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.setting-label i { width: 20px; text-align: center; font-style: normal; }
.stepper {
  display: grid;
  grid-template-columns: 30px minmax(54px, auto) 30px;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(220, 190, 128, 0.2);
  border-radius: 9px;
}
.stepper button {
  width: 30px;
  height: 30px;
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: #ffe399;
  font-size: 18px;
  cursor: pointer;
}
.stepper button:disabled { opacity: 0.25; cursor: not-allowed; }
.stepper b { padding: 0 6px; text-align: center; color: #fff5d7; font-size: 12px; }
.setting-row.calculated > b {
  min-width: 116px;
  color: #cfe9a3;
  text-align: center;
}
.settings-help {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.45;
}

/* Rol kartı */
.role-card {
  text-align: center;
}
.role-emoji {
  font-size: 64px;
  line-height: 1;
  margin: 6px 0 10px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
}
.role-hero {
  display: flex;
  justify-content: center;
  margin: 4px 0 8px;
  animation: hero-pop 0.5s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.role-hero svg {
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55));
  animation: hero-float 3.2s ease-in-out infinite;
}
.role-hero.small svg { animation: none; }
@keyframes hero-pop {
  from { transform: scale(0.4); opacity: 0; }
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
.avatar.bean {
  background: none;
  padding: 0;
}
.avatar.bean svg { display: block; }
.role-name {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 4px;
}
.role-team {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.role-team.koy { background: rgba(201, 162, 39, 0.25); color: var(--koy); }
.role-team.vampir { background: rgba(179, 18, 59, 0.3); color: #ff6b8f; }
.role-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-dim);
}
.teammates {
  margin-top: 14px;
  font-size: 13px;
}
.teammates b { color: #ff6b8f; }

/* Aksiyon hedef listesi */
.targets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}
.target-btn {
  padding: 14px 10px;
  border-radius: 12px;
  border: 2px solid var(--card-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.target-btn.selected {
  border-color: #ffd45c;
  background: linear-gradient(135deg, rgba(179, 18, 59, 0.42), rgba(119, 67, 18, 0.35));
  box-shadow: 0 0 0 2px rgba(255, 212, 92, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.selection-check {
  display: block;
  margin-top: 4px;
  color: #ffe28a;
  font-size: 11px;
  font-weight: 800;
}
.selected-choice {
  border-color: #ffd45c !important;
  color: #ffe28a !important;
  background: rgba(154, 100, 23, 0.25) !important;
}
.selection-note {
  margin: 10px 0 0;
  color: #d9c895;
  font-size: 12px;
  text-align: center;
}
.collective-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 107, 143, 0.25);
  border-radius: 12px;
  background: rgba(95, 12, 38, 0.18);
}
.collective-heading,
.collective-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.collective-heading { margin-bottom: 8px; }
.consensus {
  color: #d7b8bf;
  font-size: 11px;
}
.consensus.ready { color: #86e6a3; }
.collective-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.collective-list li {
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text-dim);
  font-size: 12px;
}
.collective-list li b { color: #ffb4c6; }
.collective-list li.pending b { color: #a99b90; font-weight: 500; }
.collective-hint {
  margin: 8px 0 0;
  color: #c9aaa9;
  font-size: 11px;
}
.vote-status {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(229, 188, 99, 0.23);
  border-radius: 12px;
  background: rgba(38, 31, 21, 0.42);
}
.vote-status-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: #f0d895;
  font-size: 12px;
}
.vote-status-heading span { color: var(--text-dim); }
.vote-tally { display: grid; gap: 7px; }
.vote-row {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(70px, 1.4fr) 22px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.vote-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vote-row > b { text-align: right; color: #ffe18b; }
.vote-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}
.vote-bar i {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #b3123b, #e5b447);
  transition: width 0.2s ease;
}
.vote-row.abstain { color: var(--text-dim); }
.vote-row.abstain .vote-bar i { background: #81776b; }
.target-btn:active { transform: scale(0.96); }

/* Olay/açıklama listesi */
.events {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.event {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.35);
  border-left: 3px solid var(--text-dim);
  font-size: 15px;
  line-height: 1.4;
}
.event.death { border-left-color: var(--danger); }
.event.lynch { border-left-color: var(--vampir); }
.event.peaceful, .event.no_lynch { border-left-color: var(--ok); }

/* Sonuç ekranı */
.result-banner {
  font-size: 30px;
  font-weight: 800;
  text-align: center;
  margin: 10px 0;
}
.result-banner.koy { color: var(--koy); }
.result-banner.vampir { color: #ff6b8f; }

/* Oyun Günlüğü (game over) */
.game-history {
  margin-top: 14px;
  border: 1px solid rgba(215, 178, 112, 0.2);
  border-radius: 12px;
  background: rgba(15, 20, 16, 0.32);
  overflow: hidden;
}
.game-history summary {
  padding: 12px 14px;
  color: #f4dfaa;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}
.game-history summary::-webkit-details-marker { display: none; }
.history-content {
  padding: 0 14px 14px;
}
.history-round {
  margin-top: 10px;
  padding: 4px 0;
  font-size: 13px;
  color: #e5c87a;
  border-bottom: 1px solid rgba(215, 178, 112, 0.12);
}
.history-round:first-child { margin-top: 0; }
.history-line {
  padding: 4px 8px;
  margin: 3px 0;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.15);
}
.history-line.death { color: #ffaaa6; }
.history-line.peaceful { color: #86e6a3; }
.history-line.lynch { color: #ff9eaf; }
.h-saved { color: #86e6a3; font-weight: 700; }
.h-hit { color: #86e6a3; font-weight: 700; }
.h-miss { color: #ff8888; font-weight: 700; }

/* Son söz hakkı */
.last-words-card { text-align: center; }
.last-words-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}
.last-words-header h2 { margin: 0; }
.last-words-avatar svg { display: block; }
.last-words-label {
  font-size: 15px;
  font-weight: 700;
  color: #ffb74d;
  margin: 0 0 14px;
  animation: pulse-text 1.8s ease-in-out infinite;
}
@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.last-words-stage {
  padding: 18px;
  border-radius: 12px;
  background: rgba(179, 18, 59, 0.15);
  border: 1px solid rgba(255, 107, 143, 0.2);
  margin-bottom: 14px;
}
.last-words-icon {
  font-size: 42px;
  margin-bottom: 8px;
}
.condemned-row {
  background: rgba(179, 18, 59, 0.18);
  border-radius: 6px;
  padding: 2px 4px;
}

.info-line {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 10px;
}

/* Alt durum çubuğu */
.statusbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 10px 16px calc(var(--safe-bottom) + 10px);
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  background: linear-gradient(0deg, rgba(6, 4, 12, 0.85), transparent);
  min-height: 20px;
  pointer-events: none;
}

/* ── Faz geçiş sinematiği ─────────────────────────────────────────────────────── */
.transition {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  background: radial-gradient(circle at 50% 40%, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.9));
}
.transition.show {
  opacity: 1;
}
.transition.night { background: radial-gradient(circle at 50% 40%, rgba(20, 10, 40, 0.6), rgba(2, 2, 10, 0.94)); }
.transition.day { background: radial-gradient(circle at 50% 30%, rgba(255, 200, 90, 0.28), rgba(10, 8, 20, 0.9)); }
.transition.vote { background: radial-gradient(circle at 50% 40%, rgba(120, 12, 40, 0.5), rgba(5, 2, 8, 0.92)); }
.transition-inner {
  text-align: center;
  transform: translateY(14px);
  transition: transform 0.5s ease;
}
.transition.show .transition-inner { transform: translateY(0); }
.transition-icon {
  font-size: 72px;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.6));
  animation: trans-icon 1.9s ease;
}
@keyframes trans-icon {
  0% { transform: scale(0.5) rotate(-8deg); opacity: 0; }
  25% { transform: scale(1.1) rotate(0); opacity: 1; }
  100% { transform: scale(1); }
}
.transition-title {
  font-size: 30px;
  font-weight: 800;
  margin-top: 10px;
  letter-spacing: 0.5px;
}
.transition-sub {
  font-size: 15px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── Sessize alma düğmesi ──────────────────────────────────────────────────────── */
.mute-btn {
  position: fixed;
  z-index: 20;
  right: 12px;
  bottom: calc(var(--safe-bottom) + 12px);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(20, 16, 28, 0.75);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

/* ── Harita yakınlaştırma ───────────────────────────────────────────────────── */
.map-controls {
  position: fixed;
  z-index: 20;
  left: 12px;
  bottom: calc(var(--safe-bottom) + 12px);
  display: flex;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(20, 16, 28, 0.78);
  backdrop-filter: blur(8px);
}
.map-controls button {
  min-width: 38px;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--card-border);
  background: transparent;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.map-controls button:last-child { border-right: 0; }
.map-controls #zoomReset { min-width: 62px; font-size: 12px; }

/* Geniş ekranda oyun paneli meydanı kapatmaz; sağ kontrol alanına dönüşür. */
@media (orientation: landscape) and (min-width: 900px) {
  body.in-room .app {
    align-items: flex-end;
    padding-left: 24px;
    padding-right: max(24px, 3vw);
  }
  body.in-room .card {
    width: min(430px, 31vw);
    max-width: 430px;
    max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 112px);
    overflow-y: auto;
  }
}

/* ── Yatay (landscape) düzen ──────────────────────────────────────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
  .app {
    padding-top: calc(var(--safe-top) + 52px);
    padding-bottom: calc(var(--safe-bottom) + 12px);
    align-items: flex-end;
    padding-left: 48%;
    padding-right: max(16px, 3vw);
  }
  .card {
    max-width: 620px;
    max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 64px);
    padding: 16px 20px;
    overflow-y: auto;
  }
  .card h1 { font-size: 22px; }
  .card h2 { margin-bottom: 8px; }
  .subtitle { margin-bottom: 12px; }
  .field { margin-bottom: 9px; }
  input[type="text"] { padding: 10px 12px; }
  .btn { padding: 10px; }
  .players { margin-top: 8px; grid-template-columns: repeat(2, minmax(110px, 1fr)); }
  .player-chip { padding: 7px 9px; }
  .role-emoji { font-size: 44px; margin: 2px 0 6px; }
  .role-name { font-size: 22px; }
  .targets { grid-template-columns: repeat(3, 1fr); }
  .celestial { top: 8%; }
  .map-controls { bottom: calc(var(--safe-bottom) + 8px); }
  .mute-btn { bottom: calc(var(--safe-bottom) + 8px); }
}

/* Küçük yükseklikte köy sahnesini kısalt */
/* Dikey mobil: harita üstte, karar/etkileşim alanı ayrı bir alt panelde. */
@media (orientation: portrait) and (max-width: 600px) {
  body.in-room .village-canvas {
    inset: 0 0 auto;
    height: 46vh;
    height: 46svh;
  }
  body.in-room .app {
    position: fixed;
    inset: 46vh 0 0;
    inset: 46svh 0 0;
    height: auto;
    justify-content: flex-start;
    align-items: stretch;
    padding: 8px 8px calc(var(--safe-bottom) + 8px);
    overflow: hidden;
    background: linear-gradient(180deg, rgba(13, 24, 17, 0.98), rgba(18, 15, 22, 1));
  }
  body.in-room .card {
    width: 100%;
    max-width: none;
    max-height: 100%;
    border-radius: 16px 16px 8px 8px;
    padding: 50px 16px 16px;
    overflow-y: auto;
  }
  body.in-room .map-controls {
    top: calc(46vh - 48px);
    top: calc(46svh - 48px);
    bottom: auto;
  }
  body.in-room .mute-btn {
    top: calc(46vh - 48px);
    top: calc(46svh - 48px);
    bottom: auto;
  }
  body.in-room.panel-collapsed .village-canvas {
    height: calc(100vh - 64px);
    height: calc(100svh - 64px);
  }
  body.in-room.panel-collapsed .app {
    inset: auto 0 0;
    height: 64px;
    padding: 8px;
    background: transparent;
  }
  body.in-room.panel-collapsed .card {
    align-self: flex-end;
    margin-left: auto;
  }
  body.in-room.panel-collapsed .map-controls,
  body.in-room.panel-collapsed .mute-btn {
    top: auto;
    bottom: calc(var(--safe-bottom) + 72px);
  }
  .targets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Yatay telefon: harita solda kalır, kompakt panel sağ kenara yaslanır. */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 899px) {
  body.in-room .app {
    padding: calc(var(--safe-top) + 48px) 10px calc(var(--safe-bottom) + 8px) 54%;
  }
  body.in-room .card {
    width: 100%;
    max-width: 390px;
    max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 58px);
    padding: 44px 14px 12px;
  }
  body.in-room .card h2 { font-size: 18px; }
  body.in-room .subtitle,
  body.in-room .role-desc { font-size: 12px; margin-bottom: 8px; }
  body.in-room .target-btn,
  body.in-room .player-chip { min-height: 42px; padding: 7px 8px; }
}

@media (max-height: 640px) {
  .celestial { width: 52px; height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
