/* ============================================================
   NOT A FAIR GAME — CSS
   Dark gritty theme, responsive board
   ============================================================ */

:root {
  --bg: #0d0d1a;
  --bg2: #13132b;
  --bg3: #1a1a35;
  --border: #2a2a4a;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --accent: #f59e0b;
  --red: #ef4444;
  --green: #22c55e;
  --blue: #3b82f6;
  --purple: #a855f7;
  --orange: #f97316;
  --shadow: rgba(0,0,0,0.5);
  --board-sq: 88px;
  --glow: 0 0 12px rgba(245, 158, 11, 0.3);
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

/* ============================================================ SCREENS */
.screen { display: none; width: 100vw; height: 100vh; }
.screen.active { display: flex; }

/* ============================================================ LOBBY */
.screen#screen-lobby {
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 60%, #1a1050 0%, #0d0d1a 70%);
}

.lobby-container {
  width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.logo-wrap { text-align: center; }
.logo-main {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fbbf24, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  line-height: 1;
}
.logo-sub {
  font-size: 1.3rem;
  color: var(--accent);
  letter-spacing: 8px;
  margin-top: 4px;
  margin-bottom: 12px;
}
.logo-desc {
  font-size: 0.85rem;
  color: var(--text2);
  line-height: 1.5;
  max-width: 360px;
  margin: 0 auto;
}

.lobby-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.input-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.input-group label { font-size: 0.8rem; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
input[type="text"]:focus { border-color: var(--accent); }
input[type="text"]::placeholder { color: #4a5568; }

.lobby-buttons { display: flex; flex-direction: column; gap: 12px; }
.divider { display: flex; align-items: center; gap: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { color: var(--text2); font-size: 0.8rem; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: 3px; font-weight: 700; }

.lobby-hint { color: var(--text2); font-size: 0.78rem; text-align: center; }

/* ============================================================ BUTTONS */
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-big { width: 100%; padding: 14px; font-size: 1.05rem; margin-top: 8px; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.2rem; padding: 4px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; filter: none !important; }

.error-msg {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.875rem;
  margin-top: 12px;
}
.hidden { display: none !important; }

/* ============================================================ WAITING ROOM */
.screen#screen-waiting {
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px;
}

.waiting-container {
  width: 760px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
}
.room-label { font-size: 0.7rem; color: var(--text2); text-transform: uppercase; letter-spacing: 2px; }
.room-code {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--accent);
  font-family: monospace;
}

.waiting-title { font-size: 1.4rem; font-weight: 700; text-align: center; }
.waiting-hint { color: var(--text2); font-size: 0.85rem; text-align: center; }

.character-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.char-card {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  text-align: center;
}
.char-card:hover:not(.taken) { border-color: var(--accent); transform: translateY(-2px); }
.char-card.selected { border-color: var(--accent); background: rgba(245,158,11,0.1); box-shadow: 0 0 20px rgba(245,158,11,0.2); }
.char-card.taken { opacity: 0.4; cursor: not-allowed; }
.char-card.mine { border-color: #22c55e; background: rgba(34,197,94,0.08); }

.char-emoji { font-size: 2.2rem; display: block; margin-bottom: 6px; }
.char-name { font-size: 0.8rem; font-weight: 700; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.char-desc { font-size: 0.68rem; color: var(--text2); line-height: 1.4; margin-bottom: 10px; }

.char-stats { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.stat-badge {
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.stat-badge.high { color: #86efac; border-color: #22c55e55; }
.stat-badge.low { color: #fca5a5; border-color: #ef444455; }

.taken-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(239,68,68,0.8);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.player-list-wrap { width: 100%; }
.player-list-wrap h3 { font-size: 0.85rem; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.player-list { display: flex; flex-wrap: wrap; gap: 8px; }

.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
}
.player-chip .chip-emoji { font-size: 1.2rem; }
.player-chip.ready { border-color: #22c55e55; }

.waiting-host-note { color: var(--text2); font-size: 0.8rem; text-align: center; }

/* ============================================================ GAME SCREEN */
.screen#screen-game { display: none; flex-direction: row; overflow: hidden; }
.screen#screen-game.active { display: flex; }

.game-layout {
  display: flex;
  width: 100%;
  height: 100vh;
  gap: 0;
}

/* LEFT / RIGHT PANELS */
.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 12px;
  gap: 12px;
  overflow-y: auto;
  flex-shrink: 0;
}
.panel-left { width: 220px; border-left: none; border-top: none; border-bottom: none; }
.panel-right { width: 200px; border-right: none; border-top: none; border-bottom: none; }
.panel-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text2); margin-bottom: 6px; }
.panel-section { display: flex; flex-direction: column; }

.turn-badge {
  background: linear-gradient(135deg, #f59e0b33, #ef444433);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  color: var(--accent);
}
.round-info { text-align: center; font-size: 0.72rem; color: var(--text2); margin-top: 4px; }

/* Player stats in left panel */
.ps-item {
  display: flex;
  flex-direction: column;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 6px;
  transition: border-color 0.3s;
}
.ps-item.active-player { border-color: var(--accent); background: rgba(245,158,11,0.06); }
.ps-item.my-player { border-color: #3b82f655; }

.ps-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.ps-emoji { font-size: 1.2rem; }
.ps-name { font-size: 0.72rem; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-pos { font-size: 0.62rem; color: var(--text2); }

.ps-stats { display: flex; flex-direction: column; gap: 3px; }
.ps-stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
}
.ps-stat-label { color: var(--text2); width: 52px; flex-shrink: 0; }
.ps-stat-bar { flex: 1; height: 5px; background: #1a1a35; border-radius: 3px; overflow: hidden; }
.ps-stat-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }
.ps-stat-val { color: var(--text); font-weight: 700; width: 14px; text-align: right; flex-shrink: 0; }
.ps-turn-left { font-size: 0.6rem; color: var(--text2); margin-top: 4px; }
.ps-skip { font-size: 0.62rem; color: #fca5a5; margin-top: 2px; }

/* Game log */
#game-log {
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.log-entry {
  font-size: 0.68rem;
  color: var(--text2);
  line-height: 1.4;
  padding: 4px 6px;
  background: var(--bg3);
  border-radius: 4px;
  border-left: 2px solid var(--border);
}
.log-entry.good { border-left-color: var(--green); color: #86efac; }
.log-entry.bad { border-left-color: var(--red); color: #fca5a5; }
.log-entry.system { border-left-color: var(--purple); color: #d8b4fe; }
.log-entry.skip { border-left-color: var(--orange); color: #fdba74; }

/* BOARD WRAP */
.board-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a1040 0%, #0d0d1a 70%);
  overflow: hidden;
  padding: 8px;
}

/* BOARD GRID */
.board {
  display: grid;
  grid-template-columns: repeat(10, var(--board-sq));
  grid-template-rows: repeat(6, var(--board-sq));
  gap: 2px;
  position: relative;
  background: #0a0a1a;
  border: 2px solid #2a2a4a;
  border-radius: 8px;
  box-shadow: 0 0 60px rgba(0,0,0,0.8), 0 0 30px rgba(245,158,11,0.1);
}

/* Board center */
.board-center {
  grid-row: 2 / 6;
  grid-column: 2 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: radial-gradient(ellipse at center, #1a0a30 0%, #0a0a1a 80%);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.board-center-title {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #fbbf24, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  line-height: 1.1;
}
.board-center-sub {
  font-size: 0.9rem;
  color: var(--accent);
  letter-spacing: 6px;
  margin-top: 4px;
  text-align: center;
}
.board-center-scales { font-size: 2.8rem; margin-bottom: 8px; }

/* SQUARES */
.square {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 3px;
  position: relative;
  cursor: default;
  border: 1px solid transparent;
  transition: all 0.2s;
  overflow: hidden;
}

.square-emoji { font-size: 1.2rem; line-height: 1; display: none; }
.square-name {
  font-size: 0.48rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  margin-top: 2px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.square-effect {
  font-size: 0.5rem;
  color: rgba(255,255,255,0.8);
  text-align: center;
  line-height: 1.2;
  margin-top: 1px;
}

/* Square types */
.sq-start   { background: #14532d; border-color: #22c55e44; }
.sq-opportunity { background: #14532d; border-color: #16a34a66; }
.sq-negative    { background: #431407; border-color: #f9731666; }
.sq-obstacle    { background: #450a0a; border-color: #ef444466; }
.sq-conditional { background: #422006; border-color: #ca8a0466; }
.sq-corner      { background: #1e3a5f; border-color: #3b82f666; }
.sq-system_draw { background: #3b0764; border-color: #a855f766; }
.sq-special     { background: #3b0764; border-color: #7c3aed66; }
.sq-end         { background: #451a03; border-color: #f59e0b88; }

.square.active-square {
  box-shadow: 0 0 12px rgba(245,158,11,0.8);
  border-color: var(--accent) !important;
  animation: pulse-square 1.2s ease-in-out infinite;
}

@keyframes pulse-square {
  0%, 100% { box-shadow: 0 0 8px rgba(245,158,11,0.6); }
  50%       { box-shadow: 0 0 18px rgba(245,158,11,1); }
}

/* TOKENS */
.tokens-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 2px;
  justify-content: center;
}
.token {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.6);
  font-size: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  position: relative;
  z-index: 10;
}

/* MY STATS panel */
.my-stats-section { flex: 1; }
#my-stats { display: flex; flex-direction: column; gap: 8px; }

.my-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.my-stat-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.my-stat-info { flex: 1; }
.my-stat-name { font-size: 0.65rem; color: var(--text2); }
.my-stat-bar { height: 6px; background: #1a1a35; border-radius: 3px; overflow: hidden; margin-top: 2px; }
.my-stat-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }
.my-stat-val { font-size: 0.9rem; font-weight: 700; color: var(--text); width: 20px; text-align: right; flex-shrink: 0; }

/* DICE */
.dice-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
}
.dice-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.dice {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #1e1e3a, #2d2d5e);
  border: 2px solid #4a4a8a;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  position: relative;
  cursor: default;
  user-select: none;
}
.dice.rolling {
  animation: roll-dice 0.6s ease-in-out;
}
@keyframes roll-dice {
  0%   { transform: rotate(0deg) scale(1); }
  20%  { transform: rotate(-15deg) scale(1.1); }
  40%  { transform: rotate(15deg) scale(1.15); }
  60%  { transform: rotate(-10deg) scale(1.1); }
  80%  { transform: rotate(8deg) scale(1.05); }
  100% { transform: rotate(0deg) scale(1); }
}
.dice-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  min-height: 24px;
  text-align: center;
}
.btn-dice {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  box-shadow: 0 4px 15px rgba(245,158,11,0.3);
}
.btn-dice:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(245,158,11,0.4); }
.btn-dice:disabled { opacity: 0.3; cursor: not-allowed; transform: none; box-shadow: none; }

.turn-note { font-size: 0.72rem; color: var(--text2); text-align: center; line-height: 1.4; }
.turn-note.my-turn { color: #86efac; font-weight: 600; }

/* ============================================================ MODALS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}

.modal-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  animation: modal-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modal-in {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal-emoji { font-size: 3rem; margin-bottom: 8px; }
.modal-square-name { font-size: 1.2rem; font-weight: 800; color: var(--accent); margin-bottom: 8px; }
.modal-desc { font-size: 0.85rem; color: var(--text2); margin-bottom: 16px; line-height: 1.5; }
.modal-effects { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; }

.effect-chip {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid;
}
.effect-chip.positive { background: rgba(34,197,94,0.15); border-color: #22c55e; color: #86efac; }
.effect-chip.negative { background: rgba(239,68,68,0.15); border-color: #ef4444; color: #fca5a5; }
.effect-chip.neutral  { background: rgba(148,163,184,0.15); border-color: #475569; color: #cbd5e1; }

/* System card modal */
.system-card-modal { border-color: #a855f7; }
.system-card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}
.system-card-emoji { font-size: 2.5rem; }
.system-badge {
  background: rgba(168,85,247,0.2);
  border: 1px solid #a855f7;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  color: #d8b4fe;
  font-weight: 700;
  letter-spacing: 1px;
}
.system-card-name { font-size: 1.3rem; font-weight: 800; color: #d8b4fe; margin-bottom: 8px; }
.system-card-desc { font-size: 0.85rem; color: var(--text2); margin-bottom: 16px; line-height: 1.5; }

.system-effects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 20px;
  max-height: 200px;
  overflow-y: auto;
}
.sys-effect-row {
  background: var(--bg3);
  border-radius: 8px;
  padding: 8px;
  text-align: left;
  font-size: 0.75rem;
  border: 1px solid var(--border);
}
.sys-effect-row .player-name { font-weight: 700; color: var(--text); margin-bottom: 4px; }
.sys-effect-row .effect-line { color: var(--text2); }
.sys-effect-row.has-effect { border-color: #a855f755; }

/* ============================================================ GAME OVER */
.screen#screen-gameover {
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px;
  background: radial-gradient(ellipse at 50% 30%, #1a0a30 0%, #0d0d1a 70%);
}

.gameover-container {
  width: 700px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  padding: 20px 0;
}

.gameover-header { text-align: center; }
.gameover-icon { font-size: 4rem; margin-bottom: 12px; }
.gameover-header h1 {
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fbbf24, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.gameover-subtitle { color: var(--text2); margin-top: 8px; }

.scores-list { width: 100%; display: flex; flex-direction: column; gap: 10px; }

.score-card {
  display: flex;
  gap: 16px;
  align-items: stretch;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.score-card.rank-1 { border-color: #fbbf24; box-shadow: 0 0 20px rgba(251,191,36,0.2); }
.score-card.rank-2 { border-color: #94a3b8; }
.score-card.rank-3 { border-color: #cd7c46; }

.score-rank {
  font-size: 2rem;
  font-weight: 900;
  width: 40px;
  text-align: center;
  color: var(--text2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rank-1 .score-rank { color: #fbbf24; }
.rank-2 .score-rank { color: #94a3b8; }
.rank-3 .score-rank { color: #cd7c46; }

.score-info { flex: 1; }
.score-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.score-emoji { font-size: 1.8rem; }
.score-name-wrap { flex: 1; }
.score-player-name { font-weight: 700; font-size: 1rem; }
.score-char-name { font-size: 0.75rem; color: var(--text2); }
.score-total {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent);
}

.score-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.score-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  background: var(--bg3);
  border-radius: 6px;
  padding: 4px 8px;
  border: 1px solid var(--border);
}
.score-stat .sval { font-weight: 700; color: var(--text); }
.score-stat .sdiff { font-size: 0.6rem; }
.score-stat .sdiff.pos { color: #86efac; }
.score-stat .sdiff.neg { color: #fca5a5; }

.score-obstacle {
  font-size: 0.72rem;
  color: #fca5a5;
}

.gameover-insight {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  width: 100%;
}
.gameover-insight h3 { color: var(--accent); margin-bottom: 10px; }
.gameover-insight p { color: var(--text2); line-height: 1.7; font-size: 0.9rem; }

/* ============================================================ STAT COLORS */
.stat-para    { background: linear-gradient(90deg, #f59e0b, #d97706); }
.stat-egitim  { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.stat-saglik  { background: linear-gradient(90deg, #22c55e, #16a34a); }
.stat-sosyalHak { background: linear-gradient(90deg, #a855f7, #9333ea); }
.stat-psikoloji { background: linear-gradient(90deg, #ec4899, #db2777); }

/* ============================================================ LUCIDE ICONS */

.lucide-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}
.lucide-icon svg { display: block; }

/* Stat icon colors */
.stat-para-icon      { color: #f59e0b; }
.stat-egitim-icon    { color: #3b82f6; }
.stat-saglik-icon    { color: #22c55e; }
.stat-sosyalHak-icon { color: #a855f7; }
.stat-psikoloji-icon { color: #ec4899; }

/* ── Character Avatar (Waiting Room) ───────────────────────── */
.char-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--char-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  box-shadow: 0 0 14px rgba(0,0,0,0.4), 0 0 0 0 var(--char-color);
  transition: box-shadow 0.3s;
}
.char-card.selected .char-avatar,
.char-card.mine .char-avatar {
  box-shadow: 0 0 0 3px var(--char-color), 0 0 20px rgba(0,0,0,0.5);
}
.char-card.taken .char-avatar { opacity: 0.5; }
.char-avatar-icon { color: var(--char-color) !important; }
.char-avatar-icon svg { width: 28px; height: 28px; }

/* Stat badge icon */
.stat-badge-icon { display: inline-flex; vertical-align: middle; }
.stat-badge-icon svg { width: 10px; height: 10px; margin-right: 2px; }

/* ── Board Square Icons ─────────────────────────────────────── */
.square-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(0,0,0,0.25);
  flex-shrink: 0;
}
.square-svg-icon { display: flex; align-items: center; justify-content: center; }
.square-svg-icon svg { width: 16px; height: 16px; stroke-width: 2; }

/* ── Player Stats Panel Icons ───────────────────────────────── */
.ps-stat-icon { flex-shrink: 0; }
.ps-stat-icon svg { width: 10px; height: 10px; }
.ps-stat-label {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ── My Stats Panel Icons ───────────────────────────────────── */
.my-stat-lucide { display: flex; }
.my-stat-lucide svg { width: 18px; height: 18px; }

/* ── Effect Modal Icon ──────────────────────────────────────── */
.sq-modal-icon { display: flex; align-items: center; justify-content: center; }
.sq-modal-icon svg { width: 48px; height: 48px; stroke-width: 1.5; }
#modal-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.effect-chip-icon { margin-right: 4px; }
.effect-chip-icon svg { width: 12px; height: 12px; }

/* ── System Modal Icon ──────────────────────────────────────── */
.sys-card-icon { display: flex; }
.sys-card-icon svg { width: 40px; height: 40px; color: #a855f7; stroke-width: 1.5; }

.sys-player-token {
  display: inline-flex;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  margin-right: 4px;
  border: 1px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
}
.eff-pos { color: #86efac; display: inline-flex; align-items: center; gap: 2px; font-weight: 700; }
.eff-neg { color: #fca5a5; display: inline-flex; align-items: center; gap: 2px; font-weight: 700; }
.eff-neutral { color: var(--text2); }
.eff-icon svg { width: 10px; height: 10px; }

/* ── Score Card Icons ───────────────────────────────────────── */
.score-stat-icon { margin-right: 2px; }
.score-stat-icon svg { width: 14px; height: 14px; }
.score-stat { display: flex; align-items: center; gap: 4px; }

/* ── Responsive icon size tweaks ────────────────────────────── */
@media (max-width: 860px) {
  .square-icon-wrap { width: 26px; height: 26px; border-radius: 6px; }
  .square-svg-icon svg { width: 14px; height: 14px; }
}
@media (max-width: 560px) {
  .square-icon-wrap { width: 20px; height: 20px; border-radius: 5px; }
  .square-svg-icon svg { width: 11px; height: 11px; }
  .char-avatar { width: 48px; height: 48px; }
  .char-avatar-icon svg { width: 22px; height: 22px; }
}
@media (max-width: 380px) {
  .square-icon-wrap { width: 16px; height: 16px; border-radius: 4px; }
  .square-svg-icon svg { width: 9px; height: 9px; }
}

/* ============================================================ RESPONSIVE */

@media (max-width: 1200px) {
  :root { --board-sq: 74px; }
  .panel-left { width: 190px; }
  .panel-right { width: 180px; }
}

@media (max-width: 1050px) {
  :root { --board-sq: 62px; }
  .panel-left { width: 170px; }
  .panel-right { width: 160px; }
  .square-emoji { font-size: 1rem; }
  .square-effect { display: none; }
}

/* ── Tablet / Mobile Landscape ─────────────────────────────── */
@media (max-width: 860px) {
  :root { --board-sq: 52px; }
  body { overflow: auto; }

  /* Lobby */
  .lobby-container { width: 100%; padding: 0 16px; }

  /* Waiting */
  .waiting-container { padding: 0 12px; }
  .character-grid { grid-template-columns: repeat(2, 1fr); }

  /* Game – stack vertically */
  .screen#screen-game { height: auto; min-height: 100vh; }
  .screen#screen-game.active { flex-direction: column; overflow-y: auto; height: auto; min-height: 100vh; }
  .game-layout { flex-direction: column; height: auto; }

  /* Panel order: right (dice+stats) → board → left (players+log) */
  .panel-right {
    order: 1;
    width: 100% !important;
    flex-direction: row;
    flex-wrap: wrap;
    border: none;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    padding: 12px;
  }
  .board-wrap { order: 2; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 10px 8px; }
  .panel-left  { order: 3; width: 100% !important; border: none; border-top: 1px solid var(--border); }

  .my-stats-section { flex: 1; min-width: 180px; }
  .dice-section { flex-direction: column; align-items: center; min-width: 150px; padding: 0; gap: 8px; }

  .square-effect { display: none; }
  .square-name { font-size: 0.42rem; }
}

/* ── Mobile Portrait ────────────────────────────────────────── */
@media (max-width: 560px) {
  :root { --board-sq: 38px; }

  /* Lobby */
  .logo-main { font-size: 2.2rem; letter-spacing: 1px; }
  .logo-sub  { font-size: 1rem; letter-spacing: 5px; }
  .lobby-card { padding: 20px 16px; }

  /* Waiting */
  .character-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .char-card  { padding: 10px 8px; }
  .char-emoji { font-size: 1.8rem; }
  .char-name  { font-size: 0.72rem; }
  .char-desc  { font-size: 0.62rem; }

  /* Board squares */
  .square-emoji { font-size: 0.75rem; }
  .square-name  { font-size: 0.32rem; letter-spacing: 0; line-height: 1.1; }
  .token { width: 10px; height: 10px; font-size: 0.4rem; border-width: 1px; }
  .board-center-scales { font-size: 1.5rem; margin-bottom: 2px; }
  .board-center-title  { font-size: 0.88rem; }
  .board-center-sub    { font-size: 0.5rem; letter-spacing: 2px; }

  /* Panels */
  .panel-right { flex-direction: column; }

  /* Dice – sticky bottom bar */
  .dice-section {
    position: sticky;
    bottom: 0;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    padding: 10px 16px;
    z-index: 100;
    width: 100%;
    gap: 12px;
  }
  .dice-wrap { flex-direction: row; align-items: center; gap: 10px; }
  .dice { width: 46px; height: 46px; font-size: 1.8rem; border-radius: 10px; }
  .dice-value { font-size: 0.85rem; min-height: 18px; }
  .btn-dice { padding: 10px 20px; flex: 1; font-size: 0.9rem; }
  .turn-note { display: none; }

  /* My stats – 2-col compact grid */
  #my-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .my-stat-row { gap: 4px; }
  .my-stat-info .my-stat-bar { height: 4px; margin-top: 1px; }
  .my-stat-val { font-size: 0.85rem; width: 16px; }

  /* Turn badge */
  .turn-badge { font-size: 0.88rem; padding: 10px; }

  /* Left panel */
  .panel-left { padding: 10px; }
  #game-log { max-height: 120px; }

  /* Game over */
  .gameover-container { padding: 16px 0; }
  .gameover-header h1 { font-size: 1.8rem; }
  .gameover-icon { font-size: 3rem; }
  .score-card { padding: 12px; gap: 10px; }
  .score-stats { flex-wrap: wrap; }

  /* Modals */
  .modal-card { padding: 20px 16px; width: 95%; }
  .system-effects-grid { grid-template-columns: 1fr; }
}

/* ── Very Small Phones (≤380px) ─────────────────────────────── */
@media (max-width: 380px) {
  :root { --board-sq: 34px; }
  .logo-main { font-size: 1.8rem; }
  .board-center-title  { font-size: 0.72rem; }
  .board-center-sub    { font-size: 0.42rem; }
  .board-center-scales { font-size: 1.2rem; }
  .square-name { font-size: 0.28rem; }
}

/* ============================================================ SCROLLBAR */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ============================================================ UTILS */
.flash {
  animation: flash-anim 0.4s ease;
}
@keyframes flash-anim {
  0%, 100% { filter: brightness(1); }
  50%       { filter: brightness(2); }
}
