:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f9;
  --ink: #17202f;
  --muted: #647083;
  --line: #d9e0ea;
  --line-strong: #b9c4d3;
  --blue: #2d6cdf;
  --blue-2: #e7f0ff;
  --green: #2f9d66;
  --green-2: #e7f7ee;
  --red: #c94040;
  --red-2: #ffecec;
  --amber: #c47b11;
  --amber-2: #fff3d8;
  --violet: #6957d6;
  --violet-2: #eeeaff;
  --tile-field: #78b86d;
  --tile-road: #c79b61;
  --tile-city: #9b5960;
  --tile-tunnel: #6d6063;
  --tile-river: #4a9ec8;
  --wood-dark: #2f170b;
  --wood-mid: #6f3c1d;
  --wood-light: #a26332;
  --parchment: #d9b879;
  --parchment-light: #efdcae;
  --parchment-edge: #9f6931;
  --shadow: 0 18px 45px rgba(27, 39, 59, 0.1);
  font-family:
    Inter, Pretendard, "Segoe UI", "Malgun Gothic", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(45, 108, 223, 0.08), transparent 36%),
    linear-gradient(220deg, rgba(47, 157, 102, 0.08), transparent 42%),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app {
  min-height: 100vh;
}

.shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.shell.is-game-mode {
  grid-template-columns: 78px minmax(0, 1fr);
  background:
    radial-gradient(circle at 30% 18%, rgba(184, 103, 44, 0.35), transparent 34%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    repeating-linear-gradient(0deg, #2d160b 0 9px, #3a1d0e 9px 18px, #4b2612 18px 29px, #32180b 29px 42px);
  background-size: auto, 96px 100%, auto;
}

.shell.is-game-mode .sidebar {
  padding: 16px 10px;
  border-right: 1px solid rgba(230, 179, 105, 0.22);
  background:
    linear-gradient(180deg, rgba(28, 14, 7, 0.92), rgba(69, 34, 15, 0.82)),
    var(--wood-dark);
  box-shadow: inset -10px 0 22px rgba(0, 0, 0, 0.28);
}

.shell.is-game-mode .brand {
  justify-content: center;
}

.shell.is-game-mode .brand > div:not(.brand-mark),
.shell.is-game-mode .nav-button span:last-child,
.shell.is-game-mode .sidebar-bottom {
  display: none;
}

.shell.is-game-mode .brand-mark {
  border-color: rgba(239, 220, 174, 0.48);
  color: #3a1c0d;
  background:
    radial-gradient(circle at 35% 25%, #f6db9e, #a86934 70%),
    var(--parchment);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    0 8px 18px rgba(0, 0, 0, 0.32);
}

.shell.is-game-mode .nav {
  gap: 12px;
}

.shell.is-game-mode .nav-button {
  grid-template-columns: 1fr;
  justify-items: center;
  color: rgba(246, 226, 184, 0.72);
}

.shell.is-game-mode .nav-button:hover,
.shell.is-game-mode .nav-button.is-active {
  color: #ffe5ad;
  background: rgba(255, 221, 153, 0.14);
  box-shadow: inset 3px 0 0 #d59b4d;
}

.shell.is-game-mode .main {
  padding: 16px 18px;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 198, 108, 0.16), transparent 26%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    repeating-linear-gradient(0deg, #3b1d0e 0 14px, #522a14 14px 30px, #6f3b1c 30px 42px, #41200f 42px 56px);
  background-size: auto, 110px 100%, auto;
}

.shell.is-game-mode .topbar {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(135deg, rgba(47, 157, 102, 0.95), rgba(45, 108, 223, 0.95)),
    #2d6cdf;
  font-weight: 850;
  letter-spacing: 0;
}

.brand-title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.1;
}

.brand-domain {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav-button:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-button.is-active {
  color: var(--ink);
  background: var(--blue-2);
  box-shadow: inset 3px 0 0 var(--blue);
}

.nav-icon {
  width: 24px;
  text-align: center;
  font-weight: 800;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: white;
  background: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.user-meta {
  min-width: 0;
}

.user-name {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.user-state {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  margin-bottom: 18px;
}

.page-title {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  letter-spacing: 0;
}

.page-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.82rem;
  white-space: nowrap;
}

.pill strong {
  color: var(--ink);
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.workspace.wide {
  grid-template-columns: minmax(0, 1fr);
}

.stack {
  display: grid;
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 1rem;
}

.panel-body {
  padding: 18px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.13);
}

.button-row,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 750;
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(0.98);
}

.btn.primary {
  color: white;
  background: var(--blue);
}

.btn.success {
  color: white;
  background: var(--green);
}

.btn.danger {
  color: white;
  background: var(--red);
}

.btn.ghost {
  border: 1px solid var(--line);
  background: var(--surface);
}

.btn.icon-only {
  width: 40px;
  padding: 0;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.segment {
  min-height: 34px;
  padding: 6px 11px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 750;
}

.segment.is-active {
  color: var(--ink);
  background: var(--surface);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 128px);
}

.auth-art {
  overflow: hidden;
  position: relative;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #193149;
  box-shadow: var(--shadow);
}

.auth-board {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 1fr;
  gap: 8px;
  padding: 28px;
  transform: rotate(-6deg) scale(1.08);
  opacity: 0.96;
}

.auth-board .tile-mini {
  width: 100%;
  height: auto;
  min-height: 78px;
  aspect-ratio: 1;
}

.auth-overlay {
  position: absolute;
  inset: auto 0 0;
  padding: 28px;
  color: white;
  background: linear-gradient(transparent, rgba(10, 20, 32, 0.9));
}

.auth-overlay h2 {
  max-width: 560px;
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1.05;
}

.auth-overlay p {
  max-width: 540px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
}

.room-list {
  display: grid;
  gap: 10px;
}

.room-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.room-name {
  margin: 0 0 8px;
  font-size: 1rem;
}

.room-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.toggle input {
  accent-color: var(--blue);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(500px, 1fr) 330px;
  gap: 14px;
  align-items: stretch;
  max-height: calc(100vh - 134px);
  min-height: calc(100vh - 134px);
}

.shell.is-game-mode .game-layout {
  grid-template-columns: minmax(660px, 1fr) 330px;
  max-height: calc(100vh - 32px);
  min-height: calc(100vh - 32px);
  gap: 16px;
}

.game-table {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.shell.is-game-mode .game-table {
  position: relative;
  border: 0;
  border-radius: 26px 22px 30px 20px;
  background:
    radial-gradient(circle at 20% 16%, rgba(255, 255, 255, 0.28), transparent 14%),
    radial-gradient(circle at 83% 20%, rgba(113, 69, 30, 0.12), transparent 20%),
    linear-gradient(135deg, rgba(255, 244, 204, 0.92), rgba(210, 165, 93, 0.9)),
    var(--parchment);
  box-shadow:
    0 4px 0 rgba(81, 42, 17, 0.7),
    0 36px 70px rgba(0, 0, 0, 0.42),
    inset 0 0 60px rgba(103, 62, 25, 0.26);
}

.shell.is-game-mode .game-table::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 7% 96%, rgba(74, 35, 13, 0.18), transparent 12%),
    radial-gradient(circle at 99% 6%, rgba(74, 35, 13, 0.14), transparent 10%),
    repeating-linear-gradient(18deg, rgba(94, 58, 25, 0.06) 0 1px, transparent 1px 9px);
  pointer-events: none;
  mix-blend-mode: multiply;
}

.shell.is-game-mode .game-table > * {
  position: relative;
  z-index: 1;
}

.game-table > .panel-body {
  padding: 12px 14px;
}

.shell.is-game-mode .game-table > .panel-header {
  padding: 18px 22px 8px;
  border-bottom: 0;
  color: #3c2113;
  background: transparent;
}

.shell.is-game-mode .game-table > .panel-header .panel-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 800;
}

.shell.is-game-mode .game-table > .panel-body {
  padding: 8px 22px 10px;
}

.game-side {
  min-height: 0;
  max-height: calc(100vh - 134px);
  overflow: hidden;
}

.shell.is-game-mode .game-side {
  max-height: calc(100vh - 32px);
  gap: 12px;
}

.game-side .panel {
  min-height: 0;
}

.shell.is-game-mode .game-side .panel {
  border: 1px solid rgba(104, 55, 22, 0.72);
  border-radius: 8px;
  color: #f9e7c1;
  background:
    linear-gradient(180deg, rgba(105, 55, 25, 0.92), rgba(52, 25, 11, 0.96)),
    var(--wood-mid);
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.34),
    inset 0 2px 0 rgba(255, 218, 153, 0.24),
    inset 0 -12px 24px rgba(0, 0, 0, 0.2);
}

.shell.is-game-mode .game-side .panel-header {
  border-bottom-color: rgba(245, 211, 144, 0.2);
}

.shell.is-game-mode .game-side .panel-title,
.shell.is-game-mode .game-side label,
.shell.is-game-mode .game-side .score-line,
.shell.is-game-mode .game-side .log-line,
.shell.is-game-mode .game-side .log-line strong {
  color: #f9e7c1;
}

.shell.is-game-mode .game-side .log-line {
  border-left-color: #d39a4b;
  background: rgba(36, 17, 7, 0.44);
}

.shell.is-game-mode .game-side .tag,
.shell.is-game-mode .game-side .input,
.shell.is-game-mode .game-side .select {
  border-color: rgba(245, 211, 144, 0.26);
  color: #3b2112;
  background: rgba(255, 241, 205, 0.92);
}

.shell.is-game-mode .game-side .toggle {
  border-color: rgba(245, 211, 144, 0.26);
  color: #3b2112;
  background: rgba(255, 241, 205, 0.92);
}

.shell.is-game-mode .game-side .toggle span {
  color: #3b2112;
}

.shell.is-game-mode .game-side .btn.ghost {
  color: #3b2112;
  border-color: rgba(245, 211, 144, 0.3);
  background: linear-gradient(180deg, #f0d28f, #b9793b);
}

.shell.is-game-mode .game-side .btn.success {
  color: #221005;
  background: linear-gradient(180deg, #8fd07a, #49812f);
  box-shadow: 0 4px 0 rgba(24, 55, 18, 0.54);
}

.shell.is-game-mode .game-table .btn.primary {
  color: #2b1408;
  background:
    linear-gradient(180deg, #e8b86d, #9a5524),
    var(--wood-light);
  box-shadow: 0 4px 0 rgba(70, 34, 13, 0.55);
}

.shell.is-game-mode .game-table .btn.ghost,
.shell.is-game-mode .game-table .btn.icon-only {
  color: #3a1b0c;
  border-color: rgba(83, 44, 19, 0.44);
  background:
    linear-gradient(180deg, #f1d59a, #bc7435),
    var(--parchment);
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.player-card {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.shell.is-game-mode .player-card {
  border-color: rgba(112, 66, 26, 0.44);
  color: #3d2414;
  background:
    linear-gradient(180deg, rgba(255, 236, 188, 0.84), rgba(209, 153, 76, 0.72)),
    var(--parchment);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 8px 16px rgba(89, 48, 19, 0.18);
}

.shell.is-game-mode .player-card.is-turn {
  border-color: #5e2f13;
  background:
    linear-gradient(180deg, rgba(255, 229, 161, 0.96), rgba(196, 122, 45, 0.78)),
    var(--parchment);
}

.player-card.is-turn {
  border-color: var(--blue);
  background: var(--blue-2);
}

.player-card h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 5px;
  font-size: 0.9rem;
}

.color-dot {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.16);
}

.score-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.board-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  margin: 0 12px 0;
  border: 1px solid rgba(121, 137, 157, 0.45);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(58, 70, 84, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(58, 70, 84, 0.055) 1px, transparent 1px),
    linear-gradient(145deg, rgba(245, 236, 211, 0.92), rgba(218, 229, 239, 0.95));
  background-size: 32px 32px, 32px 32px, auto;
  box-shadow:
    inset 0 0 38px rgba(81, 92, 109, 0.16),
    0 18px 38px rgba(23, 32, 47, 0.14);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.shell.is-game-mode .board-wrap {
  margin: 2px 24px 0;
  border: 1px solid rgba(104, 66, 31, 0.46);
  border-radius: 18px 14px 22px 16px;
  background:
    linear-gradient(90deg, rgba(87, 56, 26, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(87, 56, 26, 0.055) 1px, transparent 1px),
    radial-gradient(circle at 23% 18%, rgba(255, 249, 216, 0.85), transparent 24%),
    radial-gradient(circle at 76% 68%, rgba(110, 70, 31, 0.16), transparent 28%),
    linear-gradient(145deg, rgba(236, 207, 141, 0.97), rgba(197, 151, 79, 0.95));
  background-size: 38px 38px, 38px 38px, auto, auto, auto;
  box-shadow:
    inset 0 0 80px rgba(96, 53, 22, 0.28),
    inset 0 0 0 2px rgba(255, 236, 178, 0.24),
    0 18px 40px rgba(35, 16, 6, 0.32);
}

.shell.is-game-mode .board-wrap::before,
.shell.is-game-mode .board-wrap::after {
  content: "";
  position: absolute;
  left: 3%;
  right: 3%;
  z-index: 2;
  height: 12px;
  border-radius: 50%;
  background: rgba(72, 35, 13, 0.18);
  filter: blur(9px);
  pointer-events: none;
}

.shell.is-game-mode .board-wrap::before {
  top: -8px;
}

.shell.is-game-mode .board-wrap::after {
  bottom: -8px;
}

.board-title-mark {
  position: absolute;
  top: 20px;
  left: 28px;
  z-index: 7;
  display: grid;
  gap: 2px;
  color: #4b2614;
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(255, 239, 190, 0.45);
}

.board-title-mark strong {
  width: max-content;
  padding-right: 34px;
  border-bottom: 2px solid rgba(73, 37, 19, 0.54);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3vw, 3.4rem);
  line-height: 0.9;
  font-style: italic;
}

.board-title-mark span {
  padding-left: 20px;
  font-size: 0.95rem;
  font-weight: 750;
}

.board-wrap.is-panning {
  cursor: grabbing;
}

.board-pan-layer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  transition: transform 0.12s ease;
  will-change: transform;
}

.board-wrap.is-panning .board-pan-layer {
  transition: none;
}

.board-zoom-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(120, 134, 154, 0.48);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 28px rgba(23, 32, 47, 0.16);
  backdrop-filter: blur(10px);
}

.shell.is-game-mode .board-zoom-controls {
  top: 18px;
  right: 20px;
  padding: 0;
  gap: 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.zoom-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 850;
}

.shell.is-game-mode .zoom-btn {
  width: 42px;
  height: 38px;
  border: 1px solid rgba(73, 37, 19, 0.68);
  border-radius: 6px;
  color: #3a1b0c;
  background:
    linear-gradient(180deg, #c78844, #7c3f1c),
    var(--wood-light);
  box-shadow:
    0 5px 0 #4b230f,
    0 12px 18px rgba(0, 0, 0, 0.26),
    inset 0 2px 0 rgba(255, 218, 157, 0.36);
  text-shadow: 0 1px 0 rgba(255, 220, 158, 0.42);
}

.shell.is-game-mode .zoom-btn:hover {
  background:
    linear-gradient(180deg, #d79a51, #8c4b24),
    var(--wood-light);
}

.shell.is-game-mode .zoom-value {
  color: #4b2614;
  background: rgba(255, 233, 176, 0.42);
  border-radius: 999px;
}

.zoom-btn:hover {
  background: var(--blue-2);
}

.zoom-btn.reset {
  font-size: 0.92rem;
}

.zoom-value {
  display: grid;
  place-items: center;
  min-height: 24px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.board {
  --board-cell: clamp(20px, min(calc((100vw - 760px) / 13), calc((100vh - 570px) / 13)), 50px);
  --board-gap: clamp(2px, 0.28vw, 4px);
  display: grid;
  grid-template-columns: repeat(13, var(--board-cell));
  grid-template-rows: repeat(13, var(--board-cell));
  gap: var(--board-gap);
  width: auto;
  min-width: 0;
  justify-content: center;
}

.cell {
  position: relative;
  width: var(--board-cell);
  height: var(--board-cell);
  border: 1px dashed rgba(83, 105, 130, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.34);
}

.cell.is-empty {
  cursor: pointer;
}

.cell.is-empty:hover {
  border-color: var(--blue);
  background: rgba(231, 240, 255, 0.66);
}

.cell.is-valid {
  border-color: rgba(47, 157, 102, 0.82);
  background: rgba(231, 247, 238, 0.72);
  box-shadow: inset 0 0 0 2px rgba(47, 157, 102, 0.16);
}

.cell.is-invalid {
  opacity: 0.45;
}

.coord {
  position: absolute;
  right: 5px;
  bottom: 4px;
  color: rgba(23, 32, 47, 0.35);
  font-size: 0.62rem;
  pointer-events: none;
}

.tile-mini {
  position: relative;
  width: 74px;
  height: 74px;
  overflow: hidden;
  border: 2px solid rgba(23, 32, 47, 0.28);
  border-radius: 8px;
  background: var(--tile-field);
  box-shadow:
    0 10px 18px rgba(27, 39, 59, 0.2),
    0 2px 0 rgba(255, 255, 255, 0.42) inset,
    inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.shell.is-game-mode .tile-mini {
  border-color: rgba(45, 28, 14, 0.52);
  border-radius: 5px;
  box-shadow:
    0 13px 18px rgba(31, 16, 7, 0.34),
    0 3px 0 rgba(59, 34, 17, 0.42),
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.shell.is-game-mode .board .tile-mini {
  border-radius: 4px;
  box-shadow:
    0 12px 18px rgba(31, 16, 7, 0.38),
    0 2px 0 rgba(69, 40, 18, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.board .tile-mini {
  width: var(--board-cell);
  height: var(--board-cell);
  border-width: 1px;
  box-shadow:
    0 7px 14px rgba(27, 39, 59, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.tile-mini.large {
  width: 156px;
  height: 156px;
}

.tile-edge {
  position: absolute;
  background: var(--tile-field);
}

.tile-edge.n {
  top: 0;
  left: 26%;
  width: 48%;
  height: 32%;
}

.tile-edge.e {
  top: 26%;
  right: 0;
  width: 32%;
  height: 48%;
}

.tile-edge.s {
  bottom: 0;
  left: 26%;
  width: 48%;
  height: 32%;
}

.tile-edge.w {
  top: 26%;
  left: 0;
  width: 32%;
  height: 48%;
}

.tile-edge.road,
.terrain-road {
  background: var(--tile-road);
}

.tile-edge.city,
.terrain-city {
  background: var(--tile-city);
}

.tile-edge.field,
.terrain-field {
  background: var(--tile-field);
}

.tile-edge.tunnel,
.terrain-tunnel {
  background: var(--tile-tunnel);
}

.tile-edge.river,
.terrain-river {
  background: var(--tile-river);
}

.tile-center {
  position: absolute;
  inset: 25%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(23, 32, 47, 0.22);
  border-radius: 50%;
  color: #102032;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 850;
}

.tile-mini.large .tile-center {
  font-size: 1.28rem;
}

.feature-monastery .tile-center,
.feature-cult .tile-center {
  border-radius: 8px;
  background: #f8f3e3;
}

.feature-cult .tile-center {
  color: white;
  background: #59335f;
}

.feature-volcano .tile-center {
  color: white;
  background: #bb3d2b;
}

.feature-meteor .tile-center {
  color: white;
  background: #3a4251;
}

.feature-cemetery .tile-center {
  color: white;
  background: #48606f;
}

.shield-mark,
.tomb-mark {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  color: white;
  background: var(--amber);
  font-size: 0.68rem;
  font-weight: 850;
}

.tomb-mark {
  right: auto;
  left: 6px;
  background: #52606f;
}

.meeple {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 24%;
  height: 24%;
  min-width: 12px;
  min-height: 12px;
  max-width: 18px;
  max-height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 50% 50% 45% 45%;
  color: white;
  font-size: 0.54rem;
  font-weight: 900;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.22);
}

.meeple.pos-0 {
  top: 38%;
  left: 38%;
}

.meeple.pos-1 {
  top: 14%;
  left: 38%;
}

.meeple.pos-2 {
  top: 38%;
  right: 14%;
}

.meeple.pos-3 {
  right: 38%;
  bottom: 14%;
}

.meeple.pos-4 {
  left: 14%;
  bottom: 38%;
}

.tile-name {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.hand {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  min-height: 88px;
}

.hand-tile {
  display: grid;
  justify-items: center;
  width: 86px;
  min-height: 84px;
  margin-left: -8px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f7f9fc);
  cursor: pointer;
  box-shadow:
    0 14px 28px rgba(27, 39, 59, 0.16),
    0 2px 0 rgba(255, 255, 255, 0.65) inset;
  transform-origin: bottom center;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

.hand-tile:first-child {
  margin-left: 0;
}

.hand-tile:hover {
  transform: translateY(-8px);
  box-shadow:
    0 20px 38px rgba(27, 39, 59, 0.2),
    0 2px 0 rgba(255, 255, 255, 0.7) inset;
}

.hand-tile.is-selected {
  border-color: var(--blue);
  background: var(--blue-2);
  transform: translateY(-12px);
}

.hand-tile .tile-mini {
  margin: 0 auto;
  width: 54px;
  height: 54px;
  box-shadow:
    0 8px 14px rgba(27, 39, 59, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.48) inset,
    inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.hand-tile:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.hand-tile:disabled:hover {
  transform: none;
  box-shadow: 0 10px 24px rgba(27, 39, 59, 0.12);
}

.hand-dock {
  padding: 8px 14px 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.shell.is-game-mode .hand-dock {
  position: relative;
  margin: 0 24px 18px;
  padding: 8px 18px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.shell.is-game-mode .hand-dock::before {
  content: "";
  position: absolute;
  left: 24%;
  right: 24%;
  bottom: 13px;
  height: 18px;
  border-radius: 6px;
  background:
    linear-gradient(180deg, #9a5c2c, #51250f),
    var(--wood-mid);
  box-shadow:
    0 8px 14px rgba(0, 0, 0, 0.32),
    inset 0 2px 0 rgba(255, 206, 134, 0.25);
}

.shell.is-game-mode .hand-dock-header {
  color: #4b2614;
}

.shell.is-game-mode .hand-dock-header .btn {
  border: 1px solid rgba(82, 43, 19, 0.5);
  color: #3a1b0c;
  background:
    linear-gradient(180deg, #f0cf89, #b46d30),
    var(--parchment);
  box-shadow: 0 4px 0 rgba(72, 35, 13, 0.5);
}

.shell.is-game-mode .hand {
  position: relative;
  z-index: 2;
}

.shell.is-game-mode .hand-tile {
  border: 1px solid rgba(55, 31, 15, 0.48);
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(255, 241, 199, 0.96), rgba(184, 125, 56, 0.4)),
    var(--parchment-light);
  box-shadow:
    0 18px 22px rgba(30, 14, 5, 0.28),
    0 4px 0 rgba(80, 42, 17, 0.42),
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

.shell.is-game-mode .hand-tile:hover,
.shell.is-game-mode .hand-tile.is-selected {
  box-shadow:
    0 24px 30px rgba(30, 14, 5, 0.36),
    0 5px 0 rgba(80, 42, 17, 0.46),
    inset 0 2px 0 rgba(255, 255, 255, 0.48);
}

.shell.is-game-mode .hand-tile.is-selected {
  border-color: #4e2b14;
  background:
    linear-gradient(180deg, rgba(255, 226, 150, 0.98), rgba(177, 94, 37, 0.5)),
    var(--parchment-light);
}

.shell.is-game-mode .hand-tile .tile-name {
  color: #4b2614;
  font-weight: 750;
}

.hand-dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}

.hand-dock-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.game-side .event-log {
  max-height: 142px;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.rule-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.rule-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.rule-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.rule-card li + li {
  margin-top: 6px;
}

.designer {
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(23, 32, 47, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(23, 32, 47, 0.06) 1px, transparent 1px),
    #f9fbfd;
  background-size: 24px 24px;
}

.tile-builder-panel .panel-body {
  padding: 16px;
}

.tile-builder-stage {
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tile-block-palette {
  display: grid;
  gap: 7px;
  max-height: 474px;
  overflow: auto;
  padding-right: 3px;
}

.tile-block-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #17202f;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.tile-block-button span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 26px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(23, 32, 47, 0.22);
  font-size: 0.72rem;
  font-weight: 900;
}

.tile-block-button strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8rem;
}

.tile-block-button:hover,
.tile-block-button.is-active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.12);
}

.tile-grid-editor {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 474px);
  aspect-ratio: 1;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe5da;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), var(--shadow);
}

.tile-grid-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(34, 45, 38, 0.2);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.96);
  cursor: pointer;
  font-size: clamp(0.62rem, 1.15vw, 0.82rem);
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.tile-grid-cell:hover {
  outline: 3px solid rgba(45, 108, 223, 0.2);
  z-index: 1;
}

.tile-meta-card {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-content: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.tile-meta-card span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.tile-mini-micro {
  padding: 5px;
}

.micro-preview-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  overflow: hidden;
}

.micro-preview-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  color: rgba(255, 255, 255, 0.96);
  font-size: 0.42rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

.tile-mini.large .micro-preview-cell {
  font-size: 0.82rem;
}

.micro-field {
  background: #86ad74;
}

.micro-road {
  background: #c9c5b8;
  color: #4c5149;
  text-shadow: none;
}

.micro-city-wall {
  background: #757c80;
}

.micro-city-inside {
  background: #9b8792;
}

.micro-river {
  background: #5a9fbc;
}

.micro-tunnel {
  background: #4d5150;
}

.micro-monastery {
  background: #8f9794;
}

.micro-cult {
  background: #8a6496;
}

.micro-cemetery {
  background: #8e8e91;
}

.micro-volcano {
  background: #9d4d39;
}

.micro-meteor {
  background: #686f70;
}

.micro-shield {
  background: #c8a23f;
}

.micro-tomb {
  background: #777e7c;
}

.tile-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.library-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.library-item .tile-mini {
  margin: 0 auto;
}

.panel-kicker {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.select.compact {
  width: auto;
  min-width: 180px;
}

.btn.ghost.is-selected {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(45, 108, 223, 0.1);
}

.operator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}

.operator-board-panel .panel-body {
  padding: 14px;
}

.operator-board-wrap {
  overflow: auto;
  max-height: calc(100vh - 190px);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(47, 70, 56, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(47, 70, 56, 0.05) 1px, transparent 1px),
    #eef2eb;
  background-size: 28px 28px;
}

.operator-board-grid {
  display: grid;
  grid-template-columns: repeat(var(--operator-cols), 58px);
  gap: 5px;
  justify-content: center;
  min-width: max-content;
}

.operator-cell {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px dashed rgba(104, 120, 108, 0.42);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
  cursor: pointer;
  font-size: 0.64rem;
}

.operator-cell:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.12);
}

.operator-cell.is-occupied {
  border-style: solid;
  border-color: rgba(67, 78, 72, 0.42);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px rgba(30, 43, 37, 0.12);
}

.operator-cell .tile-mini {
  width: 52px;
  height: 52px;
  box-shadow: none;
}

.operator-cell .tile-center {
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
}

.operator-tools {
  position: sticky;
  top: 18px;
}

.operator-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.operator-selected-tile {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.operator-selected-tile .tile-mini {
  margin: 0 auto;
}

.operator-selected-tile p {
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.operator-tile-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  max-height: 430px;
  overflow: auto;
  padding-right: 3px;
}

.operator-tile-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 68px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 750;
}

.operator-tile-card:hover,
.operator-tile-card.is-selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.11);
}

.operator-tile-card .tile-mini {
  width: 48px;
  height: 48px;
}

.operator-tile-card span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.swatch {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.swatch.is-active {
  outline: 3px solid rgba(45, 108, 223, 0.24);
  border-color: var(--blue);
}

.event-log {
  display: grid;
  gap: 8px;
  max-height: 312px;
  overflow: auto;
}

.log-line {
  padding: 9px 10px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.84rem;
}

.log-line strong {
  color: var(--ink);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .workspace,
  .game-layout,
  .designer,
  .operator-layout,
  .auth-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .game-layout,
  .game-side {
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .board {
    --board-cell: clamp(24px, min(calc((100vw - 72px) / 13), calc((100vh - 430px) / 13)), 52px);
  }

  .scoreboard,
  .rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operator-tools {
    position: static;
  }
}

@media (max-height: 850px) and (min-width: 1181px) {
  .main {
    padding: 20px 24px 12px;
  }

  .topbar {
    min-height: 48px;
    margin-bottom: 12px;
  }

  .page-title {
    font-size: 1.55rem;
  }

  .page-subtitle {
    margin-top: 3px;
    font-size: 0.86rem;
  }

  .game-layout,
  .game-side {
    max-height: calc(100vh - 112px);
    min-height: calc(100vh - 112px);
  }

  .game-table > .panel-body {
    padding: 8px 12px;
  }

  .game-table > .panel-header,
  .game-side .panel-header {
    padding: 10px 14px;
  }

  .player-card {
    padding: 7px 9px;
  }

  .board {
    --board-cell: clamp(18px, min(calc((100vw - 780px) / 13), calc((100vh - 520px) / 13)), 44px);
    --board-gap: 2px;
  }

  .hand-dock {
    padding: 6px 12px 8px;
  }

  .hand-dock-header p {
    display: none;
  }

  .hand {
    min-height: 72px;
  }

  .hand-tile {
    width: 74px;
    min-height: 70px;
    margin-left: -6px;
    padding: 5px;
  }

  .hand-tile .tile-mini {
    width: 44px;
    height: 44px;
  }

  .hand-tile .tile-name {
    margin-top: 4px;
    font-size: 0.68rem;
  }

  .game-side {
    gap: 8px;
  }

  .game-side .panel-body {
    padding: 10px 12px;
  }

  .game-side .btn {
    min-height: 34px;
    padding: 6px 9px;
  }

  .game-side .toggle {
    min-height: 34px;
    padding: 6px 9px;
  }

  .game-side .panel:nth-child(3) {
    display: none;
  }
}

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-button {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 8px 6px;
    font-size: 0.78rem;
  }

  .nav-icon {
    width: auto;
  }

  .sidebar-bottom {
    display: none;
  }

  .main {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .grid-2,
  .grid-3,
  .scoreboard,
  .rule-grid,
  .operator-mode-grid,
  .operator-tile-list,
  .toggle-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .board {
    --board-cell: clamp(20px, calc((100vw - 58px) / 13), 42px);
    --board-gap: 2px;
  }

  .hand-dock-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .hand {
    justify-content: flex-start;
    overflow-x: auto;
    padding-top: 12px;
  }
}

@media (max-width: 560px) {
  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .auth-art {
    min-height: 360px;
  }

  .room-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Dark tabletop game client skin */
.shell.is-game-mode {
  grid-template-columns: 140px minmax(0, 1fr);
  background:
    radial-gradient(circle at 46% 16%, rgba(70, 105, 120, 0.16), transparent 34%),
    linear-gradient(180deg, #101722, #070b10 74%);
}

.shell.is-game-mode .sidebar {
  padding: 8px 8px 10px;
  border-right: 1px solid #24303d;
  background: #111820;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.shell.is-game-mode .brand {
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.shell.is-game-mode .brand > div:not(.brand-mark),
.shell.is-game-mode .nav-button span:last-child,
.shell.is-game-mode .sidebar-bottom {
  display: block;
}

.shell.is-game-mode .brand-mark {
  width: 28px;
  height: 28px;
  border-color: #31404f;
  color: #f3ffe6;
  background: linear-gradient(180deg, #7e9c59, #57733e);
  box-shadow: none;
  font-size: 0.88rem;
}

.shell.is-game-mode .brand-title {
  color: #f4f7fb;
  font-size: 1rem;
}

.shell.is-game-mode .brand-domain {
  display: none;
}

.shell.is-game-mode .nav {
  gap: 4px;
}

.shell.is-game-mode .nav-button {
  grid-template-columns: 24px 1fr;
  justify-items: stretch;
  min-height: 34px;
  padding: 7px 8px;
  border-radius: 5px;
  color: #aeb9c7;
}

.shell.is-game-mode .nav-button:hover,
.shell.is-game-mode .nav-button.is-active {
  color: #f4f7fb;
  background: #242d38;
  box-shadow: none;
}

.shell.is-game-mode .nav-icon {
  width: 20px;
  color: #8ca468;
}

.shell.is-game-mode .sidebar-bottom {
  margin-top: auto;
  padding: 8px;
  border-color: #263341;
  color: #dbe3ee;
  background: #19222c;
}

.shell.is-game-mode .main {
  padding: 2px 4px;
  background: #090e14;
}

.shell.is-game-mode .topbar {
  display: none;
}

.shell.is-game-mode .game-layout {
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 8px;
  max-height: calc(100vh - 4px);
  min-height: calc(100vh - 4px);
}

.shell.is-game-mode .game-table {
  grid-template-rows: 48px minmax(0, 1fr) 92px;
  border: 1px solid #263342;
  border-radius: 5px;
  background: #0b1118;
  box-shadow: none;
}

.shell.is-game-mode .game-table::before {
  display: none;
}

.shell.is-game-mode .game-table > .panel-header {
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #263342;
  color: #f2f5f9;
  background: linear-gradient(180deg, #1a222d, #141b24);
}

.shell.is-game-mode .game-table > .panel-header .panel-title {
  font-family: Inter, Pretendard, "Segoe UI", "Malgun Gothic", Arial, sans-serif;
  font-size: 0.86rem;
  font-weight: 850;
}

.shell.is-game-mode .room-meta {
  gap: 4px;
}

.shell.is-game-mode .tag,
.shell.is-game-mode .pill {
  min-height: 20px;
  padding: 2px 7px;
  border-color: #304051;
  color: #bec8d5;
  background: #1b2430;
  font-size: 0.68rem;
}

.shell.is-game-mode .current-turn-pill {
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid #2d3c4f;
  color: #bcd5ff;
  background: linear-gradient(180deg, #223246, #182335);
}

.shell.is-game-mode .board-wrap {
  margin: 8px 8px 0;
  border: 1px solid #1f2a36;
  border-radius: 5px;
  background:
    radial-gradient(circle at 50% 30%, rgba(89, 120, 103, 0.2), transparent 38%),
    linear-gradient(180deg, rgba(7, 11, 16, 0.04), rgba(0, 0, 0, 0.38)),
    #0a0f15;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    inset 0 -36px 58px rgba(0, 0, 0, 0.48);
}

.shell.is-game-mode .board-wrap::before,
.shell.is-game-mode .board-wrap::after,
.shell.is-game-mode .board-title-mark {
  display: none;
}

.board-player-overlay {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 7;
  display: flex;
  gap: 6px;
  max-width: calc(100% - 108px);
}

.shell.is-game-mode .player-card {
  width: 160px;
  padding: 7px 8px;
  border: 1px solid #2b3948;
  border-radius: 4px;
  color: #dfe8f3;
  background: rgba(20, 28, 37, 0.92);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.shell.is-game-mode .player-card.is-turn {
  border-color: #52647d;
  background: rgba(26, 36, 48, 0.94);
}

.shell.is-game-mode .player-card h4 {
  margin-bottom: 3px;
  color: #f7f9fc;
  font-size: 0.72rem;
}

.shell.is-game-mode .score-line {
  color: #aeb9c7;
  font-size: 0.64rem;
}

.shell.is-game-mode .score-line strong {
  color: #f3d56a;
}

.shell.is-game-mode .board {
  --board-cell: clamp(40px, min(calc((100vw - 560px) / 13), calc((100vh - 260px) / 13)), 70px);
  --board-gap: 1px;
  padding: 10px;
  border: 10px solid rgba(7, 12, 10, 0.88);
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.18) 1px, transparent 1px),
    #2d432f;
  background-size:
    calc(var(--board-cell) + var(--board-gap)) calc(var(--board-cell) + var(--board-gap)),
    calc(var(--board-cell) + var(--board-gap)) calc(var(--board-cell) + var(--board-gap)),
    auto;
  box-shadow:
    0 22px 38px rgba(0, 0, 0, 0.52),
    inset 0 0 42px rgba(0, 0, 0, 0.34);
}

.shell.is-game-mode .cell {
  border: 0;
  border-radius: 0;
  background: #395436;
}

.shell.is-game-mode .cell:nth-child(2n) {
  background: #587055;
}

.shell.is-game-mode .cell:nth-child(4n) {
  background: #263d2c;
}

.shell.is-game-mode .cell.is-valid {
  box-shadow: inset 0 0 0 2px #86d77b;
}

.shell.is-game-mode .coord {
  display: none;
}

.shell.is-game-mode .tile-mini,
.shell.is-game-mode .board .tile-mini {
  border: 1px solid rgba(9, 13, 18, 0.7);
  border-radius: 2px;
  box-shadow:
    0 8px 12px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.shell.is-game-mode .board-zoom-controls {
  top: 30px;
  right: 14px;
  gap: 7px;
}

.shell.is-game-mode .zoom-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #3b4b5d;
  border-radius: 6px;
  color: #dce5f0;
  background: linear-gradient(180deg, #26313e, #17202b);
  box-shadow:
    0 6px 12px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.shell.is-game-mode .zoom-value {
  min-height: 18px;
  color: #cdd6e2;
  background: rgba(12, 17, 23, 0.62);
}

.shell.is-game-mode .hand-dock {
  margin: 0;
  padding: 0 78px 10px 190px;
  border-top: 1px solid #1e2935;
  background: linear-gradient(180deg, rgba(9, 14, 20, 0.2), #070b10);
}

.shell.is-game-mode .hand-dock::before {
  left: 24%;
  right: 21%;
  bottom: 11px;
  height: 20px;
  border-radius: 3px;
  background: linear-gradient(180deg, #7a533f, #3b241a);
  box-shadow:
    0 8px 12px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.shell.is-game-mode .hand-dock-header {
  display: none;
}

.shell.is-game-mode .hand {
  min-height: 84px;
  align-items: flex-end;
}

.shell.is-game-mode .hand-tile {
  width: 68px;
  min-height: 78px;
  margin-left: -4px;
  padding: 5px;
  border-radius: 4px;
  background: #1b2430;
  box-shadow:
    0 12px 16px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.shell.is-game-mode .hand-tile:hover,
.shell.is-game-mode .hand-tile.is-selected {
  transform: translateY(-8px);
}

.shell.is-game-mode .hand-tile .tile-mini {
  width: 58px;
  height: 58px;
}

.shell.is-game-mode .hand-tile .tile-name {
  margin-top: 3px;
  color: #d6dee9;
  font-size: 0.62rem;
}

.table-utility-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 7;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: #dce5f0;
  background: linear-gradient(180deg, #26313e, #17202b);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.38);
  cursor: pointer;
  font-size: 1.3rem;
}

.shell.is-game-mode .game-side {
  gap: 6px;
  max-height: calc(100vh - 4px);
}

.shell.is-game-mode .game-side .panel,
.shell.is-game-mode .game-side .panel:nth-child(3) {
  display: block;
  border: 1px solid #263342;
  border-radius: 5px;
  color: #f0f4f8;
  background: #151d26;
  box-shadow: none;
}

.shell.is-game-mode .game-side .panel-header {
  padding: 8px 10px;
  border-bottom: 1px solid #283645;
}

.shell.is-game-mode .game-side .panel-title {
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
}

.shell.is-game-mode .game-side .panel-body {
  padding: 7px 8px;
}

.active-tile-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
}

.tiny-tile {
  width: 100%;
  padding: 0;
  border: 1px solid #2e3c4c;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
}

.tiny-tile .tile-mini {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

.side-section-title {
  margin: 0 0 -7px;
  color: #d9e1ec;
  font-size: 0.68rem;
  font-weight: 850;
}

.meeple-action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.shell.is-game-mode .game-side .btn.ghost,
.shell.is-game-mode .game-side .btn.success,
.shell.is-game-mode .game-table .btn.ghost,
.shell.is-game-mode .game-table .btn.primary {
  min-height: 26px;
  padding: 4px 5px;
  border: 1px solid #2f3e4e;
  border-radius: 5px;
  color: #edf3fa;
  background: #101721;
  box-shadow: none;
  font-size: 0.6rem;
}

.shell.is-game-mode .game-side .btn.ghost.is-selected,
.shell.is-game-mode .game-side .btn.ghost:hover {
  background: #4d7b38;
}

.shell.is-game-mode .game-side .btn.success {
  background: #355e2e;
}

.compact-field {
  gap: 3px;
}

.shell.is-game-mode .game-side label,
.shell.is-game-mode .game-side .compact-field label {
  color: #d9e1ec;
  font-size: 0.68rem;
  font-weight: 850;
}

.shell.is-game-mode .game-side .select,
.shell.is-game-mode .game-side .input {
  min-height: 28px;
  padding: 5px 7px;
  border-color: #2d3b4b;
  color: #ecf2f8;
  background: #0f151d;
}

.turn-phase-track {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 4px;
}

.phase-step {
  display: grid;
  justify-items: center;
  gap: 3px;
  color: #cad4df;
  font-size: 0.58rem;
  text-align: center;
}

.phase-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: #223143;
  font-size: 1rem;
}

.phase-step.is-active .phase-icon {
  background: #496f36;
}

.phase-step.is-done .phase-icon {
  background: #344459;
}

.phase-arrow {
  color: #7d8a99;
}

.log-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid #293746;
}

.shell.is-game-mode .log-tabs .segment {
  min-height: 24px;
  color: #9eabb9;
  background: transparent;
  font-size: 0.62rem;
}

.shell.is-game-mode .log-tabs .segment.is-active {
  color: #ffffff;
  box-shadow: inset 0 -2px 0 #638451;
}

.shell.is-game-mode .event-log {
  max-height: 86px;
  padding-right: 2px;
}

.shell.is-game-mode .game-side .log-line {
  padding: 5px 6px;
  border-left: 0;
  color: #edf3fa;
  background: transparent;
  font-size: 0.64rem;
}

.shell.is-game-mode .game-side .log-line strong {
  color: #ffffff;
}

@media (max-height: 850px) and (min-width: 1181px) {
  .shell.is-game-mode .game-layout {
    max-height: calc(100vh - 4px);
    min-height: calc(100vh - 4px);
  }

  .shell.is-game-mode .game-table {
    grid-template-rows: 46px minmax(0, 1fr) 86px;
  }

  .shell.is-game-mode .game-side .panel-body {
    padding: 7px 9px;
  }

  .shell.is-game-mode .event-log {
    max-height: 66px;
  }
}

/* Three.js simulator layout */
.shell.is-game-mode {
  grid-template-columns: 0 minmax(0, 1fr);
  overflow: hidden;
  background: #7c5231;
}

.shell.is-game-mode .sidebar,
.shell.is-game-mode .topbar {
  display: none;
}

.shell.is-game-mode .main {
  min-height: 100vh;
  padding: 0;
  background:
    radial-gradient(circle at 48% 18%, rgba(255, 225, 169, 0.34), transparent 36%),
    linear-gradient(180deg, #b98555, #6d4427 72%);
}

.three-game-view {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  color: #fff3dd;
  background:
    radial-gradient(circle at 52% 34%, rgba(255, 232, 185, 0.24), transparent 38%),
    linear-gradient(180deg, #b98455, #5d3922);
}

.three-stage {
  position: absolute;
  inset: 0;
}

.three-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.three-stage canvas:active {
  cursor: grabbing;
}

.three-missing {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #4e2c16;
  background: #d0a56e;
}

.three-hud {
  position: absolute;
  z-index: 4;
  pointer-events: none;
}

.three-hud.top {
  top: 18px;
  left: 22px;
  right: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.three-brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 220, 165, 0.28);
  border-radius: 10px;
  background: rgba(40, 24, 14, 0.68);
  box-shadow: 0 16px 36px rgba(34, 17, 7, 0.34);
  backdrop-filter: blur(16px);
}

.brand-mark.small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.three-brand-lockup div {
  display: grid;
  gap: 2px;
}

.three-brand-lockup strong {
  font-size: 1rem;
}

.three-brand-lockup span:not(.brand-mark) {
  color: #e9d1aa;
  font-size: 0.78rem;
}

.three-turn-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.three-pill,
.three-button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 220, 165, 0.28);
  border-radius: 9px;
  color: #fff0d5;
  background: rgba(40, 24, 14, 0.68);
  box-shadow: 0 12px 30px rgba(34, 17, 7, 0.28);
  backdrop-filter: blur(16px);
  font-size: 0.78rem;
  font-weight: 750;
}

.three-button {
  cursor: pointer;
}

.three-button:hover {
  background: rgba(78, 50, 27, 0.86);
}

.three-player-strip {
  position: absolute;
  top: 82px;
  left: 22px;
  z-index: 4;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.three-player-card {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 4px 8px;
  min-width: 172px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 220, 165, 0.26);
  border-radius: 10px;
  color: #fff0d5;
  background: rgba(40, 24, 14, 0.68);
  box-shadow: 0 16px 34px rgba(34, 17, 7, 0.3);
  backdrop-filter: blur(16px);
}

.three-player-card.is-turn {
  border-color: rgba(156, 218, 120, 0.58);
  background: rgba(43, 53, 25, 0.76);
}

.three-player-card strong {
  color: #ffffff;
  font-size: 0.82rem;
}

.three-player-card span:not(.color-dot) {
  color: #e9d1aa;
  font-size: 0.68rem;
}

.three-hint-panel {
  position: absolute;
  right: 22px;
  bottom: 24px;
  z-index: 4;
  display: grid;
  gap: 3px;
  width: min(320px, calc(100vw - 44px));
  padding: 12px 14px;
  border: 1px solid rgba(255, 220, 165, 0.26);
  border-radius: 12px;
  color: #fff0d5;
  background: rgba(40, 24, 14, 0.7);
  box-shadow: 0 18px 38px rgba(34, 17, 7, 0.34);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.three-hint-panel strong {
  color: #ffffff;
  font-size: 0.86rem;
}

.three-hint-panel span,
.three-hint-panel small {
  color: #e9d1aa;
  font-size: 0.72rem;
}

.three-log-strip {
  position: absolute;
  left: 22px;
  bottom: 24px;
  z-index: 4;
  display: grid;
  gap: 4px;
  width: min(360px, calc(100vw - 390px));
  pointer-events: none;
}

.three-log-strip span {
  overflow: hidden;
  padding: 7px 9px;
  border-left: 3px solid rgba(156, 218, 120, 0.74);
  border-radius: 8px;
  color: #fff0d5;
  background: rgba(40, 24, 14, 0.56);
  backdrop-filter: blur(10px);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .three-hud.top {
    left: 12px;
    right: 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  .three-player-strip {
    top: 126px;
    left: 12px;
    flex-direction: column;
  }

  .three-log-strip {
    display: none;
  }

  .three-hint-panel {
    right: 12px;
    bottom: 14px;
  }
}

/* Integrated locked 3D board layout */
.shell.is-game-mode {
  grid-template-columns: 150px minmax(0, 1fr);
  overflow: hidden;
  color: #edf2f7;
  background:
    radial-gradient(circle at 20% 0%, rgba(92, 129, 93, 0.22), transparent 28%),
    linear-gradient(135deg, #101211, #07090c 64%);
}

.shell.is-game-mode .sidebar {
  display: flex;
  padding: 10px 9px;
  border-right: 1px solid rgba(217, 226, 238, 0.08);
  background: rgba(14, 17, 18, 0.96);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.shell.is-game-mode .brand {
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.shell.is-game-mode .brand > div:not(.brand-mark),
.shell.is-game-mode .nav-button span:last-child,
.shell.is-game-mode .sidebar-bottom {
  display: block;
}

.shell.is-game-mode .brand-mark {
  width: 30px;
  height: 30px;
  border-color: rgba(159, 183, 130, 0.45);
  color: #eff9df;
  background: linear-gradient(180deg, #76915a, #4f6c3d);
  box-shadow: none;
  font-size: 0.86rem;
}

.shell.is-game-mode .brand-title {
  color: #f4f7fb;
  font-size: 1rem;
}

.shell.is-game-mode .brand-domain {
  display: none;
}

.shell.is-game-mode .nav {
  gap: 5px;
}

.shell.is-game-mode .nav-button {
  grid-template-columns: 24px 1fr;
  justify-items: stretch;
  min-height: 34px;
  padding: 7px 8px;
  border-radius: 6px;
  color: #9da8b4;
}

.shell.is-game-mode .nav-button:hover,
.shell.is-game-mode .nav-button.is-active {
  color: #f5f7fb;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 3px 0 0 #8ca468;
}

.shell.is-game-mode .sidebar-bottom {
  margin-top: auto;
  padding: 8px;
  border: 1px solid rgba(217, 226, 238, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.shell.is-game-mode .main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  min-width: 0;
  padding: 12px;
  background:
    radial-gradient(circle at 50% 0%, rgba(132, 164, 105, 0.11), transparent 34%),
    #080b0f;
}

.shell.is-game-mode .topbar {
  display: flex;
  flex: 0 0 auto;
  min-height: 54px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 226, 238, 0.08);
  border-radius: 8px;
  color: #eef3f8;
  background: rgba(18, 22, 25, 0.92);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
}

.shell.is-game-mode .page-title {
  color: #ffffff;
  font-size: 1.1rem;
}

.shell.is-game-mode .page-subtitle {
  color: #9da8b4;
  font-size: 0.78rem;
}

.shell.is-game-mode .status-strip {
  gap: 6px;
}

.shell.is-game-mode .pill {
  min-height: 28px;
  border-color: rgba(217, 226, 238, 0.09);
  color: #aeb8c4;
  background: rgba(255, 255, 255, 0.05);
}

.shell.is-game-mode .pill strong {
  color: #edf2f7;
}

.shell.is-game-mode .view.is-visible {
  flex: 1 1 auto;
  min-height: 0;
}

.three-game-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 304px;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  color: #edf2f7;
  background: transparent;
}

.three-board-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(217, 226, 238, 0.1);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 6%, rgba(194, 168, 104, 0.14), transparent 32%),
    linear-gradient(180deg, #15191a, #0b0e10);
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.three-stage {
  position: absolute;
  inset: 0;
}

.three-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.three-stage canvas:active {
  cursor: grabbing;
}

.three-board-title {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(217, 226, 238, 0.1);
  border-radius: 8px;
  background: rgba(10, 13, 15, 0.68);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.three-board-title strong {
  color: #ffffff;
  font-size: 0.86rem;
}

.three-board-title span {
  color: #aeb8c4;
  font-size: 0.72rem;
}

.three-status-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
}

.three-status-card {
  display: grid;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(217, 226, 238, 0.1);
  border-radius: 8px;
  background: rgba(18, 22, 25, 0.92);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.three-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.three-card-heading span {
  color: #7f8b98;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.three-card-heading strong {
  color: #ffffff;
  font-size: 0.8rem;
}

.three-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.three-stat-grid span,
.three-action-state {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(217, 226, 238, 0.08);
  border-radius: 7px;
  color: #9da8b4;
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.68rem;
}

.three-stat-grid strong {
  display: block;
  margin-bottom: 2px;
  color: #f3d56a;
  font-size: 0.88rem;
}

.three-button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(159, 183, 130, 0.24);
  border-radius: 7px;
  color: #f4f8ee;
  background: linear-gradient(180deg, #435b33, #2f4327);
  box-shadow: none;
  backdrop-filter: none;
  font-size: 0.76rem;
  font-weight: 850;
}

.three-button.wide {
  width: 100%;
}

.three-button:hover {
  background: linear-gradient(180deg, #506b3d, #38502e);
}

.three-player-strip {
  position: static;
  display: grid;
  gap: 7px;
  pointer-events: none;
}

.three-player-card {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(217, 226, 238, 0.09);
  border-radius: 7px;
  color: #dfe6ee;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: none;
  backdrop-filter: none;
}

.three-player-card.is-turn {
  border-color: rgba(159, 183, 130, 0.44);
  background: rgba(118, 145, 90, 0.16);
}

.three-player-card strong {
  color: #ffffff;
  font-size: 0.78rem;
}

.three-player-card span:not(.color-dot) {
  color: #9da8b4;
  font-size: 0.66rem;
}

.three-log-strip {
  position: static;
  display: grid;
  gap: 5px;
  width: auto;
  pointer-events: none;
}

.three-log-strip span {
  padding: 7px 8px;
  border-left: 3px solid rgba(159, 183, 130, 0.72);
  border-radius: 6px;
  color: #dfe6ee;
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: none;
  font-size: 0.66rem;
  white-space: normal;
}

@media (max-width: 1100px) {
  .shell.is-game-mode {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .shell.is-game-mode .brand > div:not(.brand-mark),
  .shell.is-game-mode .nav-button span:last-child,
  .shell.is-game-mode .sidebar-bottom {
    display: none;
  }

  .shell.is-game-mode .nav-button {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .three-game-view {
    grid-template-columns: minmax(0, 1fr) 260px;
  }
}

@media (max-width: 820px) {
  .shell.is-game-mode {
    grid-template-columns: 1fr;
  }

  .shell.is-game-mode .sidebar {
    display: none;
  }

  .three-game-view {
    grid-template-columns: minmax(0, 1fr);
  }

  .three-status-panel {
    display: none;
  }
}

/* Concept-art tabletop composition */
.shell.is-game-mode {
  grid-template-columns: 38px minmax(0, 1fr);
  background: #0a1017;
}

.shell.is-game-mode .sidebar {
  display: flex;
  padding: 6px 4px;
  border-right: 1px solid #17212d;
  background: #0d141c;
}

.shell.is-game-mode .brand {
  justify-content: center;
  margin-bottom: 14px;
}

.shell.is-game-mode .brand > div:not(.brand-mark),
.shell.is-game-mode .nav-button span:last-child,
.shell.is-game-mode .sidebar-bottom {
  display: none;
}

.shell.is-game-mode .brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.shell.is-game-mode .nav {
  gap: 9px;
}

.shell.is-game-mode .nav-button {
  grid-template-columns: 1fr;
  justify-items: center;
  min-height: 31px;
  padding: 4px 0;
  border-radius: 5px;
}

.shell.is-game-mode .nav-icon {
  width: auto;
}

.shell.is-game-mode .nav-button.is-active {
  box-shadow: inset 2px 0 0 #95b66b;
}

.shell.is-game-mode .main {
  height: 100vh;
  padding: 0;
  background: #111922;
}

.shell.is-game-mode .topbar {
  display: none;
}

.shell.is-game-mode .view.is-visible {
  height: 100vh;
}

.three-game-view {
  grid-template-columns: 132px minmax(0, 1fr) 206px;
  gap: 0;
  height: 100vh;
  background:
    linear-gradient(90deg, #101923 0 132px, #080d13 132px calc(100% - 206px), #141e28 calc(100% - 206px)),
    #0b1118;
}

.three-events-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  padding: 39px 5px 16px;
  border-right: 1px solid rgba(100, 123, 145, 0.28);
  background:
    linear-gradient(180deg, rgba(18, 27, 37, 0.98), rgba(11, 17, 25, 0.98)),
    #101923;
}

.three-events-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 29px;
  padding: 0 8px;
  border: 1px solid #2b3948;
  border-radius: 4px;
  color: #e7edf4;
  background: #17222d;
  font-size: 0.68rem;
}

.three-events-list {
  margin-top: 7px;
  overflow: auto;
  padding: 5px 7px;
  border: 1px solid rgba(70, 88, 107, 0.5);
  border-radius: 4px;
  color: #f2f6fb;
  background: rgba(6, 10, 15, 0.52);
  font-size: 0.66rem;
  line-height: 1.28;
}

.three-events-list span {
  display: block;
  margin-bottom: 6px;
}

.three-events-footer {
  display: grid;
  gap: 3px;
  margin: 10px 8px 0;
  color: #c3cbd4;
  font-size: 0.65rem;
}

.three-board-panel {
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(55, 77, 75, 0.28), transparent 36%),
    linear-gradient(180deg, #16202a, #090e14);
  box-shadow:
    inset 0 0 72px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.three-board-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4, 8, 12, 0.22), transparent 25%, rgba(3, 6, 9, 0.28)),
    radial-gradient(circle at 50% 52%, transparent 42%, rgba(0, 0, 0, 0.38) 100%);
}

.three-match-overlay {
  position: absolute;
  top: 5px;
  left: 42px;
  right: 12px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(180px, 230px) minmax(180px, 250px) minmax(180px, 230px);
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  pointer-events: none;
}

.three-header-player,
.three-turn-banner {
  border: 1px solid rgba(105, 135, 155, 0.42);
  border-radius: 5px;
  color: #edf4fb;
  background: linear-gradient(180deg, rgba(28, 39, 50, 0.96), rgba(17, 25, 34, 0.96));
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.three-header-player {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 9px;
  min-height: 65px;
  padding: 7px 9px;
}

.three-header-player.is-turn {
  border-color: rgba(121, 161, 188, 0.72);
  box-shadow:
    0 0 0 1px rgba(121, 161, 188, 0.14),
    0 12px 28px rgba(0, 0, 0, 0.48);
}

.three-portrait {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid #576778;
  border-radius: 999px;
  color: #dce7f2;
  background:
    radial-gradient(circle at 35% 28%, #697886, #1f2a36 66%),
    #22303d;
  font-size: 0.78rem;
  font-weight: 900;
}

.three-header-meta {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.three-header-meta strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.three-header-meta span {
  color: #aeb8c4;
  font-size: 0.66rem;
}

.three-resource-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.three-resource-row b {
  color: #e7d17b;
  font-size: 0.68rem;
}

.three-region-tag {
  color: #8896a5;
  font-size: 0.62rem;
  font-weight: 850;
}

.three-turn-banner {
  justify-self: center;
  display: grid;
  justify-items: center;
  min-height: 44px;
  padding: 8px 16px;
  text-align: center;
}

.three-turn-banner strong {
  color: #ffffff;
  font-size: 0.82rem;
}

.three-turn-banner span {
  color: #a9b4c0;
  font-size: 0.68rem;
}

.three-status-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  overflow: hidden;
  padding: 24px 10px;
  border-left: 1px solid rgba(100, 123, 145, 0.28);
  background:
    radial-gradient(circle at 50% 42%, rgba(92, 132, 139, 0.16), transparent 32%),
    linear-gradient(180deg, #18232e, #111923);
}

.three-phase-current {
  display: grid;
  justify-items: center;
  gap: 5px;
  color: #f3f7fb;
  text-align: center;
}

.phase-diamond {
  color: #8db5ab;
  font-size: 1.8rem;
  line-height: 1;
}

.three-phase-current strong {
  font-size: 0.68rem;
  line-height: 1.12;
}

.three-phase-track-modern {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 5px;
  padding: 10px 4px 8px;
  border-top: 1px solid rgba(151, 172, 189, 0.18);
  border-bottom: 1px solid rgba(151, 172, 189, 0.18);
}

.three-phase-step {
  display: grid;
  justify-items: center;
  gap: 2px;
  color: #9eabb8;
  text-align: center;
}

.phase-token {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 4px;
  color: #dbe8f0;
  background: #283847;
  font-size: 0.68rem;
  font-weight: 900;
}

.three-phase-step.is-active .phase-token {
  color: #ffffff;
  background: #416f85;
  box-shadow: 0 0 0 2px rgba(128, 186, 199, 0.16);
}

.three-phase-step.is-done .phase-token {
  background: #506c64;
}

.three-phase-step strong,
.three-phase-step small {
  font-size: 0.58rem;
  line-height: 1.05;
}

.phase-flow {
  color: #6f7e8b;
  font-size: 0.78rem;
}

.three-progress-shell {
  height: 9px;
  padding: 2px;
  border: 1px solid rgba(93, 111, 125, 0.55);
  border-radius: 999px;
  background: rgba(3, 7, 10, 0.62);
}

.three-progress-shell span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3d8f88, #8cc0a6);
}

.three-command-spark {
  display: grid;
  place-items: center;
  height: 96px;
  color: rgba(209, 220, 226, 0.62);
  font-size: 3rem;
}

.three-status-panel .three-button {
  min-height: 50px;
  border: 1px solid rgba(133, 208, 193, 0.66);
  border-radius: 5px;
  color: #f6fffb;
  background: linear-gradient(180deg, #4f8077, #315d58);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  font-size: 0.78rem;
}

@media (max-width: 1180px) {
  .three-game-view {
    grid-template-columns: 112px minmax(0, 1fr) 188px;
  }

  .three-match-overlay {
    left: 16px;
    grid-template-columns: minmax(160px, 1fr) minmax(170px, 220px) minmax(160px, 1fr);
  }
}

/* Final light boardgame target skin */
.shell.is-game-mode {
  grid-template-columns: 38px minmax(0, 1fr);
  background: #c4c5c1;
}

.shell.is-game-mode .sidebar {
  border-right: 1px solid #a9aaa6;
  background: #c5c6c2;
  box-shadow: none;
}

.shell.is-game-mode .brand-mark {
  border: 1px solid rgba(90, 120, 70, 0.26);
  color: #eff8e9;
  background: linear-gradient(180deg, #93ad77, #6e8d55);
}

.shell.is-game-mode .nav-button {
  color: #6d726f;
}

.shell.is-game-mode .nav-button:hover,
.shell.is-game-mode .nav-button.is-active {
  color: #3f5d34;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 2px 0 0 #7ea35f;
}

.shell.is-game-mode .main {
  background: #c4c5c1;
}

.three-game-view {
  grid-template-columns: 132px minmax(0, 1fr) 206px;
  background:
    linear-gradient(90deg, #c7c8c4 0 132px, #c2c3bf 132px calc(100% - 206px), #c6c7c3 calc(100% - 206px)),
    #c4c5c1;
}

.three-events-panel {
  padding-top: 40px;
  border-right: 1px solid #aaaba6;
  background: #c9cac6;
}

.three-events-select {
  min-height: 28px;
  border: 1px solid rgba(80, 82, 78, 0.14);
  border-radius: 6px;
  color: #1d211f;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 18px rgba(65, 67, 62, 0.16);
}

.three-events-list {
  border: 1px solid rgba(72, 75, 70, 0.12);
  color: #151816;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 20px rgba(70, 72, 67, 0.14);
}

.three-events-footer {
  color: #202421;
}

.three-board-panel {
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.28), transparent 38%),
    linear-gradient(180deg, #cecfca, #babbb6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
}

.three-board-panel::after {
  display: none;
}

.three-match-overlay {
  top: 6px;
  left: 54px;
  right: 20px;
  grid-template-columns: minmax(178px, 198px) minmax(190px, 212px) minmax(178px, 198px);
  justify-content: space-between;
  gap: 24px;
}

.three-header-player,
.three-turn-banner {
  border: 1px solid rgba(80, 82, 78, 0.14);
  color: #151815;
  background: rgba(247, 248, 246, 0.92);
  box-shadow:
    0 8px 18px rgba(66, 68, 63, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.three-header-player {
  min-height: 68px;
  grid-template-columns: 48px minmax(0, 1fr) auto;
}

.three-header-player.is-turn {
  border-color: rgba(80, 82, 78, 0.2);
  box-shadow:
    0 8px 18px rgba(66, 68, 63, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.three-portrait {
  border-color: #7e8584;
  color: #f1f4f0;
  background:
    radial-gradient(circle at 35% 26%, #a3adb1, #525e61 68%),
    #6f7a7d;
}

.three-header-meta strong,
.three-turn-banner strong {
  color: #111412;
}

.three-header-meta span,
.three-turn-banner span,
.three-region-tag {
  color: #343936;
}

.three-resource-row b {
  color: #2e3330;
}

.three-turn-banner {
  min-height: 43px;
  padding: 8px 14px;
}

.three-status-panel {
  border-left: 1px solid #adaeaa;
  background: #c9cac6;
}

.three-phase-current {
  color: #171a18;
}

.phase-diamond {
  color: #668f8b;
}

.current-stage-label {
  color: #1c211f;
  font-size: 0.62rem;
}

.three-phase-current strong {
  color: #171a18;
}

.three-phase-track-modern {
  border-color: rgba(75, 78, 74, 0.18);
}

.three-phase-step {
  color: #2c312e;
}

.phase-token {
  color: #f4f6f4;
  background: #aeb4af;
}

.three-phase-step.is-active .phase-token {
  background: #6f9490;
  box-shadow: none;
}

.three-phase-step.is-done .phase-token {
  background: #87958b;
}

.phase-flow {
  color: #858985;
}

.three-progress-shell {
  border-color: rgba(70, 72, 68, 0.24);
  background: rgba(255, 255, 255, 0.34);
}

.three-progress-shell span {
  background: linear-gradient(90deg, #6da099, #9db8ac);
}

.three-command-spark {
  color: rgba(255, 255, 255, 0.58);
}

.three-status-panel .three-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  background: linear-gradient(180deg, #a4a5a1, #868883);
  box-shadow:
    0 8px 14px rgba(83, 84, 79, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  font-size: 0.78rem;
}

.three-stage canvas {
  filter: saturate(0.9) contrast(0.96);
}

/* Rule-driven turn controls */
.three-phase-current strong small {
  display: block;
  max-width: 170px;
  margin-top: 4px;
  color: #4d5551;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.25;
}

.turn-action-card {
  display: grid;
  gap: 9px;
  width: 100%;
  padding: 12px 10px;
  border-top: 1px solid rgba(75, 78, 74, 0.18);
  border-bottom: 1px solid rgba(75, 78, 74, 0.18);
  color: #242a27;
  background: rgba(255, 255, 255, 0.26);
  font-size: 0.65rem;
  line-height: 1.35;
}

.turn-action-card.hint {
  background: rgba(239, 242, 237, 0.46);
}

.turn-action-card.result {
  justify-items: center;
  padding-block: 20px;
  text-align: center;
}

.turn-action-card.result strong {
  color: #38563c;
  font-size: 0.88rem;
}

.turn-action-row {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 7px;
}

.three-status-panel .three-button.primary {
  border-color: rgba(74, 123, 88, 0.55);
  background: linear-gradient(180deg, #6e9978, #4e7658);
}

.three-status-panel .three-button.subtle {
  border: 1px solid rgba(74, 78, 73, 0.22);
  color: #303632;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: none;
}

.three-status-panel .three-button.compact {
  min-height: 28px;
  padding: 5px 7px;
  border: 1px solid rgba(86, 96, 87, 0.2);
  color: #2c342e;
  background: rgba(248, 250, 247, 0.74);
  box-shadow: none;
  font-size: 0.58rem;
  text-align: left;
}

.cemetery-rescue {
  display: grid;
  gap: 5px;
  max-height: 126px;
  overflow: auto;
  padding-top: 7px;
  border-top: 1px solid rgba(75, 78, 74, 0.16);
}

.three-events-footer strong {
  margin-bottom: 3px;
  font-size: 0.66rem;
}

@media (max-width: 900px) {
  .turn-action-card {
    padding: 9px 7px;
  }

  .three-phase-current strong small {
    display: none;
  }
}
