:root {
    --bg: #f0e6d4;
    --panel: #fffaf1;
    --ink: #1d2430;
    --muted: #5f6875;
    --line: #111;
    --accent: #ffd166;
    --accent-2: #8ecae6;
    --shadow: 0 6px 0 rgba(17, 17, 17, 0.24);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    font-family: "IBM Plex Sans", sans-serif;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.55)),
        repeating-linear-gradient(0deg, #e6d8bd 0, #e6d8bd 24px, #f0e6d4 24px, #f0e6d4 48px);
}

.apis-shell {
    width: min(1320px, calc(100% - 24px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.hero,
.panel,
.hero-btn,
.api-card,
.brain-pixel {
    border: 4px solid var(--line);
    box-shadow: var(--shadow);
}

.hero,
.panel,
.api-card {
    background: var(--panel);
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: end;
    padding: 24px;
    margin-bottom: 22px;
}

.eyebrow,
.section-tag {
    font-family: "Press Start 2P", monospace;
    font-size: 0.62rem;
    color: #8a5e34;
}

.hero h1,
.section-head h2 {
    margin: 12px 0 10px;
    font-family: "Press Start 2P", monospace;
    line-height: 1.4;
}

.hero-copy {
    color: var(--muted);
    line-height: 1.6;
    max-width: 760px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 14px;
    text-decoration: none;
    background: var(--accent);
    color: var(--ink);
    font-family: "Press Start 2P", monospace;
    font-size: 0.62rem;
}

.hero-btn.secondary { background: var(--accent-2); }

.apis-grid {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 22px;
}

.panel {
    padding: 20px;
}

.list-actions {
    margin: 16px 0;
}

.api-list {
    display: grid;
    gap: 14px;
}

.api-card {
    display: grid;
    grid-template-columns: 94px 1fr;
    gap: 14px;
    padding: 14px;
    cursor: pointer;
}

.api-card.active {
    background: #fff1bf;
}

.mini-brain {
    position: relative;
    width: 72px;
    height: 72px;
    border: 4px solid var(--line);
    background: linear-gradient(180deg, #b8ecff, #7fb7ff);
}

.mini-brain::before {
    content: "";
    position: absolute;
    inset: 14px;
    border: 4px solid var(--line);
    background: #ffd166;
}

.api-card strong {
    display: block;
    margin-bottom: 6px;
}

.api-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.brain-stage {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
    align-items: center;
    margin: 16px 0 20px;
}

.brain-pixel {
    position: relative;
    width: 108px;
    height: 108px;
    background: linear-gradient(180deg, #b8ecff, #7fb7ff);
}

.brain-core {
    position: absolute;
    inset: 22px;
    border: 4px solid var(--line);
    background: #ffd166;
    box-shadow: inset 0 0 0 4px #fff2b8;
}

.brain-eye,
.brain-mouth,
.brain-antenna {
    position: absolute;
    background: var(--line);
}

.brain-eye {
    width: 10px;
    height: 10px;
    top: 42px;
}

.eye-left { left: 34px; }
.eye-right { right: 34px; }

.brain-mouth {
    width: 24px;
    height: 6px;
    left: 42px;
    bottom: 36px;
}

.brain-antenna {
    width: 6px;
    height: 18px;
    top: 8px;
    left: 51px;
    box-shadow: 0 -10px 0 0 #ff6b6b;
}

.brain-copy p {
    color: var(--muted);
    line-height: 1.6;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.form-grid label {
    display: grid;
    gap: 6px;
}

.form-grid .wide {
    grid-column: 1 / -1;
}

.form-grid input,
.form-grid textarea {
    width: 100%;
    padding: 12px;
    border: 3px solid var(--line);
    background: #fffdf8;
    font: inherit;
    color: var(--ink);
}

.save-status {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    color: var(--muted);
}

.save-status.error {
    color: #8f1d1d;
}

.code-block {
    margin: 14px 0 0;
    padding: 14px;
    border: 3px solid var(--line);
    background: #fffdf8;
    white-space: pre-wrap;
    font-family: "IBM Plex Sans", sans-serif;
    line-height: 1.6;
}

@media (max-width: 980px) {
    .apis-grid,
    .hero,
    .form-grid,
    .brain-stage,
    .api-card {
        grid-template-columns: 1fr;
        display: grid;
    }
}
