:root {
  color-scheme: dark;
  --bg: #0a0d0c;
  --panel: #101513;
  --ink: #e9eee8;
  --muted: #8b9b91;
  --line: #2a352e;
  --line-strong: #596344;
  --accent: #ffd84a;
  --accent-2: #ffb000;
  --accent-3: #55e3c1;
  --danger: #ff7d7d;
  --stage-glow: rgba(255, 216, 74, 0.48);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}
button, a, input, textarea { font: inherit; -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-3);
  outline-offset: 3px;
}
svg { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; }
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.scanline { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 3px, #ffffff04 3px 4px); opacity: 0.35; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: #0b100ef5;
  backdrop-filter: blur(12px);
}
.brand { display: inline-flex; align-items: center; gap: 0.8rem; padding: 0; border: 0; background: none; text-align: left; }
.brand strong { display: block; font-size: 1.15rem; color: var(--accent); }
.brand small { display: block; color: var(--muted); font-size: 0.65rem; }
.brand-mark { display: block; flex: 0 0 auto; width: 40px; height: 40px; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 3px; }
.top-actions { display: flex; align-items: center; gap: 1.25rem; min-width: 0; }
.session-indicator { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.67rem; color: var(--muted); white-space: nowrap; }
.status-dot { display: inline-block; flex: 0 0 auto; width: 6px; height: 6px; background: var(--accent-3); }

.outline-button, .ghost-button, .secondary-button, .primary-button, .icon-button, .square-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 40px;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}
.outline-button:hover, .ghost-button:hover, .secondary-button:hover, .icon-button:hover, .square-button:hover { border-color: var(--accent); background: #ffd84a0a; }
.primary-button { border-color: var(--accent); background: var(--accent); color: #11170f; font-weight: 700; }
.primary-button:hover { background: #ffe88c; }
.secondary-button { background: #ffd84a0e; border-color: var(--line-strong); }
.icon-button, .square-button { width: 38px; height: 38px; min-height: 38px; padding: 0; flex: 0 0 auto; }
.icon-button svg, .square-button svg, .dock-item svg { width: 17px; height: 17px; }

.shell { width: min(1280px, calc(100% - 3rem)); margin: 0 auto; padding: 1.6rem 0 6rem; }
.view { animation: viewIn 180ms ease both; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.section-head h1 { margin: 0; font-size: 1.8rem; line-height: 1.25; font-weight: 600; }
.eyebrow { margin: 0 0 0.35rem; font-size: 0.65rem; color: var(--muted); text-transform: uppercase; }
.terminal-caret { color: var(--accent); animation: blink 1.2s steps(2, start) infinite; }
.head-tools { display: flex; gap: 0.4rem; }
.workspace-bar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; padding: 0.7rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.7rem; }
.path-root { color: var(--accent); }
.bar-divider { margin: 0 0.6rem; color: var(--line-strong); }
.launch-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 1rem; align-items: stretch; }
.stamp-panel, .console-panel { min-width: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
.stamp-panel { padding: 1rem; }
.panel-label, .panel-title, .composer-footer, .receipt-meta, .route-option { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.panel-label { padding-bottom: 0.85rem; font-size: 0.69rem; color: var(--muted); }
.window-label { color: var(--accent); font-size: 0.6rem; }
.stamp-stage { position: relative; display: grid; place-items: center; height: 300px; min-width: 0; overflow: hidden; border: 1px solid #253029; background-color: #0b100d; background-image: linear-gradient(#28372b44 1px, transparent 1px), linear-gradient(90deg, #28372b44 1px, transparent 1px); background-size: 24px 24px; }
.stamp-stage::before, .stamp-stage::after { position: absolute; color: #627347; font-size: 0.6rem; }
.stamp-stage::before { content: "OBJECT / SOLAR RELAY"; top: 0.6rem; left: 0.65rem; }
.stamp-stage::after { content: "LOCAL ASSET"; right: 0.65rem; bottom: 0.6rem; }
.stamp-stage img { position: relative; z-index: 2; width: min(66%, 225px); max-height: 255px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(8px 12px 0 #00000088); animation: hoverStamp 5s ease-in-out infinite; }
.sun-rings { position: absolute; width: min(72%, 260px); aspect-ratio: 1; border: 1px dashed #ffd84a30; transform: rotate(45deg); }
.sun-rings::before { content: ""; position: absolute; inset: 15%; border: 1px solid #55e3c120; }
.press-arm { position: absolute; top: -90px; left: 50%; z-index: 3; width: 130px; height: 44px; border: 1px solid var(--accent); background: #ffd84a30; transform: translateX(-50%); }
.stamp-stage.is-pressing .press-arm { animation: pressDown 420ms ease both; }
.selector-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px; align-items: center; gap: 0.65rem; margin-top: 1rem; }
.design-copy { text-align: center; min-width: 0; }
.design-copy h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.design-copy p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.67rem; }
.swatches { display: flex; justify-content: center; gap: 0.6rem; margin: 1rem 0; }
.swatch { width: 27px; height: 27px; padding: 0; background: var(--swatch); border: 2px solid #536046; border-radius: 2px; box-shadow: inset 0 0 0 4px #0004; }
.swatch.is-active { outline: 1px solid var(--accent); outline-offset: 3px; }
.asset-control { padding-top: 0.75rem; border-top: 1px solid var(--line); }
.range-control { display: grid; gap: 0.5rem; color: var(--muted); font-size: 0.7rem; }
.range-control > span { display: flex; justify-content: space-between; gap: 1rem; }
.range-control strong { color: var(--accent); }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }
.meter { height: 3px; margin-top: 0.65rem; background: #27312a; overflow: hidden; }
.meter span { display: block; width: 68%; height: 100%; background: var(--accent); transition: width 150ms ease; }

.console-panel { display: flex; flex-direction: column; background: #0c100e; }
.panel-title { min-height: 52px; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-title h2 { margin: 0; font-size: 0.82rem; font-weight: 500; }
.prompt-mark { color: var(--accent); margin-right: 0.5rem; }
.small-tag { display: inline-flex; align-items: center; min-height: 23px; padding: 0.1rem 0.45rem; border: 1px solid var(--line-strong); border-radius: 2px; color: var(--accent); font-size: 0.62rem; }
.small-tag[data-state="ready"] { color: var(--accent-3); border-color: #55e3c140; }
.small-tag[data-state="running"] { color: var(--accent); border-color: var(--accent); }
.runtime-strip { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.65rem 1rem; font-size: 0.59rem; color: var(--muted); border-bottom: 1px solid #1c2820; }
.runtime-strip > span:first-child { display: flex; align-items: center; gap: 0.45rem; }
.terminal-output { flex: 1 1 auto; height: 300px; max-height: 360px; min-height: 300px; overflow: auto; overscroll-behavior: contain; padding: 1.1rem 1rem; scrollbar-width: thin; scrollbar-color: #3d503b #0c100e; }
.terminal-row { display: grid; grid-template-columns: 52px 42px minmax(0, 1fr); align-items: baseline; gap: 0.65rem; margin: 0 0 0.7rem; font-size: 0.75rem; line-height: 1.6; }
.terminal-row time { color: #596e5e; font-size: 0.58rem; }
.log-label { color: var(--accent-3); font-size: 0.63rem; }
.log-message { white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal-row[data-kind="input"] .log-message { color: var(--accent); }
.terminal-row[data-kind="input"] .log-label { visibility: hidden; }
.terminal-row[data-kind="error"] .log-label, .terminal-row[data-kind="error"] .log-message { color: var(--danger); }
.terminal-row[data-kind="scope"] .log-message { color: var(--muted); }
.command-line { display: flex; align-items: center; gap: 0.6rem; min-height: 51px; margin: 0; padding: 0.55rem 0.8rem; border-block: 1px solid var(--line); background: #141b15; }
.command-line label { flex: 0 0 auto; color: var(--accent); font-size: 0.68rem; }
.command-line label span { color: var(--muted); }
.command-line input { width: 100%; min-width: 0; padding: 0.4rem 0; border: 0; background: transparent; color: var(--ink); font-size: 0.75rem; outline-offset: 1px; }
.command-line input::placeholder { color: #708272; }
.command-submit { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; padding: 0; border: 1px solid var(--line-strong); background: #ffd84a0c; color: var(--accent); }
.runtime-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); }
.runtime-stats div + div { padding-left: 1rem; border-left: 1px solid var(--line); }
.runtime-stats dt { font-size: 0.59rem; color: var(--muted); }
.runtime-stats dd { margin: 0.15rem 0 0; font-size: 0.86rem; }
.runtime-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; padding: 0.9rem 1rem; }
.runtime-actions button { font-size: 0.72rem; }
.runtime-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem 1rem; border-top: 1px solid var(--line); color: #7c8e7f; font-size: 0.52rem; }

.stamp-locker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; }
.stamp-card { display: grid; grid-template-rows: 190px auto 1fr; gap: 0.65rem; min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); text-align: left; }
.stamp-card.is-active { border-color: var(--accent); }
.stamp-card img { width: min(85%, 155px); max-height: 185px; margin: auto; image-rendering: pixelated; }
.stamp-card h2 { margin: 0; font-size: 0.88rem; }
.stamp-card p { margin: 0; font-size: 0.7rem; color: var(--muted); }
.desk-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.8fr); gap: 1.5rem; border-top: 1px solid var(--line); padding-top: 1.25rem; }
.composer { min-width: 0; }
.composer > label { display: block; margin-bottom: 0.7rem; color: var(--accent); font-size: 0.75rem; }
textarea { width: 100%; min-height: 260px; padding: 1rem; border: 1px solid var(--line); border-radius: 3px; background: #101813; color: var(--ink); resize: vertical; line-height: 1.7; }
.composer-footer { margin-top: 0.7rem; color: var(--muted); font-size: 0.7rem; }
.route-panel { min-width: 0; }
.route-panel h2 { margin: 0 0 1rem; font-size: 0.9rem; }
.route-option { padding: 0.8rem 0; border-bottom: 1px solid var(--line); font-size: 0.72rem; }
.route-option span { color: var(--muted); }
.route-option strong { text-align: right; font-weight: 500; }
.notice { margin: 1rem 0 0; font-size: 0.72rem; color: var(--muted); line-height: 1.7; }
.receipt-list { border-top: 1px solid var(--line); }
.receipt-item { padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.receipt-meta { color: var(--muted); font-size: 0.68rem; }
.receipt-meta span:first-child { color: var(--accent-3); }
.receipt-item h2 { margin: 0.6rem 0 0.3rem; font-size: 1rem; }
.receipt-item p { max-width: 800px; margin: 0; overflow-wrap: anywhere; color: var(--muted); }
.empty-state { padding: 3rem 0; color: var(--muted); }
.system-manifest { margin: 0; border-top: 1px solid var(--line); }
.system-manifest div { display: grid; grid-template-columns: minmax(160px, 0.4fr) minmax(0, 1fr); gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.system-manifest dt { color: var(--muted); }
.system-manifest dd { margin: 0; overflow-wrap: anywhere; }

.dock { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: center; gap: 0.3rem; padding: 0.55rem 1rem calc(0.55rem + env(safe-area-inset-bottom)); background: #0b100efa; border-top: 1px solid var(--line); }
.dock-item { display: inline-flex; align-items: center; justify-content: center; gap: 0.65rem; min-width: 125px; min-height: 40px; padding: 0.55rem 1rem; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 0.74rem; }
.dock-item.is-active { border-color: var(--accent); color: var(--accent); background: #ffd84a09; }
.dock-item:hover { color: var(--ink); }
.modal { width: min(520px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--panel); color: var(--ink); }
.modal::backdrop { background: #000b; backdrop-filter: blur(4px); }
.modal-card { position: relative; padding: 1.4rem; }
.modal-card h2 { margin: 0; padding-right: 3rem; font-size: 1.3rem; }
.modal-card p:not(.eyebrow) { color: var(--muted); font-size: 0.8rem; }
.modal-close { position: absolute; right: 1rem; top: 1rem; }
.modal-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1rem; }
.wallet-choices { display: grid; gap: 0.7rem; margin-top: 1rem; }
.wallet-option { display: flex; align-items: center; gap: 1rem; }
.wallet-option button { flex: 1; }
.wallet-option a { font-size: 0.7rem; text-decoration: underline; }
.wallet-address { overflow-wrap: anywhere; }
.stats-list { margin: 1rem 0; border-top: 1px solid var(--line); }
.stats-list div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); font-size: 0.75rem; }
.stats-list dt { color: var(--muted); }
.stats-list dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.console-status.is-error { color: var(--danger) !important; }
.toast { position: fixed; z-index: 40; right: 1rem; bottom: 5rem; max-width: min(420px, calc(100% - 2rem)); padding: 0.8rem 1rem; border: 1px solid var(--line-strong); border-radius: 3px; background: #111a14; font-size: 0.75rem; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 160ms ease, transform 160ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@keyframes hoverStamp { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-6px) rotate(1deg); } }
@keyframes pressDown { 0%, 100% { top: -90px; } 45% { top: 85px; } }
@keyframes blink { to { visibility: hidden; } }
@keyframes viewIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 1000px) {
  .stamp-locker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .terminal-row { grid-template-columns: 44px 34px minmax(0, 1fr); gap: 0.45rem; }
  .terminal-row time { font-size: 0.53rem; }
  .runtime-strip { font-size: 0.55rem; }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 2rem); padding-top: 1.1rem; }
  .topbar { padding: 0.8rem 1rem; }
  .session-indicator { display: none; }
  .launch-grid, .desk-grid { grid-template-columns: minmax(0, 1fr); }
  .stamp-panel { order: 2; }
  .console-panel { order: 1; }
  .stamp-stage { height: 250px; }
  .stamp-stage img { max-height: 215px; width: min(60%, 190px); }
  .section-head h1 { font-size: 1.45rem; }
  .dock { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; padding-inline: 0.4rem; }
  .dock-item { flex-direction: column; min-width: 0; min-height: 48px; padding: 0.35rem 0.1rem; gap: 0.3rem; font-size: 0.62rem; }
  .dock-item svg { width: 16px; height: 16px; }
  .stamp-locker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .shell { width: calc(100% - 1rem); }
  .topbar { gap: 0.6rem; padding-inline: 0.75rem; }
  .top-actions .outline-button { padding-inline: 0.5rem; font-size: 0.65rem; }
  .brand { gap: 0.55rem; }
  .brand strong { font-size: 1rem; }
  .brand small { font-size: 0.52rem; }
  .brand-mark { width: 32px; height: 32px; }
  .section-head { align-items: flex-start; gap: 0.5rem; }
  .section-head h1 { font-size: 1.13rem; }
  .head-tools { gap: 0.25rem; }
  .head-tools .icon-button { width: 32px; height: 32px; min-height: 32px; }
  .eyebrow { font-size: 0.54rem; }
  .workspace-bar { font-size: 0.59rem; }
  .terminal-output { padding: 1rem 0.7rem; height: 285px; min-height: 285px; }
  .terminal-row { grid-template-columns: 33px minmax(0, 1fr); gap: 0.5rem; font-size: 0.66rem; }
  .terminal-row time { display: none; }
  .log-label { font-size: 0.58rem; }
  .panel-title, .runtime-strip, .runtime-stats, .runtime-actions { padding-inline: 0.7rem; }
  .command-line { padding-inline: 0.6rem; gap: 0.35rem; }
  .command-line label { font-size: 0.59rem; }
  .runtime-stats div + div { padding-left: 0.65rem; }
  .runtime-stats dt { font-size: 0.54rem; }
  .runtime-footer { padding-inline: 0.7rem; font-size: 0.46rem; }
  .stamp-locker { grid-template-columns: minmax(0, 1fr); }
  .stamp-card { grid-template-rows: 170px auto 1fr; }
  .system-manifest div { grid-template-columns: minmax(0, 1fr); gap: 0.35rem; }
  .composer-footer { align-items: flex-start; }
  .composer-footer button { font-size: 0.65rem; }
  .modal-actions { display: grid; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
