:root {
  color-scheme: dark;
  --void: #050712;
  --night: #080c1b;
  --panel: rgba(10, 16, 34, .92);
  --panel-strong: #0d142b;
  --line: rgba(111, 242, 255, .19);
  --line-violet: rgba(184, 101, 255, .27);
  --cyan: #6ff2ff;
  --cyan-soft: #a6f8ff;
  --violet: #b865ff;
  --violet-soft: #dab1ff;
  --gold: #f0c56a;
  --ink: #edf8ff;
  --muted: #91a5bb;
  --dim: #8196b2;
  --good: #75f2bc;
  --bad: #ff7d8f;
  --sans: Inter, "Segoe UI", system-ui, sans-serif;
  --display: "Arial Narrow", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--void); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 77% 4%, rgba(78, 64, 200, .21), transparent 30rem),
    radial-gradient(circle at 15% 42%, rgba(0, 211, 232, .09), transparent 34rem),
    linear-gradient(145deg, #050712, #080719 48%, #040814);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(111, 242, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 242, 255, .025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}
button, a { font: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible, [role="radio"]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.idle-shell { position: relative; width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 18px 0 26px; }
.top-rail { min-height: 62px; display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark { position: relative; width: 33px; height: 40px; border: 1px solid var(--cyan); clip-path: polygon(50% 0,100% 24%,86% 80%,50% 100%,14% 80%,0 24%); background: radial-gradient(circle at 50% 52%, rgba(184,101,255,.5), transparent 37%), #08152b; box-shadow: 0 0 26px rgba(111,242,255,.28); }
.brand-mark::before, .brand-mark::after, .brand-mark i { content: ""; position: absolute; left: 50%; transform: translateX(-50%); background: var(--cyan); }
.brand-mark::before { top: 8px; width: 2px; height: 22px; box-shadow: -7px 4px 0 -0.5px var(--violet), 7px 4px 0 -0.5px var(--violet); }
.brand-mark::after { bottom: 7px; width: 17px; height: 1px; }
.brand b { display: block; font: 800 17px/1 var(--display); letter-spacing: .24em; }
.brand small { display: block; margin-top: 5px; color: var(--cyan); font-size: 9px; font-weight: 800; letter-spacing: .23em; }
.world-state { display: flex; align-items: center; gap: 8px; margin-left: auto; border: 0; padding: 5px 7px; color: var(--muted); background: transparent; font-size: 12px; cursor: pointer; }
.world-state:hover { color: var(--ink); background: rgba(111,242,255,.045); }
.sync-age { color: var(--dim); font-size: 9px; }
.retry-copy { padding: 4px 7px; border: 1px solid rgba(111,242,255,.22); color: var(--cyan-soft); font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.signal { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 13px currentColor; }
.world-state.online .signal { color: var(--good); background: var(--good); }
.world-state.error .signal { color: var(--bad); background: var(--bad); }
.back-link { border: 1px solid var(--line); padding: 8px 13px; color: var(--cyan-soft); text-decoration: none; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

main { padding-top: 24px; }
.hero-panel { position: relative; display: grid; grid-template-columns: 190px 1fr auto; align-items: center; min-height: 220px; padding: 26px 30px; overflow: hidden; border: 1px solid var(--line-violet); background: linear-gradient(100deg, rgba(14,20,44,.97), rgba(20,12,43,.92)); box-shadow: 0 26px 80px rgba(0,0,0,.42); }
.hero-panel::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, transparent 0 69%, rgba(111,242,255,.035) 70% 70.5%, transparent 71%); background-size: 88px 100%; }
.reactor { position: relative; width: 145px; aspect-ratio: 1; place-self: center; }
.reactor::before { content: ""; position: absolute; inset: 10%; border-radius: 50%; background: repeating-conic-gradient(from 22deg, rgba(111,242,255,.6) 0 2deg, transparent 2deg 13deg); mask-image: radial-gradient(circle, transparent 0 53%, black 55% 58%, transparent 60%); animation: orbit 22s linear infinite; }
.reactor-ring { position: absolute; inset: 18%; border: 1px solid var(--cyan); border-radius: 50%; box-shadow: inset 0 0 28px rgba(111,242,255,.18), 0 0 20px rgba(111,242,255,.12); }
.ring-a { animation: breathe 3.8s ease-in-out infinite; }
.ring-b { inset: 30%; border-color: var(--violet); border-style: dashed; animation: orbit 8s linear reverse infinite; }
.reactor-core { position: absolute; inset: 41%; transform: rotate(45deg); background: linear-gradient(145deg, var(--cyan), var(--violet)); box-shadow: 0 0 35px var(--violet); }
.reactor-scan { position: absolute; top: 49%; left: -5%; width: 110%; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan), transparent); box-shadow: 0 0 12px var(--cyan); animation: scan 3.2s ease-in-out infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.08); opacity: .66; } }
@keyframes scan { 0%,100% { transform: translateY(-45px); opacity: .25; } 50% { transform: translateY(45px); opacity: 1; } }
.eyebrow { margin: 0 0 7px; color: var(--cyan); font-size: 9px; font-weight: 900; letter-spacing: .22em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; font-family: var(--display); }
h1 { max-width: 670px; font-size: clamp(27px, 4.3vw, 49px); line-height: .98; letter-spacing: .035em; text-transform: uppercase; }
.active-meta { min-height: 20px; margin: 10px 0 20px; color: var(--muted); font-size: 13px; }
.progress-track, .mastery-track { position: relative; overflow: hidden; background: rgba(255,255,255,.055); }
.progress-track { max-width: 650px; height: 9px; border: 1px solid rgba(111,242,255,.14); }
.progress-track > i, .mastery-track > i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width .45s ease; box-shadow: 0 0 15px rgba(111,242,255,.54); }
.progress-pulse { position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); animation: pulse 2.7s ease-in-out infinite; }
@keyframes pulse { 60%,100% { transform: translateX(100%); } }
.progress-data { max-width: 650px; display: flex; justify-content: space-between; margin-top: 7px; color: var(--dim); font: 700 10px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.compact-actions { display: none; }

.account-strip { display: grid; grid-template-columns: 1.1fr 1fr .45fr 2fr; gap: 1px; margin: 12px 0; border: 1px solid var(--line); background: var(--line); }
.account-strip > div { min-height: 73px; padding: 14px 16px; background: rgba(8,13,29,.96); }
.data-label { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--dim); font-size: 9px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.data-label b { color: var(--muted); font-weight: 700; letter-spacing: .03em; }
.account-strip strong { font-size: 14px; }
.level-cell strong { color: var(--gold); font-size: 25px; line-height: .75; }
.mastery-track { height: 5px; margin-top: 12px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, .8fr); gap: 12px; }
.panel { border: 1px solid var(--line); background: linear-gradient(155deg, rgba(10,16,34,.96), rgba(8,11,25,.96)); padding: 22px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2 { font-size: 22px; letter-spacing: .03em; text-transform: uppercase; }
.server-seal, .inventory-count { color: var(--good); border: 1px solid rgba(117,242,188,.28); padding: 6px 9px; font-size: 9px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.activity-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.activity-card { position: relative; min-height: 138px; padding: 17px 16px 14px 20px; cursor: pointer; overflow: hidden; border: 1px solid rgba(111,242,255,.13); background: rgba(255,255,255,.018); color: inherit; text-align: left; }
.activity-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--activity-color, var(--cyan)); opacity: .35; }
.activity-card::after { content: ""; position: absolute; right: -35px; top: -35px; width: 90px; height: 90px; border: 1px solid color-mix(in srgb, var(--activity-color, var(--cyan)) 35%, transparent); transform: rotate(45deg); }
.activity-card:hover { border-color: rgba(111,242,255,.42); background: rgba(111,242,255,.04); }
.activity-card[aria-checked="true"] { border-color: var(--activity-color, var(--cyan)); background: linear-gradient(135deg, rgba(184,101,255,.10), rgba(111,242,255,.055)); box-shadow: inset 0 0 35px rgba(111,242,255,.035); }
.activity-code { color: var(--activity-color, var(--cyan)); font: 900 9px/1 var(--sans); letter-spacing: .18em; }
.activity-card h3 { margin-top: 10px; font-size: 16px; text-transform: uppercase; }
.activity-card p { min-height: 31px; margin: 7px 0 11px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.activity-facts { display: flex; gap: 12px; color: var(--dim); font-size: 9px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.operation-controls { display: flex; gap: 8px; margin-top: 16px; }
.action { min-height: 42px; border: 1px solid var(--line); padding: 10px 15px; cursor: pointer; color: var(--ink); background: rgba(255,255,255,.035); text-decoration: none; font-weight: 850; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.action:hover:not(:disabled) { filter: brightness(1.16); }
.action:disabled { cursor: not-allowed; opacity: .58; color: rgba(224,232,255,.64); border-color: rgba(153,174,215,.22); }
.activity-offline { grid-column: 1 / -1; display: grid; gap: 5px; max-width: 580px; margin: 0; padding: 13px 15px; border: 1px dashed rgba(111,242,255,.18); color: var(--muted); background: rgba(111,242,255,.025); font-size: 11px; line-height: 1.45; }
.activity-offline strong { color: var(--cyan-soft); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.action.primary { border-color: var(--cyan); background: linear-gradient(110deg, rgba(111,242,255,.2), rgba(184,101,255,.18)); color: var(--cyan-soft); }
.action.claim { margin-left: auto; border-color: rgba(240,197,106,.55); color: var(--gold); }
.feedback { min-height: 18px; margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.feedback.error { color: var(--bad); }
.feedback.good { color: var(--good); }

.compact-heading { margin-bottom: 10px; }
.metric-list { margin: 0; }
.metric-list div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid rgba(111,242,255,.1); }
.metric-list dt { color: var(--muted); font-size: 11px; }
.metric-list dd { margin: 0; color: var(--cyan-soft); font: 800 13px/1 var(--sans); text-align: right; }
.account-bound { margin: 13px 0 0; padding: 11px; border-left: 2px solid var(--gold); color: var(--gold); background: rgba(240,197,106,.045); font-size: 10px; font-weight: 800; line-height: 1.4; text-transform: uppercase; }
.forge-panel { grid-column: 1 / -1; border-color: rgba(240,197,106,.27); background: linear-gradient(125deg, rgba(18,14,34,.98), rgba(8,18,34,.96)); }
.forge-layout { display: grid; grid-template-columns: 150px minmax(0,1fr) minmax(210px,.55fr); gap: 22px; align-items: center; }
.forge-tool { position: relative; width: 118px; aspect-ratio: 1; place-self: center; transform: rotate(-16deg); }
.forge-tool::before { content: ""; position: absolute; left: 11%; top: 44%; width: 77%; height: 19%; clip-path: polygon(0 38%, 68% 0, 100% 50%, 68% 100%, 0 62%); border: 1px solid var(--gold); background: linear-gradient(90deg, #18203b, #3d2b58 58%, #0c8197); box-shadow: 0 0 26px rgba(111,242,255,.2); }
.forge-tool::after { content: ""; position: absolute; right: 2%; top: 36%; width: 31%; aspect-ratio: 1; clip-path: polygon(50% 0, 61% 34%, 100% 50%, 61% 66%, 50% 100%, 39% 66%, 0 50%, 39% 34%); background: conic-gradient(from 45deg, var(--cyan), #26314e, var(--violet), #26314e, var(--cyan)); box-shadow: 0 0 25px rgba(111,242,255,.42); animation: orbit 8s linear infinite; }
.forge-tool-core { position: absolute; z-index: 1; left: 26%; top: 42%; width: 30%; height: 22%; border: 1px solid rgba(111,242,255,.6); background: repeating-linear-gradient(90deg, rgba(111,242,255,.8) 0 2px, transparent 2px 8px), #11182c; }
.forge-tool-ring { position: absolute; z-index: 2; right: 14%; top: 43%; width: 18%; aspect-ratio: 1; border: 2px solid var(--gold); border-radius: 50%; box-shadow: 0 0 14px rgba(240,197,106,.45); }
.forge-recipe { min-width: 0; }
.forge-code, .forge-slot { margin: 0; color: var(--gold); font-size: 9px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.forge-recipe h3 { margin-top: 7px; font-size: 20px; text-transform: uppercase; }
.forge-recipe > p:not(.forge-code):not(.forge-bound) { margin: 8px 0 14px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.forge-costs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; margin: 0; padding: 0; list-style: none; }
.forge-costs li { min-height: 57px; padding: 10px; border: 1px solid rgba(111,242,255,.12); background: rgba(255,255,255,.02); }
.forge-costs li.ready { border-color: rgba(117,242,188,.42); background: rgba(117,242,188,.04); }
.forge-costs li.missing { border-color: rgba(255,125,143,.32); }
.forge-costs b, .forge-costs span { display: block; }
.forge-costs b { color: var(--ink); font-size: 10px; }
.forge-costs span { margin-top: 7px; color: var(--dim); font-size: 9px; }
.forge-bound { margin: 12px 0 0; color: var(--good); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.forge-actions { display: grid; gap: 8px; padding: 16px; border-left: 1px solid rgba(240,197,106,.2); }
.forge-actions strong { min-height: 31px; color: var(--cyan-soft); font-size: 12px; line-height: 1.35; }
.action-reason { min-height: 28px; margin: -3px 2px 2px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.forge-actions .feedback { margin-top: 3px; }
.inventory { grid-column: 1 / -1; }
.inventory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.item-card { position: relative; min-height: 86px; padding: 13px 12px 10px 53px; border: 1px solid rgba(184,101,255,.16); background: rgba(255,255,255,.02); }
.item-specimen { position: absolute; top: 17px; left: 15px; width: 25px; height: 25px; transform: rotate(45deg); border: 1px solid var(--item-color, var(--violet)); background: radial-gradient(circle, color-mix(in srgb, var(--item-color, var(--violet)) 80%, white) 0 10%, var(--item-color, var(--violet)) 12% 26%, rgba(0,0,0,.3) 28% 100%); box-shadow: 0 0 17px color-mix(in srgb, var(--item-color, var(--violet)) 45%, transparent); }
.item-card b { display: block; font-size: 11px; line-height: 1.25; }
.item-card strong { display: block; margin-top: 7px; color: var(--gold); font-size: 18px; }
.item-card small { color: var(--dim); font-size: 8px; text-transform: uppercase; letter-spacing: .1em; }
.empty-state { grid-column: 1 / -1; margin: 0; color: var(--dim); font-size: 12px; }
.offline { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.offline > .panel-heading { grid-column: 1 / -1; }
.offline time { color: var(--cyan); font: 800 11px/1 var(--sans); letter-spacing: .1em; }
.offline-report { position: relative; min-height: 118px; padding: 15px 16px 15px 27px; border: 1px solid rgba(111,242,255,.11); }
.report-line { position: absolute; left: 11px; top: 13px; bottom: 13px; width: 2px; background: linear-gradient(var(--cyan), var(--violet)); box-shadow: 0 0 10px var(--cyan); }
.offline-report p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.offline-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 13px; }
.offline-stats b { display: block; color: var(--cyan-soft); font-size: 16px; }
.offline-stats small { color: var(--dim); font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
.loot-journal { min-height: 118px; border-top: 1px solid var(--line-violet); padding-top: 10px; }
.loot-journal h3 { color: var(--violet-soft); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.loot-journal ol { max-height: 124px; margin: 10px 0 0; padding: 0; list-style: none; overflow: auto; }
.loot-journal li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid rgba(184,101,255,.11); color: var(--muted); font-size: 10px; }
.loot-journal li b { color: var(--gold); }
footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 16px; color: var(--dim); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

.auth-gate { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(2,4,12,.86); backdrop-filter: blur(14px); }
.auth-gate[hidden] { display: none; }
.auth-card { width: min(450px, 100%); border: 1px solid var(--line-violet); padding: 34px; text-align: center; background: #0a0e20; box-shadow: 0 30px 100px #000; }
.auth-emblem { display: block; width: 48px; height: 48px; margin: 0 auto 18px; transform: rotate(45deg); border: 1px solid var(--cyan); background: radial-gradient(circle, var(--violet), transparent 54%); box-shadow: 0 0 27px rgba(111,242,255,.25); }
.auth-card h2 { font-size: 26px; text-transform: uppercase; }
.auth-card p:not(.eyebrow) { margin: 12px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.auth-card .action { display: inline-flex; align-items: center; }
.text-link { display: block; margin-top: 17px; color: var(--muted); font-size: 11px; }

@media (max-width: 760px) {
  .idle-shell { width: min(100% - 20px, 1180px); }
  .hero-panel { grid-template-columns: 105px 1fr; min-height: 180px; padding: 20px; }
  .reactor { width: 90px; }
  .account-strip { grid-template-columns: 1fr 1fr; }
  .mastery-cell { grid-column: 1 / -1; }
  .content-grid { grid-template-columns: 1fr; }
  .forge-panel { grid-column: auto; }
  .forge-layout { grid-template-columns: 105px 1fr; }
  .forge-actions { grid-column: 1 / -1; border-left: 0; border-top: 1px solid rgba(240,197,106,.2); }
  .activity-grid, .inventory-grid { grid-template-columns: 1fr 1fr; }
  .inventory, .offline { grid-column: auto; }
  .offline { grid-template-columns: 1fr; }
  .offline > .panel-heading { grid-column: auto; }
  .loot-journal { margin-top: 18px; }
}

@media (max-width: 480px) {
  .back-link { display: none; }
  .hero-panel { grid-template-columns: 1fr; }
  .reactor { display: none; }
  .activity-grid, .inventory-grid { grid-template-columns: 1fr; }
  .forge-layout { grid-template-columns: 1fr; }
  .forge-tool { display: none; }
  .forge-costs { grid-template-columns: 1fr; }
  .forge-actions { grid-column: auto; }
  .operation-controls { flex-wrap: wrap; }
  .action.claim { margin-left: 0; }
  .panel { padding: 17px; }
  footer { flex-direction: column; }
}

html.compact, html.compact body { width: 420px; min-width: 320px; max-width: 100vw; height: 100%; min-height: 230px; overflow: hidden; background: #070a17; }
html.compact body::before { background-size: 24px 24px; }
html.compact .idle-shell { width: 100%; height: 100dvh; min-height: 230px; padding: 0; }
html.compact .top-rail { min-height: 44px; padding: 0 10px; gap: 10px; background: #070b18; }
html.compact .brand-mark { width: 21px; height: 25px; }
html.compact .brand-mark::before { top: 5px; height: 14px; }
html.compact .brand-mark::after { bottom: 4px; width: 11px; }
html.compact .brand b { font-size: 11px; }
html.compact .brand small { display: none; }
html.compact .world-state { font-size: 11px; }
html.compact .sync-age { display: none; }
html.compact .retry-copy { display: none; }
html.compact .lilith-home-dock { display: none !important; }

@media (min-width: 681px) {
  body:not(.compact) .lilith-home-dock { left: auto; right: 18px; padding: 5px; border-radius: 50%; }
  body:not(.compact) .lilith-home-dock b { display: none; }
}

@media (max-width: 1280px) {
  body:not(.compact) .lilith-home-dock {
    position: static;
    width: max-content;
    margin: 16px auto calc(16px + env(safe-area-inset-bottom));
    border-radius: 16px;
  }
  body:not(.compact) .lilith-home-dock b { display: inline; }
}
html.compact .back-link { display: none; }
html.compact main { padding: 0; }
html.compact .hero-panel { grid-template-columns: 58px minmax(0, 1fr) 84px; min-height: 186px; height: calc(100dvh - 44px); padding: 13px 10px; border-width: 0 0 1px; }
html.compact .reactor { display: block; width: 50px; }
html.compact .active-copy { min-width: 0; }
html.compact .eyebrow { margin-bottom: 5px; font-size: 11px; }
html.compact h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
html.compact .active-meta { min-height: 17px; margin: 8px 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
html.compact .progress-track { height: 6px; }
html.compact .progress-data { margin-top: 7px; font-size: 11px; }
html.compact .compact-actions { display: grid; align-content: center; gap: 7px; margin-left: 8px; }
html.compact .compact-actions .action { min-height: 38px; padding: 8px 6px; font-size: 11px; }
html.compact .expand-link { color: var(--cyan); text-align: center; font-size: 11px; font-weight: 800; text-transform: uppercase; }
html.compact .account-strip, html.compact .content-grid, html.compact footer { display: none; }
html.compact .auth-gate { position: absolute; padding: 8px; }
html.compact .auth-card { padding: 13px; }
html.compact .auth-emblem, html.compact .auth-card .eyebrow, html.compact .auth-card p, html.compact .text-link { display: none; }
html.compact .auth-card h2 { margin-bottom: 12px; font-size: 16px; }
html.compact .auth-card .action { min-height: 40px; font-size: 11px; }

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

/* Playable surface: the city is the primary experience. The legacy dashboard is a drawer. */
html, body { width: 100%; height: 100%; overflow: hidden; }
body { min-height: 100%; background: #02040c; }
body::before { display: none; }
.idle-shell { width: 100%; height: 100dvh; margin: 0; padding: 0; overflow: hidden; }

.top-rail {
  position: fixed;
  z-index: 40;
  top: 14px;
  right: 18px;
  left: 18px;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid rgba(111,242,255,.22);
  background: rgba(3,7,18,.93);
  box-shadow: 0 12px 36px rgba(0,0,0,.44);
}
.top-rail .brand-mark { width: 27px; height: 32px; }
.top-rail .brand b { font-size: 14px; }
.top-rail .brand small { font-size: 8px; }

.playfield-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 620px;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(1,5,15,.18), rgba(1,3,12,.07) 45%, rgba(1,3,10,.65)),
    url("/assets/belzelith-city-map-20260725.webp") center / cover no-repeat;
}
#idleGameCanvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}
#idleGameCanvas:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -4px;
}
.playfield-grade {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(2,6,17,.58), transparent 28%, transparent 72%, rgba(2,4,15,.56)),
    linear-gradient(180deg, rgba(2,4,14,.42), transparent 22%, transparent 72%, rgba(2,4,12,.74)),
    repeating-linear-gradient(180deg, rgba(111,242,255,.018) 0 1px, transparent 1px 5px);
  box-shadow: inset 0 0 110px rgba(0,0,0,.6);
}

.game-hud, .game-objective, .game-prompt, .game-hotbar, .game-actions, .game-controls, .game-authority, .touch-controls {
  position: absolute;
  z-index: 5;
}
.game-hud {
  top: 86px;
  padding: 13px 15px;
  border: 1px solid rgba(111,242,255,.22);
  background: rgba(3,8,21,.9);
  box-shadow: 0 16px 38px rgba(0,0,0,.36);
}
.game-hud-left { left: 18px; width: min(430px, calc(100vw - 36px)); }
.game-hud-right { right: 18px; display: grid; grid-template-columns: repeat(3, auto); gap: 1px; padding: 0; }
.game-hud-right > div { min-width: 94px; padding: 11px 13px; border-left: 1px solid rgba(111,242,255,.14); }
.game-hud-right > div:first-child { border-left: 0; }
.game-hud-right span, .game-objective span {
  display: block;
  margin-bottom: 5px;
  color: var(--dim);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .16em;
}
.game-hud-right b { color: var(--cyan-soft); font-size: 12px; }
.game-kicker { margin: 0 0 6px; color: var(--cyan); font-size: 8px; font-weight: 900; letter-spacing: .18em; }
.game-hud h1 { max-width: none; font-size: clamp(22px, 3vw, 37px); }
.game-hud p:not(.game-kicker) { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.game-progress { height: 4px; margin-top: 11px; overflow: hidden; background: rgba(255,255,255,.08); }
.game-progress i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); box-shadow: 0 0 12px var(--cyan); transition: width .25s linear; }

.game-objective {
  top: 183px;
  left: 18px;
  max-width: min(390px, calc(100vw - 36px));
  padding: 9px 12px;
  border-left: 3px solid var(--gold);
  color: var(--ink);
  background: rgba(5,8,20,.88);
}
.game-objective span { display: inline; margin-right: 8px; color: var(--gold); }
.game-objective b { font-size: 10px; letter-spacing: .07em; }

.game-prompt {
  left: 50%;
  bottom: 174px;
  display: flex;
  align-items: center;
  gap: 9px;
  transform: translateX(-50%);
  padding: 8px 11px;
  border: 1px solid rgba(111,242,255,.42);
  background: rgba(2,7,18,.95);
  color: var(--cyan-soft);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 0 32px rgba(111,242,255,.12);
}
.game-prompt[hidden] { display: none; }
.game-prompt kbd, .game-controls kbd {
  min-width: 25px;
  padding: 4px 6px;
  border: 1px solid rgba(111,242,255,.32);
  color: #06101d;
  background: var(--cyan-soft);
  text-align: center;
  font: 900 9px/1 var(--sans);
}

.game-hotbar {
  bottom: 28px;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(4, minmax(76px, 96px));
  gap: 7px;
  transform: translateX(-50%);
  padding: 8px;
  border: 1px solid rgba(111,242,255,.2);
  background: rgba(2,6,17,.94);
}
.game-hotbar button {
  position: relative;
  min-height: 66px;
  border: 1px solid rgba(111,242,255,.14);
  color: var(--muted);
  background: rgba(255,255,255,.025);
  cursor: pointer;
}
.game-hotbar button:hover, .game-hotbar button[aria-pressed="true"] { color: var(--ink); border-color: var(--cyan); background: rgba(111,242,255,.085); }
.game-hotbar button[aria-pressed="true"] { box-shadow: inset 0 -3px var(--cyan), 0 0 20px rgba(111,242,255,.12); }
.game-hotbar button:focus-visible, .game-actions button:focus-visible, .touch-controls button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.game-hotbar span { display: block; margin-top: 5px; font-size: 9px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.game-hotbar small { position: absolute; top: 5px; right: 7px; color: var(--dim); font-size: 8px; }
.hotbar-glyph { position: relative; display: block; width: 27px; height: 27px; margin: 4px auto 0; border: 1px solid currentColor; transform: rotate(45deg); }
.hotbar-glyph::before, .hotbar-glyph::after { content: ""; position: absolute; background: currentColor; }
.hotbar-glyph.mine::before { inset: 6px 11px; transform: rotate(-45deg); }
.hotbar-glyph.mine::after { width: 15px; height: 2px; left: 5px; top: 12px; transform: rotate(-45deg); }
.hotbar-glyph.grove { border-radius: 50% 8% 50% 50%; }
.hotbar-glyph.grove::before { width: 2px; height: 16px; left: 12px; top: 5px; transform: rotate(-45deg); }
.hotbar-glyph.forge::before { width: 17px; height: 7px; left: 4px; top: 9px; transform: rotate(-45deg); }
.hotbar-glyph.forge::after { width: 8px; height: 13px; left: 9px; top: 6px; transform: rotate(45deg); }
.hotbar-glyph.gate { border-radius: 50%; box-shadow: inset 0 0 0 5px rgba(184,101,255,.24); }
.hotbar-glyph.gate::before { inset: 8px; border-radius: 50%; background: var(--bad); }

.game-actions { right: 18px; bottom: 28px; display: grid; gap: 6px; width: 190px; }
.game-actions button {
  min-height: 39px;
  border: 1px solid rgba(111,242,255,.28);
  color: var(--cyan-soft);
  background: rgba(3,8,20,.94);
  cursor: pointer;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.game-actions button:first-child { border-color: var(--cyan); background: rgba(18,59,79,.92); }
.game-actions button:nth-child(2):not(:disabled) { border-color: var(--gold); color: var(--gold); }
.game-actions button:disabled { cursor: not-allowed; opacity: .46; }
.game-controls { left: 18px; bottom: 28px; display: grid; gap: 5px; padding: 8px 10px; color: var(--muted); background: rgba(2,6,17,.86); font-size: 8px; font-weight: 700; }
.game-authority { right: 18px; bottom: 161px; width: 220px; margin: 0; color: rgba(203,220,236,.66); font-size: 8px; line-height: 1.45; text-align: right; }

.command-console {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: none;
  width: auto;
  max-width: none;
  margin: 0 auto;
  padding: 78px max(24px, calc((100vw - 1180px) / 2)) 34px;
  overflow: auto;
  border: 0;
  background: #050817;
  box-shadow: 0 32px 100px rgba(0,0,0,.76);
}
body.console-open .command-console { display: block; }
body.console-open .playfield-shell, body.console-open .top-rail { visibility: hidden; }
.command-console-bar {
  position: sticky;
  z-index: 5;
  top: -78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: -78px min(-24px, calc((1180px - 100vw) / 2)) 18px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(111,242,255,.2);
  background: #070c1e;
}
.command-console-bar span, .command-console-bar b { display: block; }
.command-console-bar span { color: var(--cyan); font-size: 8px; font-weight: 900; letter-spacing: .18em; }
.command-console-bar b { margin-top: 3px; font-size: 12px; }
.command-console-bar button { min-height: 35px; border: 1px solid var(--bad); color: var(--ink); background: rgba(255,125,143,.08); cursor: pointer; }
footer { display: none; }
.auth-gate { z-index: 500; background: rgba(2,4,12,.97); backdrop-filter: none; }

.touch-controls { display: none; }

html.compact .top-rail, html.compact .game-hotbar, html.compact .game-actions, html.compact .game-controls, html.compact .game-authority, html.compact .touch-controls, html.compact .command-console { display: none !important; }
html.compact .playfield-shell { height: 100dvh; min-height: 230px; }
html.compact .game-hud { top: 8px; left: 8px; right: auto; width: calc(100% - 16px); padding: 8px 10px; }
html.compact .game-hud h1 { font-size: 15px; }
html.compact .game-hud p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.compact .game-hud-right, html.compact .game-objective { display: none; }
html.compact .game-prompt { bottom: 12px; }

@media (max-width: 900px) {
  .top-rail { top: 8px; right: 8px; left: 8px; }
  .sync-age, .top-rail .brand small { display: none; }
  .game-hud { top: 72px; }
  .game-hud-right { top: 72px; }
  .game-objective { top: 166px; }
  .game-hotbar { bottom: 16px; grid-template-columns: repeat(4, 67px); }
  .game-hotbar button { min-height: 58px; }
  .game-actions { right: 10px; bottom: 94px; width: 160px; }
  .game-controls, .game-authority { display: none; }
}

@media (max-width: 760px) {
  .game-hud-right { display: none; }
}

@media (max-width: 640px), (pointer: coarse) {
  .playfield-shell { height: 100dvh; min-height: 0; }
  .top-rail { min-height: 46px; }
  .top-rail .world-state { margin-left: auto; }
  .top-rail .back-link, .retry-copy { display: none; }
  .game-hud { top: 62px; left: 8px; width: calc(100% - 16px); padding: 9px 11px; }
  .game-hud h1 { font-size: 21px; }
  .game-hud-right { display: none; }
  .game-objective { top: 144px; left: 8px; max-width: calc(100% - 16px); }
  .game-hotbar { right: 8px; bottom: 116px; left: 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; transform: none; padding: 5px; }
  .game-hotbar button { min-height: 52px; }
  .game-hotbar span { font-size: 7px; }
  .game-actions { right: 8px; bottom: 194px; width: 152px; }
  .game-actions #gamePrimaryAction, .game-actions #gameClaimAction { display: none; }
  .game-actions button { min-height: 34px; }
  .game-authority { display: none; }
  .touch-controls { left: 12px; bottom: 16px; display: flex; align-items: flex-end; gap: 10px; }
  .touch-dpad { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 44px); gap: 4px; }
  .touch-dpad button, .touch-interact, .touch-impulse { min-width: 44px; min-height: 44px; border: 1px solid rgba(111,242,255,.45); background: rgba(3,8,20,.9); }
  .touch-dpad [data-move="up"] { grid-column: 2; }
  .touch-dpad [data-move="left"] { grid-column: 1; grid-row: 2; }
  .touch-dpad [data-move="down"] { grid-column: 2; grid-row: 2; }
  .touch-dpad [data-move="right"] { grid-column: 3; grid-row: 2; }
  .touch-dpad button::before { content: ""; display: block; width: 8px; height: 8px; margin: auto; border-top: 2px solid var(--cyan); border-left: 2px solid var(--cyan); }
  .touch-dpad [data-move="up"]::before { transform: rotate(45deg); }
  .touch-dpad [data-move="left"]::before { transform: rotate(-45deg); }
  .touch-dpad [data-move="down"]::before { transform: rotate(-135deg); }
  .touch-dpad [data-move="right"]::before { transform: rotate(135deg); }
  .touch-interact { width: 48px; height: 48px; border-radius: 50%; color: var(--cyan); font-weight: 900; }
  .touch-impulse { width: 72px; height: 48px; color: var(--bad); font-size: 7px; font-weight: 900; letter-spacing: .08em; }
  .game-prompt { bottom: 244px; }
  .command-console { inset: 0; padding: 54px 10px 10px; }
  .command-console-bar { top: -54px; margin: -54px -10px 10px; }
}

@media (max-width: 480px) {
  .game-objective { display: none; }
  .game-actions {
    right: 8px;
    bottom: 194px;
    left: auto;
    width: 152px;
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .game-actions button { min-height: 42px; padding: 4px; font-size: 7px; }
  .game-hotbar {
    right: 8px;
    bottom: 116px;
    left: 8px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .game-hotbar button { min-height: 50px; }
  .hotbar-glyph { width: 22px; height: 22px; }
  .game-prompt { bottom: 244px; }
}

@media (max-width: 480px) and (max-height: 480px) {
  .game-hud { top: 56px; padding: 6px 9px; }
  .game-hud h1 { font-size: 17px; }
  .game-hud p:not(.game-kicker) { display: none; }
  .game-progress { margin-top: 6px; }
  .game-prompt { display: none; }
  .game-hotbar, .game-actions { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .playfield-grade { background: linear-gradient(180deg, rgba(2,4,14,.42), transparent 22%, transparent 72%, rgba(2,4,12,.74)); }
  .game-progress i, .game-hotbar button { transition: none; }
}
