:root {
  color-scheme: dark;
  --bg: #11140f;
  --panel: rgba(24, 30, 22, 0.92);
  --panel-strong: #202a1b;
  --line: rgba(208, 230, 180, 0.18);
  --text: #eef7e7;
  --muted: #adbea3;
  --accent: #b8f06a;
  --accent-strong: #73c23d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --sidebar-collapsed: 3.35rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at top left, rgba(119, 189, 64, 0.22), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(90, 142, 215, 0.18), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  overflow: hidden;
}

.shell {
  display: grid;
  grid-template-columns: minmax(20rem, 24rem) 1fr;
  height: 100%;
  transition: grid-template-columns 180ms ease;
}

.shell.is-sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed) 1fr;
}

.panel {
  background: linear-gradient(180deg, var(--panel), rgba(15, 18, 13, 0.95));
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  z-index: 2;
}

.sidebar-toggle,
.mobile-panel-toggle {
  appearance: none;
  background: rgba(184, 240, 106, 0.12);
  border: 1px solid rgba(184, 240, 106, 0.34);
  border-radius: 0.75rem;
  color: var(--accent);
  cursor: pointer;
  flex: 0 0 auto;
  font: 700 0.78rem "Trebuchet MS", Verdana, sans-serif;
  letter-spacing: 0.06em;
  margin: 0.75rem 0.75rem 0;
  padding: 0.65rem 0.75rem;
  text-transform: uppercase;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.mobile-panel-toggle {
  display: none;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible,
.mobile-panel-toggle:hover,
.mobile-panel-toggle:focus-visible {
  background: rgba(184, 240, 106, 0.2);
  border-color: rgba(184, 240, 106, 0.65);
  color: var(--text);
  outline: none;
}

.panel-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem;
  scrollbar-color: rgba(184, 240, 106, 0.45) rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
}

.panel-content::-webkit-scrollbar {
  width: 0.55rem;
}

.panel-content::-webkit-scrollbar-thumb {
  background: rgba(184, 240, 106, 0.45);
  border-radius: 999px;
}

.panel-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
}

.shell.is-sidebar-collapsed .panel-content {
  display: none;
}

.shell.is-sidebar-collapsed .sidebar-toggle {
  align-self: center;
  height: auto;
  margin: 0.75rem auto;
  min-height: 7.5rem;
  padding: 0.7rem 0.35rem;
  transform: rotate(180deg);
  width: 2.1rem;
  writing-mode: vertical-rl;
}

.brand {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.eyebrow {
  color: var(--accent);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.95;
  margin-top: 0.35rem;
}

h2 {
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.card {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 1rem;
  flex: 0 0 auto;
  padding: 1rem;
}

.muted {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
}

.dimension-tabs {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  margin-top: 0.9rem;
}

.dimension-tab {
  appearance: none;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  font: 700 0.78rem "Trebuchet MS", Verdana, sans-serif;
  letter-spacing: 0.05em;
  padding: 0.7rem 0.45rem;
  text-transform: uppercase;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.dimension-tab:hover,
.dimension-tab:focus-visible,
.dimension-tab.is-active {
  background: linear-gradient(135deg, rgba(184, 240, 106, 0.2), rgba(255, 255, 255, 0.07));
  border-color: rgba(184, 240, 106, 0.55);
  color: var(--text);
  outline: none;
}

.dimension-tab.is-active {
  box-shadow: inset 0 0 0 1px rgba(184, 240, 106, 0.2);
}

.players {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.player-link-form,
.web-marker-form,
.wardrobe-controls {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.wardrobe-controls[hidden] {
  display: none;
}

.wardrobe-action-row {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.player-link-form label,
.web-marker-form label {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.player-link-row {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.player-link-form > input,
.web-marker-form > input,
.player-link-row input {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  color: var(--text);
  font: 700 1rem "Trebuchet MS", Verdana, sans-serif;
  min-width: 0;
  padding: 0.7rem 0.8rem;
}

.player-link-form > input:focus,
.web-marker-form > input:focus,
.player-link-row input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(184, 240, 106, 0.18);
}

.player-link-row button,
.subtle-button {
  appearance: none;
  border-radius: 0.8rem;
  cursor: pointer;
  font: 700 0.78rem "Trebuchet MS", Verdana, sans-serif;
  letter-spacing: 0.05em;
  padding: 0.7rem 0.85rem;
  text-transform: uppercase;
}

.player-link-row button {
  background: linear-gradient(135deg, #b8f06a, #73c23d);
  border: 0;
  color: #14200f;
}

.subtle-button {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  color: var(--muted);
  margin-top: 0.65rem;
  width: 100%;
}

.subtle-button:hover,
.subtle-button:focus-visible {
  border-color: rgba(184, 240, 106, 0.45);
  color: var(--accent);
  outline: none;
}

.link-card.is-linked .player-link-form {
  display: none;
}

.link-card:not(.is-linked) .web-marker-form {
  display: none;
}

.link-card:not(.is-linked) .subtle-button {
  display: none;
}

.map-points {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.point-owner {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 0.9rem;
  overflow: hidden;
}

.point-owner-toggle {
  appearance: none;
  background: rgba(255, 255, 255, 0.055);
  border: 0;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 0.2rem;
  padding: 0.8rem;
  text-align: left;
  width: 100%;
}

.point-owner-toggle:hover,
.point-owner-toggle:focus-visible,
.point-owner.is-active .point-owner-toggle {
  background: linear-gradient(135deg, rgba(184, 240, 106, 0.16), rgba(255, 255, 255, 0.055));
  outline: none;
}

.point-owner-name {
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
}

.point-owner-meta {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.78rem;
}

.point-owner-points {
  display: grid;
  gap: 0.5rem;
  padding: 0 0.65rem 0.65rem;
}

.player,
.map-point {
  appearance: none;
  background: linear-gradient(135deg, rgba(184, 240, 106, 0.16), rgba(255, 255, 255, 0.055));
  border: 1px solid rgba(184, 240, 106, 0.3);
  border-radius: 0.85rem;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.player,
.map-point {
  cursor: default;
}

.player:hover,
.player:focus-visible,
.map-point:hover,
.map-point:focus-visible {
  background: linear-gradient(135deg, rgba(184, 240, 106, 0.24), rgba(255, 255, 255, 0.075));
  border-color: var(--accent);
  outline: none;
  transform: translateY(-1px);
}

.player-name,
.map-point-name {
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 1rem;
  font-weight: 700;
}

.player-meta,
.map-point-meta {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.8rem;
}

.player-details,
.map-point-details {
  display: grid;
  gap: 0.2rem;
}

.player-actions,
.map-point-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.25rem;
}

.player-action,
.map-point-action {
  appearance: none;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(184, 240, 106, 0.25);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font: 700 0.72rem "Trebuchet MS", Verdana, sans-serif;
  padding: 0.42rem 0.62rem;
}

.player-action:hover,
.player-action:focus-visible,
.map-point-action:hover,
.map-point-action:focus-visible {
  background: rgba(184, 240, 106, 0.16);
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.player-action.is-danger,
.map-point-action.is-danger {
  border-color: rgba(255, 120, 92, 0.34);
  color: #ffb4a8;
}

.player-action.is-danger:hover,
.player-action.is-danger:focus-visible,
.map-point-action.is-danger:hover,
.map-point-action.is-danger:focus-visible {
  background: rgba(255, 120, 92, 0.16);
  border-color: #ffb4a8;
}

.player-action:disabled,
.map-point-action:disabled,
.context-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.player-action:disabled:hover,
.player-action:disabled:focus-visible,
.map-point-action:disabled:hover,
.map-point-action:disabled:focus-visible,
.context-menu button:disabled:hover,
.context-menu button:disabled:focus-visible {
  background: transparent;
  color: var(--muted);
  outline: none;
}

.map-point.is-home {
  background: linear-gradient(135deg, rgba(111, 179, 255, 0.16), rgba(255, 255, 255, 0.055));
  border-color: rgba(111, 179, 255, 0.34);
}

.map-point.is-marker {
  background: linear-gradient(135deg, rgba(255, 190, 92, 0.16), rgba(255, 255, 255, 0.055));
  border-color: rgba(255, 190, 92, 0.34);
}

.map-point.is-tombstone {
  background: linear-gradient(135deg, rgba(226, 226, 210, 0.16), rgba(255, 120, 92, 0.07));
  border-color: rgba(226, 226, 210, 0.34);
}

.context-menu {
  background: linear-gradient(180deg, rgba(24, 30, 22, 0.98), rgba(12, 16, 10, 0.98));
  border: 1px solid rgba(184, 240, 106, 0.3);
  border-radius: 0.85rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
  display: grid;
  gap: 0.25rem;
  min-width: 14rem;
  padding: 0.45rem;
  position: fixed;
  z-index: 50;
}

.context-menu[hidden] {
  display: none;
}

.context-menu button {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 0.55rem;
  color: var(--text);
  cursor: pointer;
  font: 700 0.84rem "Trebuchet MS", Verdana, sans-serif;
  padding: 0.65rem 0.75rem;
  text-align: left;
}

.context-menu button:hover,
.context-menu button:focus-visible {
  background: rgba(184, 240, 106, 0.14);
  color: var(--accent);
  outline: none;
}

.context-menu button.is-danger {
  color: #ffb4a8;
}

.context-menu button.is-danger:hover,
.context-menu button.is-danger:focus-visible {
  background: rgba(255, 120, 92, 0.16);
  color: #ffd0c8;
}

.context-menu .context-menu-label {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem 0.25rem;
}

.toast {
  background: rgba(9, 13, 8, 0.95);
  border: 1px solid rgba(184, 240, 106, 0.32);
  border-radius: 999px;
  bottom: 1rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  color: var(--text);
  font: 700 0.86rem "Trebuchet MS", Verdana, sans-serif;
  left: 50%;
  max-width: min(32rem, calc(100% - 2rem));
  padding: 0.75rem 1rem;
  position: fixed;
  text-align: center;
  transform: translateX(-50%);
  z-index: 60;
}

.toast.is-error {
  border-color: rgba(255, 180, 163, 0.55);
  color: #ffd2c8;
}

.toast[hidden] {
  display: none;
}

.player.is-off-dimension,
.map-point.is-off-dimension {
  opacity: 0.68;
}

.player.is-off-dimension:hover,
.player.is-off-dimension:focus-visible,
.map-point.is-off-dimension:hover,
.map-point.is-off-dimension:focus-visible {
  opacity: 1;
}

.player.is-following {
  border-color: rgba(184, 240, 106, 0.78);
  box-shadow: inset 0 0 0 1px rgba(184, 240, 106, 0.24), 0 0 24px rgba(184, 240, 106, 0.12);
}

.map-wrap {
  min-width: 0;
  position: relative;
}

iframe {
  border: 0;
  display: block;
  height: 100%;
  width: 100%;
}

@media (max-width: 780px) {
  body {
    overflow: hidden;
  }

  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 42vh) minmax(0, 1fr);
    height: 100dvh;
  }

  .shell.is-sidebar-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: 3.6rem minmax(0, 1fr);
  }

  .shell.is-map-minimized {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 0;
  }

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

  .mobile-panel-toggle {
    display: block;
    margin-top: 0.45rem;
  }

  .shell.is-sidebar-collapsed .mobile-panel-toggle {
    display: none;
  }

  .shell.is-map-minimized .map-wrap {
    min-height: 0;
    overflow: hidden;
    visibility: hidden;
  }

  .shell.is-sidebar-collapsed .sidebar-toggle {
    margin: 0.6rem;
    min-height: 0;
    padding: 0.6rem 0.75rem;
    transform: none;
    width: auto;
    writing-mode: horizontal-tb;
  }
}
