:root {
  color-scheme: dark;
  --background: #13171d;
  --panel: #1a2027;
  --raised: #222a33;
  --border: #303941;
  --text: #f1f0eb;
  --muted: #a9b3bc;
  --orange: #ffad72;
  --ink: #251708;
  --mint: #a7ccba;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
button:disabled { cursor: default; opacity: .48; }
[hidden] { display: none !important; }
::selection { color: var(--ink); background: var(--orange); }
svg { width: 20px; height: 20px; flex: 0 0 auto; }
.skip { position: fixed; top: 10px; left: 10px; z-index: 20; padding: 10px; background: var(--panel); transform: translateY(-150%); }
.skip:focus { transform: none; }
.wrap { width: min(1180px, calc(100% - 64px)); margin-inline: auto; }

.header { position: sticky; top: 0; z-index: 5; padding-top: var(--safe-top); background: #13171df5; border-bottom: 1px solid var(--border); }
.header-row { min-height: 70px; display: flex; align-items: center; gap: 34px; }
.brand { display: inline-flex; align-items: center; gap: 11px; white-space: nowrap; background: none; border: 0; padding: 0; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; color: var(--orange); background: #35291f; border: 1px solid #61442e; border-radius: 9px; }
.brand-name { font-size: 21px; font-weight: 800; letter-spacing: -.055em; }
.brand-name span { color: var(--orange); }
.nav { display: flex; align-self: stretch; gap: 24px; }
.nav button { display: inline-flex; align-items: center; gap: 8px; position: relative; background: none; border: 0; padding: 0 2px; color: var(--muted); font-size: 14px; font-weight: 650; }
.nav button[aria-current="page"] { color: var(--text); }
.nav button[aria-current="page"]::after { content: ""; position: absolute; bottom: -1px; inset-inline: 0; height: 2px; background: var(--orange); }
.nav button:hover, .quiet:hover, .clear:hover { color: var(--text); }
.header-search { margin-left: auto; display: flex; gap: 9px; align-items: center; padding: 9px 12px; min-height: 40px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; color: var(--muted); font-size: 14px; }
.header-search:hover, .icon-button:hover { background: var(--raised); color: var(--text); }
kbd { color: var(--muted); padding: 1px 5px; margin-left: 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }
.dock { display: none; }

main { padding-block: 26px 42px; min-height: 75vh; }
.hero { position: relative; display: flex; align-items: center; min-height: 310px; overflow: hidden; isolation: isolate; padding: 36px 46px; border: 1px solid #4a4038; border-radius: 15px; background: #251e19; }
.hero::before { content: ""; position: absolute; z-index: -2; inset: 0; background: url("./assets/courtyard.webp") 73% 52% / cover no-repeat; }
.hero::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, #1a1a1bf7 0%, #1a1a1beb 28%, #1a1a1b72 55%, #17151609 90%); }
.hero-copy { max-width: 560px; }
.eyebrow { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; color: var(--orange); text-transform: uppercase; font-weight: 750; font-size: 12px; letter-spacing: .12em; }
.eyebrow svg { width: 17px; height: 17px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { letter-spacing: -.04em; }
h1 { font-size: clamp(34px, 6vw, 66px); line-height: .99; font-weight: 800; }
h1 span { color: var(--orange); }
.hero p:not(.eyebrow) { max-width: 420px; margin-top: 14px; color: #d4d0c8; font-size: 16px; line-height: 1.45; }
.hero .action { margin-top: 22px; }
.action { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 9px; padding: 9px 14px; border-radius: 8px; background: var(--orange); border: 1px solid transparent; color: var(--ink); font-weight: 750; font-size: 14px; }
.action:hover { background: #ffc598; }
.action.secondary { background: var(--panel); border-color: var(--border); color: var(--text); }
.action.secondary:hover { background: var(--raised); }
.action svg { width: 18px; height: 18px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 340px); gap: 28px; margin-top: 30px; align-items: start; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin-bottom: 14px; }
.section-heading h2, .subheading { font-size: clamp(22px, 3vw, 28px); line-height: 1.1; }
.section-heading p { color: var(--muted); font-size: 14px; padding-top: 5px; }
.quiet, .clear { border: 0; background: none; padding: 7px 0; color: var(--orange); font-weight: 650; font-size: 14px; white-space: nowrap; }
.map-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.map-card { width: 100%; min-width: 0; padding: 0; display: block; overflow: hidden; text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.map-card:hover, .map-card:focus-visible { border-color: var(--map-tone); }
.map-art { position: relative; height: 81px; isolation: isolate; overflow: hidden; background: linear-gradient(125deg, color-mix(in srgb, var(--map-tone), #151b20 76%), #1b232c 80%); }
.map-art::after, .map-cover::after { content: ""; pointer-events: none; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(#e9ebe90d 1px, transparent 1px), linear-gradient(90deg, #e9ebe90d 1px, transparent 1px); background-size: 16px 16px; mask-image: linear-gradient(90deg, transparent, #000); }
.map-code { position: absolute; top: 11px; left: 12px; color: var(--map-tone); font: 700 11px/1.2 ui-monospace, Consolas, monospace; text-transform: uppercase; letter-spacing: .065em; }
.schematic { position: absolute; right: 0; width: 75%; height: 100%; opacity: .78; pointer-events: none; }
.map-info { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 10px 12px 11px; }
.map-info strong { display: block; font-size: 16px; font-weight: 760; }
.map-info small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.map-info svg { color: var(--muted); width: 17px; height: 17px; }
.stack { display: grid; gap: 8px; }
.nade-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); padding-right: 6px; }
.nade-row:hover { border-color: #53616d; }
.row-open { min-width: 0; text-align: left; display: flex; align-items: center; gap: 11px; padding: 10px; min-height: 61px; color: var(--text); background: none; border: 0; }
.row-copy { min-width: 0; }
.row-copy strong { display: block; overflow-wrap: anywhere; font-size: 15px; font-weight: 690; line-height: 1.24; }
.row-copy small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.3; font-size: 12px; }
.type-icon { width: 37px; height: 37px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--type-tone), transparent 69%); border-radius: 8px; color: var(--type-tone); background: color-mix(in srgb, var(--type-tone), transparent 90%); }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid transparent; background: none; color: var(--muted); border-radius: 8px; }
.icon-button[aria-pressed="true"] { color: var(--orange); }
.icon-button[aria-pressed="true"] svg { fill: #ffad7240; }
.aside-link { display: flex; align-items: center; gap: 8px; margin-top: 13px; color: var(--orange); font-size: 14px; font-weight: 650; }
.aside-link button, .aside-link a { display: inline-flex; align-items: center; gap: 7px; color: inherit; border: 0; background: none; padding: 4px 0; }
.aside-link svg { width: 16px; height: 16px; }
.footer { display: flex; flex-wrap: wrap; gap: 10px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; padding-block: 18px 26px; }
.footer a:hover { color: var(--text); }

.titlebar { margin: 4px 0 20px; }
.titlebar h1, .map-cover h1 { font-size: clamp(35px, 6vw, 53px); }
.titlebar p, .map-cover p { margin-top: 8px; color: var(--muted); font-size: 15px; }
.all-maps { max-width: 930px; }
.all-maps .map-art { height: 103px; }
.all-maps .section-heading { margin-top: 24px; }
.toolbox { display: grid; gap: 12px; margin-bottom: 20px; }
.searchbox { display: flex; align-items: center; gap: 10px; padding: 0 12px; min-height: 47px; color: var(--muted); border: 1px solid var(--border); background: var(--panel); border-radius: 8px; }
.searchbox:focus-within { border-color: var(--orange); }
.searchbox input { flex: 1; min-width: 0; background: transparent; padding: 11px 0; outline: none; border: 0; color: var(--text); font-size: 16px; }
.searchbox input::placeholder { color: var(--muted); }
.searchbox .icon-button { width: 30px; height: 36px; }
.filters, .chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip, select { display: inline-flex; align-items: center; gap: 7px; background: var(--panel); color: var(--muted); border: 1px solid var(--border); border-radius: 7px; min-height: 38px; padding: 7px 11px; font-size: 14px; }
.chip:hover { color: var(--text); border-color: #687580; }
.chip[aria-pressed="true"] { color: var(--orange); background: #33291f; border-color: #795636; }
.chip svg { width: 16px; height: 16px; }
.inline-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-filters select { color: var(--text); max-width: 100%; }
.results { display: grid; gap: 9px; }
.result-count { margin: 0 0 11px; color: var(--muted); font-size: 14px; }
.empty { display: grid; align-items: start; justify-items: start; gap: 10px; padding: 22px; background: var(--panel); border: 1px dashed #52616d; border-radius: 10px; }
.empty p { color: var(--muted); line-height: 1.45; }
.empty > svg { color: var(--orange); width: 27px; height: 27px; }
.map-cover { isolation: isolate; position: relative; overflow: hidden; min-height: 154px; padding: 22px; background: linear-gradient(110deg, #1c2128, color-mix(in srgb, var(--map-tone), #151b20 80%)); border: 1px solid var(--border); border-radius: 12px; display: grid; align-content: end; }
.map-cover .schematic { width: min(60%, 510px); z-index: -1; }
.map-back { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 0; background: transparent; border: 0; color: var(--muted); font-size: 14px; }
.map-back:hover { color: var(--orange); }
.map-back svg { width: 16px; height: 16px; }
.map-tabs { display: flex; gap: 6px; margin: 12px 0 19px; }
.map-tabs .chip { min-height: 42px; font-weight: 690; }
.positions-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(245px, 310px); gap: 18px; }
.zone-block + .zone-block { margin-top: 17px; }
.zone-block h3 { margin-bottom: 7px; font-size: 16px; }
.position-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.position-card { text-align: left; border: 1px solid var(--border); border-radius: 7px; min-height: 49px; background: var(--panel); padding: 7px 11px; display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.position-card:hover { border-color: var(--orange); }
.position-card strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.position-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; overflow-wrap: anywhere; }
.position-card svg { color: var(--muted); width: 15px; height: 15px; }
.position-guide { align-self: start; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); display: grid; gap: 12px; }
.position-guide p { font-size: 14px; color: var(--muted); line-height: 1.5; }
.position-guide .action { justify-self: start; }
.position-guide .map-art { border-radius: 7px; }
.section-search { max-width: 860px; }
.search-group { margin-top: 18px; }
.search-group h2 { margin-bottom: 9px; font-size: 20px; }
.click-text { margin-left: 6px; font-size: 12px; color: var(--muted); }

dialog { color: var(--text); background: var(--panel); border: 1px solid #52616d; border-radius: 15px; padding: 0; width: min(600px, calc(100% - 24px)); max-width: none; max-height: min(760px, calc(100dvh - 30px - var(--safe-bottom))); }
dialog::backdrop { background: #090b10c9; }
.dialog-body { padding: 22px; }
.dialog-head { display: flex; gap: 12px; align-items: start; margin-bottom: 16px; }
.dialog-head h2 { font-size: clamp(23px, 5vw, 32px); }
.dialog-head small { color: var(--muted); }
.dialog-head .icon-button { margin-left: auto; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.detail-lead { color: var(--muted); line-height: 1.5; }
.detail-steps { display: grid; gap: 9px; list-style: none; padding: 0; margin: 14px 0; }
.detail-steps li { display: grid; grid-template-columns: 1.8rem 1fr; align-items: start; gap: 8px; background: var(--background); border: 1px solid var(--border); padding: 9px; border-radius: 7px; line-height: 1.4; color: var(--muted); }
.detail-steps li > span { color: var(--orange); font: 700 13px/24px ui-monospace, Consolas, monospace; }
.detail-steps strong { display: block; color: var(--text); font-size: 14px; }
.dialog-sub { margin: 17px 0 9px; }
.video-frame { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 9px; background: #10141a; }
.toast { z-index: 10; position: fixed; left: 50%; bottom: calc(20px + var(--safe-bottom)); width: max-content; max-width: calc(100% - 24px); transform: translateX(-50%); display: none; background: var(--raised); border: 1px solid #52616d; border-radius: 8px; padding: 9px 14px; font-size: 14px; color: var(--text); }
.toast.show { display: block; }

@media (max-width: 880px) {
  .wrap { width: calc(100% - 38px); }
  .header-row { gap: 20px; }
  .nav { gap: 15px; }
  .layout { gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(230px, 290px); }
  .layout .map-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 660px) {
  .wrap { width: calc(100% - 26px); }
  .header-row { min-height: 54px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-name { font-size: 19px; }
  .header .nav { display: none; }
  .header-search { border: 0; padding: 0; width: 40px; justify-content: center; }
  .header-search span, kbd { display: none; }
  .dock { display: flex; z-index: 5; position: fixed; background: #191e25fa; bottom: 0; inset-inline: 0; border-top: 1px solid var(--border); padding: 3px 7px var(--safe-bottom); justify-content: space-evenly; }
  .dock button { padding: 7px 4px; flex: 1; display: grid; justify-items: center; gap: 3px; border-radius: 6px; font-size: 11px; }
  .dock button[aria-current="page"] { color: var(--orange); }
  .dock button[aria-current="page"]::after { display: none; }
  main { padding-block: 14px 24px; }
  .hero { min-height: 264px; padding: 20px; }
  .hero::before { background-position: 65% 48%; }
  .hero::after { background: linear-gradient(90deg, #141416ee, #171619b3 49%, #1c171536), linear-gradient(0deg, #1b1a1b63, transparent 65%); }
  .hero p:not(.eyebrow) { max-width: 235px; font-size: 14px; }
  .hero .action { margin-top: 16px; }
  .eyebrow { font-size: 11px; }
  .layout, .positions-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
  .layout { margin-top: 21px; gap: 24px; }
  .map-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .map-art, .all-maps .map-art { height: 59px; }
  .map-info { padding: 8px; }
  .map-info strong { font-size: 14px; }
  .map-info small { font-size: 11px; }
  .map-code { top: 7px; left: 8px; font-size: 10px; }
  .footer { padding-bottom: calc(72px + var(--safe-bottom)); }
  .toast { bottom: calc(64px + var(--safe-bottom)); }
  .dialog-body { padding: 14px; }
}
