:root {
  color-scheme: dark;
  font-family: "Avenir Next", "PingFang SC", system-ui, sans-serif;
  color: #f3f5e8;
  background: #131e1c;
  --muted: #a7beb2;
  --line: #3c584e;
  --green: #ceee93;
  --panel: #1e302b;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible {
  outline: 2px solid #fff1ad;
  outline-offset: 3px;
}
.shell { max-width: 1090px; margin: 0 auto; padding: 22px 28px; }
.masthead, .brand, .footer, .hud { display: flex; align-items: center; }
.masthead { justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.masthead-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.masthead-actions .button { padding-inline: 9px; }
#settings-speech-status:empty { display: none; }
.settings #read-settings, .character-portrait .read-card { justify-self: start; }
.character-portrait .read-card { margin-top: 8px; }
.brand { gap: 10px; }
.brand h1 { font-size: clamp(1.05rem, 3vw, 1.45rem); margin: 0; letter-spacing: -.025em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  color: #18241e;
  background: var(--green);
  border-radius: 10px;
  font-size: 1.3rem;
}
.button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #253d35;
  color: inherit;
  font-weight: 650;
}
.button:hover { background: #345349; }
.primary { background: var(--green); color: #1a2a22; border-color: transparent; }
.primary:hover { background: #e2faaf; }
.secondary { white-space: nowrap; }
.coop-weapons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.coop-weapons[hidden], .online-fields[hidden] { display: none; }
.coop-weapons label, .online-fields { display: grid; gap: 7px; }
.coop-weapons label { flex: 1 1 145px; color: var(--muted); }
.coop-weapons select, .online-fields input {
  width: 100%; min-height: 42px; background: #253d35; color: inherit;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit;
}
.online-fields input { text-transform: uppercase; letter-spacing: .12em; }
#online-status:empty { display: none; }
.hud { gap: clamp(10px, 3.3vw, 42px); padding: 10px 15px; border: 1px solid var(--line); border-radius: 11px 11px 0 0; background: #1b2b27; }
.hud-stat { display: grid; gap: 2px; flex: 0 0 auto; }
.hud-stat > span, .hud-stat > label, .footer, .eyebrow { color: var(--muted); font-size: .875rem; }
.hud-stat strong { font-size: .98rem; font-variant-numeric: tabular-nums; }
.health strong { color: #ffb2a2; }
.run-coins strong { color: #ffd167; }
.survival-timer strong { color: #9bdbff; }
.survival-timer[hidden] { display: none; }
.xp { flex: 1; min-width: 28px; gap: 7px; }
progress { width: 100%; height: 8px; accent-color: var(--green); }
.field { position: relative; height: clamp(440px, 66svh, 650px); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 11px 11px; overflow: hidden; background: #20362e; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.opening-active .hud, .opening-active .battle-stage, .opening-active .footer,
.opening-active .tutorial-task, .opening-active .wave-notice { display: none; }
.opening-active .field { border: 1px solid #516584; border-radius: 11px; }
.opening-panel { position: absolute; inset: auto 0 0; display: flex; justify-content: space-between; align-items: end;
  gap: 12px; flex-wrap: wrap; padding: 32px clamp(14px, 4vw, 40px) clamp(12px, 4vw, 29px);
  background: linear-gradient(transparent, #080f20e8 38%, #080f20); color: #f1f6ff; }
.opening-panel[hidden] { display: none; }
.opening-copy { flex: 1 1 230px; }
.opening-copy h2 { margin: 0 0 6px; color: #a9d8ff; font-size: clamp(1rem, 2.3vw, 1.35rem); }
.opening-copy p { margin: 0; line-height: 1.45; font-weight: 600; }
.opening-panel .button { border-color: #6e91bd; background: #1a2c49; color: #f1f6ff; }
.wave-notice, .boss-status { position: absolute; left: 50%; transform: translateX(-50%); pointer-events: none; text-align: center; }
.tutorial-task { margin: 8px 0 12px; padding: 9px 12px; border-left: 3px solid var(--green); background: #294238; line-height: 1.45; }
.tutorial-guide { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; margin: 9px 0 19px; padding: 8px 10px;
  border: 1px solid #799b62; border-radius: 8px; background: #293f32; }
.tutorial-guide[hidden] { display: none; }
.tutorial-guide p { flex: 1 1 190px; margin: 0; color: #edf4d8; line-height: 1.4; }
.tutorial-guide .button { padding: 5px 9px; }
.tutorial-target { position: relative; outline: 2px solid #ffe396; outline-offset: 3px; }
.tutorial-target::after { content: ''; position: absolute; z-index: 1; top: -16px; left: calc(50% - 7px);
  border: 7px solid transparent; border-top: 10px solid #ffe396; pointer-events: none; }
.gear-card .tutorial-target::after { inset: 50% auto auto -17px; transform: translateY(-50%) rotate(-90deg); }
.wave-notice { top: 25px; max-width: calc(100% - 36px); width: max-content; padding: 7px 12px; background: #342723; color: #ffcb9b; border: 1px solid #aa7356; border-radius: 8px; font-weight: 750; }
.boss-status { bottom: 28px; display: grid; gap: 5px; width: min(300px, 75%); color: #ffcbaa; font-weight: 750; text-shadow: 0 1px 6px #151a19; }
.boss-status[hidden] { display: none; }
.boss-status progress { margin: 0; accent-color: #ff977f; }
.boss-health-heading { display: flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap; }
.boss-status.is-boss { width: min(480px, 88%); bottom: 22px; padding: 8px 13px 11px; gap: 7px;
  background: #321a1eee; color: #fff2de; border: 1px solid #e9a47d; border-radius: 9px;
  box-shadow: 0 0 15px #28151aab; font-size: clamp(.93rem, 2.3vw, 1.09rem); }
.boss-status.is-boss progress { appearance: none; height: 14px; border: 1px solid #bf735d; border-radius: 3px;
  background: #45252b; overflow: hidden; --boss-fill: linear-gradient(90deg, #bf433e, #ffc17d); }
.boss-status.is-boss progress::-webkit-progress-bar { background: #45252b; }
.boss-status.is-boss progress::-webkit-progress-value { background: var(--boss-fill); }
.boss-status.is-boss progress::-moz-progress-bar { background: var(--boss-fill); }
.boss-status.is-enraged { border-color: #ff8672; box-shadow: 0 0 14px #ff664b70; }
.boss-status.is-enraged progress { --boss-fill: linear-gradient(90deg, #fa554d, #ff9075); }
.boss-rage { color: #ffdbcb; background: #8b302d; border: 1px solid #ff9782; border-radius: 5px; padding: 1px 7px; font-size: .78em; }
.boss-move { color: #ffdfba; font-size: .78em; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto; background: #111f1bb5; }
.overlay[hidden] { display: none; }
.panel, dialog { width: min(100%, 480px); background: var(--panel); border: 1px solid #58766a; border-radius: 17px; box-shadow: 0 18px 45px #0b161377; }
.panel { padding: clamp(16px, 4vw, 28px); }
.elite-answer { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.elite-answer[hidden] { display: none; }
.elite-answer input { flex: 1 1 170px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #253d35; color: inherit; font: inherit; }
.elite-wheel { position: relative; width: 100%; display: grid; place-items: center; padding: 6px 0; }
.elite-wheel::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 1;
  border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 17px solid #fff0b8; }
.elite-wheel-disk { display: grid; place-items: center; width: 164px; height: 164px; border: 3px solid #ffdb91; border-radius: 50%;
  background: conic-gradient(from -60deg, #e7bd66 0 120deg, #8dd09b 120deg 240deg, #a5c0ee 240deg);
  color: #17231b; transition: transform .8s cubic-bezier(.12,.72,.19,1); }
.elite-wheel-disk span { grid-area: 1 / 1; font-weight: 750; font-size: .82rem;
  transform: rotate(calc(var(--sector) * 120deg)) translateY(-53px) rotate(calc(var(--sector) * -120deg)); }
@media (prefers-reduced-motion: reduce) { .elite-wheel-disk { transition: none; } }
.eyebrow { color: var(--green); font-weight: 750; margin: 0 0 8px; }
.panel h2 { margin: 0; font-size: clamp(1.55rem, 5vw, 2.8rem); line-height: 1.13; letter-spacing: -.037em; }
.panel h2:focus { outline: none; }
.panel p:not(.eyebrow), .settings p { line-height: 1.5; color: var(--muted); }
.panel p:empty { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.choice { text-align: start; flex: 1 1 115px; }
.read-question { flex-basis: 100%; }
.spoken-upgrade { flex: 1 1 118px; display: grid; grid-template-rows: 1fr auto; gap: 5px; min-width: 0; }
.spoken-upgrade .secondary { white-space: normal; }
#battle-speech-status:empty { display: none; }
.choice small { display: block; color: var(--muted); font-size: .875rem; font-weight: 450; margin-top: 3px; }
.choice[aria-invalid="true"] { border-color: #edab9c; color: #ffd4c9; }
#feedback { margin: 12px 0 0; color: #ffc5b6; }
.footer { justify-content: space-between; flex-wrap: wrap; gap: 5px 16px; margin-top: 10px; }
.footer strong { margin-inline-start: 4px; color: var(--green); }
.loadout { flex-basis: 100%; }
dialog { max-width: calc(100% - 32px); padding: 0; color: inherit; }
dialog::backdrop { background: #111c18c9; }
.settings { padding: clamp(18px, 4vw, 28px); display: grid; gap: 9px; }
.settings h2 { margin: 0 0 8px; }
.settings label { font-weight: 650; }
#test-password { width: 100%; min-height: 45px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #253d35; color: inherit; font: inherit; }
#test-password-status { margin: 0; color: #ffc5b6; }
#test-password-status:empty { display: none; }
.settings select {
  appearance: none;
  width: 100%;
  min-height: 45px;
  padding: 7px 38px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  background:
    linear-gradient(45deg, transparent 50%, #cee7d7 50%) right 18px center / 5px 5px no-repeat,
    linear-gradient(135deg, #cee7d7 50%, transparent 50%) right 13px center / 5px 5px no-repeat,
    #253d35;
  margin-bottom: 7px;
}
.settings p { margin: 0 0 9px; }
.settings .primary { justify-self: start; }
.setting-toggle { display: flex; align-items: center; gap: 8px; min-height: 35px; cursor: pointer; }
.setting-toggle input { accent-color: var(--green); margin: 0; width: 16px; height: 16px; }
@media (max-width: 560px) {
  .shell { padding: 11px 12px; }
  .masthead { margin-bottom: 10px; }
  .hud { gap: 8px; padding: 8px; flex-wrap: wrap; }
  .hud-stat > span, .hud-stat > label { font-size: .78rem; }
  .field { height: max(400px, 66svh); }
}

.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: stretch;
  min-height: 255px;
  isolation: isolate;
  overflow: hidden;
  background: #1b3028;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.hero-copy { padding: clamp(20px, 4vw, 36px); z-index: 1; }
.hero-copy h2 { font-size: clamp(2rem, 5vw, 3.6rem); letter-spacing: -.045em; margin: 0; line-height: 1.1; }
.hero-copy > p:not(.eyebrow) { color: var(--muted); line-height: 1.55; max-width: 34ch; }
.hero-copy .primary { min-width: 125px; margin-top: 4px; }
.hero-arena {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, #1b3028, #1b302800 23%),
    radial-gradient(ellipse at 48% 51%, #44745a, transparent 67%),
    repeating-linear-gradient(0deg, transparent 0 30px, #7bc19326 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 30px, #7bc19326 31px 32px);
}
.hero-orbit, .hero-bot, .hero-shot, .hero-bug { position: absolute; }
.hero-orbit { width: 47%; aspect-ratio: 1; left: 27%; top: 50%; transform: translateY(-50%); border: 1px solid #83c49855; border-radius: 50%; box-shadow: 0 0 0 26px #74af8f13, 0 0 0 54px #6b9d8212; }
.hero-bot { left: 38%; top: 44%; width: 55px; height: 45px; border: 3px solid #c2efd0; border-radius: 14px; background: #83bc9e; box-shadow: 0 10px 0 #192b2390; transform: rotate(-12deg); }
.hero-bot i { position: absolute; inset: 8px; border-radius: 5px; background: #23443b; }
.hero-bot i::before, .hero-bot i::after { content: ""; position: absolute; width: 4px; height: 6px; top: 7px; background: #e4ffa1; }
.hero-bot i::before { left: 7px; }
.hero-bot i::after { right: 7px; }
.hero-shot { width: 21px; height: 6px; background: #d5fcac; border-radius: 3px; box-shadow: 0 0 13px #ceee93; transform: rotate(-22deg); }
.hero-shot:nth-of-type(1) { left: 57%; top: 48%; }
.hero-shot:nth-of-type(2) { left: 66%; top: 41%; }
.hero-shot:nth-of-type(3) { left: 76%; top: 34%; }
.hero-bug { border-radius: 40% 52% 46% 40%; width: 24px; height: 18px; background: #c77e72; border: 2px solid #ffb299; transform: rotate(-19deg); box-shadow: 0 6px 0 #192b2390; }
.hero-bug:nth-of-type(4) { left: 81%; top: 26%; }
.hero-bug:nth-of-type(5) { left: 63%; top: 68%; }
.hero-bug:nth-of-type(6) { left: 77%; top: 72%; }

.hangar { margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; background: #1a2a25; padding: clamp(13px, 2.6vw, 24px); }
.hangar-bar, .hangar nav { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.hangar-bar { justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.wallet { padding: 5px 8px; color: #ffde9f; }
.section-button { border: 1px solid transparent; border-radius: 7px; color: var(--muted); background: transparent; padding: 7px 9px; min-height: 39px; font-weight: 650; }
.section-button:hover, .section-button[aria-pressed=true] { background: #284239; color: #e4f6dc; border-color: #456657; }
.home-hint { color: var(--muted); margin: 13px 0; line-height: 1.5; }
.hangar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 10px; }
.gear-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 13px; border: 1px solid #3c5b50; border-radius: 9px; background: #20332c; }
.gear-card h3, .gear-card p { margin: 0; }
.gear-card h3 { font-size: 1.06rem; }
.gear-card p { color: var(--muted); line-height: 1.42; }
.gear-card .button { align-self: start; margin-top: auto; font-size: .9rem; }
.gear-card .button:disabled { opacity: .55; cursor: default; }
.gear-rank { font-size: .85rem; color: #ffd79b; font-weight: 680; }
.gear-symbol { width: 33px; height: 26px; background: #2b4840; border: 1px solid #4a6e5b; border-radius: 6px; display: grid; place-items: center; color: var(--green); }
.gear-symbol[data-tier="1"] { background: #245154; color: #9ff9f3; }
.gear-symbol[data-tier="2"] { background: #533962; color: #f5c5ff; }
.gear-symbol[data-tier="3"] { background: #653c2b; color: #ffe1aa; }
.gear-card .button + .button { margin-top: 0; }
.gear-card .button[aria-pressed=true] { border-color: #88ad71; color: #e4f6dc; background: #354d37; }
.skill-control { min-width: 174px; }
.skill-control:disabled { color: var(--muted); background: #263830; border-color: var(--line); cursor: default; }
.rare-choice { border-color: #ffc076; background: #563831; color: #ffe5a9; }
.rare-choice:hover { background: #6e4539; }
.home-status { color: var(--green); margin: 10px 0 0; }
.home-status:empty { display: none; }
.settings #leave-game { justify-self: start; }

@media (max-width: 590px) {
  .home-hero { grid-template-columns: minmax(0, 1fr); }
  .hero-copy h2 { font-size: clamp(1.45rem, 6vw, 2rem); }
  .hero-arena { position: absolute; inset: 0 0 0 27%; opacity: .4; z-index: 0; }
  .hero-copy > p:not(.eyebrow) { max-width: 31ch; }
}

.shop-section { margin: 16px 0; }
.shop-section > h3, .character-sheet h3 { margin: 0 0 10px; font-size: 1.06rem; }
.check-in-grid { grid-template-columns: repeat(auto-fit, minmax(min(118px, 100%), 1fr)); }
.activity-hint { margin: 0 0 10px; color: var(--muted); line-height: 1.5; }
.activity-card h4 { margin: 0; font-size: 1rem; }
.activity-card p { font-variant-numeric: tabular-nums; }
.activity-card button[data-gear]:enabled { color: #1b2e21; background: var(--green); }
.character-sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.22fr);
  gap: 16px;
  align-items: start;
}
.character-portrait {
  border: 1px solid #416255;
  border-radius: 12px;
  background: #172921;
  padding: 14px;
}
.character-portrait canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 360 / 238;
  border: 1px solid #36564b;
  border-radius: 8px;
  background:
    radial-gradient(ellipse, #7dba7d35, transparent 68%),
    repeating-linear-gradient(0deg, transparent 0 28px, #81a58c1e 29px 30px),
    repeating-linear-gradient(90deg, transparent 0 28px, #81a58c1e 29px 30px), #203830;
}
.character-portrait p { margin: 10px 0 0; color: var(--muted); line-height: 1.5; }
.character-portrait .portrait-stats { color: var(--green); font-weight: 650; }
.slot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gear-slot[data-equipped="true"] { border-color: #87b87d; background: #294236; }
.gear-slot[data-equipped="true"] .gear-symbol { color: #f4ffdb; background: #466644; }
.gear-slot .button { min-height: 36px; padding: 4px 9px; }
.battle-stage { margin: 0 0 6px; font-size: .94rem; color: var(--muted); }
.starter-field {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
}
.starter-field select {
  min-height: 38px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #22392f;
  color: inherit;
  padding: 4px 8px;
}
.character-roster { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.character-roster .button[aria-pressed="true"] { border-color: #aadb9b; background: #37533d; }
.home[data-tab="character"] .home-hero { display: block; min-height: 0; }
.home[data-tab="character"] .hero-arena, .home[data-tab="character"] .hero-copy > p { display: none; }
.home[data-tab="character"] .hero-copy { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; }
.home[data-tab="character"] .hero-copy h2 { font-size: 1.4rem; }
.home[data-tab="character"] .hero-copy .primary { margin: 0; }
@media (max-width: 655px) {
  .character-sheet { grid-template-columns: minmax(0, 1fr); }
  .character-portrait canvas { max-height: 250px; object-fit: contain; }
}

.mission-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.mission-actions .button { margin: 0; }
.mission-actions .button:disabled { opacity: .62; cursor: default; }
#coop-mode[aria-pressed="true"] { background: #2a455c; border-color: #86ccff; color: #d5efff; }
.partner-health strong { color: #86ccff; }
.partner-health[hidden] { display: none; }
.loot-chest { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; align-items: start; padding: 18px;
  border: 1px solid #8c7950; border-radius: 14px; background: linear-gradient(135deg, #393327, #213128 76%); }
.chest-mark { display: grid; place-items: center; aspect-ratio: 1; border-radius: 12px; border: 1px solid #9b8051;
  background: #4c3f29; }
.chest-mark i { position: relative; width: 58px; height: 40px; border: 2px solid #ffdb87; border-radius: 13px 13px 7px 7px;
  background: linear-gradient(#72522b 0 40%, #e5ad52 40% 49%, #92623a 49%); }
.chest-mark i::after { content: ''; position: absolute; left: calc(50% - 6px); top: 12px; width: 12px; height: 15px;
  border: 2px solid #fff0ad; border-radius: 3px; background: #bf8b44; }
.chest-content h3 { margin: 0; color: #ffdc91; }
.chest-content p { margin: 6px 0; }
.chest-pity { color: #ffdf9c; font-weight: 650; }
.chest-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chest-actions .button { margin: 0; }
.chest-results { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 12px 0 0; padding: 0; }
.chest-results:empty { display: none; }
.chest-results li { padding: 5px 8px; border: 1px solid currentColor; border-radius: 8px; color: var(--rarity); background: #192a24; }
[data-rarity="0"] { --rarity: #c5d2c9; }
[data-rarity="1"] { --rarity: #9edf91; }
[data-rarity="2"] { --rarity: #87cdff; }
[data-rarity="3"] { --rarity: #ddacff; }
[data-rarity="4"] { --rarity: #ffcb77; }
[data-rarity="5"] { --rarity: #ff9dbb; }
.gear-card[data-rarity] { border-color: var(--rarity); }
.gear-card[data-rarity] .gear-symbol { color: var(--rarity); }
.gear-slot select { grid-column: 1 / -1; width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; background: #253d35; color: inherit; font: inherit; }
.fusion-hint { color: var(--muted); margin: 0 0 12px; }
.fusion-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 12px; }
.fusion-actions .button { margin: 0; }
.fusion-actions .button:disabled { opacity: .55; cursor: default; }
.fusion-actions p { margin: 0; color: #d5eca2; }
.gear-catalog { margin: 14px 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: #20332b; }
.gear-catalog > summary, .gear-effects > summary { cursor: pointer; color: #d5eca2; font-weight: 650; }
.gear-catalog .gear-card .read-card { margin-top: 0; }
.gear-catalog select { margin: 12px 0; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #253d35; color: inherit; font: inherit; }
.gear-effects { grid-column: 1 / -1; margin-top: 4px; }
.gear-effects dl { display: grid; grid-template-columns: minmax(52px, auto) 1fr; gap: 6px 10px; margin: 8px 0 0;
  padding-top: 8px; border-top: 1px solid var(--line); font-size: .86rem; }
.gear-effects dt { color: var(--rarity); font-weight: 650; }
.gear-effects dt[aria-current] { text-decoration: underline; }
.gear-effects dd { margin: 0; color: #d3e0d6; }
@media (max-width: 510px) {
  .loot-chest { grid-template-columns: 1fr; gap: 10px; }
  .chest-mark { display: none; }
}
.mission-board { padding: 14px 16px; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: #182a23; }
.mission-header { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.energy-meter { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.energy-meter strong { color: #daef9d; }
.energy-meter span { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.stage-picker { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 8px; flex-basis: 100%; }
.stage-picker .button { padding: 0; width: 44px; height: 44px; font-size: 1.8rem; line-height: 1; }
.stage-picker .button:disabled { opacity: .35; cursor: default; }
.stage-current { text-align: center; }
.stage-access { color: var(--muted); font-size: .85rem; }
#mission-status { color: #d5eca2; margin: 8px 0 0; }
#mission-status:empty { display: none; }
.home[data-stage="power"] .hero-arena { filter: hue-rotate(-45deg); }
.home[data-stage="treatment"] .hero-arena { filter: hue-rotate(115deg); }
.home[data-stage="siege"] .hero-arena { filter: hue-rotate(68deg); }
.home[data-stage="orchard"] .hero-arena { filter: hue-rotate(-36deg) saturate(1.35); }
.home[data-stage="foundry"] .hero-arena { filter: hue-rotate(-88deg); }

#toggle-test-mode[aria-pressed=true] { background: #51472a; border-color: #c0a060; color: #fff2c4; }
.test-panel { border: 1px solid #826c46; border-radius: 12px; padding: 12px 16px; background: #30291f; margin-top: 12px; }
.test-panel p { color: #f3d9a6; margin: 0 0 9px; }
.test-panel .test-weapons-preview { margin: 9px 0 0; line-height: 1.4; }
.test-weapon-pair { margin-top: 9px; }
.test-weapon-pair[hidden] { display: none; }
.test-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.test-controls label { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.test-controls label[hidden] { display: none; }
.test-controls select {
  min-height: 38px;
  color: inherit;
  background: #322e24;
  border: 1px solid #826c46;
  border-radius: 7px;
  padding: 4px 8px;
}
.test-density input { width: min(140px, 45vw); accent-color: #efd694; }
.test-density output { min-width: 3.4em; color: #ffdf9b; font-variant-numeric: tabular-nums; }
.social-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-block: 8px; }
.social-form[hidden] { display: none; }
.social-form input { flex: 1 1 105px; min-width: 0; }
.social-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; max-height: min(43vh, 340px); overflow: auto; }
.social-results li { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; padding: 7px 9px; border-bottom: 1px solid var(--line); }
.social-results li span { overflow-wrap: anywhere; }
.secret-frame { border: 3px solid #c1a5ff; border-radius: 12px; box-shadow: inset 0 0 0 2px #f5d48b, 0 0 8px #b490ef88; }
#profile-frame { width: 39px; height: 39px; vertical-align: middle; margin-right: 7px; background: #2d2142; }
.achievement-toast { position: fixed; z-index: 5; top: 18px; right: max(16px, env(safe-area-inset-right));
  max-width: min(390px, calc(100vw - 32px)); display: grid; gap: 4px; padding: 13px 17px;
  color: #fff0d3; background: #31203ff5; border: 1px solid #d1aaff; border-left: 4px solid #f4c77b;
  border-radius: 12px; box-shadow: 0 8px 24px #100c18a8; pointer-events: none; }
.achievement-toast[hidden] { display: none; }
.achievement-toast strong { color: #ffe4ae; font-size: 1rem; }
.achievement-toast span { font-size: .9rem; }
.friend-identity { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.social-avatar { --avatar-size: 46px; width: var(--avatar-size); height: var(--avatar-size); flex: 0 0 var(--avatar-size);
  display: inline-grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); position: relative; box-sizing: border-box;
  border-radius: 50%; background: #36554f; padding: 2px; vertical-align: middle; }
.social-avatar canvas { display: block; width: 100%; height: 100%; border-radius: 50%; background: #203a37; }
.social-avatar.has-frame { isolation: isolate; padding: 6px; border-radius: 32%;
  background: conic-gradient(#fff1bb, #d19aff 12%, #56258b 23%, #ffca70 36%, #fff1bb 50%, #d19aff 62%, #56258b 73%, #ffca70 86%, #fff1bb);
  box-shadow: 0 0 0 1px #332046, 0 0 0 2px #dfad64, 0 0 12px #b185ff8c; }
.social-avatar.has-frame canvas { box-shadow: 0 0 0 1px #ffe6a8; border-radius: 27%;
  background: radial-gradient(circle at 48% 34%, #62508d, #241b43 74%); }
.social-avatar.has-frame::before, .social-avatar.has-frame::after { content: ''; position: absolute;
  left: 50%; width: 10px; height: 10px; z-index: 1; transform: translateX(-50%) rotate(45deg);
  background: linear-gradient(135deg, #fff7db 5%, #f4c56c 48%, #a959b8 50%, #623582 96%);
  border: 1px solid #4b225e; box-shadow: 0 0 6px #efaaff; pointer-events: none; }
.social-avatar.has-frame::before { top: -4px; }
.social-avatar.has-frame::after { bottom: -4px; }
#social-self-avatar .social-avatar { --avatar-size: 54px; }
.profile-frame-status { display: block; color: #f2cf9b; font-size: .83rem; margin-top: 3px; }
.profile-frame-status[hidden] { display: none; }
.danger-button { background: #723a3e; border-color: #d77d76; color: #fff3ef; }
.chat-messages { list-style: none; padding: 9px; margin: 7px 0; background: #132520; border-radius: 8px;
  min-height: 120px; max-height: 38vh; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.chat-messages li { align-self: start; display: flex; align-items: flex-start; min-width: 0; max-width: 95%; gap: 8px; }
.chat-messages li.chat-own { align-self: end; flex-direction: row-reverse; }
.chat-bubble { background: #29473b; padding: 6px 9px; min-width: 0; border-radius: 9px; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-own .chat-bubble { background: #465e38; }
.chat-messages time { display: block; margin-top: 3px; color: #d7e4ce; font-size: .75rem; }
#chat-body { flex: 1 1 160px; min-width: 0; padding: 8px; background: #233b31; border: 1px solid var(--line);
  border-radius: 8px; color: inherit; font: inherit; resize: vertical; }
