:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  --page: #171816;
  --surface: #20211e;
  --surface-raised: #292a26;
  --ink: #f2e6ce;
  --muted: #b6ac97;
  --line: #413c31;
  --accent: #dca967;
  --accent-light: #f2c885;
  --accent-ink: #292017;
  --plan: #dda75d;
  --base: #96ae7d;
  --resource: #75b8c5;
  --danger: #ef8f86;
  --note: #b4a0ce;
  --suggestion: #e8c995;
  --player: #f2e7d1;
  --cave: #92c5be;
  --dungeon: #e2a4db;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 290px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, .brand-title { font-family: Georgia, "Times New Roman", serif; }
h1 { font-size: clamp(1.35rem, 2.6vw, 2.13rem); font-weight: 500; letter-spacing: -.024em; line-height: 1.2; }
h2 { font-size: 1.1rem; font-weight: 500; line-height: 1.25; }
p { line-height: 1.5; }
.site-header {
  min-height: 75px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem clamp(1rem, 3vw, 2.5rem);
  background: #1a1b18;
}
.brand { display: flex; align-items: center; gap: .85rem; }
.brand-mark, .login-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #876340;
  border-radius: 13px;
  color: #edb774;
  background: #2d261d;
  box-shadow: inset 0 0 0 3px #352b1f;
  font-family: Georgia, serif;
  font-size: 1.6rem;
}
.brand-title { font-size: 1.25rem; line-height: 1.15; }
.brand-subtitle { color: var(--muted); font-size: .77rem; margin-top: .25rem; }
.account, .connection { display: flex; align-items: center; gap: .65rem; }
.account { gap: 1rem; font-size: .85rem; }
.connection { color: var(--muted); }
.connection[data-online="true"] { color: #c8d4b9; }
.connection i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #af8b58; }
.connection[data-online="true"] i { background: #a5c489; box-shadow: 0 0 9px #a5c48970; }
.user-name { color: var(--ink); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  padding: .57rem .8rem;
  min-height: 37px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: .84rem;
  line-height: 1.2;
  font-weight: 600;
}
.button:hover { border-color: #786343; background: #333128; }
.button.primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: var(--accent-light); border-color: var(--accent-light); }
.button.quiet { background: transparent; color: var(--muted); }
.button.quiet:hover { color: var(--ink); background: #292922; }
.button.danger { color: #f1a39a; border-color: #764d47; background: #382623; }
.button.danger:hover { background: #492b28; }
.dashboard {
  margin: 0 auto;
  max-width: 1720px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 345px);
  gap: 1.1rem;
  padding: clamp(1rem, 2.1vw, 1.8rem) clamp(1rem, 3vw, 2.5rem) 2rem;
  align-items: start;
}
.map-card, .panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  min-width: 0;
  overflow: clip;
  box-shadow: 0 12px 30px #0003;
}
.map-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.05rem 1.15rem; }
.map-header p { color: var(--muted); margin-top: .42rem; font-size: .81rem; }
.map-add { flex-shrink: 0; }
.map-add span { font-size: 1.2rem; line-height: .7; }
.map-frame {
  background: #191a17;
  position: relative;
  min-height: 460px;
  height: min(66vh, 740px);
  overflow: hidden;
  isolation: isolate;
  cursor: grab;
  touch-action: none;
  border-block: 1px solid #5b4736;
  user-select: none;
}
.map-frame[data-panning="true"] { cursor: grabbing; }
.map-frame[data-mode="place"] { cursor: crosshair; }
.map-frame:focus-visible { outline-offset: -4px; z-index: 1; }
.map-art { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.pins { position: absolute; inset: 0; pointer-events: none; }
.pin {
  --pin-color: var(--plan);
  position: absolute;
  z-index: 2;
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 1px solid #2e231b;
  border-radius: 8px;
  padding: 0;
  color: #26251d;
  background: var(--pin-color);
  box-shadow: 0 2px 8px #21150d85, inset 0 0 0 2px #fff3;
  font-size: 1rem;
  line-height: 1;
  font-weight: 800;
  transition: box-shadow .16s ease, scale .16s ease;
}
.pin[data-kind="player"] { border-radius: 50%; }
.pin[data-family="suggestion"] { border: 1px dashed #5d4524; border-radius: 12px; box-shadow: 0 2px 8px #21150d65; }
.pin[data-family="draft"] { width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 2px dashed #262019; background: #ffe1aeb5; box-shadow: none; cursor: default; }
.pin[data-selected="true"], .pin:hover { z-index: 4; scale: 1.15; box-shadow: 0 0 0 3px #fff2ce, 0 3px 9px #32271c85; }
.kind-plan { --pin-color: var(--plan); }
.kind-base { --pin-color: var(--base); }
.kind-resource { --pin-color: var(--resource); }
.kind-danger { --pin-color: var(--danger); }
.kind-note { --pin-color: var(--note); }
.kind-suggestion { --pin-color: var(--suggestion); }
.kind-player { --pin-color: var(--player); }
.kind-cave { --pin-color: var(--cave); }
.kind-dungeon { --pin-color: var(--dungeon); }
.pin[data-family="exploration"] { width: 25px; height: 25px; margin: -12.5px 0 0 -12.5px; z-index: 1; }
.pin[data-family="exploration"][data-selected="true"], .pin[data-family="exploration"]:hover { z-index: 4; }
.map-compass {
  position: absolute;
  top: 16px;
  left: 15px;
  color: #f6ddb3;
  background: #31291de8;
  border: 1px solid #d2ac75;
  border-radius: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 42px;
  padding: .3rem .3rem .4rem;
  font-family: Georgia, serif;
  pointer-events: none;
}
.map-compass strong { font-size: 1.3rem; line-height: 1; }
.zoom-controls {
  right: 14px;
  bottom: 14px;
  position: absolute;
  z-index: 6;
  display: flex;
  flex-direction: column;
  border: 1px solid #d2ac75;
  border-radius: 8px;
  overflow: clip;
  background: #31291df5;
  box-shadow: 0 2px 12px #1e150e65;
}
.zoom-controls button {
  display: grid;
  place-items: center;
  padding: 0;
  width: 39px;
  height: 39px;
  background: transparent;
  border: 0;
  color: #f5deb4;
  font-size: 1.2rem;
}
.zoom-controls button + button { border-top: 1px solid #d2ac754e; }
.zoom-controls button:not(:disabled):hover { background: #5b452b; }
.zoom-controls button:focus-visible { outline-offset: -3px; }
.map-action {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .45rem .55rem .45rem .8rem;
  color: var(--ink);
  background: #262019f5;
  border: 1px solid #b1663a;
  box-shadow: 0 2px 12px #1e150e85;
  border-radius: 8px;
  width: max-content;
  max-width: calc(100% - 110px);
  font-size: .82rem;
}
.map-action button { flex: none; }
.map-message {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 8;
  transform: translate(-50%, -50%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  max-width: calc(100% - 4rem);
  width: max-content;
  padding: .65rem .85rem;
  border: 1px solid #80644b;
  border-radius: 7px;
  background: #23231e;
  color: var(--ink);
  text-align: center;
  font-size: .85rem;
}
.map-footer {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  justify-content: space-between;
  align-items: center;
  padding: .7rem .9rem;
  color: var(--muted);
  font-size: .75rem;
}
.marker-filters { display: flex; flex-wrap: wrap; gap: .42rem; }
.map-attribution { display: flex; flex-wrap: wrap; gap: .5rem .8rem; }
.map-attribution a, .exploration-source { color: var(--muted); text-underline-offset: .15em; }
.map-attribution a:hover, .exploration-source:hover { color: var(--accent-light); }
.filter {
  border: 1px solid var(--line);
  border-radius: 100px;
  min-height: 30px;
  padding: .28rem .55rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--muted);
  background: #24251f;
  font-size: .73rem;
}
.filter[aria-pressed="false"] { opacity: .52; text-decoration: line-through; }
.filter:focus-visible, .filter:hover { color: var(--ink); border-color: #836944; }
.swatch { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--pin-color); }
.panel { min-height: min(60vh, 480px); }
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: #1d1e1a; }
.tabs button {
  position: relative;
  min-height: 51px;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: .86rem;
  font-weight: 600;
}
.tabs button:focus-visible { outline-offset: -3px; }
.tabs button[aria-current="true"] { color: var(--accent-light); }
.tabs button[aria-current="true"]::after { content: ""; position: absolute; bottom: 0; inset-inline: .65rem; height: 2px; background: var(--accent); }
.tabs button:hover { color: var(--ink); background: #27281f; }
.panel-section, .editor { padding: .95rem .95rem 1rem; }
.panel-section + .panel-section, .editor + .panel-section { border-top: 1px solid var(--line); }
.section-heading, .editor-heading { display: flex; align-items: center; justify-content: space-between; gap: .55rem; margin-bottom: .7rem; }
.section-heading time, .count { font-size: .72rem; color: var(--muted); }
.count:empty { display: none; }
.muted { color: var(--muted); font-size: .81rem; }
.notice { margin-bottom: .55rem; }
.entry-list, .sessions { display: grid; gap: .45rem; }
.entry {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: .63rem;
  width: 100%;
  min-height: 47px;
  border: 1px solid #454236;
  border-radius: 7px;
  padding: .52rem .56rem;
  background: #282923;
  color: var(--ink);
  text-align: left;
}
button.entry:hover, .entry[data-selected="true"] { border-color: #9d784e; background: #323024; }
.entry-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: #1e201b;
  color: var(--pin-color, var(--accent-light));
  border-radius: 6px;
}
.entry-name { display: block; font-size: .85rem; font-weight: 640; overflow-wrap: anywhere; }
.entry-meta { display: block; color: var(--muted); margin-top: .2rem; font-size: .75rem; line-height: 1.35; overflow-wrap: anywhere; }
.entry-action { color: var(--accent); font-size: .95rem; }
.editor { background: #28271f; }
.icon-button { min-width: 35px; font-size: 1.25rem; }
label { display: block; color: var(--muted); font-size: .76rem; font-weight: 600; margin: .65rem 0 .28rem; }
input, textarea, select {
  width: 100%;
  padding: .52rem .58rem;
  min-height: 37px;
  background: #1b1c18;
  color: var(--ink);
  border: 1px solid #5d5240;
  border-radius: 6px;
}
textarea { resize: vertical; }
textarea::placeholder { color: #a89d86; }
.coordinates { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .35rem; padding: .4rem 0; color: var(--muted); font-size: .75rem; }
.coordinates .button { font-size: .73rem; padding: .33rem .45rem; min-height: 30px; }
.editor-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .45rem; }
.form-error { margin: .5rem 0; color: #f5a69b; font-size: .82rem; }
.suggestion-filters { display: grid; grid-template-columns: 1fr 1fr; gap: .28rem .5rem; margin-bottom: .8rem; }
.suggestion-filters label { margin-top: .2rem; }
.suggestion-filters label[for="stage-filter"] { grid-area: 1 / 1; }
.suggestion-filters label[for="suggestion-kind-filter"] { grid-area: 1 / 2; }
.suggestion-entry { padding: .65rem; align-items: start; }
.suggestion-entry .entry-meta { white-space: pre-wrap; }
.suggestion-entry .entry-icon { margin-top: .12rem; }
.sessions { margin-top: .7rem; }
.session {
  padding: .65rem .7rem;
  border: 1px solid #454236;
  border-radius: 7px;
  background: #282923;
}
.session summary { cursor: pointer; color: var(--ink); font-size: .88rem; font-weight: 650; }
.session summary::marker { color: var(--accent); }
.session-date { color: var(--muted); margin: .28rem 0 .2rem; font-size: .75rem; }
.session-text { color: var(--ink); font-size: .83rem; margin: .4rem 0; }
.session-source { display: block; color: var(--muted); font-size: .73rem; margin: .4rem 0 .1rem; }
.timeline { list-style: none; padding: 0; margin: .55rem 0 0; display: grid; gap: .45rem; }
.timeline li { border-inline-start: 2px solid #8c704b; padding-left: .5rem; color: var(--muted); font-size: .75rem; }
.profile summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.exploration-list summary { cursor: pointer; color: var(--ink); font-size: .85rem; }
.exploration-list .count { margin-left: .4rem; }
.exploration-list .entry-list { margin-top: .65rem; }
.exploration-note { margin: .48rem 0; font-size: .85rem; }
.exploration-source { display: inline-block; font-size: .78rem; margin: .12rem 0 .3rem; }
.profile form .button { margin-top: .55rem; }
.profile-passkey { padding: .75rem 0; margin-bottom: .55rem; border-bottom: 1px solid var(--line); }
.profile-passkey h3 { font-size: .88rem; margin-bottom: .28rem; }
.profile-passkey .button { margin-top: .55rem; }
.passkey-status { margin-top: .45rem; }
.profile-invitation { padding-top: .75rem; margin-top: .8rem; border-top: 1px solid var(--line); }
#invitation-expiry { margin-top: .4rem; }
#invitation-copy { margin-top: .5rem; }
.adventure-form { margin-block: .75rem; padding: .65rem; border: 1px solid var(--line); border-radius: 7px; background: #25251e; }
.adventure-form label:first-child { margin-top: 0; }
.world-changes { margin-top: .65rem; }
.event-link { display: block; border: 0; background: transparent; color: var(--accent-light); text-align: left; padding: .14rem 0; }
.event-link:hover { text-decoration: underline; }
.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 2rem);
  color: var(--ink);
  background: #30291e;
  border: 1px solid #a47c4d;
  box-shadow: 0 5px 17px #0007;
  border-radius: 8px;
  padding: .7rem .95rem;
  font-size: .84rem;
}
.login-page {
  min-height: calc(100svh - 76px);
  display: grid;
  place-items: center;
  padding: 1rem;
  background: radial-gradient(ellipse at 50% 27%, #3e3021 0%, var(--page) 60%);
}
.login-card {
  width: min(100%, 400px);
  background: #22211c;
  border: 1px solid #62513b;
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 12px 35px #0006;
}
.login-mark { margin-bottom: 1rem; }
.login-card p { color: var(--muted); margin: .5rem 0 .95rem; font-size: .88rem; }
.login-card .form-error { color: #f5a69b; }
.login-card .primary { width: 100%; min-height: 44px; margin-top: 1.2rem; }
.login-card .login-invitation { margin: 1rem 0 0; }
.login-card .login-status { margin-bottom: .55rem; }
@media (max-width: 980px) {
  .dashboard { grid-template-columns: minmax(0, 1fr) minmax(255px, 285px); gap: .75rem; }
  .map-frame { min-height: 400px; }
}
@media (max-width: 740px) {
  .dashboard { display: flex; flex-direction: column; }
  .map-card, .panel { width: 100%; }
  .panel { min-height: 0; }
  .map-frame { min-height: 330px; height: min(55svh, 520px); }
  .site-header { min-height: 63px; }
  .account { gap: .5rem; }
  .user-name { display: none; }
  .connection { gap: .35rem; font-size: .72rem; }
  .brand-mark { height: 36px; width: 36px; }
  .brand-title { font-size: 1.06rem; }
  .brand-subtitle { font-size: .69rem; }
  .login-page { min-height: calc(100svh - 64px); }
}
@media (max-width: 420px) {
  .dashboard { padding: .65rem .5rem 1rem; }
  .site-header { padding: .55rem .65rem; }
  .brand { gap: .45rem; }
  .map-header { padding: .75rem .65rem; gap: .5rem; }
  .map-header h1 { font-size: 1.26rem; }
  .map-header p { font-size: .7rem; }
  .map-add { padding: .44rem .48rem; align-self: center; font-size: .68rem; }
  .map-footer { padding: .55rem .6rem; }
  .zoom-controls { right: 8px; bottom: 8px; }
  .map-compass { left: 8px; top: 8px; }
  .map-action { max-width: calc(100% - 95px); font-size: .71rem; gap: .32rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pin { transition: none; }
}
