:root {
  --bg: #07080c;
  --panel: #10131a;
  --panel-2: #151923;
  --ink: #edf3ff;
  --muted: #8c98aa;
  --line: rgba(255, 255, 255, .13);
  --red: #ff2d55;
  --cyan: #24d6ff;
  --yellow: #d7a92f;
  --green: #52e08b;
  --danger: #ff5c4d;
  --shadow: 0 16px 45px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .02) 1px, transparent 1px),
    radial-gradient(circle at 80% 12%, rgba(36, 214, 255, .13), transparent 30%),
    radial-gradient(circle at 12% 18%, rgba(255, 45, 85, .18), transparent 32%),
    #07080c;
  background-size: 36px 36px, 36px 36px, auto, auto, auto;
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.landing {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 8, 12, .76);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 45, 85, .72);
  color: var(--red);
  background: rgba(255, 45, 85, .1);
  box-shadow: 0 0 24px rgba(255, 45, 85, .2);
}

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

.hero {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(340px, .85fr);
  align-items: center;
  gap: 36px;
  padding: 52px clamp(20px, 6vw, 86px) 34px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  color: var(--cyan);
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(44px, 6vw, 86px);
  line-height: .93;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 28px;
}

h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.hero-panel {
  min-height: 520px;
  border: 1px solid rgba(36, 214, 255, .28);
  background:
    linear-gradient(140deg, rgba(36, 214, 255, .1), transparent 32%),
    linear-gradient(320deg, rgba(255, 45, 85, .16), transparent 42%),
    rgba(16, 19, 26, .82);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, .04);
  position: relative;
  overflow: hidden;
}

.city-lines {
  position: absolute;
  inset: auto 0 0;
  height: 58%;
  background:
    linear-gradient(to top, rgba(7, 8, 12, .95), transparent),
    repeating-linear-gradient(90deg, transparent 0 32px, rgba(36, 214, 255, .23) 33px 35px, transparent 36px 72px);
  clip-path: polygon(0 42%, 7% 42%, 7% 22%, 14% 22%, 14% 52%, 23% 52%, 23% 8%, 31% 8%, 31% 36%, 39% 36%, 39% 18%, 46% 18%, 46% 48%, 56% 48%, 56% 27%, 63% 27%, 63% 7%, 72% 7%, 72% 44%, 82% 44%, 82% 17%, 91% 17%, 91% 35%, 100% 35%, 100% 100%, 0 100%);
}

.hud-card {
  position: absolute;
  width: 72%;
  left: 14%;
  top: 12%;
  border: 1px solid rgba(255, 45, 85, .45);
  background: rgba(7, 8, 12, .76);
  padding: 18px;
}

.hud-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.hud-row:last-child {
  border-bottom: 0;
}

.btn {
  border: 1px solid rgba(255, 255, 255, .14);
  color: var(--ink);
  background: rgba(255, 255, 255, .05);
  min-height: 38px;
  height: auto;
  padding: 9px 14px;
  font-weight: 800;
  border-radius: 6px;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.btn.primary {
  border-color: rgba(255, 45, 85, .8);
  background: linear-gradient(180deg, rgba(255, 45, 85, .94), rgba(166, 20, 48, .95));
}

.btn.cyan {
  border-color: rgba(36, 214, 255, .75);
  color: #071017;
  background: var(--cyan);
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 12px;
}

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

.features {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 32px;
}

.card,
.auth-card,
.panel {
  border: 1px solid var(--line);
  background: rgba(16, 19, 26, .84);
  box-shadow: var(--shadow);
}

.card,
.panel {
  border-radius: 8px;
}

.card {
  padding: 18px;
  min-width: 0;
}

.auth-layout,
.page {
  min-height: 100vh;
  padding: 28px;
}

.auth-layout {
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(460px, 100%);
  padding: 26px;
  border-radius: 8px;
}

.form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(3, 4, 7, .68);
  padding: 11px 12px;
  outline: none;
  min-width: 0;
}

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

.page {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 22px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
}

.campaign-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.campaign-card {
  min-height: 180px;
  display: grid;
  gap: 10px;
  border-left: 3px solid var(--red);
  align-content: start;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, .04);
}

.sync-pill {
  font-weight: 900;
}

.sync-pill.online {
  border-color: rgba(82, 224, 139, .42);
  color: var(--green);
  background: rgba(82, 224, 139, .08);
}

.sync-pill.offline {
  border-color: rgba(215, 169, 47, .38);
  color: var(--yellow);
  background: rgba(215, 169, 47, .08);
}

.vtt {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 58px 1fr;
}

.vtt-main {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(420px, 1fr) minmax(300px, 380px);
}

.sidebar {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: rgba(10, 12, 17, .92);
  padding: 16px;
  scrollbar-width: thin;
}

.rightbar {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.board-wrap {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #090b10;
}

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

.board {
  position: relative;
  overflow: hidden;
  min-height: 560px;
  transform: scale(var(--board-zoom, 1));
  transform-origin: top left;
  background:
    linear-gradient(rgba(36, 214, 255, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 214, 255, .12) 1px, transparent 1px),
    var(--board-bg, #ffffff);
  background-size: var(--grid-size, 48px) var(--grid-size, 48px), var(--grid-size, 48px) var(--grid-size, 48px), auto;
}

.board.editing {
  cursor: crosshair;
}

.mode-hud {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: min(560px, calc(100% - 24px));
  padding: 8px 10px;
  border: 1px solid rgba(36, 214, 255, .28);
  border-radius: 8px;
  background: rgba(7, 8, 12, .78);
  backdrop-filter: blur(10px);
  font-size: 12px;
}

.mode-hud span {
  color: var(--muted);
}

.board.targeting {
  cursor: crosshair;
}

.board.grid-off {
  background: var(--board-bg, #ffffff);
}

.token {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 2px solid var(--cyan);
  color: #061018;
  background: var(--cyan);
  font-weight: 900;
  box-shadow: 0 0 22px rgba(36, 214, 255, .35);
  transform: translate(-50%, -50%);
  touch-action: none;
  z-index: 3;
}

.token span {
  position: relative;
  z-index: 2;
}

.hp-bar {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: -8px;
  height: 4px;
  border: 1px solid rgba(0, 0, 0, .55);
  background: rgba(0, 0, 0, .55);
}

.hp-bar b {
  display: block;
  height: 100%;
  background: var(--green);
}

.token.npc {
  border-color: var(--red);
  background: var(--red);
}

.token.enemy {
  border-color: var(--danger);
  background: var(--danger);
}

.token.neutral {
  border-color: var(--yellow);
  background: var(--yellow);
}

.token.object {
  border-radius: 8px;
  border-color: var(--muted);
  background: var(--panel-2);
  color: var(--ink);
}

.token.vehicle {
  width: 64px;
  border-radius: 8px;
  border-color: var(--green);
  background: var(--green);
}

.token.locked {
  opacity: .58;
}

.token.hidden {
  border-style: dashed;
  opacity: .35;
}

.token.valid-target {
  outline: 3px solid rgba(36, 214, 255, .7);
  outline-offset: 4px;
}

.token.invalid-move {
  outline: 3px solid rgba(255, 92, 77, .8);
  outline-offset: 4px;
}

.board-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 2;
}

.blocker,
.player-door {
  pointer-events: stroke;
  cursor: pointer;
}

.blocker polyline,
.blocker line {
  stroke: rgba(255, 45, 85, .9);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px rgba(255, 45, 85, .35));
}

.blocker .blocker-hitbox {
  stroke: transparent;
  stroke-width: 24;
  filter: none;
}

.blocker.wall polyline {
  stroke-dasharray: 10 4;
}

.blocker.door line,
.player-door line {
  stroke: rgba(215, 169, 47, .95);
  stroke-width: 7;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(215, 169, 47, .35));
}

.blocker.door.open line,
.player-door.open line {
  stroke: rgba(82, 224, 139, .95);
  stroke-dasharray: 6 6;
}

.blocker.locked line,
.player-door.locked line {
  stroke: rgba(255, 92, 77, .95);
}

.blocker.wall .blocker-hitbox,
.blocker.door .blocker-hitbox {
  stroke: transparent;
  stroke-width: 24;
  stroke-dasharray: none;
  filter: none;
}

.blocker.inactive {
  opacity: .35;
}

.blocker.selected polyline,
.blocker.selected line {
  stroke-width: 8;
}

.blocker-handle,
.blocker circle,
.player-door circle {
  fill: rgba(7, 8, 12, .82);
  stroke: currentColor;
  stroke-width: 2;
}

.blocker-handle {
  color: var(--cyan);
  cursor: grab;
  filter: drop-shadow(0 0 8px rgba(36, 214, 255, .35));
}

.blocker-handle.endpoint {
  fill: rgba(36, 214, 255, .22);
}

.blocker-handle.segment {
  fill: rgba(215, 169, 47, .22);
  stroke: rgba(215, 169, 47, .95);
}

.blocker.selected {
  cursor: grab;
}

.blocker.pending circle {
  fill: rgba(36, 214, 255, .3);
  stroke: var(--cyan);
}

.blocker-preview line,
.door-preview line {
  stroke: rgba(82, 224, 139, .95);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 7 5;
  filter: drop-shadow(0 0 10px rgba(82, 224, 139, .35));
}

.blocker-preview circle,
.door-preview circle {
  fill: rgba(7, 8, 12, .8);
  stroke: rgba(82, 224, 139, .95);
  stroke-width: 2;
}

.door-preview.invalid line,
.door-preview.invalid circle {
  stroke: rgba(255, 92, 77, .95);
  filter: drop-shadow(0 0 10px rgba(255, 92, 77, .32));
}

.fog-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.fog-never {
  fill: rgba(0, 0, 0, .96);
}

.move-range {
  fill: rgba(36, 214, 255, .07);
  stroke: rgba(36, 214, 255, .38);
  stroke-width: 2;
  stroke-dasharray: 8 8;
}

.move-line,
.aim-line {
  stroke: var(--cyan);
  stroke-width: 3;
  filter: drop-shadow(0 0 8px rgba(36, 214, 255, .4));
}

.move-segment line {
  stroke: rgba(82, 224, 139, .75);
  stroke-width: 3;
  stroke-dasharray: 4 5;
  filter: drop-shadow(0 0 7px rgba(82, 224, 139, .26));
}

.move-segment circle {
  fill: var(--green);
}

.move-segment.gm-override line {
  stroke: rgba(215, 169, 47, .82);
}

.move-order {
  font-size: 10px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(7, 8, 12, .9);
  stroke-width: 3px;
}

.spawn-marker {
  pointer-events: none;
}

.spawn-marker circle {
  fill: rgba(7, 8, 12, .7);
  stroke-width: 3;
}

.spawn-marker line {
  stroke-width: 2;
  stroke-linecap: round;
}

.spawn-marker.player circle,
.spawn-marker.player line,
.spawn-marker.individual circle,
.spawn-marker.individual line {
  stroke: var(--green);
}

.spawn-marker.npc circle,
.spawn-marker.npc line {
  stroke: var(--red);
}

.spawn-marker.arrival circle,
.spawn-marker.arrival line {
  stroke: var(--yellow);
}

.map-cell rect {
  stroke: rgba(255, 255, 255, .2);
  stroke-width: 1;
}

.map-cell.wall rect {
  fill: rgba(255, 45, 85, .32);
}

.map-cell.closedDoor rect,
.map-cell.lockedDoor rect,
.map-cell.door rect {
  fill: rgba(215, 169, 47, .32);
}

.map-cell.object rect,
.map-cell.blocked rect {
  fill: rgba(255, 255, 255, .22);
}

.map-cell.difficult rect {
  fill: rgba(36, 214, 255, .18);
}

.inline-feedback {
  margin: 8px 0 12px;
  padding: 9px 10px;
  border: 1px solid rgba(36, 214, 255, .28);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(36, 214, 255, .08);
  font-size: 12px;
  font-weight: 800;
}

.spawn-tool-hud {
  border-color: rgba(82, 224, 139, .34);
  background: rgba(7, 12, 10, .84);
}

.move-line.invalid {
  stroke: var(--danger);
}

.aim-line {
  stroke: var(--red);
}

.overlay-label {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, .72);
  stroke-width: 4px;
}

.token-menu {
  position: absolute;
  z-index: 8;
  width: min(380px, calc(100% - 24px));
  max-height: min(560px, calc(100% - 24px));
  overflow: auto;
  border: 1px solid rgba(36, 214, 255, .38);
  border-radius: 8px;
  padding: 12px;
  background: rgba(7, 8, 12, .95);
  box-shadow: var(--shadow), 0 0 28px rgba(36, 214, 255, .12);
}

.token-actions {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  margin: 10px 0;
  gap: 8px;
}

.token-actions .btn {
  height: auto;
  min-height: 54px;
  display: grid;
  place-items: center;
  gap: 2px;
  white-space: normal;
}

.token-actions small {
  color: var(--muted);
  font-size: 10px;
}

.btn.blocked,
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.chat-log {
  display: grid;
  gap: 8px;
  max-height: min(300px, 34vh);
  overflow: auto;
  padding-right: 4px;
}

.message {
  border-left: 2px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .045);
  padding: 9px 10px;
  overflow-wrap: anywhere;
}

.message.gm {
  border-left-color: var(--red);
}

.message.roll {
  border-left-color: var(--cyan);
}

.message.gm-only {
  border-left-color: var(--yellow);
  background: rgba(215, 169, 47, .08);
}

.message small {
  display: block;
  color: var(--muted);
  margin-bottom: 3px;
}

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

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tab {
  flex: 1;
  min-width: 110px;
}

.hidden-view {
  display: none;
}

.notice {
  color: var(--yellow);
  font-size: 13px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.creator-shell,
.sheet-layout {
  width: min(1440px, 100%);
  margin: 0 auto;
}

.creator-shell {
  display: grid;
  gap: 18px;
  border: 1px solid rgba(36, 214, 255, .22);
  border-radius: 8px;
  padding: 18px;
  background: rgba(10, 12, 17, .88);
  box-shadow: var(--shadow);
}

.creator-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: end;
}

.meter {
  height: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--cyan));
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 8px;
}

.creator-form {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

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

.role-grid,
.market-grid,
.inventory-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

.role-card {
  display: grid;
  gap: 8px;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, .045);
}

.role-card input {
  width: auto;
}

.role-card.selected {
  border-color: rgba(36, 214, 255, .72);
  box-shadow: 0 0 22px rgba(36, 214, 255, .12);
}

.role-card span,
.role-card small,
.item-card small,
label small {
  color: var(--muted);
  line-height: 1.45;
}

.stat-grid {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
}

.skill-card {
  margin-bottom: 12px;
}

.skill-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
}

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

.vertical {
  display: grid;
}

.statline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.danger-text {
  color: var(--danger);
}

.item-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.item-card .actions,
.campaign-card .actions {
  align-items: stretch;
}

.item-card .actions .btn,
.campaign-card .actions .btn {
  flex: 1 1 110px;
}

.agent-board {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.agent-phone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 260px;
  border: 1px solid rgba(36, 214, 255, .35);
  border-radius: 22px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(36, 214, 255, .12), transparent),
    rgba(3, 4, 7, .82);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .035), 0 0 28px rgba(36, 214, 255, .08);
  text-align: center;
}

.agent-phone.large {
  min-height: 380px;
}

.agent-phone img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.phone-empty {
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 45, 85, .4);
  background: rgba(255, 45, 85, .08);
  color: var(--red);
  font-weight: 900;
}

.preview-phone {
  min-height: 220px;
}

.combat-actions {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
  margin-bottom: 16px;
}

.combat-panel {
  border: 1px solid rgba(255, 45, 85, .22);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 45, 85, .045);
}

.gm-control {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, .04);
  min-width: 0;
}

.gm-token-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.gm-token-button {
  height: auto;
  min-height: 54px;
  display: grid;
  justify-items: start;
  gap: 2px;
  text-align: left;
  white-space: normal;
}

.gm-token-button span {
  color: var(--muted);
  font-size: 11px;
}

.map-editor-panel {
  border-color: rgba(36, 214, 255, .24);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

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

.editor-tools.disabled-tools {
  opacity: .48;
  pointer-events: none;
}

.tool-group {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: rgba(255, 255, 255, .025);
}

.paint-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(36, 214, 255, .14);
  border-radius: 8px;
  background: rgba(36, 214, 255, .035);
}

.paint-controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.paint-controls input[type="color"] {
  width: 100%;
  height: 32px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 6px;
  background: rgba(0, 0, 0, .35);
}

.paint-stroke {
  pointer-events: none;
}

.editor-tools .btn {
  display: grid;
  gap: 2px;
  justify-items: center;
}

.editor-tools small {
  color: var(--muted);
  font-size: 10px;
}

.property-panel {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, .035);
}

.map-switcher,
.audio-panel {
  min-width: 0;
}

.room-audio {
  width: 100%;
  min-width: 0;
}

.movement-hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
  border: 1px solid rgba(36, 214, 255, .18);
  border-radius: 8px;
  padding: 10px;
  background: rgba(36, 214, 255, .045);
}

.movement-hud strong {
  grid-column: 1 / -1;
}

.movement-hud span {
  color: var(--muted);
  font-size: 12px;
}

.segment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segment-list span {
  border: 1px solid rgba(82, 224, 139, .22);
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--green);
  background: rgba(82, 224, 139, .055);
  font-size: 12px;
  font-weight: 800;
}

.participant-box {
  border: 1px solid rgba(36, 214, 255, .22);
  border-radius: 8px;
  padding: 10px;
  background: rgba(36, 214, 255, .045);
  max-height: 280px;
  overflow: auto;
}

.initiative-list {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(255, 45, 85, .24);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 45, 85, .045);
  max-height: 240px;
  overflow: auto;
}

.initiative-entry {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-left: 2px solid rgba(255, 255, 255, .16);
  padding: 7px 8px;
  background: rgba(255, 255, 255, .04);
}

.initiative-entry.current {
  border-left-color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(36, 214, 255, .18);
}

.map-manager {
  margin-top: 18px;
  border: 1px solid rgba(36, 214, 255, .18);
  border-radius: 8px;
  padding: 14px;
  background: rgba(36, 214, 255, .035);
}

.gm-session-panel {
  max-width: min(1840px, calc(100vw - 32px));
  width: 100%;
}

.btn.danger {
  border-color: rgba(255, 92, 77, .38);
  color: #ff9a8f;
}

.lobby-card {
  max-width: 680px;
}

.lobby-status {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(215, 169, 47, .24);
  border-radius: 8px;
  padding: 14px;
  background: rgba(215, 169, 47, .065);
  margin: 14px 0;
}

.lobby-status span {
  color: var(--muted);
}

.lobby-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
}

.lobby-member {
  box-shadow: none;
}

.lobby-member label {
  margin: 10px 0;
}

.compact-form {
  margin-bottom: 14px;
}

.map-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
}

.map-card {
  box-shadow: none;
}

.map-card.active-map {
  border-color: rgba(36, 214, 255, .55);
}

.file-btn.wide {
  width: 100%;
}

.dice-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 44%, rgba(36, 214, 255, .12), transparent 28%),
    rgba(0, 0, 0, .42);
  backdrop-filter: blur(3px);
}

.dice-card {
  width: min(720px, calc(100vw - 28px));
  border: 1px solid rgba(36, 214, 255, .45);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(16, 19, 26, .96), rgba(7, 8, 12, .97)),
    rgba(7, 8, 12, .94);
  box-shadow: var(--shadow), 0 0 34px rgba(36, 214, 255, .16);
  text-align: center;
  pointer-events: auto;
}

.dice-table-stage {
  position: relative;
  height: clamp(220px, 34vh, 310px);
  margin: 12px 0 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(rgba(36, 214, 255, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 214, 255, .06) 1px, transparent 1px),
    radial-gradient(circle at 50% 20%, rgba(255, 45, 85, .16), transparent 35%),
    #080b10;
  background-size: 36px 36px, 36px 36px, auto, auto;
}

.dice-table-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.dice-table-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.dice-table-fallback.subtle {
  inset: auto 10px 8px;
  display: block;
  color: rgba(151, 161, 183, .66);
  font-size: 11px;
  text-align: right;
}

.dice-results {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .32s ease, transform .32s ease;
}

.dice-overlay.results-ready .dice-results {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.css-dice-stage {
  perspective: 850px;
}

.css-dice-table {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(58deg) translateY(8px);
}

.css-dice-table::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 18%;
  height: 50%;
  border: 1px solid rgba(36, 214, 255, .18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(36, 214, 255, .12), transparent 48%),
    linear-gradient(135deg, rgba(255, 45, 85, .11), transparent 34%),
    rgba(4, 7, 12, .68);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .5), 0 34px 55px rgba(0, 0, 0, .4);
  transform: translateZ(-18px);
}

.css-dice-rail {
  position: absolute;
  left: 15%;
  right: 15%;
  bottom: 40%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(36, 214, 255, .85), rgba(255, 45, 85, .75), transparent);
  filter: drop-shadow(0 0 9px rgba(36, 214, 255, .55));
  transform-origin: center;
}

.thrown-die {
  position: absolute;
  left: 50%;
  bottom: 38%;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(237, 243, 255, .38);
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(145deg, rgba(36, 214, 255, .96), rgba(10, 94, 121, .96));
  box-shadow: inset -10px -12px 20px rgba(0, 0, 0, .28), inset 9px 9px 14px rgba(255, 255, 255, .2), 0 16px 25px rgba(0, 0, 0, .38);
  transform-style: preserve-3d;
  opacity: 0;
}

.thrown-die.d10 {
  border-radius: 42% 58% 45% 55%;
  background: linear-gradient(145deg, rgba(255, 45, 85, .96), rgba(112, 18, 42, .98));
}

.thrown-die i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(237, 243, 255, .18);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, .26);
}

.dice-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 14px 0;
}

.die {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 45, 85, .55);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(255, 45, 85, .22), rgba(36, 214, 255, .12));
  animation: dice-pop .8s ease both;
  animation-delay: var(--delay);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, .05), 0 8px 20px rgba(0, 0, 0, .25);
}

.die span {
  color: var(--muted);
  font-size: 11px;
}

.die strong {
  font-size: 28px;
}

.result-banner {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font-weight: 900;
  background: rgba(255, 255, 255, .04);
}

.result-banner.hit {
  border-color: rgba(82, 224, 139, .7);
  color: var(--green);
}

.result-banner.miss {
  border-color: rgba(255, 92, 77, .7);
  color: var(--danger);
}

.dice-damage-btn {
  width: min(220px, 100%);
  margin: 12px auto 0;
  box-shadow: 0 0 22px rgba(255, 45, 85, .26);
}

@keyframes dice-pop {
  0% {
    transform: translateY(12px) rotate(-10deg) scale(.82);
    opacity: .2;
  }
  55% {
    transform: translateY(-5px) rotate(6deg) scale(1.08);
    opacity: 1;
  }
  100% {
    transform: translateY(0) rotate(0) scale(1);
  }
}

.file-btn {
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, .05);
  font-weight: 800;
}

.file-btn input {
  display: none;
}

.map-setup-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(720px, 1fr);
  gap: 16px;
  align-items: start;
}

.map-setup-list,
.map-setup-editor {
  min-width: 0;
}

.map-setup-list .map-manager {
  margin: 0;
}

.map-editor-preview {
  min-width: 0;
  border: 1px solid rgba(36, 214, 255, .22);
  border-radius: 8px;
  background: rgba(9, 12, 18, .82);
  overflow: hidden;
}

.map-editor-preview .map-editor-panel {
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  margin: 0;
}

.inline-map-toolstrip {
  border-bottom-color: rgba(36, 214, 255, .18);
}

.settings-board-scroll {
  max-width: 100%;
  height: min(82vh, 900px);
  min-height: 620px;
  overflow: auto;
  background:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px),
    #05070b;
  background-size: 32px 32px;
}

.settings-board {
  min-width: 1080px;
  min-height: 680px;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
}

@media (max-width: 1040px) {
  .hero,
  .dashboard-grid,
  .vtt-main,
  .sheet-layout,
  .agent-board,
  .creator-head,
  .map-setup-workspace {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: 360px;
  }

  .vtt-main {
    grid-template-rows: auto minmax(520px, 1fr) auto;
  }

  .sidebar,
  .rightbar {
    border: 0;
    border-bottom: 1px solid var(--line);
    max-height: 46vh;
  }

  .board-wrap {
    overflow-x: auto;
  }

  .board {
    min-width: 760px;
  }

  .rightbar {
    max-height: none;
  }
}

@media (max-width: 680px) {
  .topbar,
  .toolstrip,
  .split {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    padding: 14px;
    align-items: stretch;
  }

  .topbar .actions {
    justify-content: stretch;
  }

  .topbar .actions .btn,
  .toolstrip .actions .btn,
  .toolstrip .file-btn {
    flex: 1 1 130px;
  }

  .features {
    grid-template-columns: 1fr;
  }

  .wizard-steps,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .auth-layout,
  .page {
    padding: 14px;
  }

  .hero {
    padding: 28px 14px;
  }

  h1 {
    font-size: 42px;
  }

  .sidebar {
    padding: 12px;
  }

  .board {
    min-width: 680px;
    min-height: 480px;
  }

  .token-menu {
    position: fixed;
    left: 12px !important;
    right: 12px;
    top: auto !important;
    bottom: 12px;
    width: auto;
    max-height: 58vh;
  }

  .movement-hud,
  .gm-token-list,
  .token-actions {
    grid-template-columns: 1fr;
  }

  .dice-card {
    padding: 14px;
  }
}

@media (max-width: 420px) {
  .btn {
    width: 100%;
  }

  .actions {
    width: 100%;
  }

  .brand {
    font-size: 14px;
  }

  .card,
  .panel,
  .auth-card {
    padding: 14px;
  }
}
