:root {
  --bg: #101113;
  --bg-2: #15161a;
  --surface: rgba(24, 26, 30, 0.94);
  --surface-2: rgba(31, 34, 39, 0.94);
  --surface-3: #272a30;
  --text: #f5f3ee;
  --text-dark: #17191d;
  --muted: #aeb4bd;
  --subtle: #777f8d;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  --hot: #ff7300;
  --hot-2: #ff9100;
  --aqua: #22d4d8;
  --gold: #f6bd4b;
  --green: #6ee7a8;
  --radius: 8px;
  --header-h: 96px;
  --app-pad: clamp(12px, 1.6vw, 22px);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, rgba(16, 17, 19, 0.88), rgba(16, 17, 19, 0.96) 46%, rgba(16, 17, 19, 1)),
    url("images/Season_9_wallpaper.png") center top / cover fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: var(--header-h) 0 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 72%);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: rgba(12, 14, 18, 0.85);
  backdrop-filter: blur(12px);
  color: var(--text);
  transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
}

.loading-gif {
  max-width: 320px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}
.loading-content h2 {
  font-size: 24px;
  font-weight: 850;
  letter-spacing: 0.05em;
  color: var(--hot);
  margin: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 2px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(22px, 2.8vw, 40px);
  min-height: var(--header-h);
  padding: 0 clamp(20px, 2.6vw, 40px);
  border-bottom: 1px solid rgba(255, 66, 109, 0.24);
  background: rgba(13, 14, 17, 0.96);
  box-shadow:
    inset 0 -1px 0 rgba(34, 212, 216, 0.08),
    0 16px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.app-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
  color: var(--text);
  text-decoration: none;
}

.app-brand img {
  display: block;
  width: clamp(218px, 18vw, 292px);
  max-height: 70px;
  object-fit: contain;
}

.brand-lockup {
  display: grid;
  gap: 3px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.brand-lockup strong {
  color: var(--text);
  font-size: 23px;
  font-weight: 900;
  line-height: 1.1;
}

.brand-lockup small {
  color: var(--subtle);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
}

.global-nav {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.nav-link {
  display: grid;
  min-height: 46px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 18px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 850;
  text-decoration: none;
}

.nav-link.active,
.nav-link[aria-current="page"] {
  border-color: rgba(255, 66, 109, 0.32);
  background: rgba(255, 66, 109, 0.14);
  color: var(--text);
}

.nav-link:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.header-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.action-btn,
.mini-btn,
.export-grid button,
.import-btn,
.tool,
.utility {
  border: 0.5px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 800;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.action-btn {
  min-width: 74px;
  min-height: 44px;
  padding: 0 15px;
  font-size: 15px;
}

.action-btn:hover,
.mini-btn:hover,
.export-grid button:hover,
.import-btn:hover,
.tool:hover,
.utility:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.12);
}

.action-btn.primary {
  border-color: rgba(255, 66, 109, 0.68);
  background: linear-gradient(135deg, var(--hot), var(--hot-2));
  color: #fff;
}

.planner-app {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: calc(145dvh - var(--header-h));
  grid-template-rows: auto minmax(0, 1fr);
  gap: 15px;
  padding: var(--app-pad);
  padding-bottom: 0;
}

.planner-command {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) minmax(170px, 0.9fr) minmax(290px, 0.9fr) auto;
  align-items: end;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(20, 22, 25, 0.9);
  box-shadow: var(--shadow);
  padding: 14px;
  backdrop-filter: blur(14px);
  z-index: 10;
}

.field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

label,
.field-label,
.section-head span,
.section-title span,
.index-heading span {
  color: var(--subtle);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  padding: 10px 12px;
  outline: 0;
}

select option {
  color: var(--text-dark);
}

input::placeholder {
  color: rgba(245, 243, 238, 0.42);
}

input:focus,
select:focus {
  border-color: rgba(34, 212, 216, 0.72);
  box-shadow: 0 0 0 3px rgba(34, 212, 216, 0.13);
}

.mode-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  min-height: 46px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.seg {
  min-width: 0;
  min-height: 36px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.seg.active {
  color: #101113;
}

.seg[data-side="attack"].active {
  background: #F04030;
}

.seg[data-side="both"].active {
  background: var(--gold);
}

.seg[data-side="defense"].active {
  background: #7099DE;
}

.planner-metrics {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.planner-metrics span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  padding: 9px 11px;
}

.planner-metrics b {
  color: var(--text);
  font-size: 17px;
}

.shell {
  display: grid;
  min-height: 0;
  height: calc(145dvh - var(--header-h) - 92px);
  grid-template-columns: clamp(300px, 22vw, 390px) minmax(390px, 1fr) clamp(268px, 19vw, 330px);
  gap: 15px;
  overflow: hidden;
}

.panel,
.topbar,
.phasebar,
.canvas-stage {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  padding: 16px;
}

.right-panel {
  overflow-y: auto;
}

.right-panel::-webkit-scrollbar {
  width: 6px;
}

.right-panel::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(108px, 140px);
  align-items: end;
  gap: 12px;
}

.section-head.solo {
  display: block;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.right-panel .section-head:first-child {
  border-top: 0;
  padding-top: 0;
}

.section-head h2,
.section-title h2 {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 850;
  line-height: 1.15;
}

#agentSearch {
  min-height: 42px;
  padding: 9px 11px;
}

.roster {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding: 2px 3px 2px 4px;
}

.roster::-webkit-scrollbar,
.phase-tabs::-webkit-scrollbar,
.content-index::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.roster::-webkit-scrollbar-thumb,
.phase-tabs::-webkit-scrollbar-thumb,
.content-index::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
}

.faction {
  display: grid;
  gap: 9px;
}

.faction-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--hot);
  border-radius: 6px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.faction-title span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.faction-title img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.faction-title b {
  color: var(--muted);
  font-size: 13px;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.agent {
  position: relative;
  display: block;
  border: none;
  border-radius: 4px;
  background: none;
  padding: 0;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: outline-color 0.15s;
}

.agent.active {
  outline-color: var(--agent-accent, var(--hot));
}

.agent img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  border-radius: 4px;
  object-fit: cover;
}

.board-wrap {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  min-height: 68px;
  padding: 11px;
}

.phasebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 11px;
}

.tool-strip {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.secondary-tools {
  justify-content: flex-start;
}

.tool {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
}

.tool.active {
  border-color: rgba(255, 66, 109, 0.88);
  background: var(--hot);
  color: #fff;
}

.tool-icon {
  position: relative;
  display: block;
  width: 23px;
  height: 23px;
  color: currentColor;
}

.tool-icon::before,
.tool-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.tool-icon.icon-asset {
  width: 24px;
  height: 24px;
  opacity: 0.92;
}

.tool-icon.icon-asset::before,
.tool-icon.icon-asset::after {
  content: none;
}

.tool-icon.icon-asset img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: invert(1) brightness(1.2);
  pointer-events: none;
}

.icon-select::before {
  left: 4px;
  top: 2px;
  width: 0;
  height: 0;
  border-left: 11px solid currentColor;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  transform: rotate(42deg);
}

.icon-select::after {
  left: 11px;
  top: 13px;
  width: 8px;
  height: 3px;
  border-radius: 3px;
  background: currentColor;
  transform: rotate(42deg);
}

.icon-pan::before,
.icon-pan::after {
  inset: 4px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.icon-pan::after {
  inset: 1px;
  border-left-color: transparent;
  border-right-color: transparent;
}

.icon-token::before {
  inset: 3px;
  border: 3px solid currentColor;
  border-radius: 50%;
}

.icon-token::after {
  left: 8px;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.icon-arrow::before {
  left: 4px;
  top: 14px;
  width: 16px;
  height: 3px;
  border-radius: 4px;
  background: currentColor;
  transform: rotate(-38deg);
}

.icon-arrow::after {
  right: 1px;
  top: 3px;
  width: 8px;
  height: 8px;
  border-right: 3px solid currentColor;
  border-top: 3px solid currentColor;
  transform: rotate(7deg);
}

.icon-line::before {
  left: 3px;
  top: 10px;
  width: 17px;
  height: 3px;
  border-radius: 4px;
  background: currentColor;
  transform: rotate(-32deg);
}

.icon-pen::before {
  left: 4px;
  top: 11px;
  width: 14px;
  height: 5px;
  border-radius: 5px 2px 2px 5px;
  background: currentColor;
  transform: rotate(-42deg);
}

.icon-pen::after {
  right: 2px;
  bottom: 3px;
  width: 6px;
  height: 2px;
  border-radius: 3px;
  background: currentColor;
  transform: rotate(-42deg);
}

.icon-zone::before {
  inset: 3px;
  border: 3px solid currentColor;
  border-radius: 50%;
}

.icon-zone::after {
  inset: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}

.icon-text::before {
  left: 4px;
  top: 3px;
  width: 14px;
  height: 3px;
  background: currentColor;
}

.icon-text::after {
  left: 9px;
  top: 4px;
  width: 4px;
  height: 15px;
  background: currentColor;
}

.icon-pin::before {
  left: 8px;
  top: 2px;
  width: 7px;
  height: 7px;
  border: 3px solid currentColor;
  border-radius: 50%;
}

.icon-pin::after {
  left: 10px;
  top: 12px;
  width: 3px;
  height: 9px;
  border-radius: 3px;
  background: currentColor;
}

.icon-string::before {
  inset: 3px;
  border: 3px solid currentColor;
  border-radius: 3px;
  transform: rotate(45deg);
}

.icon-string::after {
  left: 1px;
  top: 10px;
  width: 20px;
  border-top: 2px dashed currentColor;
}

.icon-minus::before,
.icon-plus::before,
.icon-plus::after {
  left: 4px;
  top: 10px;
  width: 14px;
  height: 3px;
  border-radius: 3px;
  background: currentColor;
}

.icon-plus::after {
  transform: rotate(90deg);
}

.icon-fit::before {
  inset: 4px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.icon-fit::after {
  left: 7px;
  top: 7px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.icon-undo::before,
.icon-redo::before {
  inset: 5px 4px 4px 5px;
  border: 3px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}

.icon-undo::after {
  left: 2px;
  top: 6px;
  width: 0;
  height: 0;
  border-right: 8px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.icon-redo::before {
  transform: scaleX(-1);
}

.icon-redo::after {
  right: 2px;
  top: 6px;
  width: 0;
  height: 0;
  border-left: 8px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.icon-trash::before {
  left: 5px;
  top: 7px;
  width: 12px;
  height: 12px;
  border: 3px solid currentColor;
  border-top: 0;
  border-radius: 1px 1px 4px 4px;
}

.icon-trash::after {
  left: 4px;
  top: 3px;
  width: 14px;
  height: 3px;
  border-radius: 3px;
  background: currentColor;
}

.icon-clear::before {
  left: 4px;
  top: 4px;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.icon-clear::after {
  left: 6px;
  top: 10px;
  width: 12px;
  height: 3px;
  border-radius: 3px;
  background: currentColor;
  transform: rotate(-45deg);
}

.zoom-readout {
  display: grid;
  min-width: 62px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

#colorPicker {
  width: 42px;
  height: 42px;
  padding: 4px;
  flex-shrink: 0;
}

#sizeSlider {
  width: 104px;
  accent-color: var(--hot);
}

.canvas-stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(39, 42, 48, 0.82), rgba(18, 19, 22, 0.92)),
    #181a1e;
}

.canvas-stage::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

#plannerCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  max-width: none;
  max-height: none;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: #070b12;
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.05),
    0 22px 52px rgba(0, 0, 0, 0.36);
  touch-action: none;
}

#plannerCanvas[data-tool="pan"],
#plannerCanvas[data-tool="select"] {
  cursor: grab;
}

#plannerCanvas[data-tool="pan"]:active,
#plannerCanvas[data-tool="select"]:active {
  cursor: grabbing;
}

#plannerCanvas[data-tool="token"],
#plannerCanvas[data-tool="ping"],
#plannerCanvas[data-tool="text"] {
  cursor: crosshair;
}

.phase-tabs {
  display: flex;
  min-width: 0;
  gap: 8px;
  overflow: auto;
}

.phase-tab {
  min-width: 124px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.phase-tab.active {
  border-color: rgba(34, 212, 216, 0.78);
  background: rgba(34, 212, 216, 0.16);
  color: var(--text);
}

.mini-btn {
  min-height: 42px;
  padding: 0 16px;
  white-space: nowrap;
}

.utility-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

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

.marker-tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.marker-tab.active {
  border-color: rgba(255, 115, 0, 0.68);
  background: rgba(255, 115, 0, 0.14);
  color: var(--text);
}

.utility {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: grab;
}

.utility b {
  display: none;
}

.utility.active {
  border-color: rgba(255, 115, 0, 0.78);
  background: rgba(255, 115, 0, 0.14);
}

.util-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 115, 0, 0.13);
  padding: 4px;
}

.ability-panel {
  display: grid;
  gap: 10px;
}

.ability-panel[hidden],
.utility-grid[hidden] {
  display: none;
}

.ability-select-wrap {
  display: grid;
  gap: 6px;
}

.ability-select-wrap span {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.ability-select-wrap select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 9px 10px;
  font-weight: 800;
}

/* ── Custom image select ── */
.custom-select {
  position: relative;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, background 0.18s;
}

.custom-select-trigger:hover,
.custom-select.open .custom-select-trigger {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.custom-select-img {
  width: 38px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}

#agentSelectBtn .custom-select-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-position: top center;
}

.custom-select-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-arrow {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.4);
  transition: transform 0.2s ease;
}

.custom-select.open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 9999;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: #1a1c22;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  display: none;
}

.custom-select-list::-webkit-scrollbar {
  width: 8px;
}

.custom-select-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.custom-select-list::-webkit-scrollbar-track {
  background: transparent;
}

.custom-select.open .custom-select-list {
  display: block;
}

.custom-select-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: rgba(245, 243, 238, 0.82);
  transition: background 0.12s;
}

.custom-select-list li:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.custom-select-list li.selected {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.custom-select-list li img {
  width: 48px;
  height: 30px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
}

#agentSelectList li img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-position: top center;
}

.ability-grid {
  display: grid;
  gap: 7px;
}

.ability-marker {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 52px;
  border: 0.5px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  padding: 7px;
  color: var(--text);
  text-align: left;
  cursor: grab;
}

.ability-marker.active {
  border-color: rgba(34, 212, 216, 0.72);
  background: rgba(34, 212, 216, 0.11);
}

.ability-marker img {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.3);
  object-fit: contain;
}

.ability-marker span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ability-marker b {
  overflow: hidden;
  color: var(--hot);
  font-size: 10px;
  font-weight: 900;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.ability-marker strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.layer-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.055);
  min-height: 0;
  padding: 2px 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
}

.layer-row input {
  width: 14px;
  height: 14px;
  padding: 0;
  accent-color: var(--aqua);
}

.layer-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



.inspector {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 136px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
  padding: 13px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.inspector strong {
  color: var(--text);
}

.inspector-summary {
  display: grid;
  gap: 2px;
}

.inspector-summary span {
  display: block;
}

.inspector input {
  width: 100%;
  margin-top: 0;
}

.inspector-label {
  display: block;
  margin-top: 4px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.export-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: auto;
}

.export-grid button,
.import-btn {
  display: grid;
  min-height: 46px;
  place-items: center;
  padding: 0 10px;
  color: var(--text);
  text-align: center;
}

.export-grid button {
  border-color: rgba(255, 66, 109, 0.44);
  background: rgba(255, 66, 109, 0.12);
}

.import-btn input {
  display: none;
}

.ambient-divider {
  position: relative;
  height: clamp(80px, 10vw, 140px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ambient-glow {
  width: min(800px, 80vw);
  height: 1px;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.12) 0%, transparent 100%);
  position: relative;
}

.ambient-glow::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 120px;
  background: radial-gradient(ellipse at center, rgba(34, 212, 216, 0.05) 0%, rgba(255, 66, 109, 0.02) 40%, transparent 70%);
  pointer-events: none;
}

.content-index {
  position: relative;
  z-index: 1;
  overflow: visible;
  border-top: 0;
  background:
    linear-gradient(180deg, rgba(16, 17, 19, 0.98) 0%, rgba(20, 22, 27, 0.96) 34%, rgba(13, 14, 17, 0.98) 100%),
    url("images/Wallpaper_Phantom_Night.png") center top / cover fixed;
  color: var(--text);
}

.content-index::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: clamp(60px, 7vw, 120px);
  pointer-events: none;
  background: linear-gradient(180deg, rgba(16, 17, 19, 0), rgba(16, 17, 19, 0.98));
}

.content-index::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 72%);
}

.content-wrap {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(42px, 6vw, 84px) 0 clamp(54px, 7vw, 92px);
}

.contact-main {
  min-height: calc(100vh - var(--header-h));
}

.guide-main {
  min-height: calc(100vh - var(--header-h));
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  color: rgba(245, 243, 238, 0.6);
  font-size: 13px;
}

.breadcrumbs a {
  color: rgba(245, 243, 238, 0.86);
  font-weight: 750;
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: #c82950;
}

.index-heading {
  max-width: 760px;
  margin-bottom: 24px;
}

.index-heading h1 {
  margin: 6px 0 10px;
  color: var(--text);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.98;
}

.index-heading p {
  margin: 0;
  color: rgba(245, 243, 238, 0.74);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.55;
}

.wallpaper-reel {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(240px, 0.75fr);
  gap: 14px;
  margin: clamp(22px, 4vw, 42px) 0 clamp(34px, 5vw, 58px);
}

.content-index[data-route-type="map"] .index-heading,
.content-index[data-route-type="character"] .index-heading {
  margin-bottom: clamp(28px, 4vw, 44px);
}

.content-index[data-route-type="map"] .index-heading p,
.content-index[data-route-type="character"] .index-heading p {
  display: none;
}

.content-index[data-route-type="contact"] .wallpaper-reel {
  margin-bottom: clamp(24px, 4vw, 40px);
}

.contact-page {
  margin-top: clamp(20px, 4vw, 42px);
}

.contact-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 0.58fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 66, 109, 0.16), rgba(34, 212, 216, 0.08)),
    rgba(255, 255, 255, 0.07);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}

.contact-avatar {
  min-height: clamp(260px, 32vw, 440px);
  background: rgba(0, 0, 0, 0.24);
}

.contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.04) contrast(1.04);
}

.contact-copy {
  display: grid;
  align-content: center;
  gap: 16px;
  min-width: 0;
  padding: clamp(26px, 5vw, 58px);
}

.contact-copy span {
  color: var(--hot);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.contact-copy h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(34px, 5vw, 62px);
  line-height: 0.98;
}

.contact-copy p {
  max-width: 560px;
  margin: 0;
  color: rgba(245, 243, 238, 0.76);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.5;
}

.discord-link {
  display: inline-grid;
  width: fit-content;
  gap: 3px;
  border: 1px solid rgba(34, 212, 216, 0.32);
  border-radius: 7px;
  padding: 14px 18px;
  background: rgba(34, 212, 216, 0.11);
  color: var(--text);
  text-decoration: none;
}

.discord-link:hover {
  border-color: rgba(34, 212, 216, 0.58);
  background: rgba(34, 212, 216, 0.17);
}

.discord-link small {
  color: rgba(245, 243, 238, 0.56);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.discord-link strong {
  color: var(--text);
  font-size: 20px;
}

.contact-note {
  display: grid;
  gap: 10px;
  max-width: 660px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 18px;
}

.contact-note strong {
  color: var(--text);
  font-size: 18px;
}

.contact-note p {
  max-width: none;
  color: rgba(245, 243, 238, 0.7);
  font-size: 15px;
  line-height: 1.6;
}

.guide-page {
  display: grid;
  gap: clamp(18px, 3vw, 28px);
  margin-top: clamp(20px, 4vw, 42px);
}

.guide-panel {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(34, 212, 216, 0.12), rgba(255, 66, 109, 0.08)),
    rgba(255, 255, 255, 0.07);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}

.guide-hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  min-height: 420px;
}

.guide-hero-media {
  position: relative;
  min-height: 320px;
  background-position: center;
  background-size: cover;
}

.guide-hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(13, 14, 17, 0.16), rgba(13, 14, 17, 0.74));
}

.guide-hero-copy {
  display: grid;
  align-content: center;
  gap: 16px;
  min-width: 0;
  padding: clamp(26px, 5vw, 58px);
}

.guide-hero-copy span,
.guide-block span {
  color: var(--hot);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.guide-hero-copy h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(34px, 5vw, 62px);
  line-height: 0.98;
}

.guide-hero-copy p,
.guide-block p,
.guide-block li {
  color: rgba(245, 243, 238, 0.72);
  font-size: 15px;
  line-height: 1.62;
}

.guide-hero-copy p,
.guide-block p {
  margin: 0;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.guide-block {
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.guide-block h3 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
}

.guide-block ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.agent-guide-main .index-heading p {
  max-width: 860px;
}

.agent-guide-page {
  display: grid;
  gap: clamp(18px, 3vw, 28px);
  margin-top: clamp(20px, 4vw, 42px);
}

.agent-guide-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: clamp(22px, 4vw, 34px);
  background:
    linear-gradient(135deg, rgba(255, 66, 109, 0.16), rgba(34, 212, 216, 0.09)),
    rgba(255, 255, 255, 0.065);
  box-shadow: 0 24px 68px rgba(0, 0, 0, 0.32);
}

.agent-guide-intro span {
  color: var(--hot);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.agent-guide-intro h2 {
  margin: 8px 0 10px;
  color: var(--text);
  font-size: clamp(30px, 4.5vw, 54px);
  line-height: 0.98;
}

.agent-guide-intro p {
  max-width: 760px;
  margin: 0;
  color: rgba(245, 243, 238, 0.72);
  font-size: 15px;
  line-height: 1.6;
}

.agent-guide-counts {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.agent-guide-counts span {
  display: grid;
  min-width: 92px;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(8, 9, 13, 0.46);
  color: rgba(245, 243, 238, 0.62);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.agent-guide-counts b {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.agent-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.agent-guide-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(10, 11, 15, 0.95);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.agent-guide-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.5), 0 0 0 1.5px var(--agent-accent, rgba(255, 255, 255, 0.2));
}

.agent-guide-card img {
  width: 100%;
  height: 380px;
  object-fit: cover;
  object-position: top center;
  background: #0d0f14;
  display: block;
  transition: transform 0.4s ease;
}

.agent-guide-card:hover img {
  transform: scale(1.04);
}

.agent-guide-body {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(16, 18, 23, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.agent-guide-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.agent-guide-topline span {
  color: var(--agent-accent, var(--hot));
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.agent-guide-topline b {
  color: rgba(245, 243, 238, 0.5);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.agent-guide-body h2 {
  margin: 0;
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.agent-guide-title {
  margin: -4px 0 0;
  color: rgba(245, 243, 238, 0.55);
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
}

.agent-guide-weapon {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.agent-guide-weapon img {
  width: 80px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.42));
}

.agent-guide-weapon div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.agent-guide-weapon span {
  color: rgba(245, 243, 238, 0.42);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.agent-guide-weapon strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-guide-weapon small {
  color: var(--agent-accent, var(--hot));
  font-size: 10px;
  font-weight: 900;
}

.agent-guide-body p:not(.agent-guide-title) {
  margin: 0;
  color: rgba(245, 243, 238, 0.68);
  font-size: 13px;
  line-height: 1.55;
}

.agent-guide-body dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 2px 0 0;
}

.agent-guide-body dl div {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.03);
}

.agent-guide-body dt {
  margin-bottom: 2px;
  color: rgba(245, 243, 238, 0.42);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.agent-guide-body dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: rgba(245, 243, 238, 0.84);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
}

.meme-guide {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: clamp(22px, 4vw, 42px);
}

.meme-guide img {
  display: block;
  width: min(720px, 100%);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.34);
}

.meme-guide p {
  margin: 0;
  color: rgba(245, 243, 238, 0.58);
  font-size: 14px;
  text-align: center;
}

.wallpaper-stack {
  display: grid;
  gap: 14px;
}

.wallpaper-tile {
  min-height: 178px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.32);
}

.wallpaper-tile-main {
  min-height: clamp(260px, 28vw, 390px);
}

.video-banner-container {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: #111318;
}

.banner-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), filter 0.6s ease;
  animation: bannerFadeIn 1.2s ease-out forwards;
}

.video-banner-container:hover .banner-video {
  transform: scale(1.04);
  filter: brightness(1.15) contrast(1.05);
}

@keyframes bannerFadeIn {
  from {
    opacity: 0;
    transform: scale(1.03);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.wallpaper-tile-a {
  background-image:
    linear-gradient(180deg, rgba(13, 14, 17, 0.08), rgba(13, 14, 17, 0.56)),
    url("images/Wallpaper_Teatime_Delight_Kanami.png");
}

.wallpaper-tile-b {
  background-image:
    linear-gradient(180deg, rgba(13, 14, 17, 0.08), rgba(13, 14, 17, 0.56)),
    url("images/Wallpaper_Campus_Open_Day.png");
}

.seo-section {
  display: grid;
  gap: 16px;
  margin-top: clamp(30px, 5vw, 54px);
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 12px;
}

.section-title span,
.index-heading span {
  color: var(--hot);
}

.section-title h2 {
  display: none;
}

.guide-index {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.news-index {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 12px;
}

.news-card {
  position: relative;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  min-height: 148px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
}

.news-card-featured {
  grid-row: span 4;
  grid-template-columns: 1fr;
  min-height: 520px;
}

.news-card img {
  width: 100%;
  height: 100%;
  min-height: 148px;
  object-fit: cover;
  filter: saturate(1.06) contrast(1.03);
  transition: transform 0.25s ease;
}

.news-card-featured img {
  min-height: 300px;
}

.news-card:hover img {
  transform: scale(1.035);
}

.news-card div {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
  padding: 16px;
}

.news-card-featured div {
  align-content: start;
  padding: 20px;
}

.news-card span {
  color: var(--aqua);
  font-size: 12px;
  font-weight: 850;
}

.news-card strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.1;
}

.news-card-featured strong {
  font-size: clamp(24px, 3vw, 38px);
}

.news-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: rgba(245, 243, 238, 0.68);
  font-size: 14px;
  line-height: 1.45;
}

.event-index {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(220px, 0.85fr));
  gap: 12px;
}

.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.media-card {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #111318;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
}

.media-card img {
  display: block;
  width: 100%;
  height: auto;
}

.event-card {
  position: relative;
  display: grid;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #111318;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
}

.event-card-featured {
  grid-row: span 2;
  min-height: 532px;
}

.event-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.08) contrast(1.04);
  transition: transform 0.28s ease;
}

.event-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(13, 14, 17, 0.85) 95%);
}

.event-card:hover img {
  transform: scale(1.035);
}

.event-card-body {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: end;
  gap: 7px;
  min-height: 100%;
  padding: 18px;
}

.event-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.event-card-topline span {
  color: var(--aqua);
  font-size: 12px;
  font-weight: 850;
}

.event-card-topline b {
  border: 1px solid rgba(110, 231, 168, 0.48);
  border-radius: 999px;
  background: rgba(110, 231, 168, 0.13);
  color: var(--green);
  padding: 4px 9px;
  font-size: 11px;
  line-height: 1;
}

.event-card-topline b.ended {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.event-card strong {
  max-width: 680px;
  color: var(--text);
  font-size: clamp(20px, 2.5vw, 34px);
  line-height: 1;
}

.event-card:not(.event-card-featured) strong {
  font-size: 20px;
}

.event-card small {
  color: rgba(245, 243, 238, 0.7);
  font-size: 13px;
}

.event-card em {
  color: var(--hot);
  font-size: 13px;
  font-style: normal;
  font-weight: 850;
}

.guide-card,
.map-card {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.guide-card {
  position: relative;
  display: grid;
  overflow: hidden;
  gap: 8px;
  min-height: 144px;
  padding: 18px;
  background-position: center;
  background-size: cover;
}

.guide-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(13, 14, 17, 0.82), rgba(13, 14, 17, 0.44));
}

.guide-card > * {
  position: relative;
  z-index: 1;
}

.guide-card:nth-child(1) {
  background-image: url("images/Wallpaper_In_Our_Prime.png");
}

.guide-card:nth-child(2) {
  background-image: url("images/Wallpaper_Forest_Adventure.png");
}

.guide-card:nth-child(3) {
  background-image: url("images/Wallpaper_Bountiful_Autumn_Night.png");
}

.guide-card span,
.map-card span {
  color: var(--hot);
  font-size: 12px;
  font-weight: 850;
}

.guide-card strong,
.map-card strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.15;
}

.guide-card p,
.map-card small {
  margin: 0;
  color: rgba(245, 243, 238, 0.68);
  font-size: 14px;
  line-height: 1.45;
}

.map-index {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.map-card {
  display: grid;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.075);
}

.map-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #15161a;
  filter: saturate(1.08) contrast(1.04);
}

.map-card div {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.agent-index {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.map-index + .map-page,
.agent-index + .char-page {
  margin-top: 18px;
}

.agent-card {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 10px;
  aspect-ratio: 2 / 3;
  background: #0d0f14;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.agent-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.55), 0 0 0 1.5px var(--agent-accent, #ff426d);
  border-color: transparent;
}

.agent-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(0, 0, 0, 0.92) 100%);
  pointer-events: none;
  z-index: 1;
}

.agent-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transform-origin: top center;
  transition: transform 0.4s ease;
  image-rendering: auto;
  backface-visibility: hidden;
}

.agent-card:hover img {
  transform: scale(1.06);
}

.agent-card div {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px 12px;
  z-index: 2;
}

.agent-card span {
  display: block;
  color: var(--agent-accent, var(--hot));
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 3px;
}

.agent-card strong {
  display: block;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.1;
}

.agent-card small {
  display: block;
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  margin-top: 2px;
}

.agent-card.is-route-match {
  box-shadow: 0 0 0 2px var(--agent-accent, var(--aqua)), 0 20px 48px rgba(0, 0, 0, 0.4);
  transform: translateY(-4px);
}

.guide-card:hover,
.map-card:hover {
  border-color: rgba(255, 66, 109, 0.48);
  transform: translateY(-1px);
}

.is-route-match {
  border-color: rgba(34, 212, 216, 0.72);
  box-shadow: 0 0 0 3px rgba(34, 212, 216, 0.16), 0 18px 42px rgba(0, 0, 0, 0.28);
}

/* Map Page */
.map-page {
  overflow: hidden;
  margin-bottom: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(18, 20, 25, 0.92);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
  scroll-margin-top: 24px;
}

.map-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  min-height: 430px;
}

.map-hero-banner {
  position: relative;
  overflow: hidden;
  background: #101113;
}

.map-hero-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(13, 14, 17, 0.08), rgba(13, 14, 17, 0.72));
  pointer-events: none;
}

.map-hero-banner img {
  width: 100%;
  height: 100%;
  min-height: 430px;
  object-fit: cover;
  filter: saturate(1.07) contrast(1.04);
}

.map-hero-info {
  display: grid;
  align-content: center;
  gap: 14px;
  min-width: 0;
  padding: clamp(24px, 4vw, 46px);
  background:
    linear-gradient(180deg, rgba(255, 66, 109, 0.1), transparent 42%),
    rgba(20, 22, 27, 0.96);
}

.map-hero-info > span {
  color: var(--aqua);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.map-hero-info h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.98;
}

.map-hero-info p {
  margin: 0;
  color: rgba(245, 243, 238, 0.74);
  font-size: 16px;
  line-height: 1.55;
}

.map-mode-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.map-mode-list span {
  border: 1px solid rgba(34, 212, 216, 0.2);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(34, 212, 216, 0.08);
  color: rgba(245, 243, 238, 0.74);
  font-size: 11px;
  font-weight: 800;
}

.map-preview {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.map-preview img {
  width: 112px;
  aspect-ratio: 1;
  border-radius: 7px;
  object-fit: contain;
  background: #0b0e13;
}

.map-preview div {
  display: grid;
  gap: 4px;
}

.map-preview strong {
  color: var(--text);
  font-size: 15px;
}

.map-preview small {
  color: rgba(245, 243, 238, 0.62);
  font-size: 13px;
  line-height: 1.45;
}

.map-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.map-plan-btn {
  display: inline-grid;
  width: fit-content;
  border: 1px solid rgba(255, 66, 109, 0.4);
  border-radius: 7px;
  padding: 13px 16px;
  background: rgba(255, 66, 109, 0.14);
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
}

.map-plan-btn:hover {
  border-color: rgba(255, 66, 109, 0.68);
  background: rgba(255, 66, 109, 0.2);
}

/* Character Page */
.char-page {
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 40px;
  background: #16181e;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
  scroll-margin-top: 24px;
}

.char-hero {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) minmax(250px, 0.7fr);
  min-height: 420px;
}

.char-hero-img {
  position: relative;
  overflow: hidden;
  background: var(--char-accent, #ff426d);
}

.char-hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.char-hero-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 50%, #16181e);
}

.char-hero-info {
  padding: 36px;
}

.char-faction-badge {
  display: inline-block;
  border-radius: 99px;
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  color: #fff;
  background: var(--char-accent);
}

.char-hero-info h2 {
  margin: 0 0 4px;
  color: #f0ede8;
  font-size: clamp(30px, 4vw, 50px);
  font-weight: 900;
  line-height: 0.95;
}

.char-role {
  margin: 0 0 20px;
  color: var(--char-accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.char-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.char-stat label {
  display: block;
  color: #777f8d;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}

.char-stat span {
  color: #e8e5e0;
  font-size: 14px;
  font-weight: 750;
}

.char-bio {
  color: #aeb4bd;
  font-size: 14px;
  line-height: 1.65;
  margin: 0 0 18px;
  max-width: 500px;
}

.char-plan-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  background: var(--char-accent);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.16s, transform 0.16s;
}

.char-plan-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.char-weapon-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-width: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding: clamp(24px, 3vw, 38px);
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 115, 0, 0.16), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
}

.char-weapon-panel span {
  color: var(--char-accent);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.char-weapon-panel img {
  width: min(100%, 300px);
  max-height: 210px;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.42));
}

.char-weapon-panel strong {
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.char-weapon-panel small {
  color: rgba(245, 243, 238, 0.58);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

@media (min-width: 1680px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .secondary-tools {
    justify-content: flex-end;
  }
}

@media (max-width: 1460px) {
  .planner-command {
    grid-template-columns: minmax(160px, 1.1fr) minmax(150px, 0.9fr) minmax(230px, 0.9fr) auto;
  }

  .shell {
    grid-template-columns: 300px minmax(360px, 1fr) 270px;
  }
}

@media (max-width: 1240px) {
  :root {
    --header-h: 128px;
  }

  .app-header {
    grid-template-columns: auto 1fr;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .global-nav {
    justify-content: flex-end;
  }

  .header-actions {
    grid-column: 1 / -1;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    justify-self: stretch;
    width: 100%;
    max-width: calc(100vw - 24px);
    gap: 8px;
  }

  .action-btn {
    min-width: 0 !important;
    width: auto !important;
    padding: 0 10px;
    font-size: 14px;
  }

  .planner-command {
    grid-template-columns: minmax(160px, 1fr) minmax(150px, 1fr) minmax(230px, 1fr);
  }

  .planner-metrics {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .shell {
    height: auto;
    min-height: calc(120dvh - var(--header-h) - 140px);
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    grid-template-rows: minmax(720px, calc(120dvh - var(--header-h) - 140px)) auto;
    overflow: visible;
  }

  .right-panel {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(260px, 1.25fr);
    align-items: start;
  }

  .right-panel .section-head {
    border-top: 0;
    padding-top: 0;
  }

  .utility-head {
    grid-column: 1;
    grid-row: 1;
  }

  #utilityGrid {
    grid-column: 1;
    grid-row: 2 / span 2;
  }

  .layers-head {
    grid-column: 3;
    grid-row: 1;
  }

  #layerList {
    grid-column: 3;
    grid-row: 2;
  }

  .details-head {
    grid-column: 2;
    grid-row: 1;
  }

  #inspector {
    grid-column: 2;
    grid-row: 2;
  }

  .export-grid {
    grid-column: 3;
    grid-row: 3;
    margin-top: 0;
  }

  #plannerCanvas {
    width: calc(100% - 24px);
    height: calc(100% - 24px);
  }
}

@media (max-width: 920px) {
  :root {
    --header-h: auto;
  }

  body::before {
    inset: 0;
  }

  .app-header {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .app-brand {
    justify-content: space-between;
  }

  .app-brand img {
    width: clamp(160px, 48vw, 224px);
  }

  .brand-lockup {
    text-align: right;
  }

  .global-nav {
    justify-content: flex-start;
    overflow: auto;
    padding-bottom: 2px;
  }

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

  .action-btn {
    flex: 1;
  }

  .planner-app {
    min-height: 0;
  }

  .planner-transition {
    height: 140px;
  }

  .planner-command {
    grid-template-columns: minmax(0, 1fr);
    max-width: calc(100vw - 20px);
  }

  .planner-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .planner-metrics span {
    justify-content: center;
    min-width: 0;
  }

  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    min-height: 0;
  }

  .panel,
  .topbar,
  .phasebar,
  .canvas-stage {
    max-width: calc(100vw - 20px);
  }

  .board-wrap {
    order: 1;
    min-height: 72dvh;
  }

  .left-panel {
    order: 2;
    max-height: none;
  }

  .right-panel {
    order: 3;
    display: flex;
    grid-column: auto;
  }

  .agent-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

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

  .secondary-tools {
    justify-content: flex-start;
  }

  .phasebar {
    align-items: stretch;
    flex-direction: column;
  }

  #plannerCanvas {
    width: calc(100% - 24px);
    height: calc(100% - 24px);
  }

  .guide-index {
    grid-template-columns: 1fr;
  }

  .event-index {
    grid-template-columns: 1fr 1fr;
  }

  .news-index {
    grid-template-columns: 1fr;
  }

  .news-card-featured {
    grid-row: auto;
    min-height: 0;
  }

  .event-card-featured {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 340px;
  }

  .wallpaper-reel {
    grid-template-columns: 1fr;
  }

  .wallpaper-stack {
    grid-template-columns: 1fr 1fr;
  }

  .wallpaper-tile-main {
    min-height: 240px;
  }

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

  .char-hero {
    grid-template-columns: minmax(220px, 0.42fr) minmax(0, 0.58fr);
  }

  .char-weapon-panel {
    grid-column: 1 / -1;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 0;
  }

  .map-hero-banner img {
    min-height: 280px;
  }

  .contact-card {
    grid-template-columns: 1fr;
  }

  .guide-hero-panel,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .agent-guide-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-guide-counts {
    justify-content: flex-start;
  }

  .agent-guide-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .agent-guide-card {
    grid-template-columns: minmax(180px, 0.38fr) minmax(0, 0.62fr);
  }

  .contact-avatar {
    min-height: 320px;
  }
}

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

  .app-header {
    padding-right: 10px;
    padding-left: 10px;
  }

  .planner-app {
    padding: 10px;
  }

  .content-wrap {
    width: min(100% - 20px, 1440px);
  }

  .wallpaper-reel,
  .wallpaper-stack {
    grid-template-columns: 1fr;
  }

  .wallpaper-tile,
  .wallpaper-tile-main {
    min-height: 176px;
  }

  .event-index {
    grid-template-columns: 1fr;
  }

  .news-card {
    grid-template-columns: 1fr;
  }

  .news-card img,
  .news-card-featured img {
    min-height: 190px;
  }

  .event-card,
  .event-card-featured {
    min-height: 250px;
  }

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

  .map-preview img {
    width: 100%;
    max-height: 220px;
  }

  .contact-avatar {
    min-height: 240px;
  }

  .contact-copy {
    padding: 24px;
  }

  .brand-lockup {
    display: none;
  }

  .header-actions {
    gap: 8px;
  }

  .action-btn {
    min-width: 0;
    padding: 0 8px;
    font-size: 14px;
  }

  .nav-link {
    min-height: 42px;
    padding: 0 10px;
    font-size: 14px;
  }

  .section-head {
    grid-template-columns: 1fr;
  }

  .planner-metrics span {
    flex: 1 1 92px;
    justify-content: center;
  }

  .tool-strip {
    gap: 6px;
  }

  .tool {
    width: 36px;
    height: 36px;
  }

  #colorPicker {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  #sizeSlider {
    flex: 1 1 82px;
    width: 82px;
  }

  .agent-index {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .agent-guide-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .char-hero {
    grid-template-columns: 1fr;
  }

  .char-hero-img {
    min-height: 340px;
  }

  .char-hero-img::after {
    background: linear-gradient(180deg, transparent 54%, #16181e);
  }

  .agent-guide-card img {
    aspect-ratio: 3 / 4;
    min-height: 320px;
  }

  .agent-guide-weapon img {
    aspect-ratio: auto;
    width: 82px;
    height: 50px;
    min-height: 0;
  }

  .agent-guide-body {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 0;
  }

  .agent-guide-body dl {
    grid-template-columns: 1fr;
  }
}

/* Footer */
.site-footer {
  padding: 60px 20px 40px;
  background: #090a0d;
  text-align: center;
  position: relative;
  z-index: 2;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(245, 243, 238, 0.6);
  text-decoration: none;
  font-size: 16px;
  font-weight: 750;
  transition: color 0.2s, transform 0.2s;
}

.social-link:hover {
  color: #ff426d;
  transform: translateY(-2px);
}

.social-link svg {
  width: 30px;
  height: 30px;
}

.footer-text {
  margin: 0;
  color: rgba(245, 243, 238, 0.3);
  font-size: 12px;
}
