:root {
  color-scheme: dark;
  --bg: #090b09;
  --surface: #111411;
  --surface-elevated: #151915;
  --surface-quiet: #0d100d;
  --surface-highlight: #1b211a;
  --text: #f2f4ec;
  --muted: #8c9388;
  --muted-bright: #c1c7bd;
  --accent: #c7ee56;
  --accent-soft: rgba(199, 238, 86, .1);
  --live: #e46861;
  --warning: #f0bb6c;
  --border: rgba(255, 255, 255, .085);
  --border-strong: rgba(255, 255, 255, .14);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }
html { min-width: 320px; overflow-x: hidden; background: var(--bg); }
body { min-width: 0; min-height: 100vh; margin: 0; overflow-x: hidden; color: var(--text); background: var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body::before { position: fixed; z-index: -1; inset: 0; content: ""; pointer-events: none; background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 28rem); }
a { color: inherit; }
button, input { font: inherit; }
button { max-width: 100%; }

.site-header, .page-shell, .site-footer { width: min(1800px, calc(100% - 64px)); margin-inline: auto; }
.site-header { display: grid; grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr); align-items: center; gap: 28px; padding: 25px 0 22px; border-bottom: 1px solid var(--border); }
.brand { display: flex; min-width: 0; flex-direction: column; gap: 4px; color: var(--text); text-decoration: none; }
.brand-name { overflow: hidden; font-size: 17px; font-weight: 850; letter-spacing: .12em; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.brand-game { display: none; color: var(--muted); font-size: 13px; font-weight: 500; }
.header-center { display: flex; min-width: 210px; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.header-kicker { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .13em; }
.header-game { color: var(--text); font-size: 17px; font-weight: 680; letter-spacing: -.02em; }
.header-meta { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 13px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.live-state { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px rgba(228, 104, 97, .1); animation: live-pulse 2.4s ease-in-out infinite; }
.viewer-summary { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.viewer-summary strong { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.topic-link { color: var(--muted-bright); text-decoration: none; transition: color .18s ease; }
.topic-link:hover, .topic-link:focus-visible { color: var(--accent); }
.header-tools { display: inline-flex; align-items: center; gap: 6px; }
.toolbar-button { min-height: 34px; padding: 6px 10px; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--muted-bright); background: transparent; cursor: pointer; font-size: 12px; transition: border-color .18s ease, color .18s ease, background .18s ease; }
.toolbar-button:hover, .toolbar-button:focus-visible, .toolbar-button[aria-pressed="true"] { border-color: var(--border-strong); color: var(--text); background: var(--surface-elevated); }
.toolbar-button-strong { border-color: var(--border); color: var(--text); }
.volume-control { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.volume-control input { width: 66px; accent-color: var(--accent); cursor: pointer; }
.icon-button { display: inline-grid; width: 32px; height: 32px; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted-bright); background: transparent; cursor: pointer; transition: border-color .18s ease, color .18s ease, background .18s ease; }
.icon-button:hover, .icon-button:focus-visible { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.onche-block-banner { display: flex; width: min(1800px, calc(100% - 64px)); margin: 20px auto 0; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 17px; border: 1px solid rgba(240, 187, 108, .42); border-radius: var(--radius-md); color: #ffe5bd; background: rgba(86, 54, 20, .34); box-shadow: 0 10px 30px rgba(0, 0, 0, .16); }
.onche-block-banner[hidden] { display: none; }
.onche-block-banner-copy { display: flex; min-width: 0; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.4; }
.onche-block-banner-copy strong { color: #ffd08b; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.onche-block-banner-retry { flex: 0 0 auto; color: #ddb77f; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; white-space: nowrap; }

.page-shell { padding: 54px 0 46px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.viewer-section, .commands-panel, .ram-state-card { min-width: 0; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .12em; }
h1, h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 0; font-size: 21px; font-weight: 680; letter-spacing: -.04em; }
h3 { margin-bottom: 0; font-size: 16px; font-weight: 680; letter-spacing: -.025em; }

.game-stage { position: relative; display: grid; min-height: 520px; place-items: center; margin-top: 0; padding: 24px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-quiet); }
.screen-bezel { width: min(100%, 1040px); padding: 14px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 16px; background: #181c18; box-shadow: 0 20px 55px rgba(0, 0, 0, .24), inset 0 1px rgba(255, 255, 255, .05); }
.screen-topline { display: flex; justify-content: space-between; gap: 12px; margin: 0 2px 10px; color: #788177; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 600; letter-spacing: .08em; }
.screen-status { white-space: nowrap; }
.screen-viewport { display: grid; place-items: center; padding: 16px; overflow: hidden; border: 1px solid #050605; border-radius: 10px; background: #050705; box-shadow: inset 0 0 22px rgba(0, 0, 0, .72); }
canvas { display: block; width: min(100%, 960px); height: auto; aspect-ratio: 160 / 144; image-rendering: pixelated; image-rendering: crisp-edges; background: #0f380f; }
.game-stage:fullscreen { min-height: 100vh; padding: 5vh 5vw; border: 0; border-radius: 0; background: #050605; }
.game-stage:fullscreen .screen-bezel { width: min(92vw, 1100px); }
.game-stage:fullscreen canvas { width: min(82vw, 960px); }
.fullscreen-exit-button { display: none; position: absolute; right: 24px; bottom: 24px; align-items: center; min-height: 36px; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); background: rgba(17, 20, 17, .92); cursor: pointer; font-size: 12px; }
.game-stage:fullscreen .fullscreen-exit-button { display: inline-flex; }
.viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 56px; padding: 15px 2px 12px; border-bottom: 1px solid var(--border); }
.playback-state { display: inline-flex; min-width: 0; align-items: center; gap: 8px; color: var(--muted-bright); font-size: 13px; }
.playback-state > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-spark, .connection-dot { display: inline-block; flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.connection-inline { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.stats-line { display: flex; align-items: center; gap: 9px; padding: 14px 2px 0; color: var(--muted); font-size: 12px; }
.stats-line strong { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.stats-separator { color: var(--border-strong); }
.command-legend { display: flex; align-items: center; gap: 6px; padding: 14px 2px 0; color: var(--muted); font-size: 11px; flex-wrap: wrap; }
.legend-title { margin-right: 5px; font-weight: 750; letter-spacing: .1em; }
.legend-key { display: inline-grid; min-width: 24px; height: 24px; place-items: center; padding-inline: 7px; border: 1px solid var(--border); border-radius: 5px; color: var(--muted-bright); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }

.ram-state-card { margin-top: 28px; padding: 23px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: linear-gradient(145deg, rgba(24, 30, 23, .98), rgba(14, 18, 14, .98)); box-shadow: 0 16px 36px rgba(0, 0, 0, .14); }
.ram-card-header, .party-heading, .location-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.ram-status-block { display: flex; align-items: flex-end; flex-direction: column; gap: 8px; text-align: right; }
.state-pill { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; border: 1px solid rgba(199, 238, 86, .28); border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.state-pill[data-state="empty"] { border-color: var(--border); color: var(--muted); background: transparent; }
.battle-state { color: var(--muted); font-size: 11px; white-space: nowrap; }
.ram-metrics { display: grid; grid-template-columns: minmax(1.3fr, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 21px; }
.ram-metric { display: flex; min-width: 0; min-height: 84px; flex-direction: column; justify-content: space-between; gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: rgba(8, 11, 8, .34); }
.metric-label { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.metric-value { display: block; min-width: 0; overflow: hidden; color: var(--text); font-size: clamp(16px, 1.8vw, 21px); font-weight: 700; letter-spacing: -.03em; text-overflow: ellipsis; white-space: nowrap; }
.metric-number { font-family: "SFMono-Regular", Consolas, monospace; font-size: clamp(14px, 1.5vw, 18px); letter-spacing: -.04em; }
.metric-note { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; letter-spacing: .05em; }
.metric-note span { color: var(--muted-bright); }
.location-row { align-items: center; margin-top: 9px; padding: 14px 13px; border: 1px solid var(--border); border-radius: 10px; background: rgba(8, 11, 8, .34); }
.location-copy { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.location-name { max-width: 100%; overflow: hidden; color: var(--text); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.location-coordinates { color: var(--muted-bright); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; white-space: nowrap; }
.party-section { margin-top: 23px; padding-top: 19px; border-top: 1px solid var(--border); }
.party-summary { color: var(--muted-bright); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; white-space: nowrap; }
.party-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.party-member { min-width: 0; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: rgba(8, 11, 8, .42); }
.party-member[data-hp-state="critical"] { border-color: rgba(240, 187, 108, .45); }
.party-member[data-hp-state="empty"] { border-color: var(--border); opacity: .75; }
.party-member-header, .party-hp-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.party-member-header { min-width: 0; }
.party-name { min-width: 0; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.party-level { color: var(--accent); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; white-space: nowrap; }
.party-hp-line { margin-top: 14px; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.party-hp-text { color: var(--muted-bright); white-space: nowrap; }
.party-hp-track { height: 7px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .09); }
.party-hp-fill { width: var(--hp-ratio, 0%); height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease, background .25s ease; }
.party-member[data-hp-state="critical"] .party-hp-fill { background: var(--warning); }
.party-member[data-hp-state="empty"] .party-hp-fill { background: var(--muted); }
.empty-party { margin: 14px 0 0; padding: 16px; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.empty-party[hidden] { display: none; }

.commands-panel { min-height: 620px; padding: 25px 23px 18px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.commands-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.command-total { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; font-variant-numeric: tabular-nums; }
.feed-status { display: flex; justify-content: space-between; gap: 12px; margin-top: 25px; padding: 0 0 14px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.feed-status > span:first-child { display: inline-flex; align-items: center; gap: 8px; color: var(--muted-bright); }
.feed-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.feed-list { display: flex; max-height: 570px; flex-direction: column; margin: 0; padding: 0; overflow-y: auto; list-style: none; scrollbar-color: #4a5348 transparent; scrollbar-width: thin; }
.feed-item { display: grid; grid-template-columns: 94px minmax(0, 1fr) 70px; gap: 11px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--border); animation: command-in .18s ease-out; }
.feed-item:first-child { margin-inline: -7px; padding-inline: 11px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.command-key { min-width: 0; overflow: hidden; color: var(--accent); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; font-weight: 750; letter-spacing: .04em; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.command-author { min-width: 0; overflow: hidden; color: var(--text); font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.command-detail { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 450; text-overflow: ellipsis; white-space: nowrap; }
.command-meta { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; text-align: right; white-space: nowrap; }
.empty-feed { padding: 24px 2px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.commands-footer { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; line-height: 1.45; }

.event-overlay { position: fixed; z-index: 30; top: clamp(16px, 4vh, 42px); left: 50%; display: flex; width: min(520px, calc(100% - 28px)); min-height: 64px; flex-direction: column; justify-content: center; gap: 5px; padding: 13px 18px; overflow: hidden; border: 1px solid rgba(199, 238, 86, .38); border-radius: 12px; color: var(--text); background: rgba(18, 24, 17, .96); box-shadow: 0 18px 50px rgba(0, 0, 0, .42); pointer-events: none; transform: translateX(-50%); animation: event-in .2s ease-out; }
.event-overlay[hidden] { display: none; }
.event-overlay[data-event-type="capture"], .event-overlay[data-event-type="badge"], .event-overlay[data-event-type="save"] { border-color: rgba(199, 238, 86, .7); }
.event-overlay-label { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.event-overlay-message { overflow: hidden; font-size: 16px; font-weight: 700; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }

.site-footer { display: flex; justify-content: space-between; gap: 8px; padding: 0 0 28px; color: var(--muted); font-size: 11px; flex-wrap: wrap; }
.creator-mark { color: var(--muted-bright); }

.modal[hidden] { display: none; }
.modal { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .7); }
.modal-panel { position: relative; width: min(100%, 500px); max-height: min(720px, 88vh); overflow: auto; padding: 25px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface-elevated); box-shadow: 0 25px 80px rgba(0, 0, 0, .45); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.modal-close { min-height: 34px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted-bright); background: transparent; cursor: pointer; font-size: 11px; }
.modal-close:hover, .modal-close:focus-visible { color: var(--text); background: var(--surface); }
.modal-description { margin: 19px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.ranking-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.ranking-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--border); }
.ranking-rank { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.ranking-author { min-width: 0; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.ranking-score { color: var(--accent); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; white-space: nowrap; }
.ranking-empty { color: var(--muted); font-size: 13px; }

@keyframes command-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes event-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

@media (max-width: 1100px) {
  .content-grid { grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; }
  .header-meta { gap: 8px; }
  .header-tools .volume-control { display: none; }
  .game-stage { padding: 18px; }
}

@media (max-width: 920px) {
  .content-grid { grid-template-columns: 1fr; }
  .commands-panel { min-height: auto; }
  .feed-list { max-height: 420px; }
}

@media (max-width: 620px) {
  .site-header, .page-shell, .site-footer { width: calc(100% - 28px); }
  .onche-block-banner { width: calc(100% - 28px); align-items: flex-start; flex-direction: column; gap: 8px; }
  .site-header { display: flex; align-items: flex-start; padding: 19px 0; }
  .header-center { display: none; }
  .header-meta { max-width: 63%; align-items: flex-end; flex-direction: column; gap: 7px; }
  .viewer-summary { order: -1; }
  .header-tools { justify-content: flex-end; flex-wrap: wrap; }
  .header-tools .volume-control { display: inline-flex; }
  .header-tools .volume-control input { width: 72px; }
  .page-shell { padding: 35px 0 30px; }
  .game-stage { min-height: 0; padding: 8px; border-radius: var(--radius-md); }
  .screen-bezel { padding: 8px; border-radius: 10px; }
  .screen-viewport { padding: 8px; }
  .screen-topline { margin-bottom: 7px; font-size: 9px; }
  .viewer-toolbar { align-items: flex-start; flex-direction: column; gap: 13px; }
  .connection-inline { margin-left: 4px; }
  .stats-line { align-items: flex-start; flex-direction: column; gap: 5px; }
  .stats-separator { display: none; }
  .ram-state-card { margin-top: 22px; padding: 17px 15px; }
  .ram-card-header { gap: 10px; }
  .ram-status-block { align-items: flex-end; }
  .ram-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 17px; }
  .ram-metric-trainer { grid-column: span 2; }
  .ram-metric { min-height: 75px; padding: 11px; }
  .location-row { align-items: flex-start; flex-direction: column; gap: 9px; }
  .party-list { grid-template-columns: 1fr; }
  .commands-panel { padding: 21px 15px 15px; }
  .feed-status { margin-top: 21px; }
  .feed-item { grid-template-columns: 74px minmax(0, 1fr) auto; gap: 8px; }
  .command-key { font-size: 10px; }
  .fullscreen-exit-button { right: 12px; bottom: 12px; }
  .modal { padding: 14px; }
  .modal-panel { padding: 20px; }
}

@media (max-width: 390px) {
  .site-header, .page-shell, .site-footer { width: calc(100% - 20px); }
  .header-meta { max-width: 67%; }
  .brand-name { font-size: 14px; }
  .header-tools .toolbar-button { padding-inline: 7px; font-size: 10px; }
  .screen-topline { font-size: 8px; }
  .ram-card-header { align-items: flex-start; flex-direction: column; }
  .ram-status-block { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .metric-value { font-size: 16px; }
  .metric-number { font-size: 13px; }
}

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