:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #edf2f7;
    --border: #d8e0ea;
    --text: #172033;
    --muted: #66758a;
    --accent: #0f8f7f;
    --accent-2: #c2410c;
    --ink: #101827;
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: clip; }
body {
    margin: 0;
    background:
        linear-gradient(180deg, #eaf4f1 0, rgba(244, 246, 248, 0) 330px),
        linear-gradient(90deg, rgba(15, 143, 127, .08), rgba(194, 65, 12, .08)),
        var(--bg);
    color: var(--text);
    font-family: Arial, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(216, 224, 234, .78);
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(14px);
}
.topbar {
    max-width: 1120px;
    margin: 0 auto;
    min-height: 62px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}
.brand b { color: var(--accent); }
.logo-mark {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--ink), var(--accent));
    color: #fff;
    font-family: Consolas, monospace;
    font-size: 14px;
}
.nav-links {
    display: flex;
    gap: 6px;
}
.nav-links a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    padding: 6px 12px;
    color: var(--muted);
    font-size: 14px;
}
.nav-links a:hover { background: var(--surface-2); color: var(--text); }

main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 18px 20px 54px;
}
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
    gap: 22px;
    align-items: stretch;
    min-height: 360px;
}
.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 30px 0;
}
.eyebrow {
    margin-bottom: 10px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
h1 {
    max-width: 740px;
    margin-bottom: 14px;
    font-size: clamp(38px, 6vw, 72px);
    line-height: 1.02;
}
.hero-subtitle {
    max-width: 660px;
    color: var(--muted);
    font-size: 18px;
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}
.primary-action,
.secondary-action,
.lab-card > a {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 9px 15px;
    font-weight: 800;
}
.primary-action {
    background: var(--ink);
    color: #fff;
}
.secondary-action {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}
.score-panel {
    align-self: center;
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(216, 224, 234, .84);
    border-radius: 8px;
    background: rgba(255, 255, 255, .78);
    box-shadow: 0 18px 45px rgba(23, 32, 51, .08);
}
.score-panel div {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 2px 12px;
    padding: 16px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid rgba(23, 32, 51, .06);
}
.score-panel span {
    grid-row: span 2;
    color: var(--accent-2);
    font-family: Consolas, monospace;
    font-weight: 800;
}
.score-panel b { font-size: 17px; }
.score-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.lab-section,
.principles,
.wish-section {
    margin-top: 34px;
}
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 16px;
}
.section-head h2,
.principles h2 {
    margin-bottom: 0;
    font-size: 28px;
}
.section-head > p {
    max-width: 440px;
    margin-bottom: 4px;
    color: var(--muted);
}
.lab-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.lab-card {
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 8px;
    background: var(--surface);
    padding: 22px;
    box-shadow: 0 12px 30px rgba(23, 32, 51, .06);
}
.lab-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.lab-card-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}
.lab-card-head em {
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent), transparent 88%);
    color: var(--accent);
    padding: 4px 9px;
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}
.lab-card h3 {
    margin-bottom: 8px;
    font-size: 24px;
}
.lab-card p {
    min-height: 72px;
    color: var(--muted);
}
.metric-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 18px 0;
}
.metric-row span {
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--text);
    padding: 6px 9px;
    font-size: 13px;
    font-weight: 700;
}
.lab-card > a {
    width: 100%;
    background: color-mix(in srgb, var(--accent), #111827 18%);
    color: #fff;
}
.wish-section {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(320px, 1.1fr);
    gap: 18px;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: 10px;
    background:
        radial-gradient(circle at 10% 16%, rgba(15, 143, 127, .12), transparent 28%),
        rgba(255, 255, 255, .78);
    padding: 24px;
    box-shadow: 0 12px 30px rgba(23, 32, 51, .06);
}
.wish-copy h2 {
    margin-bottom: 10px;
    font-size: 32px;
}
.wish-copy p:not(.eyebrow) {
    color: var(--muted);
}
.wish-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}
.wish-tags span {
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid rgba(23, 32, 51, .06);
    color: var(--text);
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 700;
}
.wish-form {
    display: grid;
    gap: 12px;
    border: 1px solid rgba(216, 224, 234, .84);
    border-radius: 8px;
    background: var(--surface);
    padding: 16px;
}
.wish-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}
.wish-form input,
.wish-form select,
.wish-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 10px 11px;
    font: inherit;
}
.wish-form textarea {
    resize: vertical;
    min-height: 128px;
}
.wish-form input:focus,
.wish-form select:focus,
.wish-form textarea:focus {
    outline: 2px solid color-mix(in srgb, var(--accent), transparent 72%);
    outline-offset: 1px;
}
.wish-form button {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    cursor: pointer;
    font-weight: 800;
}
.wish-form button:hover {
    background: color-mix(in srgb, var(--ink), var(--accent) 22%);
}
.hp-field {
    position: absolute;
    left: -9999px;
}
.form-notice {
    margin: 0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 800;
}
.form-notice.success {
    color: #0f766e;
    background: #dff8f1;
}
.form-notice.error {
    color: #b91c1c;
    background: #fee2e2;
}
.admin-container {
    max-width: 1120px;
}
.page-title {
    margin-bottom: 24px;
}
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}
.admin-tabs a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 800;
}
.admin-tabs a:hover {
    color: var(--text);
    background: var(--surface-2);
}
.admin-tabs a.active {
    border-color: color-mix(in srgb, var(--accent), transparent 48%);
    background: var(--ink);
    color: #ffffff;
}
.muted {
    color: var(--muted);
}
.small {
    font-size: 13px;
}
.notice {
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 800;
}
.notice.success {
    color: #0f766e;
    background: #dff8f1;
}
.notice.error {
    color: #b91c1c;
    background: #fee2e2;
}
.admin-panel {
    margin-top: 22px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, .82);
    padding: 20px;
    box-shadow: 0 12px 30px rgba(23, 32, 51, .06);
}
.admin-key-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}
.admin-key-grid div {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 800;
}
.admin-key-grid .ready {
    color: #0f766e;
    background: #dff8f1;
}
.admin-key-grid .missing {
    color: #b91c1c;
    background: #fee2e2;
}
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.admin-actions button,
.wish-admin-card button,
.prompt-editor button {
    min-height: 39px;
    border: 0;
    border-radius: 8px;
    padding: 8px 15px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}
.admin-actions .secondary-admin-button {
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--accent);
}
.admin-result {
    margin-top: 14px;
}
.prompt-box {
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}
.prompt-box pre {
    margin: 0;
    padding: 18px;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: Consolas, "Noto Sans TC", "Microsoft JhengHei", monospace;
    font-size: 13px;
}
.prompt-editor {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}
.prompt-editor textarea {
    width: 100%;
    min-height: 520px;
    display: block;
    resize: vertical;
    border: 0;
    border-bottom: 1px solid var(--border);
    padding: 16px;
    color: var(--text);
    background: #ffffff;
    font-family: Consolas, "Noto Sans TC", "Microsoft JhengHei", monospace;
    font-size: 13px;
    line-height: 1.7;
}
.editor-actions {
    display: flex;
    justify-content: flex-end;
    padding: 12px;
    background: var(--surface-2);
}
.empty-state {
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    margin: 0;
    padding: 18px;
    text-align: center;
}
.wish-admin-list {
    display: grid;
    gap: 10px;
}
.wish-admin-card {
    display: grid;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    padding: 14px;
}
.wish-admin-card > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}
.wish-admin-card > div span {
    color: var(--accent);
    font-weight: 800;
}
.wish-admin-card p {
    margin: 0;
}
.wish-admin-card form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.wish-admin-card select {
    min-height: 39px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 7px 10px;
    font: inherit;
}
.principles {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, .72);
    padding: 24px;
}
.principle-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}
.principle-grid div {
    border-left: 3px solid var(--accent);
    padding-left: 13px;
}
.principle-grid p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 14px;
}
.footer {
    border-top: 1px solid var(--border);
    padding: 20px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

@media (max-width: 820px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .hero { grid-template-columns: 1fr; min-height: 0; }
    .hero-copy { padding: 18px 0 0; }
    .score-panel { align-self: stretch; }
    .section-head { align-items: flex-start; flex-direction: column; }
    .admin-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .admin-tabs a {
        flex: 0 0 auto;
    }
    .lab-grid,
    .admin-key-grid,
    .principle-grid,
    .wish-section { grid-template-columns: 1fr; }
    .admin-actions,
    .wish-admin-card form {
        align-items: stretch;
        flex-direction: column;
    }
    .admin-actions button,
    .wish-admin-card select,
    .wish-admin-card button {
        width: 100%;
    }
    .lab-card p { min-height: 0; }
}
