:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2330;
  --border: #2d333b;
  --accent: #d4a017;
  --accent-2: #c9971c;
  --text: #e6edf3;
  --muted: #8b949e;
  --danger: #e5534b;
  --ok: #3fb950;
  --mono: "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -100px, rgba(212,160,23,.12), transparent 60%),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(13,17,23,.85);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #f2dd7a);
  color: #1a1a1a;
  font-weight: 800;
  border-radius: 10px;
  font-size: 18px;
}
h1 { font-size: 18px; margin: 0; font-weight: 700; }

.count {
  font-size: 13px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.count b { color: var(--accent); }

.top-actions,
.section-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-tabs {
  padding: 4px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 10px;
}

.section-tab {
  border: 0;
  border-radius: 7px;
  padding: 7px 11px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.section-tab.active {
  background: var(--accent);
  color: #16120a;
}

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 15px; color: var(--muted); font-weight: 600; }

#spot-form { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 12px; align-items: end; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }

.map-combobox {
  position: relative;
  width: 100%;
}

.map-combobox-toggle {
  position: absolute;
  z-index: 2;
  top: 1px;
  right: 1px;
  width: 36px;
  height: calc(100% - 2px);
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0 7px 7px 0;
  background: var(--panel-2);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
}

.map-combobox-toggle:hover {
  color: var(--accent);
}

.map-combobox-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 5px);
  left: 0;
  width: max(100%, 230px);
  max-height: 260px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #161b22;
  box-shadow: 0 12px 30px rgba(0,0,0,.45);
}

.map-combobox-option {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: 12px var(--mono);
  text-align: left;
  cursor: pointer;
}

.map-combobox-option:hover,
.map-combobox-option.active {
  background: rgba(212,160,23,.16);
  color: #f2d675;
}

.map-combobox-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

input[type="number"],
input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--mono);
  transition: border-color .15s;
}
input[type="number"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,160,23,.15);
}
input[type="number"]::placeholder,
input[type="text"]::placeholder { color: #5a6470; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { opacity: 1; }

.map-combobox input[type="text"] {
  width: 100%;
  padding-right: 40px;
}

select {
  width: 100%;
  min-height: 40px;
  padding: 9px 34px 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,160,23,.15);
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }

.btn.add {
  grid-column: span 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #1a1a1a;
  height: 40px;
}

.btn.primary {
  width: 100%;
  font-size: 17px;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #1a1a1a;
  letter-spacing: .3px;
}

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin: 10px 0 0;
}

#spot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.spot {
  display: grid;
  grid-template-columns: auto auto auto auto 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.spot .kv { display: flex; flex-direction: column; }
.spot .kv span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.spot .kv b { font-family: var(--mono); }

.spot .preview {
  font-family: var(--mono);
  font-size: 12px;
  color: #9ae6a5;
  overflow-x: auto;
  white-space: pre;
}

.spot .del {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  transition: color .15s;
}
.spot .del:hover { color: var(--danger); }

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.output-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn.danger { color: var(--danger); border-color: rgba(229,83,75,.4); }

#output,
#v-output {
  width: 100%;
  min-height: 320px;
  background: #0a0e13;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #d6e2d6;
  font-family: var(--mono);
  font-size: 13px;
  padding: 14px;
  resize: vertical;
  line-height: 1.5;
  white-space: pre;
  tab-size: 2;
}

.visual-workspace {
  max-width: 1180px;
}

.npc-inline-info {
  padding: 11px 12px;
  border: 1px solid rgba(88, 166, 255, .35);
  border-radius: 9px;
  background: rgba(88, 166, 255, .08);
}

.npc-inline-info b {
  display: block;
  color: #b9dcff;
  font-size: 12px;
}

.npc-inline-info span {
  display: inline-block;
  margin-top: 5px;
  color: #79b8ff;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.npc-inline-info p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.project-bar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.4fr) repeat(4, auto);
  gap: 10px;
  align-items: end;
}

.visual-editor-grid {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.visual-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 92px;
}

.control-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.control-pair.single-control {
  grid-template-columns: 1fr;
}

.coordinate-output {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0a0e13;
  color: #9ae6a5;
  font-family: var(--mono);
  font-size: 12px;
}

.advanced-options {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.advanced-options-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

.visual-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.visual-controls .error { margin: -7px 0 0; }

.mode-toggle {
  width: 100%;
  transition: color .15s, background-color .15s, border-color .15s, box-shadow .15s, filter .15s, transform .05s;
}

.mode-toggle.mode-active {
  border-color: var(--ok);
  background: rgba(63, 185, 80, .14);
  color: #7ee787;
  box-shadow: inset 0 0 0 1px rgba(63, 185, 80, .18);
}

.mode-toggle.mode-paused {
  border-color: var(--danger);
  background: rgba(229, 83, 75, .14);
  color: #ff7b72;
  box-shadow: inset 0 0 0 1px rgba(229, 83, 75, .18);
}

.map-canvas.creation-paused {
  cursor: default;
}

.edit-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.edit-actions .btn { width: 100%; }

.map-card { min-width: 0; }

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

.map-toolbar h2 { margin: 0 0 3px; color: var(--text); }
.map-toolbar h2 b { color: var(--accent); }
.map-toolbar span { color: var(--muted); font-size: 12px; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.map-actions,
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zoom-controls {
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #0a0e13;
}

.zoom-controls .btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.zoom-controls .btn:disabled {
  cursor: default;
  opacity: .35;
}

.zoom-controls output {
  min-width: 42px;
  color: var(--muted);
  font: 11px var(--mono);
  text-align: center;
}

.map-layers {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.map-layers label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.map-layers input { accent-color: var(--accent); }
.layer-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.spot-dot { background: #ff4d4d; }
.npc-dot { background: #58a6ff; }
.monster-dot { background: #3fb950; }

.map-viewport {
  width: 100%;
  max-height: 760px;
  overflow: auto;
  border-radius: 10px;
  scrollbar-color: var(--border) #0a0e13;
}

.map-canvas {
  position: relative;
  width: min(100%, 760px);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #46505c;
  border-radius: 10px;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  background-color: #101720;
  background-image:
    linear-gradient(rgba(139,148,158,.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139,148,158,.15) 1px, transparent 1px),
    linear-gradient(rgba(212,160,23,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212,160,23,.08) 1px, transparent 1px);
  background-size: 6.25% 6.25%, 6.25% 6.25%, 25% 25%, 25% 25%;
  background-position: -1px -1px;
  transition: border-color .15s, box-shadow .15s;
}

.map-canvas.creation-active {
  border-color: var(--ok);
  box-shadow: 0 0 0 2px rgba(63, 185, 80, .42), 0 0 20px rgba(63, 185, 80, .2);
}

.map-canvas.creation-paused {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(229, 83, 75, .42), 0 0 20px rgba(229, 83, 75, .2);
}

.map-canvas.has-image {
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.map-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 35px rgba(0,0,0,.4);
}

.axis-label {
  position: absolute;
  z-index: 5;
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(10,14,19,.75);
  color: rgba(230,237,243,.75);
  font: 10px var(--mono);
  pointer-events: none;
}

.axis-origin { top: 6px; left: 6px; }
.axis-end { right: 6px; bottom: 6px; }
.marker-layer { position: absolute; inset: 0; z-index: 2; }

.map-marker,
.map-draft {
  position: absolute;
  transform: translate(-50%, -50%);
}

.map-marker {
  width: 8px !important;
  height: 8px !important;
  min-width: 8px;
  min-height: 8px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.7);
  cursor: pointer;
}

.map-marker::before {
  content: "";
  position: absolute;
  inset: -5px;
}

.map-marker.spot {
  background: #ff4d4d;
}

.map-marker.npc {
  background: #58a6ff;
}

.map-marker.monster-entry {
  background: #3fb950;
}

.map-marker.line {
  background: #ff4d4d;
}

.map-marker.selected { border-color: #fff; box-shadow: 0 0 0 3px var(--accent); z-index: 3; }
.map-marker.other-map { display: none; }
.map-draft {
  z-index: 4;
  min-width: 10px;
  min-height: 10px;
  border: 2px dashed var(--accent);
  border-radius: 4px;
  background: rgba(212,160,23,.23);
  box-shadow: 0 0 0 2px rgba(0,0,0,.3);
  pointer-events: none;
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--border);
  border-radius: 9px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.inline-count { margin-left: 8px; vertical-align: middle; }

.record-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 165px 165px;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #10151c;
}

.record-search { position: relative; min-width: 0; }
.record-search svg {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 11px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #697480;
  stroke-width: 1.8;
  stroke-linecap: round;
  transform: translateY(-50%);
  pointer-events: none;
}

.record-search input[type="search"] {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  font: 12px var(--mono);
}

.record-search input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,160,23,.12);
}

.record-search input[type="search"]::placeholder { color: #5c6672; }
.record-filters select { min-height: 40px; font-size: 11px; }
.filter-empty { margin-bottom: 8px; }

.visual-spot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow: auto;
}

.visual-spot-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.5fr) repeat(4, minmax(68px, .5fr)) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  font-size: 12px;
}

.visual-spot-row.selected { border-color: var(--accent); }
.visual-spot-name { min-width: 0; }
.visual-spot-name b, .visual-spot-name span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visual-spot-name span { color: var(--muted); margin-top: 2px; }
.record-kind {
  display: inline-flex !important;
  width: max-content;
  margin-top: 4px !important;
  padding: 2px 6px;
  border-radius: 10px;
  color: #0d1117 !important;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}
.record-kind.spot { background: #ff4d4d; }
.record-kind.npc { background: #58a6ff; }
.record-kind.monster { background: #3fb950; }
.visual-spot-value span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.visual-spot-value b { font-family: var(--mono); }
.row-actions { display: flex; gap: 5px; }
.row-actions .btn { padding: 7px 9px; }
.visual-output-card #v-output { min-height: 240px; }

.verify-btn {
  border-color: rgba(63,185,80,.38);
  background: rgba(63,185,80,.08);
  color: #7ee787;
}

.validation-dialog {
  width: min(650px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #343d48;
  border-radius: 16px;
  background: #12171e;
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0,0,0,.65);
}

.validation-dialog::backdrop {
  background: rgba(4,7,10,.78);
  backdrop-filter: blur(5px);
}

.validation-card {
  position: relative;
  max-height: calc(100vh - 30px);
  display: flex;
  flex-direction: column;
  padding: 25px;
  overflow-y: auto;
}

.validation-close {
  position: absolute;
  top: 13px;
  right: 14px;
  width: 31px;
  height: 31px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: #87929e;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.validation-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  padding-right: 34px;
}

.validation-shield {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(63,185,80,.38);
  border-radius: 14px 14px 18px 18px;
  background: rgba(63,185,80,.12);
  color: #7ee787;
  font-size: 22px;
  font-weight: 900;
  box-shadow: inset 0 -8px 20px rgba(63,185,80,.06);
}

.has-warnings .validation-shield {
  border-color: rgba(212,160,23,.45);
  background: rgba(212,160,23,.12);
  color: #f0c955;
}

.has-errors .validation-shield {
  border-color: rgba(229,83,75,.5);
  background: rgba(229,83,75,.12);
  color: #ff7b72;
}

.validation-heading h2 { margin: 4px 0 3px; font-size: 20px; }
.validation-heading p { margin: 0; color: #7f8a96; font-size: 11px; line-height: 1.45; }

.validation-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0 13px;
}

.validation-summary > div {
  display: flex;
  flex-direction: column;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #0d1218;
}

.validation-summary b { color: #d9e1e8; font: 700 18px var(--mono); }
.validation-summary span { margin-top: 2px; color: #687480; font-size: 9px; text-transform: uppercase; }
.validation-summary .summary-warning b { color: #e7bd4c; }
.validation-summary .summary-error b { color: #ff7269; }

.validation-issues {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.validation-issue {
  display: grid;
  grid-template-columns: 27px 1fr;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(212,160,23,.25);
  border-radius: 9px;
  background: rgba(212,160,23,.055);
}

.validation-issue > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(212,160,23,.17);
  color: #efc654;
  font-size: 11px;
  font-weight: 900;
}

.validation-issue.error { border-color: rgba(229,83,75,.28); background: rgba(229,83,75,.055); }
.validation-issue.error > span { background: rgba(229,83,75,.17); color: #ff7b72; }
.validation-issue b { display: block; font-size: 11px; }
.validation-issue p { margin: 3px 0 0; color: #7b8692; font-size: 10px; line-height: 1.45; }

.validation-issue .validation-issue-action {
  width: auto;
  margin-top: 9px;
  padding: 7px 10px;
  background: rgba(229,83,75,.08);
  font-size: 10px;
}

.validation-clean {
  padding: 13px;
  border: 1px solid rgba(63,185,80,.28);
  border-radius: 9px;
  background: rgba(63,185,80,.065);
  color: #79d589;
  font-size: 11px;
}

.validation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.validation-actions .btn { width: auto; font-size: 12px; padding: 10px 14px; }
.validation-actions .validation-download { min-width: 150px; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ok);
  color: #0d1117;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .topbar { align-items: flex-start; }
  .top-actions { flex-direction: column-reverse; align-items: flex-end; }
  .section-tab { padding: 6px 8px; }
  .section-tabs { gap: 2px; }
  #spot-form { grid-template-columns: repeat(2, 1fr); }
  .btn.add { grid-column: span 2; }
  .spot { grid-template-columns: 1fr 1fr; gap: 8px; }
  .spot .preview { grid-column: span 2; }
  .spot .del { justify-self: end; }
  h1 { font-size: 15px; }
  .project-bar { grid-template-columns: 1fr 1fr; }
  .project-select-field, .project-name-field { grid-column: span 1; }
  .visual-editor-grid { grid-template-columns: 1fr; }
  .visual-controls { position: static; }
  .visual-spot-row { grid-template-columns: 1fr 1fr 1fr; }
  .visual-spot-name { grid-column: span 3; }
  .row-actions { justify-self: end; }
  .record-filters { grid-template-columns: 1fr 1fr; }
  .record-search { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .topbar { position: static; flex-direction: column; }
  .top-actions { width: 100%; align-items: stretch; }
  .section-tabs { width: 100%; overflow-x: auto; }
  .section-tab { flex: 1 0 auto; }
  .validation-card { padding: 20px 15px; }
  .validation-heading { grid-template-columns: 1fr; }
  .validation-shield { width: 42px; height: 42px; }
  .validation-summary { grid-template-columns: 1fr 1fr 1fr; }
  .validation-summary > div { padding: 9px; }
  .validation-actions { flex-direction: column-reverse; }
  .validation-actions .btn { width: 100%; }
}

/* Application shell */
:root {
  --sidebar: 260px;
  --gold-soft: #f1cf67;
  --panel-raised: #1a2029;
}

body {
  overflow-x: hidden;
  background:
    radial-gradient(900px 520px at 42% -15%, rgba(212, 160, 23, .11), transparent 68%),
    linear-gradient(140deg, #0b0e13 0%, #0d1117 60%, #0b0f15 100%);
}

button { font-family: inherit; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  border-right: 1px solid #282f39;
  background:
    linear-gradient(rgba(13, 17, 23, .96), rgba(11, 14, 19, .98)),
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(255,255,255,.02) 14px 15px);
  box-shadow: 12px 0 40px rgba(0, 0, 0, .22);
}

.sidebar-brand {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 5px 19px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.sidebar-brand.active,
.sidebar-brand:hover {
  background: transparent;
  color: var(--text);
  box-shadow: none;
  transform: none;
}

.sidebar-brand .logo {
  flex: 0 0 43px;
  border: 1px solid rgba(255, 224, 126, .55);
  background: radial-gradient(circle at 35% 25%, #f9e59a, #d3a126 52%, #71500d 100%);
  box-shadow: 0 0 22px rgba(212, 160, 23, .2), inset 0 1px rgba(255,255,255,.5);
}

.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy b { font-size: 16px; letter-spacing: .02em; }
.brand-copy small { margin-top: 2px; color: #727c88; font: 9px var(--mono); letter-spacing: .16em; text-transform: uppercase; }

.module-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 0;
  scrollbar-width: thin;
  scrollbar-color: #313945 transparent;
}

.nav-label {
  margin: 14px 10px 7px;
  color: #626c79;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.module-tab {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 2px 0;
  padding: 9px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #9da7b3;
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s, transform .18s;
}

.module-tab:hover {
  border-color: #303844;
  background: rgba(255,255,255,.025);
  color: var(--text);
  transform: translateX(2px);
}

.module-tab.active {
  border-color: rgba(212,160,23,.35);
  background: linear-gradient(90deg, rgba(212,160,23,.16), rgba(212,160,23,.035));
  color: #f4d978;
  box-shadow: inset 3px 0 var(--accent);
}

.module-tab svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-status {
  color: #59636f;
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.nav-status.ready { color: #62c875; }

.sidebar-foot {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 13px 9px 3px;
  border-top: 1px solid var(--border);
}

.support-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin: 8px 0 10px;
  padding: 11px 10px;
  border: 1px solid rgba(0, 158, 227, .28);
  border-radius: 9px;
  background: linear-gradient(110deg, rgba(0,158,227,.13), rgba(0,98,180,.04));
  color: #dbeeff;
  text-decoration: none;
  transition: border-color .18s, background .18s, transform .18s;
}

.support-link:hover {
  border-color: rgba(0, 174, 239, .55);
  background: linear-gradient(110deg, rgba(0,158,227,.2), rgba(0,98,180,.07));
  transform: translateY(-1px);
}

.contact-link {
  border-color: rgba(212, 160, 23, .3);
  background: linear-gradient(110deg, rgba(212,160,23,.12), rgba(212,160,23,.025));
}

.contact-link:hover {
  border-color: rgba(226, 180, 53, .6);
  background: linear-gradient(110deg, rgba(212,160,23,.2), rgba(212,160,23,.06));
}

.contact-icon {
  background: linear-gradient(135deg, #c99517, #e9c55d);
  box-shadow: 0 5px 14px rgba(212,160,23,.17);
}

.contact-icon svg {
  width: 25px;
  fill: none;
  stroke: #1b1609;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-link small { color: #c9ad61; overflow-wrap: anywhere; }
.contact-link i { color: #e1bd53; }

.paypal-link {
  margin-top: -3px;
  border-color: rgba(0, 140, 255, .28);
  background: linear-gradient(110deg, rgba(0,69,124,.2), rgba(0,140,255,.045));
}

.paypal-link:hover {
  border-color: rgba(0, 140, 255, .58);
  background: linear-gradient(110deg, rgba(0,69,124,.3), rgba(0,140,255,.08));
}

.paypal-icon { background: #f7fbff; }
.paypal-icon img { width: 31px; height: 35px; }
.paypal-link small { color: #79acd5; }
.paypal-link i { color: #69b8f2; }

.support-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 10px;
  background: #009ee3;
  box-shadow: 0 5px 14px rgba(0,158,227,.18);
}

.support-icon img { width: 38px; height: 38px; display: block; }

.support-link > span:nth-child(2) { display: flex; flex-direction: column; }
.support-link b { color: #e9f7ff; font-size: 13px; line-height: 1.15; }
.support-link small { margin-top: 4px; color: #79b9d6; font-size: 10px; line-height: 1.2; }
.support-link i { color: #57bde9; font-size: 12px; font-style: normal; }

.status-light {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px rgba(63,185,80,.65);
}

.sidebar-foot span:last-child { display: flex; flex-direction: column; }
.sidebar-foot b { color: #98a2ae; font-size: 10px; }
.sidebar-foot small { max-width: 180px; margin-top: 3px; color: #59636f; font-size: 9px; line-height: 1.35; }

.app-main {
  grid-column: 2;
  min-width: 0;
}

.app-main > .topbar {
  min-height: 72px;
  padding: 13px 26px;
  border-bottom-color: #282f39;
  background: rgba(11, 15, 20, .87);
}

.page-heading { min-width: 0; }
.page-heading h1 { font-size: 16px; }
.page-heading p { margin: 4px 0 0; color: #707b87; font-size: 11px; }

.language-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 3px 4px 3px 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: #78838f;
}

.language-picker > span { color: var(--accent); font: 700 11px var(--mono); }
.language-picker select {
  width: auto;
  min-height: 32px;
  padding: 5px 28px 5px 7px;
  border: 0;
  background-color: transparent;
  box-shadow: none;
  color: #c4ccd4;
  font-size: 11px;
  cursor: pointer;
}
.language-picker select:focus { box-shadow: none; }

.sidebar-toggle {
  display: none;
  width: 38px;
  height: 38px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.sidebar-toggle span { display: block; height: 1px; margin: 4px 0; background: var(--text); }
.sidebar-backdrop { display: none; }

.app-main > main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 26px 34px;
}

.app-main > .visual-workspace { max-width: 1240px; }

/* Dashboard */
.dashboard-page { gap: 26px; }

.dashboard-hero {
  position: relative;
  min-height: 340px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr);
  align-items: center;
  overflow: hidden;
  padding: 46px 54px;
  border: 1px solid #343b44;
  border-radius: 18px;
  background:
    linear-gradient(105deg, rgba(17,22,29,.98) 0%, rgba(18,23,30,.94) 48%, rgba(23,24,24,.75) 100%),
    radial-gradient(circle at 80% 50%, rgba(212,160,23,.34), transparent 43%);
  box-shadow: 0 25px 70px rgba(0,0,0,.23), inset 0 1px rgba(255,255,255,.025);
}

.dashboard-hero::before,
.dashboard-hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.dashboard-hero::before {
  inset: 0;
  opacity: .24;
  background-image: linear-gradient(30deg, transparent 48%, rgba(212,160,23,.12) 49%, transparent 50%);
  background-size: 42px 42px;
  mask-image: linear-gradient(90deg, transparent 30%, #000 100%);
}

.dashboard-hero::after {
  right: -100px;
  bottom: -170px;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(212,160,23,.13);
  border-radius: 50%;
}

.hero-copy { position: relative; z-index: 2; }
.eyebrow { color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: .19em; text-transform: uppercase; }
.hero-copy h2 { margin: 13px 0 15px; font-size: clamp(36px, 4vw, 57px); line-height: .98; letter-spacing: -.045em; }
.hero-copy h2 em { color: var(--gold-soft); font-family: Georgia, serif; font-weight: 500; }
.hero-copy p { max-width: 525px; margin: 0; color: #9ca6b2; font-size: 14px; line-height: 1.7; }

.hero-action {
  margin-top: 27px;
  border-color: #c89924;
  background: linear-gradient(135deg, #e1b43c, #a87613);
  color: #151107;
  box-shadow: 0 8px 24px rgba(212,160,23,.16);
}
.hero-action span { margin-left: 14px; }

.hero-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 27px;
  flex-wrap: wrap;
}

.hero-actions .hero-action { margin-top: 0; }

.donate-action {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 15px 7px 8px;
  border-color: rgba(0, 158, 227, .38);
  background: rgba(0, 158, 227, .08);
  color: #83d8fb;
  text-decoration: none;
}

.donate-action img {
  width: 34px;
  height: 34px;
  padding: 2px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  background: #009ee3;
}

.paypal-action {
  border-color: rgba(0, 140, 255, .38);
  background: rgba(0, 69, 124, .16);
  color: #9ed6ff;
}

.paypal-action img {
  padding: 4px 7px;
  background: #f7fbff;
}

.hero-emblem {
  position: relative;
  z-index: 2;
  width: min(275px, 27vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  justify-self: center;
}

.emblem-ring { position: absolute; inset: 0; border: 1px solid rgba(212,160,23,.4); border-radius: 50%; }
.ring-one::before, .ring-one::after { content: ""; position: absolute; inset: 12%; border: 1px dashed rgba(212,160,23,.18); border-radius: 50%; transform: rotate(18deg); }
.ring-one::after { inset: 23%; border-style: solid; }
.ring-two { inset: 7%; border-color: rgba(255,225,130,.14); box-shadow: 0 0 60px rgba(212,160,23,.12), inset 0 0 55px rgba(212,160,23,.05); }
.ring-two::before, .ring-two::after { content: "◆"; position: absolute; left: 50%; color: #a77c1c; font-size: 11px; transform: translateX(-50%); }
.ring-two::before { top: -7px; }.ring-two::after { bottom: -7px; }
.emblem-core { display: flex; flex-direction: column; align-items: center; color: #e6bd4e; font-family: Georgia, serif; font-size: clamp(55px, 7vw, 84px); font-weight: 700; letter-spacing: -.1em; text-shadow: 0 5px 25px rgba(212,160,23,.3); transform: translateX(-4px); }
.emblem-core small { margin-top: -6px; color: #84703c; font: 8px var(--mono); letter-spacing: .38em; transform: translateX(5px); }

.dashboard-section { display: flex; flex-direction: column; gap: 15px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.section-heading h2 { margin: 5px 0 0; font-size: 20px; }
.progress-pill { padding: 7px 11px; border: 1px solid var(--border); border-radius: 20px; color: #737e8a; font-size: 10px; }
.progress-pill b { color: var(--ok); }

.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.module-card {
  position: relative;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 17px;
  overflow: hidden;
  border: 1px solid #29313b;
  border-radius: 12px;
  background: linear-gradient(150deg, #171d25, #11161d);
  color: var(--text);
  text-align: left;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.module-card::after { content: ""; position: absolute; right: -24px; bottom: -34px; width: 100px; height: 100px; border: 1px solid rgba(255,255,255,.025); border-radius: 50%; }
button.module-card { cursor: pointer; }
button.module-card:hover { transform: translateY(-3px); border-color: rgba(212,160,23,.48); box-shadow: 0 14px 28px rgba(0,0,0,.18); }
.module-card.available { border-color: rgba(212,160,23,.38); background: linear-gradient(150deg, rgba(212,160,23,.12), #14191f 52%); }
.module-number { color: #535e6a; font: 9px var(--mono); }
.module-state { position: absolute; top: 15px; right: 14px; color: #5b6571; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.available .module-state { color: #66cb77; }
.module-card-icon { min-height: 48px; display: flex; align-items: center; margin-top: 10px; color: #8994a0; font: 800 21px var(--mono); letter-spacing: -.08em; }
.available .module-card-icon { color: #e1b440; }
.module-card b { font-size: 13px; }
.module-card small { margin-top: 7px; color: #717c88; font-size: 10px; line-height: 1.5; }
.module-link { margin-top: auto; padding-top: 13px; color: #e0bd5c; font-size: 10px; font-weight: 750; }
.module-link i { margin-left: 5px; font-style: normal; }

/* Future module screens */
.module-placeholder { min-height: calc(100vh - 72px); justify-content: center; }
.coming-module {
  position: relative;
  width: min(680px, 100%);
  min-height: 390px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: auto;
  padding: 50px;
  overflow: hidden;
  border: 1px solid #303843;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 38%, rgba(212,160,23,.12), transparent 35%), #12171e;
  text-align: center;
}
.coming-module::before { content: ""; position: absolute; width: 300px; height: 300px; border: 1px solid rgba(212,160,23,.08); border-radius: 50%; }
.coming-number { position: absolute; top: 19px; right: 22px; color: #303843; font: 48px var(--mono); font-weight: 800; }
.coming-icon { position: relative; color: #d3a533; font: 800 42px var(--mono); letter-spacing: -.1em; }
.coming-module .eyebrow { position: relative; margin-top: 16px; }
.coming-module h2 { position: relative; margin: 7px 0 11px; font-size: 30px; }
.coming-module p { position: relative; max-width: 490px; margin: 0; color: #87919d; font-size: 13px; line-height: 1.65; }
.coming-badge { position: relative; margin-top: 22px; padding: 6px 11px; border: 1px solid rgba(212,160,23,.25); border-radius: 18px; color: #b69542; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

/* NPC shop editor */
.app-main > .shop-workspace { max-width: 1240px; }
.shop-workspace { gap: 16px; }
.shop-workspace .btn.primary { width: auto; padding: 10px 16px; font-size: 13px; }
.shop-profile::after { content: "SHOP + MANAGER"; }

.shop-topbar {
  display: grid;
  grid-template-columns: minmax(210px, 1.05fr) minmax(210px, 1.35fr) auto auto auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
}

.shop-binding-card { padding: 16px 18px; }
.shop-binding-fields {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(72px, .45fr));
  gap: 10px;
  align-items: end;
}

.shop-field-help,
.shop-output-help {
  margin: 8px 0 0;
  color: #737f8c;
  font-size: 10px;
  line-height: 1.5;
}
.shop-field-help b { color: #d7b457; font-family: var(--mono); }

.shop-step-head { display: flex; align-items: flex-start; gap: 10px; }
.shop-step-head > span {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(212,160,23,.42);
  border-radius: 8px;
  background: rgba(212,160,23,.11);
  color: #e4b844;
  font: 800 10px var(--mono);
}
.shop-step-head h2 { margin: 0; color: var(--text); font-size: 14px; }
.shop-step-head p { margin: 3px 0 0; color: #727e8a; font-size: 10px; line-height: 1.4; }
.shop-step-head.compact { margin-bottom: 12px; }

.shop-editor-layout {
  display: grid;
  grid-template-columns: minmax(290px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.shop-catalog-card,
.shop-inventory-card { min-width: 0; padding: 16px; }
.shop-catalog-card { position: sticky; top: 96px; }
.shop-catalog-filters { display: grid; gap: 8px; margin-top: 14px; }
.shop-catalog-filters input[type="search"] {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  background: #0d1218;
  color: var(--text);
  font: 12px var(--mono);
}
.shop-catalog-filters input[type="search"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,160,23,.13); }
.shop-result-count { margin: 10px 1px 7px; color: #697581; font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.shop-item-results {
  max-height: 590px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #36404c transparent;
}
.shop-result-item {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border: 1px solid #29313b;
  border-radius: 8px;
  background: #121820;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.shop-result-item:hover { border-color: rgba(212,160,23,.5); background: #181e26; transform: translateX(2px); }
.shop-item-symbol {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--item-color, #d4a017) 48%, #252d37);
  border-radius: 7px;
  background: color-mix(in srgb, var(--item-color, #d4a017) 12%, #11161d);
  color: var(--item-color, #d4a017);
  font: 800 9px var(--mono);
}
.shop-item-symbol.has-image {
  padding: 2px;
  background: radial-gradient(circle, color-mix(in srgb, var(--item-color, #d4a017) 16%, #18202a), #0c1117 72%);
}
.shop-item-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.72));
}
.shop-result-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.shop-result-copy b { overflow: hidden; color: #dce3e9; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.shop-result-copy small { color: #66727f; font: 9px var(--mono); }
.shop-result-add { padding: 5px 7px; border: 0; border-radius: 6px; background: rgba(212,160,23,.12); color: #d9b44d; font-size: 9px; font-weight: 800; }
.shop-no-results { padding: 28px 12px; color: #68737f; font-size: 11px; text-align: center; }

.shop-inventory-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 13px; }
.shop-count-badge { padding: 6px 9px; border: 1px solid #333c47; border-radius: 18px; background: #10151b; color: #86919c; font: 9px var(--mono); white-space: nowrap; }
.shop-inventory-scroll { max-width: 100%; overflow-x: auto; padding: 2px 2px 8px; }
.shop-inventory {
  --shop-slot: 46px;
  position: relative;
  width: calc(var(--shop-slot) * 8 + 2px);
  min-height: calc(var(--shop-slot) * 15 + 2px);
  display: grid;
  grid-template-columns: repeat(8, var(--shop-slot));
  grid-template-rows: repeat(15, var(--shop-slot));
  margin: 0 auto;
  border: 1px solid #3a4551;
  border-radius: 8px;
  background-color: #090d12;
  background-image:
    linear-gradient(to right, rgba(83,96,110,.25) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(83,96,110,.25) 1px, transparent 1px),
    radial-gradient(circle at 50% 0, rgba(212,160,23,.055), transparent 45%);
  background-size: var(--shop-slot) var(--shop-slot), var(--shop-slot) var(--shop-slot), 100% 100%;
  box-shadow: inset 0 0 35px rgba(0,0,0,.65), 0 12px 24px rgba(0,0,0,.16);
}
.shop-inventory-item {
  z-index: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 2px;
  padding: 4px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--item-color) 52%, #3a4551);
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--item-color) 18%, transparent), transparent 58%),
    linear-gradient(145deg, #202833, #11171e);
  color: #dce4eb;
  cursor: grab;
  box-shadow: inset 0 1px rgba(255,255,255,.04), 0 3px 7px rgba(0,0,0,.38);
  transition: border-color .15s, filter .15s, transform .15s;
}
.shop-inventory-item:active { cursor: grabbing; }
.shop-inventory-item.dragging { opacity: .28; filter: saturate(.55); }
.shop-inventory-item.drop-before { box-shadow: inset 4px 0 #f2c84b, 0 0 0 2px rgba(242,200,75,.5), 0 5px 14px rgba(0,0,0,.5); }
.shop-inventory-item.drop-after { box-shadow: inset -4px 0 #f2c84b, 0 0 0 2px rgba(242,200,75,.5), 0 5px 14px rgba(0,0,0,.5); }
.shop-inventory.drop-at-end { box-shadow: inset 0 0 0 2px #f2c84b, inset 0 0 35px rgba(0,0,0,.65), 0 12px 24px rgba(0,0,0,.16); }
.shop-inventory-item:hover { filter: brightness(1.15); transform: translateY(-1px); }
.shop-inventory-item.selected { z-index: 2; border-color: #fff0a7; box-shadow: 0 0 0 2px rgba(212,160,23,.65), 0 4px 12px rgba(0,0,0,.45); }
.shop-inventory-item .tile-symbol { color: var(--item-color); font: 900 13px var(--mono); text-shadow: 0 0 12px color-mix(in srgb, var(--item-color) 55%, transparent); }
.shop-inventory-item .tile-symbol.has-image {
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.shop-inventory-item .tile-symbol.has-image .shop-item-image {
  filter: drop-shadow(0 3px 5px rgba(0,0,0,.78)) drop-shadow(0 0 5px color-mix(in srgb, var(--item-color) 28%, transparent));
}
.shop-inventory-item b { width: 100%; overflow: hidden; font-size: 8px; line-height: 1.15; text-align: center; text-overflow: ellipsis; }
.shop-inventory-item small { color: #9ba6b1; font: 7px var(--mono); white-space: nowrap; }
.shop-empty { display: flex; flex-direction: column; align-items: center; margin: -380px auto 330px; pointer-events: none; color: #4e5966; text-align: center; }
.shop-empty b { font-size: 12px; }
.shop-empty span { max-width: 220px; margin-top: 6px; font-size: 10px; line-height: 1.5; }
.shop-overflow { margin: 8px auto 0; padding: 8px 10px; border: 1px solid rgba(229,83,75,.28); border-radius: 7px; background: rgba(229,83,75,.07); color: #e5857f; font-size: 10px; text-align: center; }

.shop-item-editor { margin-top: 14px; padding: 14px; border: 1px solid #333d49; border-radius: 10px; background: #11171e; }
.shop-selected-head { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.shop-selected-head > div:last-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.shop-selected-head b { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.shop-selected-head small { color: #73808d; font: 9px var(--mono); }
.shop-options-grid { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); gap: 9px; }
.shop-options-grid input,
.shop-options-grid select { min-height: 38px; padding-top: 8px; padding-bottom: 8px; font-size: 12px; }
.shop-advanced { margin-top: 11px; border-top: 1px solid #2e3742; }
.shop-advanced summary,
.shop-code-preview summary { padding: 11px 0 2px; color: #aab3bc; font-size: 11px; font-weight: 750; cursor: pointer; }
.advanced-grid { margin-top: 11px; }
.shop-edit-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.shop-edit-actions .btn { padding: 8px 10px; font-size: 11px; }
.shop-edit-actions .btn.primary { margin-right: auto; }
.shop-item-editor .error { min-height: 0; margin-bottom: 0; }

.shop-output-card { padding: 16px 18px; }
.shop-output-card .output-head { margin: 0; }
.shop-output-card h2 { margin-bottom: 0; color: var(--text); }
.shop-output-card .shop-download { width: auto; }
.shop-code-preview { margin-top: 10px; border-top: 1px solid #2e3742; }
.shop-code-preview textarea { width: 100%; min-height: 250px; margin-top: 9px; padding: 13px; resize: vertical; border: 1px solid var(--border); border-radius: 9px; background: #080c11; color: #cfdbd0; font: 11px/1.55 var(--mono); tab-size: 2; }
.shop-code-preview textarea:focus { outline: 1px solid var(--accent); }

@media (max-width: 1100px) {
  .shop-topbar { grid-template-columns: 1fr 1fr repeat(3, auto); }
  .shop-binding-fields { grid-template-columns: 2fr repeat(3, .45fr); }
  .shop-editor-layout { grid-template-columns: minmax(270px, 310px) minmax(0, 1fr); }
  .shop-inventory { --shop-slot: 43px; }
}

@media (max-width: 820px) {
  .shop-topbar { grid-template-columns: 1fr 1fr repeat(3, auto); }
  .shop-editor-layout { grid-template-columns: 1fr; }
  .shop-catalog-card { position: static; }
  .shop-item-results { max-height: 360px; }
  .shop-binding-fields { grid-template-columns: 2fr repeat(3, 1fr); }
}

@media (max-width: 560px) {
  .shop-topbar { grid-template-columns: 1fr 1fr; }
  .shop-select-field,
  .shop-name-field { grid-column: 1 / -1; }
  .shop-topbar .danger { grid-column: 1 / -1; }
  .shop-binding-fields { grid-template-columns: repeat(3, 1fr); }
  .shop-npc-field { grid-column: 1 / -1; }
  .shop-inventory { --shop-slot: 38px; }
  .shop-options-grid { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
  .shop-inventory-head { flex-direction: column; }
  .shop-output-card .output-head { align-items: stretch; }
  .shop-output-card .output-actions { display: grid; grid-template-columns: 1fr; }
  .shop-output-card .btn,
  .shop-output-card .btn.primary { width: 100%; }
}

/* Step-by-step guide */
.app-main > .guide-page {
  max-width: 1160px;
  gap: 18px;
}

.guide-category-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 7px;
  border: 1px solid #303945;
  border-radius: 14px;
  background: #10151b;
}
.guide-category-option {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #7f8a96;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s, background .16s, color .16s;
}
.guide-category-option:hover { background: #171d25; color: #c5cdd5; }
.guide-category-option.active { border-color: rgba(212,160,23,.48); background: linear-gradient(135deg, rgba(212,160,23,.16), rgba(212,160,23,.06)); color: #eef1f4; box-shadow: inset 0 1px rgba(255,255,255,.035); }
.guide-category-option > span:first-child { flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #3a4551; border-radius: 8px; background: #141a21; color: #8d98a4; font: 900 10px var(--mono); }
.guide-category-option.active > span:first-child { border-color: rgba(212,160,23,.45); background: rgba(212,160,23,.13); color: #e2b849; }
.guide-category-option > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.guide-category-option b { font-size: 12px; }
.guide-category-option small { color: #65717d; font: 9px var(--mono); }
.guide-category-panel { display: flex; flex-direction: column; gap: 34px; }
.guide-category-panel[hidden] { display: none; }
.shop-guide-intro { border-color: rgba(80,170,220,.28); background: radial-gradient(circle at 88% 20%, rgba(58,155,211,.13), transparent 30%), linear-gradient(125deg, #181d24, #11161c); }

.guide-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding: 30px 34px;
  overflow: hidden;
  border: 1px solid rgba(212,160,23,.32);
  border-radius: 16px;
  background:
    radial-gradient(circle at 88% 20%, rgba(212,160,23,.15), transparent 30%),
    linear-gradient(125deg, #181d24, #11161c);
}

.guide-intro h2 { margin: 7px 0 8px; font-size: 30px; letter-spacing: -.025em; }
.guide-intro p { max-width: 650px; margin: 0; color: #919ba6; font-size: 13px; line-height: 1.65; }
.guide-phases { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.guide-phases span { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid #343c47; border-radius: 20px; color: #8d97a2; background: rgba(10,14,19,.55); font-size: 10px; font-weight: 700; white-space: nowrap; }
.guide-phases b { color: var(--accent); font: 800 9px var(--mono); }

.guide-section { display: flex; flex-direction: column; gap: 16px; }
.guide-section-heading { display: flex; align-items: center; gap: 13px; }
.guide-section-heading > span { flex: 0 0 42px; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(212,160,23,.4); border-radius: 10px; background: rgba(212,160,23,.1); color: #e5b63d; font: 900 12px var(--mono); }
.guide-section-heading h2 { margin: 0; font-size: 19px; }
.guide-section-heading p { margin: 4px 0 0; color: #74808c; font-size: 11px; }
.guide-steps { display: flex; flex-direction: column; gap: 14px; }

.guide-step {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(250px, .75fr);
  min-height: 290px;
  overflow: hidden;
  border: 1px solid #2b333e;
  border-radius: 14px;
  background: linear-gradient(135deg, #161c24, #12171e);
  box-shadow: 0 13px 32px rgba(0,0,0,.13);
}

.guide-shot { position: relative; display: block; min-width: 0; overflow: hidden; border-right: 1px solid #303844; background: #080b0f; color: #d9b34d; text-decoration: none; }
.guide-shot img { width: 100%; height: 100%; min-height: 290px; display: block; object-fit: contain; background: #080b0f; transition: transform .2s, opacity .2s; }
.guide-shot span { position: absolute; right: 11px; bottom: 10px; padding: 6px 9px; border: 1px solid rgba(212,160,23,.38); border-radius: 7px; background: rgba(8,11,15,.88); color: #e1bd58; font-size: 9px; font-weight: 750; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }
.guide-shot:hover img { transform: scale(1.012); opacity: .92; }
.guide-shot:hover span, .guide-shot:focus-visible span { opacity: 1; transform: translateY(0); }

.guide-step-copy { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 28px; }
.guide-step-number { color: #d7a832; font: 800 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.guide-step-copy h3 { margin: 9px 0 10px; font-size: 19px; letter-spacing: -.02em; }
.guide-step-copy p { margin: 0; color: #8f99a5; font-size: 12px; line-height: 1.65; }
.guide-step-copy strong { color: #dce3e9; }
.guide-step-copy code { padding: 2px 5px; border: 1px solid #39424e; border-radius: 4px; background: #0e1319; color: #e6bd50; font: 11px var(--mono); }
.guide-step-copy aside { margin-top: 16px; padding: 10px 12px; border-left: 2px solid #d09b18; border-radius: 0 7px 7px 0; background: rgba(212,160,23,.075); color: #a9a28f; font-size: 10px; line-height: 1.5; }
.guide-step-copy aside strong { color: #e1b848; }
.guide-complete { margin-top: 18px; padding: 7px 10px; border: 1px solid rgba(63,185,80,.3); border-radius: 18px; background: rgba(63,185,80,.08); color: #75d484; font-size: 10px; font-weight: 800; }
.guide-step-warning { border-color: rgba(212,160,23,.3); }
.guide-step-finish { border-color: rgba(63,185,80,.28); }

/* Keep the visual editor comfortable inside the shell */
.visual-workspace .visual-controls { top: 96px; }

.server-profile {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  overflow: hidden;
  padding: 13px 16px;
  border: 1px solid rgba(212, 160, 23, .34);
  border-radius: 12px;
  background:
    linear-gradient(100deg, rgba(212,160,23,.11), rgba(22,27,34,.96) 38%, rgba(22,27,34,.96)),
    var(--panel);
  box-shadow: inset 3px 0 #c99a23;
}

.server-profile::after {
  content: "LOUIS UP43";
  position: absolute;
  right: 155px;
  color: rgba(212,160,23,.035);
  font: 900 38px var(--mono);
  letter-spacing: -.07em;
  pointer-events: none;
}

.profile-mark {
  position: relative;
  z-index: 1;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244,211,108,.45);
  border-radius: 9px;
  background: linear-gradient(145deg, #d6a62e, #75510c);
  color: #161106;
  font: 900 12px var(--mono);
  box-shadow: 0 5px 18px rgba(0,0,0,.25);
}

.profile-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.profile-copy > span {
  color: #8a7540;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.profile-copy strong { margin-top: 3px; font-size: 13px; }
.profile-copy strong b { color: var(--gold-soft); }
.profile-copy small { margin-top: 3px; color: #737e89; font-size: 9px; }

.compatibility-state {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(63,185,80,.25);
  border-radius: 9px;
  background: rgba(63,185,80,.065);
}

.compatibility-state > i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 9px rgba(63,185,80,.65);
}

.compatibility-state > span { display: flex; flex-direction: column; }
.compatibility-state b { color: #78d487; font-size: 9px; }
.compatibility-state small { margin-top: 1px; color: #65716d; font-size: 8px; }

@media (max-width: 1100px) {
  :root { --sidebar: 230px; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-hero { padding: 38px; }
  .project-bar { grid-template-columns: 1fr 1fr repeat(2, auto); }
  .project-bar .file-btn { grid-column: auto; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .app-main { grid-column: auto; }
  .app-sidebar {
    width: min(290px, 86vw);
    transform: translateX(-105%);
    transition: transform .24s ease;
  }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.64); backdrop-filter: blur(2px); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-toggle { display: block; flex: 0 0 auto; cursor: pointer; }
  .app-main > .topbar { position: sticky; flex-direction: row; align-items: center; padding: 10px 16px; }
  .app-main > main { padding: 18px 16px 28px; }
  .dashboard-hero { min-height: 310px; grid-template-columns: 1fr; padding: 32px; }
  .hero-copy { max-width: 560px; }
  .hero-emblem { position: absolute; right: -45px; width: 250px; opacity: .19; }
  .visual-editor-grid { grid-template-columns: 1fr; }
  .visual-workspace .visual-controls { position: static; }
  .guide-intro { align-items: flex-start; flex-direction: column; padding: 25px; }
  .guide-phases { justify-content: flex-start; }
  .guide-step { grid-template-columns: 1fr; }
  .guide-shot { border-right: 0; border-bottom: 1px solid #303844; }
  .guide-shot span { opacity: 1; transform: none; }
}

@media (max-width: 560px) {
  .page-heading p { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dashboard-hero { padding: 29px 24px; }
  .hero-copy h2 { font-size: 38px; }
  .hero-copy p { font-size: 12px; }
  .module-grid { grid-template-columns: 1fr; }
  .module-card { min-height: 160px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .project-bar { grid-template-columns: 1fr 1fr; }
  .project-select-field, .project-name-field { grid-column: span 2; }
  .map-toolbar { align-items: flex-start; flex-direction: column; }
  .map-actions { width: 100%; flex-wrap: wrap; }
  .map-layers { gap: 8px; flex-wrap: wrap; }
  .coming-module { min-height: 340px; padding: 36px 22px; }
  .server-profile { grid-template-columns: auto minmax(0, 1fr); }
  .compatibility-state { grid-column: 1 / -1; justify-content: center; }
  .server-profile::after { display: none; }
  .record-filters { grid-template-columns: 1fr; }
  .record-search { grid-column: auto; }
  .language-picker > span { display: none; }
  .guide-category-picker { grid-template-columns: 1fr; }
  .language-picker { padding-left: 3px; }
  .language-picker select { max-width: 95px; }
  .guide-intro h2 { font-size: 25px; }
  .guide-step-copy { padding: 22px; }
  .guide-shot img { min-height: 0; }
}
