:root {
  --bg: #1b1612;
  --bg-2: #231c17;
  --panel: #2c241e;
  --panel-2: #372d25;
  --line: #4a3d32;
  --text: #f3e9d8;
  --muted: #b3a38c;
  --lib: #3f7fb4;
  --lib-2: #7fb3dd;
  --lib-bg: #1d3246;
  --fas: #c0392b;
  --fas-2: #ec7a66;
  --fas-bg: #45201b;
  --gold: #e3a92b;
  --good: #5fb07a;
  --radius: 14px;
  --display: 'Oswald', 'Impact', 'Arial Narrow', sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at top, rgba(192, 57, 43, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
input {
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
}
input:focus { border-color: var(--gold); }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.lib { color: var(--lib-2); font-weight: 600; }
.fas { color: var(--fas-2); font-weight: 600; }

/* ---------- butonlar ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 10px;
  padding: 11px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #231a0c; }
.btn.primary:hover { background: #f0b940; }
.btn.danger { background: var(--fas); border-color: var(--fas); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn.tiny { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn.wide { width: 100%; }
.link-btn {
  background: none; border: none; color: var(--muted); text-decoration: underline;
  cursor: pointer; padding: 8px; font-size: 14px;
}

/* ---------- genel ---------- */
.conn, .toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50;
  padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px;
  max-width: calc(100% - 32px); text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
.conn { top: 12px; background: var(--fas); color: #fff; }
.toast { bottom: 20px; background: #f3e9d8; color: #231a0c; animation: pop .2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }

.chip {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.gold { background: rgba(227, 169, 43, .15); border-color: var(--gold); color: var(--gold); }
.chip.muted-chip { color: var(--muted); }
.chip.dead-chip { color: var(--fas-2); border-color: var(--fas); }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--fas);
  color: #fff; font-size: 11px; line-height: 18px; text-align: center; margin-left: 3px;
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #777; margin-right: 6px; vertical-align: middle; }
.dot.on { background: var(--good); }

/* ---------- ana sayfa ---------- */
#home { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px 16px; }
.home-card {
  width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.logo {
  font-family: var(--display); font-weight: 700; text-align: center; font-size: 44px; line-height: 1.15;
  letter-spacing: 4px; color: var(--text);
}
.logo span { display: block; color: var(--fas); font-size: 58px; letter-spacing: 6px; margin-top: 2px; }
.tagline { margin: -4px 0 6px; text-align: center; color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 4px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 8px; }
#code-input { text-transform: uppercase; letter-spacing: 6px; font-family: var(--display); font-size: 20px; text-align: center; }

/* ---------- lobi ---------- */
.lobby-wrap {
  max-width: 980px; margin: 0 auto; padding: 20px 16px 32px;
  display: grid; gap: 20px; grid-template-columns: 1fr;
}
@media (min-width: 820px) { .lobby-wrap { grid-template-columns: 1fr 360px; padding-top: 40px; } }
.lobby-main { display: flex; flex-direction: column; gap: 14px; }
.room-code-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; text-align: center;
}
.room-code { font-family: var(--display); font-size: 56px; letter-spacing: 12px; color: var(--gold); line-height: 1.1; }
.share-row { display: flex; gap: 8px; margin-top: 10px; }
.share-row input { font-size: 13px; padding: 8px 10px; }
.section-title { font-family: var(--display); font-weight: 500; letter-spacing: 1px; font-size: 20px; }
.lobby-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lobby-players li {
  display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line);
  padding: 10px 12px; border-radius: 10px;
}
.lobby-players li.offline { opacity: .55; }
.lp-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lobby-info { margin: 0; color: var(--text); font-size: 14px; }
.lobby-actions { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.lobby-side { min-height: 320px; display: flex; }

/* ---------- sohbet ---------- */
.chat-box {
  display: flex; flex-direction: column; width: 100%; min-height: 0; flex: 1;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.chat-list { list-style: none; margin: 0; padding: 12px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 200px; max-height: 60vh; }
.chat-list li { font-size: 14px; word-wrap: break-word; }
.chat-list li b { color: var(--gold); margin-right: 4px; }
.chat-list li.mine b { color: var(--lib-2); }
.chat-list li.sys { color: var(--muted); font-size: 12px; font-style: italic; }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chat-form input { padding: 9px 12px; }

/* ---------- oyun düzeni ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: rgba(27, 22, 18, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; }
.topbar-right { display: flex; gap: 6px; }
.logo-small { font-family: var(--display); letter-spacing: 2px; font-size: 18px; }
.logo-small b { color: var(--fas); margin-left: 3px; }
.role-btn { border-color: var(--gold); }

.game-layout {
  max-width: 1280px; margin: 0 auto; padding: 14px 16px 32px;
  display: grid; gap: 16px; grid-template-columns: 1fr;
}
@media (min-width: 1000px) {
  .game-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .game-side { position: sticky; top: 70px; height: calc(100vh - 90px); }
}
.game-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.game-side {
  display: flex; flex-direction: column; min-height: 340px; max-height: 70vh;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
@media (min-width: 1000px) { .game-side { max-height: none; } }

/* ---------- tahtalar ---------- */
.boards { display: grid; gap: 10px; }
@media (min-width: 760px) {
  .boards { grid-template-columns: 5fr 6fr; align-items: start; }
  .board-meta { grid-column: 1 / -1; }
}
.board { border-radius: var(--radius); padding: 10px; border: 2px solid; }
.liberal-board { background: var(--lib-bg); border-color: var(--lib); }
.fascist-board { background: var(--fas-bg); border-color: var(--fas); }
.board-head {
  display: flex; justify-content: space-between; font-family: var(--display); letter-spacing: 3px;
  font-size: 15px; margin-bottom: 8px; padding: 0 2px;
}
.liberal-board .board-head { color: var(--lib-2); }
.fascist-board .board-head { color: var(--fas-2); }
.board-count { letter-spacing: 1px; opacity: .8; }
.slots { display: grid; gap: 6px; }
.slots.five { grid-template-columns: repeat(5, 1fr); }
.slots.six { grid-template-columns: repeat(6, 1fr); }
.slot {
  aspect-ratio: 5 / 7; border: 1.5px dashed rgba(255,255,255,.22); border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-align: center; padding: 2px; position: relative; min-width: 0;
}
.slot.danger-zone { background: rgba(0,0,0,.18); }
.slot-ico { font-size: clamp(16px, 4vw, 24px); line-height: 1; }
.slot-txt { font-size: clamp(8px, 2.1vw, 11px); color: var(--muted); font-weight: 600; line-height: 1.1; }
.slot-mark {
  position: absolute; bottom: 3px; left: 0; right: 0; font-size: clamp(7px, 1.8vw, 9px);
  color: var(--fas-2); font-weight: 700; line-height: 1.05;
}
.board-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 4px; }
.tracker { display: flex; align-items: center; gap: 7px; }
.tdot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); display: inline-block; }
.tdot.on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 8px var(--gold); }
.tdot.last:not(.on) { border-color: var(--fas-2); }

/* ---------- yasa kartları ---------- */
.policy {
  aspect-ratio: 5 / 7; border-radius: 8px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; font-family: var(--display); letter-spacing: 1px; min-width: 0;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.18), 0 3px 8px rgba(0,0,0,.35);
}
.policy.new { animation: flip .5s ease-out; }
@keyframes flip { from { transform: rotateY(90deg); } }
.policy.liberal { background: linear-gradient(160deg, #4d8fc6, #2b5f8c); color: #eaf4ff; }
.policy.fascist { background: linear-gradient(160deg, #d44a3a, #8e2419); color: #fff0ec; }
.policy .pi { font-size: clamp(16px, 4.5vw, 30px); line-height: 1; }
.policy .pt { font-size: clamp(7px, 2vw, 13px); }

.hand { display: flex; gap: 12px; justify-content: center; margin: 12px 0; }
.hand .policy, .card-btn { width: 96px; max-width: 30%; }
.hand .card-btn .policy { width: 100%; max-width: none; }
.card-btn {
  background: none; border: 3px solid transparent; border-radius: 12px; padding: 3px; cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.card-btn:hover { transform: translateY(-3px); }
.card-btn.selected { border-color: var(--gold); transform: translateY(-6px); }
.card-btn .pt { font-size: 13px; }
.card-btn .pi { font-size: 30px; }
.hand > .policy .pt { font-size: 13px; }
.hand > .policy .pi { font-size: 30px; }

/* ---------- aksiyon paneli ---------- */
.action-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  min-height: 90px;
}
.action-panel.my-turn { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 24px rgba(227,169,43,.18); }
.action-panel h3 { font-family: var(--display); font-weight: 500; letter-spacing: 1px; font-size: 20px; margin-bottom: 4px; }
.action-panel p { margin: 4px 0; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; justify-content: center; }
.vote-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 6px; }
.vote-btn {
  font-family: var(--display); font-size: 30px; letter-spacing: 2px; padding: 14px 8px; border-radius: 12px;
  border: 3px solid transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center;
  line-height: 1.1; transition: transform .08s, opacity .15s;
}
.vote-btn small { font-family: var(--body); font-size: 12px; letter-spacing: 0; opacity: .8; }
.vote-btn:active { transform: scale(.97); }
.vote-btn.ja { background: #eae0cb; color: #1f1a14; }
.vote-btn.nein { background: #1b1612; color: #eae0cb; border-color: #5b4d40; }
.vote-row:has(.chosen) .vote-btn:not(.chosen) { opacity: .4; }
.vote-btn.chosen { border-color: var(--gold); }
.dead-note { background: var(--fas-bg); border: 1px solid var(--fas); padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; font-size: 14px; }

.gameover { text-align: center; padding: 8px 0; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.go-title { font-family: var(--display); font-size: 32px; letter-spacing: 2px; }
.gameover.liberal .go-title { color: var(--lib-2); }
.gameover.fascist .go-title { color: var(--fas-2); }
.go-reason { font-size: 17px; font-weight: 600; }

/* ---------- oyuncular ---------- */
.players { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 560px) { .players { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .players { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.pcard {
  text-align: left; background: var(--panel); border: 2px solid var(--line); border-radius: 12px;
  padding: 10px; display: flex; flex-direction: column; gap: 5px; cursor: default; min-height: 82px;
  transition: transform .1s, border-color .15s, opacity .15s; position: relative; min-width: 0;
}
.pcard.me { background: var(--panel-2); }
.pcard.role-fascist, .pcard.role-hitler { border-color: var(--fas); }
.pcard.role-liberal:not(.me) { border-color: var(--lib); }
.pcard.dead { opacity: .5; }
.pcard.dead .pname { text-decoration: line-through; }
.pcard.selectable { cursor: pointer; border-style: dashed; border-color: var(--gold); }
.pcard.selectable:hover { transform: translateY(-2px); }
.pcard.selected { border-style: solid; background: rgba(227,169,43,.16); box-shadow: 0 0 0 2px var(--gold); }
.pcard.dim { opacity: .45; }
.pname { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.prole { font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.prole.liberal { color: var(--lib-2); }
.prole.fascist, .prole.hitler { color: var(--fas-2); }
.vstat { font-size: 12px; color: var(--muted); }
.vstat.done { color: var(--good); font-weight: 600; }
.vote {
  font-family: var(--display); font-size: 16px; letter-spacing: 1px; align-self: flex-start;
  padding: 1px 10px; border-radius: 6px;
}
.vote.ja { background: #eae0cb; color: #1f1a14; }
.vote.nein { background: #0e0b09; color: #eae0cb; border: 1px solid #5b4d40; }

/* ---------- yan panel ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; background: none; border: none; padding: 11px 6px; font-weight: 600; font-size: 14px;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--gold); }
.tab-body { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }
.tab-body .chat-box { border: none; border-radius: 0; }
.tab-body .chat-list { max-height: none; }
.log { list-style: none; margin: 0; padding: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.log li { padding-left: 10px; border-left: 3px solid var(--line); }
.log li.liberal { border-left-color: var(--lib); color: var(--lib-2); }
.log li.fascist { border-left-color: var(--fas); color: var(--fas-2); }
.log li.danger { border-left-color: var(--fas); font-weight: 600; }
.log li.good { border-left-color: var(--good); }
.log li.bad { border-left-color: #8a6b4f; color: var(--muted); }
.log li.info { border-left-color: var(--gold); }
.notes-hint { margin: 12px 12px 0; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 40; background: rgba(10, 8, 6, .78); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px; overflow-y: auto;
}
.modal-card {
  width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 14px;
  animation: pop2 .18s ease-out;
}
@keyframes pop2 { from { opacity: 0; transform: scale(.96); } }
.modal-card h2 { font-family: var(--display); font-weight: 500; letter-spacing: 1px; }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.rules p { margin: 0 0 10px; font-size: 14px; }

.role-reveal { cursor: pointer; }
.role-card {
  border-radius: 14px; aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; text-align: center; user-select: none;
}
.role-card.hidden-face {
  background: repeating-linear-gradient(45deg, #3a2f26, #3a2f26 12px, #332921 12px, #332921 24px);
  border: 2px solid var(--line); font-weight: 700; color: var(--muted);
}
.role-card.hidden-face span { font-size: 40px; }
.role-card.face { animation: flip .35s ease-out; }
.role-card.liberal { background: linear-gradient(160deg, #4d8fc6, #1f4b70); }
.role-card.fascist { background: linear-gradient(160deg, #d44a3a, #6e1a12); }
.role-card.hitler { background: linear-gradient(160deg, #3a3a3a, #0d0d0d); border: 3px solid var(--fas); }
.role-kicker { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; opacity: .8; }
.role-name { font-family: var(--display); font-size: 48px; letter-spacing: 4px; line-height: 1; }
.role-party { font-size: 13px; opacity: .9; }
.role-info { font-size: 14px; background: var(--bg-2); padding: 12px; border-radius: 10px; }

/* ---------- ipuçları ---------- */
.hints {
  background: rgba(227, 169, 43, .07); border: 1px dashed rgba(227, 169, 43, .45);
  border-radius: var(--radius); padding: 10px 14px 12px; margin-top: -4px;
}
.hints-head {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--gold); font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
.hints-head .link-btn { padding: 2px 4px; font-size: 12px; }
.hints ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 5px; }
.hints li { font-size: 13.5px; line-height: 1.45; color: var(--text); }
.hints li b { color: var(--gold); }
.hints li.warn { color: var(--fas-2); }
.hints li.warn b { color: #ff9c8a; }

#boards [data-info], #players [data-info] { cursor: help; }
#boards .board-head, #boards .slot[data-info] { transition: filter .15s; }
#boards .slot[data-info]:hover, #boards .tracker:hover, #boards .piles:hover { filter: brightness(1.25); }
.tracker, .piles { padding: 4px 6px; border-radius: 8px; }
.info-dot {
  display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px;
  border-radius: 50%; border: 1px solid var(--muted); color: var(--muted);
  font: italic 700 10px/1 Georgia, serif; vertical-align: middle;
}
.board-tip { grid-column: 1 / -1; font-size: 12px; color: var(--muted); padding: 0 4px; }
.info-text { font-size: 15px; line-height: 1.55; margin: 0 0 16px; }
.info-text b { color: var(--gold); }

.intro-box {
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: 10px; padding: 12px 14px;
}
.intro-title { font-weight: 700; color: var(--gold); font-size: 14px; margin-bottom: 4px; }
.intro-box ul { margin: 0; padding-left: 18px; display: grid; gap: 5px; }
.intro-box li { font-size: 13.5px; line-height: 1.45; }
