:root {
  --bg: #151a20;
  --panel: #222933;
  --panel-2: #2b3440;
  --road: #586574;
  --paint: #f7f1e8;
  --muted: #b9c3cf;
  --line: rgba(255, 255, 255, 0.14);
  --red: #e34848;
  --green: #37b66b;
  --blue: #3f7fff;
  --yellow: #f0c441;
  --amber: #ffad4f;
  --danger: #ff6b63;
  --radius: 8px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--paint);
  background:
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(0deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(135deg, #151a20 0%, #27303a 54%, #171e25 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: var(--radius);
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(.6);
  opacity: .55;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #14191f;
  color: var(--paint);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .88rem;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 3.7rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(1580px, 100%);
  margin: 0 auto;
  padding: 8px 16px;
}

.site-header nav,
.brand,
.inline-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 900;
}

.brand-badge {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffb14c, #e34848);
  color: #16110d;
  font-size: .74rem;
}

.inline-form button,
.ghost-action {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
}

.signed-in {
  color: var(--muted);
  font-size: .88rem;
}

.primary-action {
  min-height: 44px;
  padding: 0 16px;
  background: linear-gradient(135deg, #ffb14c, #e64d4d);
  color: #17110c;
  font-weight: 900;
}

.danger-action {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 107, 99, .42);
  background: rgba(255, 107, 99, .12);
  color: #ffd5d2;
  font-weight: 900;
}

.narrow-page,
.dashboard,
.auth-page,
.room-app {
  width: min(1580px, 100%);
  margin: 0 auto;
  padding: 6px 16px 24px;
}

.auth-page {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(320px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.auth-hero {
  min-height: 440px;
  display: grid;
  align-content: space-between;
  gap: 14px;
  padding: clamp(20px, 4vw, 42px);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(227,72,72,.18), transparent 34%),
    linear-gradient(315deg, rgba(63,127,255,.2), transparent 38%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.12) 0 7px, transparent 7px 42px),
    #303a45;
  overflow: hidden;
}

.auth-hero p {
  color: var(--muted);
  max-width: 52ch;
}

.auth-hero-copy {
  display: grid;
  gap: 14px;
  align-self: end;
}

.auth-preview {
  position: relative;
  display: grid;
  width: min(360px, 100%);
  min-height: 150px;
  align-self: start;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  background: rgba(14,18,23,.54);
}

.auth-preview strong {
  align-self: end;
  color: var(--amber);
  font-size: .78rem;
}

.mini-road {
  position: absolute;
  inset: 48% 8% auto;
  height: 12px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #f7f1e8 0 18px, transparent 18px 34px), #596674;
}

.mini-token {
  position: absolute;
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 999px;
  font-weight: 900;
}

.mini-red { left: 12%; top: 34%; background: var(--red); }
.mini-green { left: 36%; top: 22%; background: var(--green); }
.mini-blue { right: 20%; top: 38%; background: var(--blue); }
.mini-yellow { right: 8%; top: 18%; background: var(--yellow); color: #1a1505; }

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

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(34,41,51,.92);
  box-shadow: 0 24px 70px rgba(0,0,0,.24);
}

.auth-card,
.form-stack,
.panel {
  padding: 16px;
}

.form-stack,
.auth-card {
  display: grid;
  gap: 13px;
}

.eyebrow {
  color: var(--amber);
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.flash {
  grid-column: 1 / -1;
  padding: 11px 13px;
  border-radius: var(--radius);
  font-weight: 800;
}

.flash-success {
  background: rgba(55,182,107,.18);
  color: #aaf0c2;
}

.flash-error {
  background: rgba(255,107,99,.18);
  color: #ffc0bc;
}

.dashboard {
  display: grid;
  gap: 14px;
}

.profile-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.profile-photo {
  display: grid;
  width: 112px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #151a20;
  color: var(--muted);
  font-size: .75rem;
  text-align: center;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.room-list,
.admin-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.room-row,
.admin-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.05);
}

.room-row span,
.admin-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .82rem;
}

.room-top {
  display: grid;
  grid-template-columns: minmax(320px, .78fr) minmax(520px, 1.22fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 8px;
}

.room-top.panel {
  padding: 10px 24px;
}

.room-top > div:first-child {
  min-width: 0;
}

.room-top h1 {
  font-size: clamp(1.7rem, 2vw, 2.15rem);
}

.room-actions {
  display: grid;
  min-width: min(680px, 100%);
  grid-template-columns: minmax(300px, 1fr) 130px 110px;
  align-items: end;
  gap: 8px;
}

.room-actions .ghost-action {
  display: grid;
  min-height: 38px;
  place-items: center;
  padding: 0 12px;
}

.invite-link-label {
  gap: 5px;
}

.invite-link-label input {
  min-height: 38px;
  font-size: .84rem;
}

.room-help {
  margin-top: 5px;
  color: #d5dee8;
  max-width: 78ch;
  line-height: 1.3;
  font-size: .92rem;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(300px, 360px);
  gap: 12px;
  align-items: start;
}

.board-panel {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015)),
    rgba(20,25,32,.94);
  place-items: center;
}

.board {
  position: relative;
  display: grid;
  width: min(100%, 900px, calc(100vh - 154px));
  aspect-ratio: 1;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  grid-template-rows: repeat(15, minmax(0, 1fr));
  padding: 2.75%;
  border: 1px solid rgba(222, 223, 210, .26);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(5, 8, 12, .08), rgba(5, 8, 12, .22)),
    url("../images/board-v4.png") center / cover no-repeat,
    #10161d;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 3px rgba(0,0,0,.28),
    0 22px 80px rgba(0,0,0,.45);
}

.base-panel {
  position: absolute;
  display: grid;
  place-items: center;
  width: 40%;
  height: 40%;
  border: 2px solid rgba(255,255,255,.16);
  border-radius: 14px;
  font-size: clamp(.62rem, 1.1vw, .9rem);
  font-weight: 850;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 1;
  box-shadow:
    inset 0 0 0 5px rgba(0,0,0,.22),
    inset 0 16px 30px rgba(255,255,255,.08),
    0 14px 34px rgba(0,0,0,.34);
}

.base-panel::after {
  position: absolute;
  inset: 13%;
  content: "";
  border: 1px dashed rgba(255,255,255,.3);
  border-radius: 12px;
  background:
    radial-gradient(circle at 21% 21%, rgba(255,255,255,.18) 0 6%, transparent 7%),
    radial-gradient(circle at 79% 21%, rgba(255,255,255,.18) 0 6%, transparent 7%),
    radial-gradient(circle at 21% 79%, rgba(255,255,255,.18) 0 6%, transparent 7%),
    radial-gradient(circle at 79% 79%, rgba(255,255,255,.18) 0 6%, transparent 7%);
}

.base-panel span {
  position: relative;
  z-index: 2;
  display: grid;
  width: clamp(38px, 5.2vw, 58px);
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid rgba(255,255,255,.62);
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,.18), transparent 34%),
    rgba(8,12,17,.52);
  color: #fff;
  font-size: clamp(.9rem, 1.8vw, 1.45rem);
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 2px 8px rgba(0,0,0,.62);
  box-shadow: inset 0 0 16px rgba(255,255,255,.12), 0 0 18px rgba(255,255,255,.16);
}

.base-panel-red {
  top: 0;
  left: 0;
  border-color: rgba(255, 84, 84, .72);
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 84, 84, .28), transparent 34%),
    linear-gradient(135deg, rgba(102,23,28,.9), rgba(43,18,22,.94));
  box-shadow: inset 0 0 0 5px rgba(0,0,0,.22), inset 0 0 32px rgba(255, 65, 65, .24), 0 0 24px rgba(227,72,72,.2), 0 14px 34px rgba(0,0,0,.34);
}

.base-panel-green {
  top: 0;
  right: 0;
  border-color: rgba(66, 238, 132, .7);
  background:
    radial-gradient(circle at 50% 46%, rgba(66, 238, 132, .26), transparent 34%),
    linear-gradient(225deg, rgba(17,87,53,.9), rgba(14,44,34,.94));
  box-shadow: inset 0 0 0 5px rgba(0,0,0,.22), inset 0 0 32px rgba(55,182,107,.24), 0 0 24px rgba(55,182,107,.2), 0 14px 34px rgba(0,0,0,.34);
}

.base-panel-blue {
  right: 0;
  bottom: 0;
  border-color: rgba(88, 148, 255, .76);
  background:
    radial-gradient(circle at 50% 46%, rgba(88, 148, 255, .28), transparent 34%),
    linear-gradient(315deg, rgba(18,68,133,.9), rgba(16,34,76,.94));
  box-shadow: inset 0 0 0 5px rgba(0,0,0,.22), inset 0 0 32px rgba(63,127,255,.26), 0 0 24px rgba(63,127,255,.2), 0 14px 34px rgba(0,0,0,.34);
}

.base-panel-yellow {
  bottom: 0;
  left: 0;
  border-color: rgba(255, 214, 74, .78);
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 214, 74, .3), transparent 34%),
    linear-gradient(45deg, rgba(135,103,17,.9), rgba(68,54,22,.94));
  color: rgba(24,22,18,.8);
  box-shadow: inset 0 0 0 5px rgba(0,0,0,.22), inset 0 0 32px rgba(240,196,65,.26), 0 0 24px rgba(240,196,65,.2), 0 14px 34px rgba(0,0,0,.34);
}

.base-panel-yellow span {
  color: #191404;
  text-shadow: none;
}

.city-block {
  position: absolute;
  display: block;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 6px;
  background:
    repeating-linear-gradient(90deg, transparent 0 12px, rgba(255, 173, 79, .14) 12px 14px, transparent 14px 22px),
    repeating-linear-gradient(0deg, transparent 0 10px, rgba(63, 127, 255, .1) 10px 12px, transparent 12px 18px),
    linear-gradient(135deg, rgba(255,255,255,.045), rgba(255,255,255,.012)),
    rgba(5,8,12,.52);
  color: transparent;
  pointer-events: none;
  z-index: 0;
  box-shadow: inset 0 0 18px rgba(0,0,0,.38);
}

.map-legend {
  display: flex;
  width: min(100%, 900px);
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.legend-item {
  display: grid;
  min-width: 164px;
  min-height: 36px;
  gap: 2px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-left: 4px solid rgba(255,255,255,.2);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.018)),
    rgba(17,22,29,.74);
  box-shadow: inset 0 0 16px rgba(255,255,255,.025);
}

.legend-item strong {
  overflow: hidden;
  font-size: .66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-item span {
  color: var(--muted);
  font-size: .61rem;
  line-height: 1.15;
}

.legend-red { border-left-color: var(--red); }
.legend-green { border-left-color: var(--green); }
.legend-blue { border-left-color: var(--blue); }
.legend-yellow { border-left-color: var(--yellow); }
.legend-safe { border-left-color: var(--amber); }

.city-block-a { inset: 42% 62% 42% 12%; }
.city-block-b { inset: 12% 42% 62% 42%; }
.city-block-c { inset: 42% 12% 42% 62%; }
.city-block-d { inset: 62% 42% 12% 42%; }

.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  background: transparent;
  z-index: 3;
}

.cell.route,
.cell.final-lane {
  margin: 3%;
  border: 1px solid rgba(232, 230, 217, .48);
  border-radius: 5px;
  background:
    radial-gradient(circle at 30% 18%, rgba(255,255,255,.16), transparent 26%),
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.02)),
    #242b31;
  box-shadow:
    inset 0 -9px 14px rgba(0,0,0,.22),
    inset 0 0 0 1px rgba(0,0,0,.36),
    0 1px 3px rgba(0,0,0,.36);
}

.cell.final-lane {
  margin: 3%;
}

.cell.route::after {
  position: absolute;
  inset: auto 18% 47% 18%;
  height: 1px;
  content: "";
  background: rgba(247,241,232,.62);
  box-shadow: 0 6px 0 rgba(247,241,232,.15);
}

.cell.final-lane::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.lane-red::after,
.lane-blue::after {
  inset: auto 18% 47% 18%;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.82) 0 10px, transparent 10px 18px);
  box-shadow: 0 0 10px rgba(255,255,255,.28);
}

.lane-green::after,
.lane-yellow::after {
  inset: 18% 47% 18% auto;
  width: 2px;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.82) 0 10px, transparent 10px 18px);
  box-shadow: 0 0 10px rgba(255,255,255,.28);
}

.cell.base-slot {
  margin: 13%;
  border: 2px solid rgba(255,255,255,.5);
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 30%, rgba(255,255,255,.16), transparent 34%),
    rgba(7,10,14,.26);
  box-shadow: inset 0 0 12px rgba(255,255,255,.1), 0 0 12px rgba(255,255,255,.08);
}

.slot-red {
  border-color: rgba(255, 126, 126, .82);
  box-shadow: inset 0 0 12px rgba(255,255,255,.1), 0 0 14px rgba(227,72,72,.26);
}

.slot-green {
  border-color: rgba(111, 244, 164, .82);
  box-shadow: inset 0 0 12px rgba(255,255,255,.1), 0 0 14px rgba(55,182,107,.26);
}

.slot-blue {
  border-color: rgba(122, 170, 255, .86);
  box-shadow: inset 0 0 12px rgba(255,255,255,.1), 0 0 14px rgba(63,127,255,.28);
}

.slot-yellow {
  border-color: rgba(255, 225, 92, .86);
  box-shadow: inset 0 0 12px rgba(255,255,255,.1), 0 0 14px rgba(240,196,65,.28);
}

.cell.center-zone {
  margin: 0;
  border: 0;
  box-shadow: none;
  background:
    radial-gradient(circle at center, rgba(255,173,79,.14), transparent 62%),
    rgba(20,25,32,.8);
}

.safehouse-core {
  z-index: 6;
}

.safehouse-core::before {
  position: absolute;
  inset: -124%;
  content: "";
  border: 3px solid rgba(255, 181, 73, .96);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), transparent 38%),
    radial-gradient(circle at center, rgba(63,127,255,.28), transparent 42%),
    radial-gradient(circle at center, rgba(255, 217, 142, .34), transparent 58%),
    linear-gradient(135deg, rgba(33,46,63,.96), rgba(12,17,24,.96)),
    repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 7px, rgba(255,255,255,.04) 7px 14px);
  clip-path: polygon(29% 0, 71% 0, 100% 29%, 100% 71%, 71% 100%, 29% 100%, 0 71%, 0 29%);
  box-shadow:
    inset 0 0 0 4px rgba(255,255,255,.08),
    inset 0 0 34px rgba(63,127,255,.2),
    0 0 34px rgba(255,173,79,.38),
    0 0 22px rgba(63,127,255,.28),
    0 12px 30px rgba(0,0,0,.42);
  pointer-events: none;
  z-index: 0;
}

.safehouse-core::after {
  position: absolute;
  inset: -74% -150%;
  display: grid;
  place-items: center;
  content: "SAFEHOUSE";
  color: #f8fbff;
  font-size: clamp(.46rem, .9vw, .78rem);
  font-weight: 950;
  letter-spacing: 0;
  text-shadow:
    0 2px 8px rgba(0,0,0,.78),
    0 0 14px rgba(63,127,255,.78),
    0 0 18px rgba(255,173,79,.54);
  pointer-events: none;
  z-index: 4;
}

.cell.special {
  border-color: rgba(255,191,95,.85);
  background:
    radial-gradient(circle at 32% 22%, rgba(255,255,255,.18), transparent 28%),
    linear-gradient(135deg, rgba(255, 173, 79, .22), rgba(24, 27, 31, .98)),
    #242b31;
  box-shadow: inset 0 0 0 2px rgba(255,159,63,.72), 0 0 16px rgba(255,159,63,.26), 0 2px 10px rgba(0,0,0,.28);
}

.lane-red {
  border-color: rgba(255, 91, 91, .74) !important;
  background: linear-gradient(180deg, rgba(255, 91, 91, .56), rgba(104, 24, 29, .86)) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 0 14px rgba(227,72,72,.28) !important;
}

.lane-green {
  border-color: rgba(70, 240, 138, .72) !important;
  background: linear-gradient(180deg, rgba(70, 240, 138, .54), rgba(18, 88, 53, .86)) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 0 14px rgba(55,182,107,.28) !important;
}

.lane-blue {
  border-color: rgba(85, 150, 255, .76) !important;
  background: linear-gradient(180deg, rgba(85, 150, 255, .56), rgba(20, 67, 132, .86)) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 0 14px rgba(63,127,255,.3) !important;
}

.lane-yellow {
  border-color: rgba(255, 217, 78, .78) !important;
  background: linear-gradient(180deg, rgba(255, 217, 78, .58), rgba(135, 103, 19, .86)) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 0 14px rgba(240,196,65,.3) !important;
}

.cell-label {
  position: absolute;
  inset: -5px -5px auto auto;
  z-index: 3;
  overflow: hidden;
  min-width: 22px;
  padding: 3px 5px;
  border: 1px solid rgba(255,191,95,.7);
  border-radius: 5px;
  background: rgba(13,16,22,.9);
  color: #fff5d5;
  font-size: clamp(.34rem, .62vw, .52rem);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(255,173,79,.22), 0 2px 8px rgba(0,0,0,.32);
}

.center-zone .cell-label {
  display: none;
}

.safehouse-core .cell-label {
  display: none;
}

.board .base-panel,
.board .city-block,
.board .cell-label,
.board .safehouse-core::before,
.board .safehouse-core::after,
.board .cell.route::after,
.board .cell.final-lane::after {
  display: none;
}

.board .cell.route,
.board .cell.final-lane,
.board .cell.base-slot,
.board .cell.center-zone,
.board .cell.special {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

.token-holder {
  position: absolute;
  inset: 2%;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  justify-content: center;
  gap: 2px;
  z-index: 5;
}

.base-token-slot {
  position: absolute;
  top: var(--token-top);
  left: var(--token-left);
  z-index: 8;
  display: grid;
  width: clamp(24px, 4.3%, 40px);
  aspect-ratio: 1;
  place-items: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.base-token-slot .token {
  width: 100%;
  min-width: 0;
  pointer-events: auto;
}

.token {
  position: relative;
  display: grid;
  width: min(68%, 42px);
  min-width: 18px;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 999px;
  background-color: #333;
  background-position: center;
  background-size: cover;
  color: #fff;
  font-size: clamp(.48rem, .86vw, .72rem);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,.92);
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,.2),
    inset 0 0 10px rgba(255,255,255,.2),
    0 0 0 1px rgba(0,0,0,.48),
    0 5px 14px rgba(0,0,0,.58);
  image-rendering: auto;
}

.token::before {
  position: absolute;
  inset: 18%;
  content: "";
  border-radius: 999px;
  background: radial-gradient(circle at 36% 28%, rgba(255,255,255,.34), transparent 28%);
  pointer-events: none;
}

.token:disabled {
  cursor: default;
  filter: none;
  opacity: 1;
}

.token-selectable {
  outline: 3px solid #fff7d6;
  outline-offset: 2px;
  transform: translateY(-2px) scale(1.08);
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,.2),
    inset 0 0 10px rgba(255,255,255,.24),
    0 0 0 1px rgba(0,0,0,.48),
    0 0 22px rgba(255, 218, 105, .72),
    0 7px 16px rgba(0,0,0,.62);
}

.token-red {
  border-color: #ffd1d1;
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,.34), transparent 28%),
    linear-gradient(135deg, #ff6868, #8d1018);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.18), inset 0 0 11px rgba(255,255,255,.2), 0 0 0 1px rgba(0,0,0,.5), 0 0 18px rgba(227,72,72,.62), 0 5px 14px rgba(0,0,0,.58);
}

.token-green {
  border-color: #c9ffdd;
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,.34), transparent 28%),
    linear-gradient(135deg, #52e98d, #0f713d);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.18), inset 0 0 11px rgba(255,255,255,.2), 0 0 0 1px rgba(0,0,0,.5), 0 0 18px rgba(55,182,107,.62), 0 5px 14px rgba(0,0,0,.58);
}

.token-blue {
  border-color: #d3e2ff;
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,.34), transparent 28%),
    linear-gradient(135deg, #5c95ff, #113f9b);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.18), inset 0 0 11px rgba(255,255,255,.2), 0 0 0 1px rgba(0,0,0,.5), 0 0 18px rgba(63,127,255,.66), 0 5px 14px rgba(0,0,0,.58);
}

.token-yellow {
  border-color: #fff3ba;
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,.4), transparent 28%),
    linear-gradient(135deg, #ffe05f, #98720f);
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.9);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.18), inset 0 0 11px rgba(255,255,255,.24), 0 0 0 1px rgba(0,0,0,.5), 0 0 18px rgba(240,196,65,.66), 0 5px 14px rgba(0,0,0,.58);
}

.room-sidebar {
  display: grid;
  gap: 10px;
  align-self: start;
}

@media (min-width: 1081px) {
  .room-sidebar {
    position: sticky;
    top: 8px;
    max-height: calc(100vh - 16px);
    overflow: auto;
    padding-right: 2px;
  }
}

.seat-list,
.host-controls,
.score-grid,
.move-choices {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.seat-card,
.score-item {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border-left: 5px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.05);
}

.seat-card button {
  justify-self: start;
  min-height: 32px;
  padding: 0 10px;
  background: rgba(255,255,255,.1);
}

.seat-red,
.score-red { border-color: var(--red); }
.seat-green,
.score-green { border-color: var(--green); }
.seat-blue,
.score-blue { border-color: var(--blue); }
.seat-yellow,
.score-yellow { border-color: var(--yellow); }

.dice-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  margin: 8px 0;
}

.dice {
  display: grid;
  min-height: 62px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ede7dc;
  color: #111;
  font-size: 2rem;
  font-weight: 900;
}

.move-button {
  min-height: 38px;
  padding: 8px 10px;
  background: var(--panel-2);
}

.status-line {
  min-height: 2.2em;
}

.action-log {
  display: grid;
  max-height: 160px;
  margin: 10px 0 0;
  padding-left: 20px;
  gap: 7px;
  overflow: auto;
  color: var(--muted);
  font-size: .86rem;
}

.action-log li:first-child {
  color: var(--paint);
}

.chat-panel {
  display: grid;
  gap: 10px;
}

.chat-messages {
  display: grid;
  max-height: 210px;
  gap: 8px;
  overflow: auto;
}

.chat-message {
  padding: 8px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.05);
}

.chat-message strong {
  display: block;
  font-size: .82rem;
}

.chat-message span {
  color: var(--muted);
  font-size: .9rem;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

@media (max-width: 1080px) {
  .auth-page,
  .play-layout {
    grid-template-columns: 1fr;
  }

  .room-top {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .room-top.panel {
    padding: 14px;
  }

  .room-top h1 {
    font-size: clamp(2rem, 8vw, 3.1rem);
  }

  .room-actions {
    min-width: 100%;
    grid-template-columns: 1fr;
  }

  .board {
    width: min(100%, 94vw);
  }

  .city-block {
    display: none;
  }

  .base-panel span {
    width: clamp(26px, 7vw, 38px);
    font-size: clamp(.74rem, 3vw, 1rem);
  }

  .safehouse-core::after {
    font-size: clamp(.46rem, 2.4vw, .7rem);
  }

  .map-legend {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .legend-item {
    min-width: 158px;
    min-height: 42px;
    padding: 7px 8px;
  }

  .base-token-slot {
    width: clamp(21px, 4.8%, 34px);
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 286px;
  }

  .site-header,
  .profile-panel,
  .room-row,
  .admin-row {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-grid,
  .dashboard-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: 320px;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .cell-label {
    min-width: 18px;
    padding: 2px 3px;
    font-size: .42rem;
  }

  .turn-panel {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 50;
    padding: 12px;
    border-color: rgba(255, 173, 79, .42);
    background: rgba(27, 33, 41, .96);
    box-shadow: 0 18px 50px rgba(0,0,0,.45);
  }

  .turn-panel h2 {
    font-size: .9rem;
  }

  .turn-panel .dice-row {
    grid-template-columns: 64px 1fr;
    margin: 7px 0;
  }

  .turn-panel .dice {
    min-height: 54px;
    font-size: 1.7rem;
  }

  .turn-panel .primary-action {
    min-height: 54px;
  }

  .turn-panel .status-line {
    min-height: auto;
    font-size: .82rem;
  }

  .turn-panel .move-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 86px;
    overflow: auto;
  }
}
