/* Shared styling for Quoridor / Ghosts / UNO project */

* { box-sizing: border-box; }

:root {
  --bg: #0f1220;
  --panel: #181c30;
  --panel-2: #20253f;
  --ink: #e8ecff;
  --muted: #9aa3c7;
  --accent: #ff6b35;
  --accent-2: #5b8cff;
  --good: #4cc9f0;
  --evil: #f25c54;
  --wall: #ffb627;
  --grid: #2a2f4d;
  --red: #e63946;
  --blue: #1d7adb;
  --green: #2a9d4a;
  --yellow: #f0c419;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--grid);
}
.nav .brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.nav a { color: var(--muted); }
.nav a.active, .nav a:hover { color: var(--ink); }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

h1 { font-size: 2rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.3rem; margin: 1.5rem 0 0.5rem; color: var(--accent); }
h3 { font-size: 1rem; margin: 1rem 0 0.4rem; color: var(--accent-2); }
p, li { line-height: 1.55; color: var(--ink); }
.muted { color: var(--muted); font-size: 0.92rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--grid);
  border-radius: 10px;
  padding: 1.25rem;
  transition: transform 0.15s, border-color 0.15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h3 { color: var(--accent); margin-top: 0; }
.card .tag {
  display: inline-block;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-right: 0.3rem;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.5rem;
}
@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
}

.board-panel, .side-panel {
  background: var(--panel);
  border: 1px solid var(--grid);
  border-radius: 10px;
  padding: 1.25rem;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 1rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn:hover { background: #ff814e; }
.btn.secondary { background: var(--panel-2); color: var(--ink); border: 1px solid var(--grid); }
.btn.secondary:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.status-line {
  font-weight: 600;
  margin: 0.5rem 0;
}
.status-line.win { color: var(--good); }
.status-line.lose { color: var(--evil); }

/* ---------- Quoridor ---------- */
.q-board {
  --cell: 44px;
  --wall: 8px;
  display: grid;
  grid-template-columns: repeat(9, var(--cell) var(--wall));
  grid-template-rows: repeat(9, var(--cell) var(--wall));
  background: var(--panel-2);
  padding: 6px;
  border-radius: 8px;
  width: max-content;
  margin: 0 auto;
}
.q-board > div { display: flex; align-items: center; justify-content: center; }
.q-cell {
  background: #2c3252;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}
.q-cell.target { background: #3a5a3a; outline: 2px dashed var(--good); }
.q-cell:hover.target { background: #4a7a4a; }
.q-cell.goal-1 { box-shadow: inset 0 0 0 2px rgba(76, 201, 240, 0.25); }
.q-cell.goal-2 { box-shadow: inset 0 0 0 2px rgba(242, 92, 84, 0.25); }
.q-cell .pawn {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.q-cell .pawn.p1 { background: var(--good); color: #0f1220; }
.q-cell .pawn.p2 { background: var(--evil); color: #fff; }

.q-slot { background: transparent; cursor: pointer; }
.q-slot.h.placed, .q-slot.v.placed { background: var(--wall); }
.q-slot.h.hover, .q-slot.v.hover { background: rgba(255, 182, 39, 0.4); }

/* ---------- Ghosts ---------- */
.g-board {
  display: grid;
  grid-template-columns: repeat(6, 60px);
  grid-template-rows: repeat(6, 60px);
  gap: 4px;
  background: var(--panel-2);
  padding: 8px;
  border-radius: 8px;
  width: max-content;
  margin: 0 auto;
}
.g-cell {
  background: #2c3252;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  cursor: pointer;
  font-size: 0.9rem;
}
.g-cell.exit::after {
  content: "EXIT";
  position: absolute;
  font-size: 0.55rem;
  bottom: 2px;
  color: var(--muted);
}
.g-cell.selectable { outline: 2px solid var(--accent); }
.g-cell.target { background: #3a5a3a; outline: 2px dashed var(--good); }
.g-piece {
  width: 80%;
  height: 80%;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}
.g-piece.good { background: var(--good); color: #0f1220; }
.g-piece.evil { background: var(--evil); color: #fff; }
.g-piece.hidden { background: #4a5180; color: #c5cbf0; }
.g-piece.revealed-good { background: var(--good); color: #0f1220; outline: 2px solid #fff; }
.g-piece.revealed-evil { background: var(--evil); color: #fff; outline: 2px solid #fff; }
.g-piece.selected { box-shadow: 0 0 0 3px var(--accent); }

.setup-pool {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
  flex-wrap: wrap;
}
.setup-pool .chip {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.chip.good { background: var(--good); color: #0f1220; }
.chip.evil { background: var(--evil); color: #fff; }
.chip.disabled { opacity: 0.3; cursor: not-allowed; }
.chip.active { box-shadow: 0 0 0 3px var(--accent); }

/* ---------- UNO ---------- */
.uno-table {
  display: grid;
  grid-template-areas:
    ". p2 ."
    "p1 center p3"
    ". me .";
  grid-template-columns: 140px 1fr 140px;
  gap: 1rem;
  align-items: center;
}
.uno-seat { background: var(--panel-2); padding: 0.8rem; border-radius: 8px; min-height: 80px; }
.uno-seat .label { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
.uno-seat.turn { outline: 2px solid var(--accent); }
.uno-seat.p1 { grid-area: p1; }
.uno-seat.p2 { grid-area: p2; text-align: center; }
.uno-seat.p3 { grid-area: p3; }
.uno-seat.me { grid-area: me; }
.uno-center { grid-area: center; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }

.uno-card {
  width: 56px; height: 84px;
  border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.85rem;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.15);
  user-select: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  position: relative;
}
.uno-card.red { background: var(--red); }
.uno-card.blue { background: var(--blue); }
.uno-card.green { background: var(--green); }
.uno-card.yellow { background: var(--yellow); color: #1a1a1a; text-shadow: none; }
.uno-card.wild { background: linear-gradient(135deg, var(--red) 0% 25%, var(--yellow) 25% 50%, var(--green) 50% 75%, var(--blue) 75% 100%); }
.uno-card.back {
  background: #1a1d33;
  border: 2px solid var(--accent);
  color: var(--accent);
  cursor: default;
}
.uno-card.playable { box-shadow: 0 0 0 3px var(--good); transform: translateY(-4px); }
.uno-card:hover.playable { transform: translateY(-8px); }
.uno-card .val { font-size: 1.4rem; }
.uno-card .corner { position: absolute; font-size: 0.65rem; top: 3px; left: 4px; }
.uno-card .corner.br { top: auto; bottom: 3px; right: 4px; left: auto; }

.uno-hand {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.color-picker { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.color-swatch {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 2px solid rgba(255,255,255,0.2);
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.red { background: var(--red); }
.color-swatch.blue { background: var(--blue); }
.color-swatch.green { background: var(--green); }
.color-swatch.yellow { background: var(--yellow); }

.log {
  max-height: 240px;
  overflow-y: auto;
  background: #0c0f1c;
  border: 1px solid var(--grid);
  border-radius: 6px;
  padding: 0.5rem;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.5rem;
}
.log .me { color: var(--good); }
.log .opp { color: var(--evil); }
.log .sys { color: var(--accent); }

.rules-box {
  background: var(--panel-2);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  font-size: 0.88rem;
}
.rules-box ul { margin: 0.3rem 0; padding-left: 1.1rem; }
