@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Space+Mono:wght@400;700&display=swap');

:root {
    --ink: #17191b;
    --surface: #232628;
    --field: #121416;
    --text: #f4f6ee;
    --muted: #adb7b2;
    --line: #505957;
    --mint: #a6f7c1;
    --coral: #ff8279;
    --yellow: #f6db75;
}
* { box-sizing: border-box; letter-spacing: 0 !important; }
body {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    background: var(--ink) !important;
    background-image: radial-gradient(#414743 1px, transparent 1px) !important;
    background-size: 16px 16px !important;
    color: var(--text) !important;
    font: 15px/1.7 'Space Mono', monospace;
    min-height: 100vh;
}
a { color: var(--mint); text-underline-offset: 5px; }
a:hover { color: var(--yellow); }
.arcade-header {
    background: var(--ink);
    border-bottom: 3px solid var(--line);
    padding: 22px max(24px, calc((100% - 1200px) / 2));
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.arcade-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text);
    text-decoration: none;
    font: 13px/1.8 'Press Start 2P', monospace;
}
.arcade-brand img { width: 40px; height: 40px; filter: invert(1); }
.arcade-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#themeToggle { min-width: 112px; min-height: 44px; }
.arcade-nav a {
    padding: 10px 14px;
    font-size: 13px;
    text-decoration: none;
    color: var(--muted);
    border: 2px solid transparent;
}
.arcade-nav a[aria-current] { border-color: var(--mint); color: var(--mint); background: #a6f7c10d; }
.arcade-nav a:hover { border-color: var(--line); color: var(--text); }
.arcade-main, body > .container-sm {
    width: min(1200px, calc(100% - 48px));
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 0 48px;
}
.page-heading { margin-bottom: 30px; border-bottom: 1px solid var(--line); padding-bottom: 24px; }
.eyebrow { color: var(--mint); font-size: 12px; text-transform: uppercase; margin: 0 0 14px; }
h1 { font: 25px/1.6 'Press Start 2P', monospace; margin: 0; }
h2, h5, .card-header { font: 14px/1.8 'Press Start 2P', monospace; }
.page-heading h1 { color: var(--text); }
.station-number { color: var(--coral); }
.workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.markdown-page .workspace { grid-template-columns: 1fr; }
.workspace > * { min-width: 0; }
.station, .card {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--line);
    border-radius: 0;
    box-shadow: 6px 6px 0 #080a0b;
    overflow: hidden;
}
.station-title, .card-header {
    padding: 18px 22px;
    margin: 0;
    background: var(--surface);
    border-bottom: 2px solid var(--line);
    color: var(--yellow);
}
.station-body, .card-body { padding: 24px; }
label, .form-label { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
textarea, input[type='text'], .form-control {
    background: var(--field) !important;
    border: 2px solid var(--line) !important;
    border-radius: 0 !important;
    color: var(--text) !important;
    font: 14px/1.7 'Space Mono', monospace !important;
    padding: 14px !important;
    width: 100%;
}
textarea { resize: vertical; min-height: 150px; }
#markdownInput { min-height: 280px; }
textarea::placeholder, input::placeholder { color: #87908b !important; }
.form-control:focus, textarea:focus { border-color: var(--mint) !important; box-shadow: 0 0 0 3px #a6f7c120 !important; }
button, .btn {
    border: 2px solid var(--mint) !important;
    border-radius: 0 !important;
    color: var(--ink) !important;
    background: var(--mint) !important;
    font: 700 13px/1.6 'Space Mono', monospace !important;
    padding: 10px 18px;
    box-shadow: 3px 3px 0 #080a0b;
    transition: transform .12s;
}
button:hover, .btn:hover { transform: translate(-1px, -1px); background: var(--yellow) !important; border-color: var(--yellow) !important; }
button:active { transform: translate(2px, 2px); box-shadow: none; }
.btn-secondary, #themeToggle, #copyButton, #pasteButton { background: transparent !important; color: var(--mint) !important; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; }
.output, #decodedPayload, .markdown-preview {
    background: var(--field) !important;
    color: var(--text) !important;
    border: 1px solid var(--line) !important;
    border-radius: 0 !important;
    padding: 18px;
    min-height: 130px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-width: 100%;
    font: 14px/1.7 'Space Mono', monospace;
}
.markdown-preview { white-space: normal; overflow-x: auto; }
.markdown-preview table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.markdown-preview th, .markdown-preview td { border: 1px solid var(--mint); padding: 10px 14px; }
.markdown-preview th { background: var(--surface); color: var(--yellow); }
.markdown-preview code { font: 14px/1.7 'Space Mono', monospace; color: var(--coral); background: var(--surface); border: 1px solid var(--line); padding: 2px 5px; overflow-wrap: anywhere; }
.markdown-preview pre { background: var(--surface); border: 1px solid var(--mint); border-left: 4px solid var(--mint); padding: 16px; margin: 16px 0; overflow-x: auto; white-space: pre; }
.markdown-preview pre code { display: block; color: var(--text); background: transparent; border: 0; padding: 0; overflow-wrap: normal; }
.markdown-preview img { max-width: 100%; }
.markdown-preview h1 { font-size: 20px; }
.markdown-preview h2 { font-size: 16px; }
.output-container { margin-top: 24px; }
.copy-button { display: none; }
.nav-pills { gap: 8px; }
.nav-pills .nav-link { border-radius: 0; color: var(--muted); border: 1px solid var(--line); font-size: 13px; }
.nav-pills .nav-link.active { background: var(--yellow); color: var(--ink); }
.table { --bs-table-bg: var(--field); --bs-table-color: var(--text); --bs-table-striped-color: var(--text); --bs-table-striped-bg: var(--surface); border-color: var(--line); overflow-wrap: anywhere; }
.alert { border-radius: 0; font-size: 13px; overflow-wrap: anywhere; }
.alert-primary { background: #a6f7c110; color: var(--mint); border: 1px solid var(--line); }
body > .container-sm > .alert { display: none !important; }
body > .container-sm > br { display: none; }
body > .container-sm > .container { padding: 0; }
body > .container-sm > .container > .row { margin: 0; }
body > .container-sm > .container > .row > .col { padding: 0; display: grid; grid-template-columns: .8fr 1.2fr; gap: 28px; align-items: start; }
body > .container-sm .p-3 { padding: 0 !important; min-width: 0; }
#resultsCard, #notFoundBox, #errorAlert { margin-top: 24px; }
.code-output { background: #fff; min-height: 280px; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto; }
#outputQRCode { width: 128px; height: 128px; flex-shrink: 0; image-rendering: pixelated; }
#outputBarcode { max-width: 100%; height: auto; }
.code-options { display: flex; gap: 0; padding: 0; border: 0; margin-bottom: 22px; }
.code-options legend { font-size: 13px; color: var(--muted); }
.code-options label { display: inline-flex; align-items: center; white-space: nowrap; padding: 10px 12px; border: 2px solid var(--line); margin: 0; cursor: pointer; color: var(--text); }
.code-options label:has(input:checked) { border-color: var(--coral); color: var(--coral); background: #ff827910; }
input[type='radio'] { accent-color: var(--coral); margin-right: 8px; }
.arcade-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 32px; color: var(--muted); font-size: 11px; }
.status-dot { display: inline-block; width: 8px; height: 8px; background: var(--mint); margin-right: 8px; }
.station { animation: boot .35s ease-out both; }
.station:nth-child(2) { animation-delay: .08s; }
@keyframes boot { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
body.light-mode {
    --ink: #e9eee7; --surface: #f9fcf5; --field: #fff;
    --text: #202822; --muted: #58645b; --line: #8e9c90;
    --mint: #216345; --yellow: #705717; --coral: #b7433c;
}
body.light-mode .arcade-brand img { filter: none; }
@media (max-width: 760px) {
    .arcade-header { padding: 18px 20px; gap: 18px; }
    .arcade-brand { font-size: 11px; }
    .arcade-nav { width: 100%; gap: 4px; }
    .arcade-nav a { padding: 8px; font-size: 11px; }
    .arcade-main, body > .container-sm { width: calc(100% - 40px); padding-top: 26px; }
    h1 { font-size: 18px; }
    .workspace, body > .container-sm > .container > .row > .col { grid-template-columns: 1fr; gap: 24px; }
    .station-body, .card-body { padding: 18px; }
    .station-title, .card-header { padding: 16px 18px; font-size: 12px; }
    .code-output { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }