:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #64748b;
  --paper: #fffaf0;
  --panel: #ffffff;
  --line: #d7dee8;
  --sea: #0e7490;
  --teal: #0f766e;
  --mint: #d8f3dc;
  --gold: #f59e0b;
  --amber: #fef3c7;
  --coral: #e76f51;
  --rose: #be123c;
  --violet: #6d5dfc;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  height: 100%;
  background: #f5f7fb;
}

body {
  margin: 0;
  min-height: 100vh;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(14, 116, 144, 0.12), transparent 32%),
    linear-gradient(315deg, rgba(245, 158, 11, 0.14), transparent 34%),
    #f5f7fb;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  position: relative;
  width: 100vw;
  max-width: none;
  height: 100vh;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
}

.topbar,
.map-panel,
.operator-block,
.script-board,
.challenge-board,
.log-board {
  border: 1px solid rgba(215, 222, 232, 0.58);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar {
  position: fixed;
  top: 18px;
  left: 18px;
  right: auto;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 88px;
  padding: 16px 18px;
  border-radius: 8px;
  width: auto;
  max-width: calc(100vw - 36px);
  backdrop-filter: blur(16px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 250px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: conic-gradient(from 18deg, #be123c, #f59e0b, #0f766e, #0e7490, #be123c);
}

.brand-mark span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--paper);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 3vw, 2.55rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.status-strip {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 31;
  display: grid;
  grid-template-columns: clamp(104px, 18%, 132px) minmax(0, 1fr);
  gap: 8px;
  width: min(640px, calc(100vw - 458px));
}

.status-strip > div {
  min-width: 0;
  min-height: 58px;
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(248, 250, 252, 0.72);
  border: 1px solid rgba(215, 222, 232, 0.58);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(14px);
}

.status-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.status-strip strong {
  display: block;
  overflow-wrap: anywhere;
}

.active-turn-line {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.active-turn-line strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.timer-status-card {
  display: grid;
  grid-template-columns: minmax(62px, auto) auto minmax(112px, 1fr);
  align-items: center;
  gap: 6px;
}

.timer-status-head {
  display: contents;
}

.timer-status-head > div {
  min-width: 0;
}

.timer-status-head .status-label {
  margin-bottom: 2px;
}

.timer-status-head #timerText {
  white-space: nowrap;
}

.timer-status-head .primary-button {
  justify-self: start;
}

.timer-status-card #timerText {
  font-size: 1.15rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.timer-status-card #timerToggle {
  min-height: 38px;
  padding: 0 10px;
  white-space: nowrap;
}

.timer-status-card .segmented {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  margin-top: 0;
  padding: 3px;
  gap: 8px;
}

.timer-status-card .segment {
  min-height: 32px;
  padding: 0 5px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.game-layout {
  display: block;
  margin-top: 0;
}

.map-panel {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.map-toolbar,
.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.map-toolbar {
  position: fixed;
  top: 126px;
  left: 18px;
  z-index: 24;
  align-items: stretch;
  flex-direction: column;
  width: 112px;
  padding: 10px;
  border: 1px solid rgba(215, 222, 232, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.map-toolbar-heading {
  display: grid;
  gap: 8px;
}

.map-toolbar h2 {
  font-size: 0.96rem;
  line-height: 1.08;
}

.map-toolbar button {
  pointer-events: auto;
}

.map-toolbar-toggle {
  display: grid;
  place-items: center;
  min-height: 36px;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(248, 250, 252, 0.78);
  border: 1px solid rgba(215, 222, 232, 0.72);
  font-size: 0.72rem;
  font-weight: 950;
}

.map-toolbar .toolbar-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

.map-toolbar .icon-button,
.map-toolbar .zoom-reset {
  width: 100%;
  min-height: 40px;
}

.map-toolbar.is-collapsed {
  width: 58px;
  height: 58px;
  padding: 6px;
  border-radius: 999px;
}

.map-toolbar.is-collapsed .map-toolbar-heading {
  display: block;
}

.map-toolbar.is-collapsed .map-toolbar-heading > div,
.map-toolbar.is-collapsed .toolbar-actions {
  display: none;
}

.map-toolbar.is-collapsed .map-toolbar-toggle {
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 999px;
  padding: 0;
}

.toolbar-actions,
.reveal-actions,
.score-tools,
.dialog-actions,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.panel-toggle,
.dock-button,
.ghost-button,
.primary-button,
.score-tools button,
.dialog-actions button {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  color: var(--ink);
  background: #f1f5f9;
  border: 1px solid var(--line);
}

.zoom-reset {
  width: 58px;
  font-size: 0.72rem;
}

.panel-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  min-height: 32px;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 0;
}

.primary-button {
  color: #ffffff;
  background: var(--rose);
  padding: 0 16px;
}

.ghost-button,
.score-tools button,
.dialog-actions button {
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 0 13px;
}

.map-stage {
  position: relative;
  flex: 1;
  min-height: 100vh;
  overflow: hidden;
  background: var(--sea);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.map-stage.is-panning {
  cursor: grabbing;
}

.map-canvas {
  position: absolute;
  inset: 0;
  min-width: 100%;
  min-height: 100%;
  transform-origin: 0 0;
  will-change: transform;
}

.map-canvas.focus-animating {
  transition: transform 950ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sea-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.island-layer,
.ship-layer {
  position: absolute;
  inset: 0;
}

.ship-layer {
  z-index: 4;
  pointer-events: none;
}

.island {
  position: absolute;
  display: grid;
  place-items: center;
  isolation: isolate;
  width: clamp(76px, 7.4vw, 112px);
  aspect-ratio: 1.24;
  transform: translate(-50%, -50%);
  color: var(--ink);
  border: 0;
  border-radius: 47% 53% 58% 42% / 55% 44% 56% 45%;
  box-shadow:
    0 0 0 9px rgba(103, 232, 249, 0.23),
    0 0 0 17px rgba(34, 211, 238, 0.11),
    0 16px 28px rgba(2, 6, 23, 0.28);
  transition: transform 180ms ease, filter 180ms ease, opacity 180ms ease;
  touch-action: none;
}

.island::before,
.island::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: inherit;
}

.island::before {
  inset: -18%;
  z-index: -1;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(34, 211, 238, 0.5) 0 37%, rgba(6, 182, 212, 0.22) 48%, transparent 69%),
    radial-gradient(ellipse at 52% 54%, rgba(255, 255, 255, 0.42) 0 42%, transparent 54%);
  filter: blur(1px);
}

.island::after {
  inset: 4%;
  z-index: 1;
  background:
    radial-gradient(circle at 30% 32%, rgba(254, 243, 199, 0.92) 0 5%, transparent 6%),
    radial-gradient(circle at 70% 66%, rgba(120, 113, 108, 0.72) 0 5%, transparent 6%),
    radial-gradient(circle at 60% 28%, rgba(68, 64, 60, 0.6) 0 4%, transparent 5%),
    radial-gradient(ellipse at 46% 42%, rgba(20, 83, 45, 0.72) 0 23%, transparent 34%),
    linear-gradient(138deg, rgba(255, 255, 255, 0.34), transparent 42%);
  mix-blend-mode: multiply;
  opacity: 0.66;
}

.ship-marker {
  position: absolute;
  width: 136px;
  height: 86px;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  color: #ffffff;
  pointer-events: auto;
  touch-action: none;
  will-change: left, top, transform;
}

.ship-marker:hover,
.ship-marker:focus-visible {
  outline: 3px solid rgba(254, 243, 199, 0.8);
  outline-offset: 6px;
}

.ship-marker.active {
  filter: drop-shadow(0 0 16px rgba(254, 243, 199, 0.9));
}

.ship-marker.sailing {
  transform: translate(-50%, -50%) scale(1.18);
  transition:
    left 1150ms cubic-bezier(0.22, 1, 0.36, 1),
    top 1150ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 1150ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ship-marker.sailing .ship-boat {
  animation: ship-bob 520ms ease-in-out infinite;
}

.ship-marker.arrived {
  animation: ship-arrived 760ms ease-out;
}

.ship-boat {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 74px;
  height: 50px;
  transform: translateX(-50%);
}

.ship-mast {
  position: absolute;
  left: 34px;
  top: 0;
  width: 4px;
  height: 42px;
  border-radius: 999px;
  background: #422006;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.24);
}

.ship-sail {
  position: absolute;
  top: 3px;
  width: 31px;
  height: 31px;
  background: #fff7ed;
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 13px rgba(15, 23, 42, 0.18);
}

.ship-sail.left {
  left: 3px;
  clip-path: polygon(100% 0, 100% 100%, 0 76%);
}

.ship-sail.right {
  left: 38px;
  background: var(--ship-color);
  clip-path: polygon(0 0, 100% 78%, 0 100%);
}

.ship-hull {
  position: absolute;
  left: 9px;
  bottom: 2px;
  width: 58px;
  height: 20px;
  border-radius: 0 0 28px 28px;
  background: linear-gradient(180deg, #92400e 0%, #451a03 100%);
  border: 2px solid rgba(254, 243, 199, 0.9);
  box-shadow: 0 12px 14px rgba(15, 23, 42, 0.25);
}

.ship-hull::before,
.ship-hull::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fef3c7;
}

.ship-hull::before {
  left: 13px;
}

.ship-hull::after {
  right: 13px;
}

.ship-label {
  position: absolute;
  left: 50%;
  bottom: 0;
  min-width: 88px;
  max-width: 128px;
  transform: translateX(-50%);
  padding: 3px 7px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(23, 32, 51, 0.78);
  font-size: 0.62rem;
  font-weight: 950;
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
  box-shadow: 0 7px 14px rgba(15, 23, 42, 0.2);
  overflow-wrap: anywhere;
}

.ship-marker.active .ship-label {
  color: var(--ink);
  background: #fef3c7;
}

@keyframes ship-bob {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) rotate(-2deg);
  }

  50% {
    transform: translateX(-50%) translateY(-5px) rotate(2deg);
  }
}

@keyframes ship-arrived {
  0% {
    filter: drop-shadow(0 0 0 rgba(254, 243, 199, 0));
  }

  45% {
    filter: drop-shadow(0 0 18px rgba(254, 243, 199, 0.95));
  }

  100% {
    filter: drop-shadow(0 0 0 rgba(254, 243, 199, 0));
  }
}

.island:hover,
.island:focus-visible {
  transform: translate(-50%, -50%) scale(1.08);
  outline: 4px solid rgba(254, 243, 199, 0.75);
  outline-offset: 3px;
}

.island.opened {
  filter: saturate(0.75);
  opacity: 0.78;
}

.island.active {
  outline: 5px solid rgba(190, 18, 60, 0.72);
  outline-offset: 4px;
}

.island-number {
  position: absolute;
  top: 16%;
  right: 16%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  background: rgba(23, 32, 51, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.52);
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.2);
}

.island-name {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: -24px;
  width: 132px;
  transform: translateX(-50%);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 2px 8px rgba(15, 23, 42, 0.6);
  overflow-wrap: anywhere;
}

.control-panel {
  position: fixed;
  top: 126px;
  right: 18px;
  bottom: 18px;
  z-index: 25;
  width: min(390px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  pointer-events: none;
}

.operator-block {
  border-radius: 8px;
  padding: 15px;
  backdrop-filter: blur(16px);
  pointer-events: auto;
}

.timer-block h2 {
  font-variant-numeric: tabular-nums;
  font-size: 2.35rem;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 14px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(237, 242, 247, 0.58);
}

.segment {
  min-height: 36px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.segment.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.08);
}

.type-pill {
  flex: none;
  max-width: 140px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--teal);
  font-size: 0.72rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.faith-meaning {
  margin: 14px 0 10px;
  color: var(--muted);
  line-height: 1.5;
}

.effect-box {
  min-height: 82px;
  padding: 12px;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  background: rgba(255, 251, 235, 0.76);
  font-weight: 750;
  line-height: 1.45;
}

.reveal-actions {
  margin-top: 12px;
}

select,
input {
  min-height: 40px;
  min-width: 0;
  border: 1px solid rgba(215, 222, 232, 0.7);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
}

.reveal-actions select {
  flex: 1;
}

.score-tools {
  display: grid;
  grid-template-columns: 86px 1fr 1fr;
  margin-top: 10px;
}

.score-tools input {
  width: 86px;
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: min(45vh, 460px);
  overflow: auto;
}

.team-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(215, 222, 232, 0.66);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.68);
}

.team-row.active {
  border-color: var(--rose);
  background: rgba(255, 241, 242, 0.72);
}

.team-name-button {
  min-width: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 900;
  text-align: left;
  overflow-wrap: anywhere;
}

.token-count {
  min-width: 48px;
  text-align: right;
  font-size: 1.1rem;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.mini-actions {
  display: flex;
  gap: 4px;
}

.mini-actions button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(215, 222, 232, 0.66);
  font-weight: 950;
}

.lower-grid {
  position: fixed;
  left: 18px;
  right: 426px;
  bottom: 82px;
  z-index: 22;
  display: grid;
  grid-template-columns: 1fr 1.4fr 1.1fr;
  gap: 18px;
  margin-top: 0;
  pointer-events: none;
}

.utility-dock {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 35;
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(215, 222, 232, 0.58);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.dock-button {
  display: grid;
  place-items: center;
  width: 48px;
  min-height: 44px;
  color: var(--ink);
  background: rgba(248, 250, 252, 0.74);
  border: 1px solid rgba(215, 222, 232, 0.66);
  padding: 0;
  font-size: 0.76rem;
}

.dock-button.active {
  color: #ffffff;
  background: var(--rose);
  border-color: var(--rose);
}

.script-board,
.challenge-board,
.log-board {
  border-radius: 8px;
  padding: 15px;
  min-height: 0;
  max-height: 292px;
  overflow: hidden;
  backdrop-filter: blur(16px);
  pointer-events: auto;
}

.utility-panel.is-hidden {
  display: none;
}

.script-board p {
  margin: 14px 0 0;
  color: var(--ink);
  line-height: 1.55;
}

.challenge-list,
.game-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 185px;
  overflow: auto;
}

.challenge-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.challenge-item strong {
  display: block;
  margin-bottom: 5px;
}

.challenge-item p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.4;
}

.game-log {
  padding-left: 22px;
}

.game-log li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
}

.operator-block.collapsed,
.script-board.collapsed,
.challenge-board.collapsed,
.log-board.collapsed {
  width: fit-content;
  min-width: min(260px, 100%);
}

.operator-block.collapsed {
  align-self: flex-end;
}

.operator-block.collapsed > :not(.block-header),
.script-board.collapsed > :not(.block-header),
.challenge-board.collapsed > :not(.block-header),
.log-board.collapsed > :not(.block-header) {
  display: none;
}

.operator-block.collapsed .block-header,
.script-board.collapsed .block-header,
.challenge-board.collapsed .block-header,
.log-board.collapsed .block-header {
  min-width: 0;
}

.operator-block.collapsed .panel-actions > :not(.panel-toggle),
.script-board.collapsed .panel-actions > :not(.panel-toggle),
.challenge-board.collapsed .panel-actions > :not(.panel-toggle),
.log-board.collapsed .panel-actions > :not(.panel-toggle) {
  display: none;
}

.operator-block.is-expanded,
.script-board.is-expanded,
.challenge-board.is-expanded,
.log-board.is-expanded {
  position: fixed;
  top: 126px;
  left: 50%;
  right: auto;
  bottom: auto;
  z-index: 60;
  width: min(760px, calc(100vw - 48px));
  max-height: calc(100vh - 158px);
  transform: translateX(-50%);
  overflow: auto;
}

.operator-block.is-expanded .team-list,
.operator-block.is-expanded .challenge-list,
.operator-block.is-expanded .game-log,
.script-board.is-expanded .challenge-list,
.script-board.is-expanded .game-log,
.challenge-board.is-expanded .challenge-list,
.challenge-board.is-expanded .game-log,
.log-board.is-expanded .challenge-list,
.log-board.is-expanded .game-log {
  max-height: calc(100vh - 300px);
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.island-dialog::backdrop {
  background:
    radial-gradient(circle at 50% 45%, rgba(254, 243, 199, 0.28), transparent 34%),
    rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(3px);
}

.dialog-body {
  width: min(380px, calc(100vw - 32px));
  padding: 18px;
}

.dialog-body input {
  width: 100%;
  margin: 12px 0;
}

.island-dialog-body {
  position: relative;
  width: min(620px, calc(100vw - 32px));
  padding: 26px;
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 251, 235, 0.96), rgba(240, 253, 250, 0.96)),
    #ffffff;
}

.island-dialog-body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(245, 158, 11, 0.12), transparent 26%, transparent 74%, rgba(15, 118, 110, 0.12)),
    radial-gradient(circle at 18% 20%, rgba(190, 18, 60, 0.1), transparent 28%);
}

.island-dialog-body > * {
  position: relative;
  z-index: 1;
}

.island-dialog-body h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.island-dialog-body .type-pill {
  display: inline-flex;
  margin-bottom: 18px;
}

.dialog-meaning {
  margin: 0 0 16px;
  color: #475569;
  font-size: 1.05rem;
  line-height: 1.55;
}

.dialog-effect {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
}

.dialog-effect span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dialog-effect strong {
  font-size: 1.08rem;
  line-height: 1.45;
}

.dialog-tool-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: -4px 0 18px;
}

.dialog-tool-button {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: #4f46e5;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 10px 18px rgba(79, 70, 229, 0.2);
}

.dialog-tool-button:hover,
.dialog-tool-button:focus-visible {
  background: #4338ca;
  outline: 3px solid rgba(199, 210, 254, 0.86);
  outline-offset: 2px;
}

.slide-tool-button {
  background: #be123c;
  box-shadow: 0 10px 18px rgba(190, 18, 60, 0.2);
}

.slide-tool-button:hover,
.slide-tool-button:focus-visible {
  background: #9f1239;
}

.dialog-spin-result {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(80px, 1fr);
  align-items: center;
  gap: 10px;
  margin: -6px 0 18px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(79, 70, 229, 0.24);
  background: rgba(238, 242, 255, 0.82);
}

.dialog-spin-result span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dialog-spin-result strong {
  color: #312e81;
  font-size: 1.35rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.dialog-choice-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.choice-card-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 112px;
  padding: 16px;
  border: 1px solid rgba(245, 158, 11, 0.36);
  border-radius: 8px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 251, 235, 0.92), rgba(240, 253, 250, 0.86)),
    rgba(255, 255, 255, 0.84);
  text-align: left;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.choice-card-button:hover,
.choice-card-button:focus-visible {
  border-color: #f59e0b;
  outline: 3px solid rgba(253, 230, 138, 0.62);
  outline-offset: 2px;
  transform: translateY(-1px);
}

.choice-card-button.selected {
  border-color: #0f766e;
  background:
    linear-gradient(135deg, rgba(204, 251, 241, 0.92), rgba(255, 251, 235, 0.88)),
    rgba(255, 255, 255, 0.9);
}

.choice-card-button span:not(.choice-card-icon) {
  display: grid;
  gap: 4px;
}

.choice-card-button strong {
  font-size: 1.16rem;
  font-weight: 950;
  line-height: 1.05;
}

.choice-card-button small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 780;
  line-height: 1.25;
}

.choice-card-button b {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 7px 10px;
  border-radius: 8px;
  color: #ffffff;
  background: #0f766e;
  font-size: 0.92rem;
  line-height: 1;
}

.choice-card-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #ffffff;
  background: #f59e0b;
  font-size: 1.4rem;
  font-weight: 950;
}

.spin-wheel-dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.spin-wheel-dialog::backdrop {
  background: rgba(2, 6, 23, 0.48);
  backdrop-filter: blur(7px);
}

.spin-wheel-body {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(125, 211, 252, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 251, 235, 0.95), rgba(224, 242, 254, 0.94)),
    rgba(255, 255, 255, 0.9);
  box-shadow: 0 28px 90px rgba(2, 6, 23, 0.36);
}

.spin-wheel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.spin-wheel-head h2 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1;
}

.spin-wheel-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 330px;
  overflow: hidden;
}

.spin-wheel-stage::after {
  content: "";
  position: absolute;
  width: 72px;
  height: 72px;
  border: 8px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  background: #0f172a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.28);
  z-index: 4;
}

.spin-pointer {
  position: absolute;
  top: 0;
  z-index: 5;
  width: 0;
  height: 0;
  border-right: 18px solid transparent;
  border-left: 18px solid transparent;
  border-top: 34px solid #f59e0b;
  filter: drop-shadow(0 5px 6px rgba(15, 23, 42, 0.28));
}

.spin-wheel {
  position: relative;
  width: min(315px, 78vw);
  aspect-ratio: 1;
  border: 10px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  background: conic-gradient(from -90deg, #0f766e, #f97316, #2563eb, #be123c, #7c3aed, #16a34a, #ca8a04, #0891b2, #0f766e);
  box-shadow:
    inset 0 0 0 2px rgba(15, 23, 42, 0.1),
    inset 0 -26px 34px rgba(15, 23, 42, 0.2),
    0 24px 50px rgba(15, 23, 42, 0.26);
  transform: rotate(0deg);
  transition: transform 2.35s cubic-bezier(0.12, 0.76, 0.12, 1);
}

.spin-wheel.is-spinning {
  transition-duration: 2.35s;
}

.spin-wheel-label {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 92px;
  min-height: 24px;
  margin: -12px 0 0 -46px;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 2px 5px rgba(15, 23, 42, 0.42);
  transform-origin: center center;
}

.spin-wheel-result {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
  font-size: 1.2rem;
  font-weight: 950;
  text-align: center;
}

.spin-wheel-actions {
  display: flex;
  justify-content: center;
}

.spin-wheel-actions .primary-button {
  min-width: 180px;
}

.slide-game-dialog {
  width: min(1180px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.slide-game-dialog::backdrop {
  background: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(8px);
}

.slide-game-body {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(125, 211, 252, 0.42);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.95);
  box-shadow: 0 30px 100px rgba(2, 6, 23, 0.42);
}

.slide-game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.slide-game-head h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  line-height: 1;
}

.slide-game-stage {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #020617;
}

.slide-game-stage img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #020617;
}

.slide-game-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.slide-game-footer strong {
  min-width: 74px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 950;
  text-align: center;
}

.slide-game-footer .primary-button,
.slide-game-footer .ghost-button {
  min-height: 48px;
}

.dialog-score-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto);
  gap: 10px;
  align-items: end;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid rgba(215, 222, 232, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.dialog-score-control label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dialog-score-control p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--ink);
  font-weight: 850;
  line-height: 1.35;
}

.dialog-score-control select {
  width: 100%;
}

.dialog-score-control strong {
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--teal);
  font-size: 0.84rem;
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .lower-grid {
    grid-template-columns: 1fr;
    right: 426px;
    width: min(360px, calc(100vw - 462px));
  }
}

@media (max-width: 820px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    width: min(1500px, 100%);
    height: auto;
    min-height: 100vh;
    padding: 12px;
    overflow: visible;
  }

  .topbar,
  .map-toolbar,
  .block-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar,
  .status-strip,
  .map-panel,
  .map-toolbar,
  .control-panel,
  .lower-grid,
  .utility-dock {
    position: static;
    width: auto;
    transform: none;
  }

  .topbar {
    margin-bottom: 12px;
  }

  .status-strip,
  .control-panel {
    grid-template-columns: 1fr;
    width: auto;
  }

  .dialog-choice-actions {
    grid-template-columns: 1fr;
  }

  .slide-game-body {
    padding: 12px;
  }

  .slide-game-head,
  .slide-game-footer {
    grid-template-columns: 1fr;
  }

  .slide-game-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  .game-layout {
    display: block;
  }

  .map-panel {
    min-height: auto;
    border: 1px solid rgba(215, 222, 232, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
  }

  .map-toolbar {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: none;
  }

  .map-panel {
    min-height: auto;
  }

  .map-stage {
    min-height: 560px;
  }

  .control-panel,
  .lower-grid {
    display: grid;
    gap: 12px;
    margin-top: 12px;
    pointer-events: auto;
  }

  .utility-dock {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 12px;
    padding: 8px;
  }

  .dock-button {
    width: 100%;
  }

  .script-board,
  .challenge-board,
  .log-board {
    max-height: none;
  }

  .operator-block.is-expanded,
  .script-board.is-expanded,
  .challenge-board.is-expanded,
  .log-board.is-expanded {
    position: static;
    width: auto;
    max-height: none;
    transform: none;
  }

  .island {
    width: 72px;
  }

  .ship-marker {
    width: 104px;
    height: 68px;
  }

  .ship-boat {
    width: 58px;
    height: 40px;
  }

  .ship-mast {
    left: 27px;
    height: 34px;
  }

  .ship-sail {
    width: 24px;
    height: 24px;
  }

  .ship-sail.right {
    left: 30px;
  }

  .ship-hull {
    left: 7px;
    width: 45px;
    height: 16px;
  }

  .ship-label {
    min-width: 74px;
    max-width: 98px;
    font-size: 0.52rem;
  }
}

@media (max-width: 540px) {
  .status-strip {
    gap: 6px;
  }

  .map-stage {
    min-height: 500px;
  }

  .island {
    width: 54px;
    border-width: 2px;
  }

  .island-number {
    width: 25px;
    height: 25px;
    font-size: 0.78rem;
  }

  .island-name {
    display: none;
    bottom: -17px;
    width: 74px;
    font-size: 0.56rem;
    line-height: 1;
  }

  .island.opened .island-name,
  .island.active .island-name {
    display: block;
  }

  .score-tools,
  .team-row {
    grid-template-columns: 1fr;
  }

  .score-tools input {
    width: 100%;
  }

  .mini-actions {
    justify-content: flex-end;
  }
}
