:root {
  color-scheme: dark;
  --bg: #101211;
  --panel: #1a1d1b;
  --panel-2: #232820;
  --line: #3a4138;
  --text: #f0eee6;
  --muted: #b7b2a4;
  --accent: #d0b25c;
  --danger: #c66b5d;
  --good: #7bb37b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(16, 18, 17, 0.76), rgba(16, 18, 17, 0.92)),
    url('/assets/black-mist-map.svg') center/cover fixed;
  color: var(--text);
  font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
}

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

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

body.auth-landing .shell,
body.creating-character .shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
}

body.playing .shell {
  grid-template-columns: 1fr;
}

body.playing .left-pane {
  display: none;
}

body.auth-landing .left-pane,
body.creating-character .left-pane {
  width: min(1180px, 100%);
  border-right: 0;
  background: transparent;
  overflow: visible;
  padding: 0;
}

body.auth-landing .game-pane,
body.auth-landing #characterForm,
body.creating-character .game-pane,
body.creating-character #authForm {
  display: none;
}

.left-pane {
  border-right: 1px solid var(--line);
  background: rgba(18, 20, 19, 0.94);
  padding: 24px;
  overflow: auto;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

body.auth-landing .brand-row,
body.creating-character .brand-row {
  justify-content: center;
  margin-bottom: 14px;
  text-align: center;
}

body.auth-landing .sigil,
body.creating-character .sigil {
  display: none;
}

.sigil {
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  background: #111;
  object-fit: cover;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

body.auth-landing h1,
body.creating-character h1 {
  color: #f6ead0;
  font-family: "Palatino Linotype", "Book Antiqua", "Noto Serif TC", "PMingLiU", serif;
  font-size: clamp(42px, 6vw, 78px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-shadow:
    0 2px 0 rgba(44, 31, 16, 0.92),
    0 0 14px rgba(0, 0, 0, 0.9),
    0 0 30px rgba(208, 178, 92, 0.24);
}

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

p,
label,
dd,
dt {
  line-height: 1.6;
}

#statusLine,
.muted,
dt {
  color: var(--muted);
}

#statusLine {
  display: none;
}

.entrance-map {
  display: none;
}

body.auth-landing .entrance-map,
body.creating-character .entrance-map {
  display: block;
  border: 1px solid var(--line);
  background: #0d0f0e;
  margin: 0 auto;
  max-width: 1120px;
  overflow: hidden;
  position: relative;
}

.entrance-map img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

body.auth-landing .entrance-map::after,
body.creating-character .entrance-map::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(7, 8, 7, 0.28), rgba(7, 8, 7, 0.18) 30%, rgba(7, 8, 7, 0.5) 100%),
    radial-gradient(circle at 50% 42%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.52) 78%);
  pointer-events: none;
}

.entrance-overlay {
  display: none;
}

body.auth-landing .entrance-overlay,
body.creating-character .entrance-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: clamp(22px, 4vw, 48px);
}

body.auth-landing .auth-panel,
body.creating-character .character-panel {
  border: 1px solid var(--line);
  background: rgba(12, 15, 13, 0.76);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.46);
  margin: 0 auto;
  max-width: 420px;
  width: min(420px, 100%);
  padding: 18px;
  backdrop-filter: blur(3px);
}

body.creating-character .character-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: none;
  max-width: 940px;
  overflow: visible;
  width: min(940px, 100%);
}

body.creating-character .character-panel > button[type="submit"] {
  position: sticky;
  bottom: 18px;
  z-index: 2;
  justify-self: start;
  margin-top: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.character-create-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.82fr) minmax(250px, 1fr) minmax(250px, 1fr);
  gap: 16px;
  min-height: 0;
}

.character-create-column {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

body.creating-character .character-panel label {
  margin-bottom: 0;
}

body.creating-character .choice-explain {
  margin: 0;
  min-height: 172px;
}

body.creating-character .character-panel textarea {
  height: 176px;
  min-height: 176px;
}

body.creating-character .entrance-overlay {
  align-content: center;
  padding: 20px;
}

body.creating-character .entrance-map {
  height: min(760px, calc(100vh - 44px));
  max-width: 1200px;
}

body.creating-character .entrance-map img {
  aspect-ratio: auto;
  height: 100%;
}

body.creating-character h1 {
  font-size: clamp(34px, 4.8vw, 62px);
}

body.auth-landing .auth-panel .panel-heading {
  margin-bottom: 8px;
}

body.auth-landing #authStatus {
  min-height: 0;
  margin-bottom: 10px;
}

.panel {
  border-top: 1px solid var(--line);
  padding: 20px 0;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #111411;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

button {
  border: 1px solid #8d783e;
  background: #d0b25c;
  color: #171511;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.hidden {
  display: none !important;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-heading h2 {
  margin-bottom: 0;
}

.secondary-button {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
  padding: 7px 10px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  margin: 12px 0;
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.segmented button + button {
  border-left: 1px solid var(--line);
}

.segmented button.active {
  background: var(--accent);
  color: #171511;
}

.auth-panel .muted {
  min-height: 24px;
}

.choice-explain {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(58, 65, 56, 0.86);
  background: rgba(35, 40, 32, 0.58);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin: -4px 0 13px;
  padding: 10px 11px;
}

.choice-explain strong {
  color: var(--accent);
  font-size: 13px;
}

.disabled-panel {
  opacity: 0.58;
}

.disabled-panel input,
.disabled-panel select,
.disabled-panel textarea,
.disabled-panel button {
  cursor: not-allowed;
}

.metrics {
  display: grid;
  gap: 12px;
  margin: 0;
}

.metrics div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.metrics .metric-wide {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.metrics dd {
  margin: 0;
  text-align: right;
}

.metrics .metric-wide dd {
  text-align: left;
  overflow-wrap: anywhere;
}

.cost-alerts {
  border-top: 1px solid rgba(58, 65, 56, 0.72);
  margin-top: 14px;
  padding-top: 14px;
}

.cost-alerts h3 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
}

.cost-alerts ul {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.cost-alerts button {
  margin-top: 10px;
  width: 100%;
}

.cost-alerts li {
  border: 1px solid rgba(58, 65, 56, 0.52);
  border-radius: 6px;
  background: rgba(19, 23, 21, 0.44);
  padding: 9px 10px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cost-alerts li.alert-high {
  border-color: rgba(202, 89, 78, 0.75);
}

.cost-alerts li.alert-watch {
  border-color: rgba(208, 178, 92, 0.72);
}

.cost-alerts strong,
.cost-alerts span,
.cost-alerts small {
  display: block;
}

.cost-alerts strong {
  color: var(--text);
  font-size: 13px;
}

.cost-alerts span {
  margin-top: 4px;
  color: var(--muted);
}

.cost-alerts small {
  margin-top: 4px;
  color: rgba(208, 217, 205, 0.68);
}

.content-admin-grid {
  display: grid;
  gap: 12px;
}

.content-admin-grid > div {
  border-top: 1px solid rgba(58, 65, 56, 0.72);
  padding-top: 10px;
}

.content-admin-grid h3 {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.admin-list {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.admin-correction {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(58, 65, 56, 0.72);
  margin-top: 14px;
  padding-top: 14px;
}

.admin-correction h3 {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
}

.admin-detail {
  border-top: 1px solid rgba(58, 65, 56, 0.72);
  margin-top: 14px;
  padding-top: 14px;
}

.admin-detail h3 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
}

.admin-detail-list {
  display: grid;
  gap: 7px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.admin-detail-list li {
  border: 1px solid rgba(58, 65, 56, 0.52);
  border-radius: 6px;
  background: rgba(19, 23, 21, 0.42);
  padding: 8px 9px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.admin-detail-list strong {
  display: block;
  color: var(--accent);
  font-size: 12px;
  margin-bottom: 2px;
}

.admin-draft {
  border-top: 1px solid rgba(58, 65, 56, 0.72);
  margin-top: 14px;
  padding-top: 14px;
}

.admin-draft h3 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
}

.admin-draft button {
  margin-top: 8px;
  width: 100%;
}

.admin-correction-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-audit {
  border-top: 1px solid rgba(58, 65, 56, 0.72);
  margin-top: 14px;
  padding-top: 14px;
}

.admin-audit h3 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
}

.admin-audit-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.admin-audit-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-audit-list li {
  border: 1px solid rgba(58, 65, 56, 0.52);
  border-radius: 6px;
  padding: 9px 10px;
  background: rgba(19, 23, 21, 0.48);
}

.admin-audit-list li.risk-high {
  border-color: rgba(202, 89, 78, 0.75);
}

.admin-audit-list li.risk-watch {
  border-color: rgba(208, 178, 92, 0.72);
}

.admin-audit-list summary {
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.admin-audit-list pre {
  max-height: 220px;
  overflow: auto;
  border: 1px solid rgba(58, 65, 56, 0.5);
  border-radius: 5px;
  background: rgba(11, 14, 12, 0.72);
  color: rgba(232, 236, 226, 0.82);
  font-size: 11px;
  line-height: 1.45;
  margin: 8px 0 0;
  padding: 8px;
  white-space: pre-wrap;
}

.admin-audit-list strong,
.admin-audit-list span,
.admin-audit-list small {
  display: block;
}

.admin-audit-list strong {
  color: var(--text);
  font-size: 13px;
}

.admin-audit-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.admin-audit-list small {
  margin-top: 4px;
  color: rgba(208, 217, 205, 0.64);
  font-size: 11px;
  line-height: 1.4;
}

.admin-audit-list .audit-risk {
  color: rgba(232, 204, 125, 0.9);
}

.game-pane {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  min-width: 0;
  background: rgba(13, 15, 14, 0.78);
}

body.playing .game-pane {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
}

.play-area {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(430px, 500px);
  gap: 16px;
  min-height: 0;
  padding: 16px 20px 20px;
}

.interaction-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  border: 1px solid rgba(91, 79, 48, 0.82);
  background: rgba(12, 13, 11, 0.9);
  box-shadow: inset 0 0 0 1px rgba(208, 178, 92, 0.08);
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 22px 26px;
  background: rgba(24, 27, 25, 0.92);
}

.game-header h2 {
  margin: 0 0 3px;
  font-size: 20px;
}

.game-header p {
  color: var(--muted);
}

#intentSelect {
  width: 140px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.playing #intentSelect,
body.playing #memoryButton,
body.playing #summaryButton,
body.playing .memory-panel,
body.playing .runtime-panel,
body.playing #mapActionButton,
body.playing #processActionPanel {
  display: none !important;
}

.admin-panel-surface {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(8, 10, 9, 0.74);
  padding: 22px;
}

.admin-panel-dialog {
  width: min(1080px, 100%);
  max-height: min(860px, calc(100vh - 44px));
  overflow: auto;
  border: 1px solid var(--line);
  background: rgba(18, 20, 19, 0.98);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  padding: 22px;
}

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

.admin-panel-header h2 {
  margin-bottom: 3px;
}

.memory-panel {
  border-bottom: 1px solid var(--line);
  background: rgba(17, 20, 18, 0.88);
  padding: 12px 26px;
}

.memory-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.memory-panel-header span:last-child {
  color: var(--muted);
  font-weight: 400;
}

.memory-summary {
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 4px;
  max-height: 64px;
  overflow: auto;
}

.memory-panel.empty .memory-summary {
  color: var(--muted);
}

.runtime-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(19, 22, 20, 0.88);
  padding: 12px 26px;
}

.runtime-column {
  min-width: 0;
}

.runtime-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.runtime-panel-header span:last-child {
  color: var(--muted);
  font-weight: 400;
}

.runtime-list {
  display: grid;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.runtime-list li {
  min-width: 0;
  border-left: 2px solid rgba(208, 178, 92, 0.7);
  background: rgba(17, 20, 18, 0.72);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  padding: 7px 9px;
  overflow-wrap: anywhere;
}

.runtime-list strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.runtime-list span {
  color: var(--muted);
}

.runtime-panel.empty .runtime-list li {
  color: var(--muted);
}

.map-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 320px);
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 15, 14, 0.86);
  padding: 14px 26px;
}

body.playing .map-panel {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  border: 1px solid rgba(58, 65, 56, 0.78);
  padding: 12px;
}

.map-frame {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(58, 65, 56, 0.86);
  background: #111411;
  aspect-ratio: 16 / 9;
}

body.playing .map-frame {
  aspect-ratio: auto;
  min-height: 0;
}

.map-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-pin {
  position: absolute;
  min-width: 44px;
  max-width: 72px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(208, 178, 92, 0.9);
  background: rgba(17, 20, 18, 0.82);
  color: var(--text);
  padding: 4px 7px;
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.map-pin-label {
  display: block;
}

.map-pin-badges {
  display: flex;
  justify-content: center;
  gap: 2px;
  max-width: 100%;
}

.map-pin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(240, 238, 230, 0.48);
  border-radius: 999px;
  background: rgba(13, 15, 14, 0.92);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.map-pin-badge.badge-debt {
  border-color: rgba(208, 178, 92, 0.95);
  color: var(--accent);
}

.map-pin-badge.badge-danger {
  border-color: rgba(214, 91, 91, 0.95);
  color: #ffd4d4;
}

.map-pin.has-pressure {
  border-color: rgba(236, 197, 107, 0.95);
}

.map-pin.current .map-pin-badge {
  background: rgba(23, 21, 17, 0.92);
  color: #f6f0dc;
}

.pin-grey-gate {
  left: 50.2%;
  top: 85.4%;
}

.pin-crowroad {
  left: 44.2%;
  top: 52.4%;
}

.pin-starwood {
  left: 20.6%;
  top: 56.2%;
}

.pin-ironroot {
  left: 78.4%;
  top: 64.2%;
}

.pin-saltmere {
  left: 76.3%;
  top: 30.8%;
}

.pin-north-rift {
  left: 49.5%;
  top: 12.5%;
}

.map-pin.current {
  background: var(--accent);
  color: #171511;
  z-index: 3;
}

.map-pin.current::before,
.map-pin.current::after {
  content: "";
  position: absolute;
  inset: -9px;
  z-index: -1;
  border-radius: 999px;
  pointer-events: none;
}

.map-pin.current::before {
  background: radial-gradient(circle, rgba(246, 222, 139, 0.54), rgba(208, 178, 92, 0.1) 54%, transparent 72%);
  animation: current-location-glow 2.2s ease-in-out infinite;
}

.map-pin.current::after {
  border: 1px solid rgba(246, 232, 174, 0.55);
  animation: current-location-ring 2.2s ease-in-out infinite;
}

.map-pin.selected {
  box-shadow: 0 0 0 2px rgba(240, 238, 230, 0.35);
}

.map-pin.current,
.map-pin.current.selected {
  animation: current-location-pin 2.2s ease-in-out infinite;
  box-shadow:
    0 0 0 2px rgba(240, 238, 230, 0.35),
    0 0 18px rgba(246, 222, 139, 0.62);
}

.map-pin.unlocked {
  border-color: var(--good);
}

.map-pin.locked {
  border-color: var(--line);
  color: var(--muted);
  opacity: 0.72;
}

.map-pin.danger {
  border-color: var(--danger);
}

.map-detail {
  min-width: 0;
  align-self: stretch;
  border-left: 2px solid rgba(208, 178, 92, 0.72);
  background: rgba(17, 20, 18, 0.72);
  padding: 12px 13px;
}

body.playing .map-detail {
  align-self: auto;
  border-left: 0;
  border-top: 2px solid rgba(208, 178, 92, 0.72);
}

.map-detail-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.map-detail-header span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.map-detail p {
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 7px;
}

.map-detail .map-pressure {
  color: var(--accent);
  border-left: 2px solid rgba(208, 178, 92, 0.72);
  padding-left: 8px;
}

.map-pressure-details {
  display: grid;
  gap: 7px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.map-pressure-details li {
  border: 1px solid rgba(58, 65, 56, 0.56);
  border-radius: 6px;
  background: rgba(11, 14, 12, 0.42);
  padding: 8px 9px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.map-pressure-details strong,
.map-pressure-details span,
.map-pressure-details small {
  display: block;
}

.map-pressure-details strong {
  color: var(--accent);
  font-size: 12px;
}

.map-pressure-details span,
.map-pressure-details small {
  margin-top: 3px;
  color: var(--muted);
}

.map-action-button {
  width: 100%;
  margin-top: 10px;
  justify-content: center;
}

.process-action-panel {
  border-top: 1px solid rgba(58, 65, 56, 0.72);
  margin-top: 12px;
  padding-top: 11px;
}

.process-action-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.process-action-header small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  text-align: right;
}

.process-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 8px;
}

.process-action-button {
  min-height: 36px;
  padding: 7px 8px;
  font-size: 12px;
  line-height: 1.15;
  text-align: center;
}

.guidance-panel {
  border-bottom: 1px solid var(--line);
  background: rgba(18, 20, 19, 0.9);
  padding: 12px 26px;
}

body.playing .guidance-panel {
  border-bottom-color: rgba(118, 94, 40, 0.78);
  background:
    linear-gradient(135deg, rgba(117, 85, 23, 0.9), rgba(65, 48, 19, 0.94)),
    rgba(82, 62, 24, 0.94);
  color: #fff7df;
  padding: 13px 14px;
}

body.playing .guidance-panel-header {
  color: #ffe39a;
}

body.playing .guidance-panel-header span:last-child {
  color: rgba(255, 246, 218, 0.78);
}

body.playing .guidance-panel p {
  color: #fff9e8;
}

.guidance-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.guidance-panel-header span:last-child {
  color: var(--muted);
  font-weight: 400;
}

.guidance-panel p {
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 5px;
}

.prompt-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  grid-column: 1 / -1;
  margin-top: 0;
}

body.playing .prompt-chips {
  grid-template-columns: 1fr;
  gap: 8px;
}

.prompt-chip {
  border-color: rgba(208, 178, 92, 0.72);
  background: rgba(17, 20, 18, 0.82);
  color: var(--text);
  display: grid;
  gap: 5px;
  min-height: 116px;
  padding: 11px 12px;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: left;
}

body.playing .prompt-chip {
  border-color: rgba(172, 133, 47, 0.86);
  background: rgba(244, 221, 142, 0.9);
  color: #211b0e;
  min-height: 0;
  padding: 9px 10px;
}

body.playing .prompt-chip strong {
  color: #5b3d06;
}

body.playing .prompt-chip small {
  color: rgba(55, 42, 18, 0.82);
}

body.playing .prompt-chip.selected {
  border-color: rgba(90, 124, 72, 0.95);
  background: rgba(219, 235, 174, 0.95);
  box-shadow: inset 0 0 0 1px rgba(72, 111, 62, 0.38);
}

.prompt-chip strong {
  color: var(--accent);
  font-size: 13px;
}

.prompt-chip span,
.prompt-chip small {
  display: block;
}

.prompt-chip small {
  color: var(--muted);
}

.prompt-chip.selected {
  border-color: var(--good);
  background: rgba(35, 52, 34, 0.78);
  box-shadow: inset 0 0 0 1px rgba(123, 179, 123, 0.45);
}

.log {
  overflow: auto;
  padding: 26px;
}

body.playing .log {
  background: #050706;
  min-height: 0;
  padding: 14px;
}

.dm-message,
.player-message {
  max-width: 880px;
  border-left: 3px solid var(--accent);
  background: rgba(26, 29, 27, 0.88);
  padding: 14px 16px;
  margin: 0 0 14px;
}

body.playing .dm-message,
body.playing .player-message {
  background: rgba(3, 5, 4, 0.95);
  color: #f8f6ef;
  max-width: none;
  padding: 12px 13px;
  margin-bottom: 10px;
}

body.playing .dm-message strong {
  color: #f0d078;
}

body.playing .player-message {
  background: rgba(17, 26, 19, 0.95);
}

.player-message {
  margin-left: auto;
  border-left-color: var(--good);
  background: rgba(35, 40, 32, 0.9);
}

.dm-message strong,
.player-message strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
}

.player-message strong {
  color: var(--good);
}

.dm-message p,
.player-message p {
  white-space: pre-wrap;
}

.turn-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 18px 26px;
  background: rgba(24, 27, 25, 0.94);
}

body.playing .turn-form {
  border-top-color: rgba(172, 133, 47, 0.72);
  background: rgba(220, 193, 107, 0.16);
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 13px 14px;
}

body.playing .action-deck-header {
  color: #f3d36f;
}

body.playing .action-deck-header small {
  color: rgba(244, 232, 185, 0.78);
}

.action-deck-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

body.playing .action-deck-header {
  display: grid;
  gap: 2px;
}

body.playing .action-deck-header small {
  text-align: left;
}

.action-deck-header small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-align: right;
}

.map-action-review {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(208, 178, 92, 0.35);
  background: rgba(39, 34, 23, 0.82);
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

body.playing .map-action-review {
  border-color: rgba(107, 80, 20, 0.75);
  background: rgba(245, 226, 155, 0.86);
  color: #211b0e;
  grid-template-columns: 1fr 1fr;
}

body.playing .map-action-review span {
  grid-column: 1 / -1;
}

.map-action-review span {
  min-width: 0;
}

.selected-action {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid rgba(123, 179, 123, 0.5);
  background: rgba(17, 20, 18, 0.82);
  padding: 10px 12px;
}

body.playing #turnSubmitButton {
  background: #a58e45;
  border-color: #ccb15b;
  color: #11100b;
  width: 100%;
}

@keyframes current-location-glow {
  0%,
  100% {
    opacity: 0.42;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.2);
  }
}

@keyframes current-location-ring {
  0%,
  100% {
    opacity: 0.32;
    transform: scale(0.88);
  }
  50% {
    opacity: 0.86;
    transform: scale(1.35);
  }
}

@keyframes current-location-pin {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(240, 238, 230, 0.28),
      0 0 10px rgba(246, 222, 139, 0.42);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(240, 238, 230, 0.46),
      0 0 24px rgba(246, 222, 139, 0.82);
  }
}

.selected-action span {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.selected-action small {
  color: var(--muted);
  line-height: 1.45;
}

.selected-action.empty {
  border-color: var(--line);
}

.selected-action.empty span {
  color: var(--muted);
}

@media (max-width: 860px) {
  body.auth-landing .shell,
  body.creating-character .shell {
    padding: 10px;
  }

  body.auth-landing .entrance-map,
  body.creating-character .entrance-map {
    min-height: calc(100vh - 20px);
  }

  body.auth-landing .entrance-map img,
  body.creating-character .entrance-map img {
    min-height: calc(100vh - 20px);
  }

  body.auth-landing .entrance-overlay,
  body.creating-character .entrance-overlay {
    align-content: center;
    padding: 18px;
  }

  body.auth-landing h1,
  body.creating-character h1 {
    font-size: clamp(36px, 13vw, 56px);
  }

  body.auth-landing .auth-panel,
  body.creating-character .character-panel {
    padding: 14px;
  }

  body.creating-character .character-panel {
    max-height: none;
    overflow: visible;
  }

  .character-create-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body.creating-character .choice-explain {
    min-height: 0;
  }

  body.creating-character .character-panel textarea {
    height: 78px;
    min-height: 78px;
  }

  body.creating-character .character-panel > button[type="submit"] {
    bottom: 10px;
    width: 100%;
  }

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

  .play-area {
    grid-template-columns: 1fr;
    gap: 12px;
    overflow: visible;
    padding: 12px;
  }

  .interaction-panel {
    min-height: 0;
  }

  body.playing .map-panel {
    grid-template-rows: auto auto;
  }

  body.playing .map-frame {
    aspect-ratio: 16 / 9;
  }

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

  .game-header,
  .turn-form {
    grid-template-columns: 1fr;
  }

  .admin-panel-surface {
    padding: 10px;
  }

  .admin-panel-dialog {
    max-height: calc(100vh - 20px);
    padding: 16px;
  }

  .admin-panel-header {
    display: grid;
  }

  .action-deck-header {
    display: grid;
  }

  .action-deck-header small {
    text-align: left;
  }

  .map-action-review {
    grid-template-columns: 1fr;
  }

  .header-controls {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .runtime-panel {
    grid-template-columns: 1fr;
  }

  .admin-correction-grid {
    grid-template-columns: 1fr;
  }

  .admin-audit-toolbar {
    grid-template-columns: 1fr;
  }

  .map-panel {
    grid-template-columns: 1fr;
  }

  #intentSelect,
  #memoryButton,
  #summaryButton,
  #adminPanelButton,
  #logoutHeaderButton {
    width: 100%;
  }
}
