:root {
  color-scheme: dark;
  --bg: #070a0a;
  --panel: #0d1212;
  --panel-2: #111817;
  --line: rgba(167, 192, 181, 0.12);
  --line-strong: rgba(167, 192, 181, 0.25);
  --text: #e9f0ed;
  --muted: #84918c;
  --cyan: #4fd8d2;
  --cyan-soft: rgba(79, 216, 210, 0.16);
  --amber: #e7a844;
  --cell: 36px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--bg); overscroll-behavior: none; }

body {
  color: var(--text);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -20%, rgba(48, 93, 87, 0.19), transparent 42%),
    var(--bg);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button { color: inherit; font: inherit; }

.app-shell {
  width: min(100%, 760px);
  height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 2px auto minmax(0, 1fr) auto;
  background: rgba(7, 10, 10, 0.96);
  box-shadow: 0 0 80px #000;
  position: relative;
  overflow: hidden;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.topbar {
  min-height: 76px;
  padding: calc(13px + var(--safe-top)) 14px 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #111817 0%, #0b100f 100%);
  z-index: 10;
}

.brand-block h1 { margin: 3px 0 0; font-size: clamp(15px, 4vw, 22px); line-height: 1; letter-spacing: 0.06em; font-weight: 900; }
.brand-block h1 span { color: var(--cyan); }
.eyebrow { color: #849b94; letter-spacing: 0.18em; font-size: 9px; font-weight: 800; }

.stats { display: flex; align-items: center; gap: 10px; }
.stat { min-width: 43px; display: flex; flex-direction: column; align-items: flex-end; }
.stat span { color: var(--muted); font-size: 9px; letter-spacing: 0.08em; }
.stat strong { margin-top: 2px; font: 800 14px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.stat strong i { color: var(--amber); font-style: normal; font-size: 10px; margin-right: 2px; }
.stat-value { min-width: 72px; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line-strong); background: #121918; border-radius: 2px; display: grid; place-items: center; padding: 8px; }
.icon-button svg { width: 19px; fill: #9aaba5; }
.icon-button:active { background: var(--cyan-soft); transform: scale(0.96); }

.progress-strip { background: #080b0b; z-index: 11; }
.progress-strip span { display: block; height: 100%; width: 0; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); transition: width 250ms ease; }

.field-nav { min-height: 46px; display: grid; grid-template-columns: minmax(72px, 1fr) repeat(4, auto); align-items: stretch; gap: 1px; padding: 5px 8px; background: #0b1110; border-bottom: 1px solid var(--line-strong); z-index: 9; }
.zone-readout { min-width: 0; padding: 4px 5px; display: flex; flex-direction: column; justify-content: center; border-left: 2px solid var(--zone-color, var(--cyan)); }
.zone-readout span { color: var(--zone-color, var(--cyan)); font: 800 8px/1 ui-monospace, monospace; letter-spacing: .08em; }
.zone-readout strong { margin-top: 4px; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-nav button { min-width: 57px; padding: 3px 5px; border: 1px solid transparent; background: #121a18; color: #dbe8e2; font-size: 10px; font-weight: 800; }
.field-nav button b { display: block; margin-top: 3px; color: var(--zone-color, var(--cyan)); font: 800 8px/1 ui-monospace, monospace; white-space: nowrap; }
.field-nav button:active { background: var(--cyan-soft); border-color: var(--zone-color, var(--cyan)); }
.field-nav button.is-ready { border-color: var(--amber); }

.scroll-area { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #24302e #090d0c; }
.inventory-frame { min-height: 100%; position: relative; padding-top: 24px; }
.grid-ruler { position: sticky; top: 0; z-index: 8; height: 24px; margin-top: -24px; padding: 0 1px; display: grid; grid-template-columns: repeat(10, 1fr); background: rgba(9, 13, 13, 0.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.grid-ruler span { display: grid; place-items: center; color: #4d5c58; font: 700 8px/1 ui-monospace, monospace; border-right: 1px solid rgba(167, 192, 181, 0.06); }

.inventory {
  position: relative;
  width: 100%;
  min-height: 100%;
  background-color: #0a0e0e;
  background-image:
    linear-gradient(to right, transparent calc(100% - 1px), var(--line) calc(100% - 1px)),
    linear-gradient(to bottom, transparent calc(100% - 1px), var(--line) calc(100% - 1px));
  background-size: var(--cell) var(--cell);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.42);
}

.zone-band { position: absolute; left: 0; right: 0; pointer-events: none; z-index: 0; border-top: 1px solid var(--band-color); background: linear-gradient(180deg, var(--band-fade), transparent 42%); }
.zone-band-label { position: absolute; top: 4px; right: 5px; color: var(--band-color); opacity: .54; font: 800 8px/1 ui-monospace, monospace; letter-spacing: .08em; text-shadow: 0 1px 3px #000; }

.loot {
  position: absolute;
  padding: 2px;
  transition: filter 300ms ease, opacity 300ms ease;
  z-index: 1;
}

.loot, .scan-target {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.loot-card {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(145, 165, 157, 0.32);
  background:
    radial-gradient(circle at 50% 42%, var(--rarity-fade), transparent 66%),
    linear-gradient(145deg, rgba(36, 45, 42, 0.94), rgba(17, 22, 21, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.025), inset 0 -15px 30px rgba(0,0,0,0.28);
}

.loot-card::before, .loot-card::after { content: ""; position: absolute; width: 9px; height: 9px; opacity: .65; }
.loot-card::before { top: 3px; left: 3px; border-top: 1px solid var(--rarity-color); border-left: 1px solid var(--rarity-color); }
.loot-card::after { right: 3px; bottom: 3px; border-right: 1px solid var(--rarity-color); border-bottom: 1px solid var(--rarity-color); }

.loot-art, .detail-icon {
  background-image: var(--sprite-url);
  background-size: 400% 400%;
  background-position: var(--sprite-x) var(--sprite-y);
  background-repeat: no-repeat;
  filter: drop-shadow(0 6px 5px rgba(0,0,0,.56));
}

.loot-art {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--cell) * var(--art-cells) * .76);
  height: calc(var(--cell) * var(--art-cells) * .76);
}

.loot-meta { position: absolute; left: 5px; right: 5px; bottom: 4px; z-index: 2; display: flex; align-items: flex-end; justify-content: space-between; gap: 3px; text-shadow: 0 1px 3px #000; pointer-events: none; }
.loot-name { max-width: 80%; font-weight: 800; font-size: clamp(7px, calc(var(--cell) * .25), 12px); line-height: 1.08; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loot-size { color: var(--rarity-color); font: 800 8px/1 ui-monospace, monospace; white-space: nowrap; }
.loot-new { animation: lootReveal 620ms cubic-bezier(.18,.88,.29,1.2) both; }
.loot[data-rarity="legendary"] .loot-card, .loot[data-rarity="artifact"] .loot-card { box-shadow: inset 0 0 0 1px rgba(255,255,255,.05), 0 0 20px var(--rarity-fade); }

@keyframes lootReveal { 0% { opacity: 0; filter: brightness(3); transform: scale(.72); } 45% { opacity: 1; } 100% { filter: brightness(1); transform: scale(1); } }

.scan-target { position: absolute; padding: 2px; z-index: 5; cursor: pointer; }
.scan-card { width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; position: relative; border: 1px solid rgba(79, 216, 210, .48); background: repeating-linear-gradient(-55deg, #121918 0 6px, #0e1413 6px 12px); box-shadow: inset 0 0 28px rgba(79,216,210,.08), 0 0 12px rgba(79,216,210,.08); }
.scan-card::before { content: ""; position: absolute; inset: -80% -30%; background: linear-gradient(90deg, transparent 42%, rgba(79,216,210,.18) 50%, transparent 58%); transform: translateX(-48%) rotate(10deg); animation: sweep 1.35s linear infinite; }
.scan-card::after { content: ""; position: absolute; left: 0; top: var(--scan-pct, 0%); width: 100%; height: 1px; background: var(--cyan); box-shadow: 0 0 9px var(--cyan); transition: top 80ms linear; }
@keyframes sweep { to { transform: translateX(48%) rotate(10deg); } }

.scan-art { position: absolute; top: 45%; left: 50%; transform: translate(-50%, -50%); width: calc(var(--cell) * var(--art-cells) * .76); height: calc(var(--cell) * var(--art-cells) * .76); opacity: 0; background-image: var(--sprite-url); background-size: 400% 400%; background-position: var(--sprite-x) var(--sprite-y); background-repeat: no-repeat; transition: opacity 400ms ease, filter 400ms ease; pointer-events: none; }
.scan-card[data-stage="shape"] .scan-art { opacity: .52; filter: brightness(0) drop-shadow(0 0 5px var(--cyan)) blur(3px); }
.scan-card[data-stage="color"] .scan-art { opacity: .8; filter: saturate(.6) blur(2px) brightness(.8); }
.scan-card[data-stage="name"] .scan-art { opacity: .94; filter: saturate(1) blur(.5px); }
.scan-card[data-stage="shape"] .magnifier, .scan-card[data-stage="color"] .magnifier, .scan-card[data-stage="name"] .magnifier { opacity: 0; }
.scan-hint { position: absolute; z-index: 2; left: 4px; right: 4px; bottom: 5px; color: #dceae6; font-size: clamp(7px, calc(var(--cell) * .23), 12px); font-weight: 800; text-shadow: 0 1px 4px #000; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transition: opacity 300ms ease; }
.scan-card[data-stage="name"] .scan-hint { opacity: 1; }
.scan-card[data-stage="name"] .scan-percent { display: none; }

.magnifier { position: relative; width: clamp(19px, calc(var(--cell) * .58), 34px); aspect-ratio: 1; border: 3px solid #d7e6e1; border-radius: 50%; filter: drop-shadow(0 0 6px rgba(79,216,210,.34)); }
.magnifier::after { content: ""; position: absolute; width: 52%; height: 3px; border-radius: 2px; right: -38%; bottom: -17%; background: #d7e6e1; transform: rotate(45deg); transform-origin: left center; }
.scan-percent { position: absolute; bottom: 5px; right: 5px; color: var(--cyan); font: 800 9px/1 ui-monospace, monospace; }

.depth-marker { color: #3f4b48; font: 700 9px/1 ui-monospace, monospace; letter-spacing: .13em; text-align: right; padding: 7px 9px 18px; }

.scanner-dock { z-index: 12; min-height: 82px; padding: 10px 12px calc(10px + var(--safe-bottom)); display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; border-top: 1px solid var(--line-strong); background: linear-gradient(180deg, rgba(17,24,23,.97), rgba(8,12,11,.99)); box-shadow: 0 -10px 30px rgba(0,0,0,.34); }
.scanner-copy { display: flex; flex-direction: column; min-width: 0; }
.scanner-copy span { color: var(--cyan); font: 800 8px/1.1 ui-monospace, monospace; letter-spacing: .12em; }
.scanner-copy strong { margin-top: 5px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boost-button { height: 42px; min-width: 126px; display: grid; grid-template-columns: 30px 1fr; grid-template-rows: 1fr 1fr; align-items: center; border: 1px solid rgba(79,216,210,.42); background: rgba(79,216,210,.08); padding: 5px 9px; text-align: left; cursor: pointer; }
.boost-button:active { transform: scale(.97); background: rgba(79,216,210,.19); }
.boost-button > span:nth-child(2) { font-size: 11px; font-weight: 800; align-self: end; }
.boost-button b { color: #79908a; font: 700 8px/1 ui-monospace, monospace; align-self: start; }
.boost-icon { grid-row: 1 / 3; width: 19px; aspect-ratio: 1; border: 2px solid var(--cyan); border-radius: 50%; position: relative; }
.boost-icon::after { content: ""; position: absolute; width: 8px; height: 2px; background: var(--cyan); right: -6px; bottom: -3px; transform: rotate(45deg); }
.pulse-button { min-width: 60px; height: 42px; border: 1px solid rgba(231,168,68,.5); background: rgba(231,168,68,.1); color: #efc17e; padding: 3px; font-size: 10px; font-weight: 900; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pulse-button small { display: block; font: 700 7px/1.1 ui-monospace, monospace; }
.pulse-button b { display: block; margin-top: 2px; font: 900 11px/1 ui-monospace, monospace; }
.pulse-button.is-holding { background: rgba(231,168,68,.28); box-shadow: 0 0 14px rgba(231,168,68,.2); }
.pulse-button:disabled { opacity: .36; }
.scanner-meter { grid-column: 1 / -1; height: 2px; background: #1b2523; overflow: hidden; }
.scanner-meter span { display: block; width: 0; height: 100%; background: var(--cyan); box-shadow: 0 0 7px var(--cyan); }

.toast { position: fixed; z-index: 40; top: calc(84px + var(--safe-top)); left: 50%; transform: translate(-50%, -12px); min-width: min(88vw, 380px); padding: 10px 14px; opacity: 0; pointer-events: none; border: 1px solid var(--toast-color, var(--cyan)); background: rgba(8, 13, 12, .94); box-shadow: 0 8px 30px #000; transition: opacity 180ms ease, transform 180ms ease; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast b { color: var(--toast-color, var(--cyan)); }

dialog { color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(3px); }
.sheet { width: min(calc(100% - 24px), 500px); margin: auto auto 0; padding: 28px 22px calc(22px + var(--safe-bottom)); border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 5px 5px 0 0; background: linear-gradient(145deg, #151d1b, #0b100f); box-shadow: 0 -20px 60px #000; }
.sheet[open] { animation: sheetIn 220ms ease-out; }
@keyframes sheetIn { from { transform: translateY(30px); opacity: 0; } }
.sheet-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; color: #75837e; font-size: 26px; }
.sheet h2 { margin: 5px 0 8px; font-size: 22px; }
.sheet p { color: #a3aea9; font-size: 13px; line-height: 1.6; }
.sheet .detail-stock { color: var(--cyan); font: 800 10px/1.3 ui-monospace, monospace; }
.detail-icon { position: relative; inset: auto; transform: none; width: 104px; height: 104px; margin: -10px auto 10px; filter: drop-shadow(0 10px 9px #000); }
.detail-rarity { color: var(--rarity-color, var(--cyan)); font: 900 10px/1 ui-monospace, monospace; letter-spacing: .15em; }
.sheet dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 18px 0 0; background: var(--line); }
.sheet dl div { padding: 12px 10px; background: #0d1312; }
.sheet dt { color: var(--muted); font-size: 9px; }
.sheet dd { margin: 6px 0 0; font: 800 12px/1.1 ui-monospace, monospace; }

.feature-sheet { max-height: min(84dvh, 750px); overflow: auto; overscroll-behavior: contain; }
.feature-intro { margin: 0 0 16px; }
.feature-list { display: grid; gap: 7px; margin-top: 12px; }
.codex-controls { display: grid; grid-template-columns: minmax(0, 1fr) 122px; gap: 8px; }
.codex-controls input, .codex-controls select { width: 100%; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 0; outline: none; background: #0a100e; color: var(--text); font: 700 12px/1 sans-serif; }
.codex-controls input:focus, .codex-controls select:focus { border-color: var(--cyan); }
.codex-empty { grid-column: 1 / -1; text-align: center; padding: 18px; }
.codex-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.codex-entry { min-height: 69px; display: flex; align-items: center; gap: 8px; padding: 7px; border: 1px solid var(--line); background: #0d1412; min-width: 0; }
.codex-entry.is-unknown { opacity: .48; }
.codex-art { flex: 0 0 46px; width: 46px; height: 46px; background-image: var(--sprite-url); background-size: 400% 400%; background-position: var(--sprite-x) var(--sprite-y); background-repeat: no-repeat; }
.codex-entry.is-unknown .codex-art { background-image: none; display: grid; place-items: center; border: 1px dashed #495550; color: #64746d; font: 900 22px/1 ui-monospace, monospace; }
.codex-text { min-width: 0; }
.codex-text strong { display: block; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.codex-text small { display: block; margin-top: 4px; color: var(--entry-color, var(--muted)); font: 700 8px/1 ui-monospace, monospace; }
.subheading { margin: 22px 0 4px; color: var(--cyan); font-size: 12px; letter-spacing: .06em; }
.mission-overview { padding: 14px; border: 1px solid rgba(79,216,210,.3); background: linear-gradient(135deg, #14201d, #0b1210); }
.mission-overview strong { display: block; margin: 7px 0 12px; font-size: 15px; }
.mission-overview p { margin: 10px 0 0; font-size: 10px; }
.mission-overview #mission-claim-total { color: var(--amber); font: 800 10px/1.4 ui-monospace, monospace; }
.mission-list-header { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mission-list-header h3 { margin: 0; color: var(--cyan); font-size: 13px; }
.mission-list-header select { min-width: 124px; height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); background: #0a100e; color: var(--text); font-size: 11px; }
.mission-list { display: grid; gap: 9px; margin-top: 10px; }
.mission-card { padding: 12px; border: 1px solid rgba(79,216,210,.22); background: linear-gradient(135deg, #121b18, #0b1210); }
.mission-card.is-ready { border-color: rgba(231,168,68,.65); box-shadow: inset 0 0 22px rgba(231,168,68,.06); }
.mission-card.is-claimed { opacity: .55; }
.mission-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mission-state { color: var(--muted); font: 800 9px/1 ui-monospace, monospace; white-space: nowrap; }
.mission-card.is-ready .mission-state { color: var(--amber); }
.mission-card h3 { margin: 9px 0 4px; font-size: 14px; }
.mission-card p { margin: 0 0 10px; font-size: 11px; }
.mission-progress { height: 5px; background: #23302c; }
.mission-progress span { display: block; height: 100%; width: 0; background: var(--cyan); box-shadow: 0 0 7px var(--cyan); transition: width 250ms ease; }
.mission-figures { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; color: #9aada5; font: 700 10px/1.3 ui-monospace, monospace; }
.mission-figures span:last-child { color: var(--amber); text-align: right; }
.mission-card button { width: 100%; margin-top: 11px; padding: 9px; border: 1px solid var(--amber); background: rgba(231,168,68,.13); color: var(--amber); font-size: 11px; font-weight: 900; }
.mission-card button:disabled { border-color: var(--line); background: transparent; color: var(--muted); opacity: .66; }
.mission-empty { margin: 0; padding: 18px; border: 1px dashed var(--line-strong); text-align: center; }
.calibration-label { text-align: center; font: 700 10px/1.5 ui-monospace, monospace; }
.rebirth-luck { padding: 15px; border: 1px solid rgba(231,168,68,.4); background: linear-gradient(135deg, #241d13, #101511); }
.rebirth-luck strong { display: block; margin-top: 8px; color: var(--amber); font-size: 13px; line-height: 1.5; }
.rebirth-requirement { margin-top: 9px; padding: 13px; border: 1px solid var(--line-strong); background: #101715; }
.rebirth-requirement-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 12px; }
.rebirth-requirement-head span:last-child { color: var(--amber); font: 800 11px/1.3 ui-monospace, monospace; text-align: right; }
.rebirth-warning { margin: 16px 0 !important; padding: 11px; border-left: 2px solid #cb7777; background: rgba(203,119,119,.07); }
#rebirth-action:disabled { opacity: .45; filter: grayscale(1); }
.recipe-card { padding: 13px; border: 1px solid var(--line-strong); background: #101715; }
.recipe-card h3 { margin: 0 0 4px; font-size: 14px; }
.recipe-card p { margin: 0 0 9px; font-size: 11px; }
.recipe-components { display: flex; flex-wrap: wrap; gap: 5px; }
.recipe-components span { border: 1px solid #34453e; padding: 5px 7px; color: #b5c8be; font: 700 10px/1 ui-monospace, monospace; }
.recipe-components span.is-missing { color: #bd7777; border-color: #583a3a; }
.recipe-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; }
.recipe-foot small { color: var(--amber); font: 800 9px/1.3 ui-monospace, monospace; }
.recipe-foot button { min-width: 90px; padding: 9px; border: 1px solid var(--cyan); background: rgba(79,216,210,.13); color: var(--cyan); font-size: 11px; font-weight: 900; }
.recipe-foot button:disabled { opacity: .35; }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding: 16px 0; }
.setting-row strong { display: block; font-size: 13px; }
.setting-row small { color: var(--muted); display: block; margin-top: 4px; font-size: 10px; }
.toggle { width: 45px; height: 24px; padding: 2px; border: 1px solid #33403d; border-radius: 12px; background: #141a19; }
.toggle span { display: block; width: 18px; height: 18px; border-radius: 50%; background: #62716c; transition: transform 180ms ease, background 180ms ease; }
.toggle.is-on { border-color: rgba(79,216,210,.5); background: rgba(79,216,210,.11); }
.toggle.is-on span { transform: translateX(19px); background: var(--cyan); box-shadow: 0 0 8px rgba(79,216,210,.55); }
.secondary-button, .danger-button { width: 100%; margin-top: 10px; padding: 12px; border: 1px solid var(--line-strong); background: #121817; font-weight: 800; font-size: 12px; }
.secondary-button { color: var(--cyan); border-color: rgba(79,216,210,.35); }
.danger-button { color: #cb7777; border-color: rgba(203,119,119,.28); }
.version { text-align: center; font: 700 8px/1 ui-monospace, monospace; letter-spacing: .08em; margin: 18px 0 0 !important; }

.tutorial { width: min(calc(100% - 28px), 440px); border: 1px solid rgba(79,216,210,.35); padding: 26px; background: linear-gradient(145deg, #151e1c, #090e0d); box-shadow: 0 20px 80px #000; }
.tutorial[open] { animation: tutorialIn 360ms ease-out; }
@keyframes tutorialIn { from { opacity: 0; transform: scale(.94); } }
.tutorial h2 { margin: 8px 0 14px; font-size: clamp(28px, 9vw, 40px); line-height: 1.08; letter-spacing: -.03em; }
.tutorial p { color: #a2aea9; font-size: 13px; line-height: 1.7; }
.tutorial ul { list-style: none; padding: 0; margin: 20px 0; }
.tutorial li { border-top: 1px solid var(--line); padding: 10px 0; color: #84918c; font-size: 11px; }
.tutorial li b { color: var(--text); }
.tutorial-scan { float: right; width: 68px; height: 68px; display: grid; place-items: center; border: 1px solid var(--line); background: repeating-linear-gradient(-55deg,#101716 0 5px,#0c1110 5px 10px); }
.tutorial-scan span { width: 26px; height: 26px; border: 3px solid var(--cyan); border-radius: 50%; position: relative; }
.tutorial-scan span::after { content:""; position:absolute; width:12px; height:3px; background:var(--cyan); right:-10px; bottom:-5px; transform:rotate(45deg); }
.primary-button { width: 100%; border: 1px solid var(--cyan); background: var(--cyan); color: #06100f; padding: 14px; font-weight: 900; letter-spacing: .08em; }

@media (min-width: 600px) {
  .topbar { padding-left: 20px; padding-right: 20px; }
  .scanner-dock { padding-left: 20px; padding-right: 20px; }
  .loot { padding: 3px; }
}

@media (max-height: 590px) {
  .topbar { min-height: 61px; padding-top: calc(8px + var(--safe-top)); }
  .scanner-dock { min-height: 70px; padding-top: 7px; }
  .tutorial { padding: 19px; }
  .tutorial p { margin: 8px 0; }
  .tutorial ul { margin: 10px 0; }
  .tutorial li { padding: 7px 0; }
}

@media (max-width: 370px) {
  .field-nav { padding-left: 4px; padding-right: 4px; }
  .field-nav button { min-width: 49px; padding-left: 2px; padding-right: 2px; font-size: 9px; }
  .scanner-dock { gap: 5px; padding-left: 7px; padding-right: 7px; }
  .boost-button { min-width: 104px; padding-left: 6px; padding-right: 5px; }
  .boost-button > span:nth-child(2) { font-size: 10px; }
  .pulse-button { min-width: 49px; }
  .codex-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
