:root {
    color-scheme: light;
    --ink: #172a22;
    --muted: #52635a;
    --paper: #f5f6ef;
    --white: #fff;
    --line: #dce5d8;
    --forest: #184834;
    --mint: #e6f0e2;
    --lime: #d9f293;
    --radius: 22px;
    font: 16px/1.5 system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; }
button, input, textarea { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #477f56; outline-offset: 3px; }
.top { background: var(--paper); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-inner, .wrap { max-width: 1080px; margin: auto; padding-inline: max(24px, env(safe-area-inset-left), env(safe-area-inset-right)); }
.top-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; gap: 13px; align-items: center; font-weight: 780; text-decoration: none; letter-spacing: -.025em; }
.mark { position: relative; display: inline-block; flex: 0 0 35px; width: 35px; height: 35px; border-radius: 12px; background: var(--forest); color: var(--lime); }
.mark::before, .mark::after { content: ''; position: absolute; width: 12px; height: 15px; border: 1.5px solid currentColor; border-radius: 3px; top: 9px; left: 10px; }
.mark::before { transform: translate(-2px, 1px) rotate(-17deg); }
.mark::after { transform: translate(2px, -1px) rotate(12deg); background: var(--forest); }
.account { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account span { overflow: hidden; text-overflow: ellipsis; font-size: .86rem; color: var(--muted); }
.wrap { padding-top: 40px; padding-bottom: max(48px, env(safe-area-inset-bottom)); }
.auth { max-width: 530px; margin-top: clamp(0px, 7vh, 85px); }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.auth-panel, .narrow { padding: clamp(22px, 5vw, 42px); }
.narrow { max-width: 690px; }
.hero { background: var(--forest); color: var(--white); border-radius: 28px; padding: clamp(26px, 5vw, 48px); display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.7rem, 3.8vw, 2.8rem); line-height: 1.12; letter-spacing: -.043em; }
h2 { font-size: 1.22rem; letter-spacing: -.022em; }
h3 { font-size: 1.07rem; }
.hero p { margin-top: 10px; color: #e2eee7; }
.muted { color: var(--muted); }
.button, button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 9px 16px; border: 1px solid transparent; border-radius: 12px; font-weight: 680; text-decoration: none; cursor: pointer; }
.primary { background: var(--forest); color: white; }
.primary:hover { background: #245c43; }
.hero .primary { color: var(--ink); background: var(--lime); }
.hero .primary:hover { background: #e4f8ad; }
.secondary { background: var(--mint); color: var(--ink); }
.secondary:hover { background: #d9ead4; }
.quiet { color: var(--forest); background: transparent; }
.quiet:hover { background: var(--mint); }
.danger { color: #8d2923; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 255px), 1fr)); gap: 16px; }
.deck-tile { text-decoration: none; display: grid; align-content: start; gap: 7px; }
.deck-tile:hover { border-color: #8eaa8a; }
.tile-icon { margin-bottom: 4px; }
.new-deck { display: grid; gap: 9px; align-content: start; background: #f9fbf6; border-style: dashed; }
.new-deck label { font-size: 1.13rem; }
.new-deck button, .form-stack > button { justify-self: start; }
.form-stack { display: grid; gap: 17px; margin-top: 20px; }
label, legend { font-weight: 650; }
input:not([type=hidden], [type=checkbox], [type=radio]), textarea { display: block; width: 100%; margin-top: 5px; background: #fbfcfa; color: var(--ink); border: 1px solid #aebdad; border-radius: 10px; padding: 10px 12px; min-height: 44px; }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: var(--forest); width: 18px; height: 18px; flex: 0 0 18px; margin: 2px 0 0; }
fieldset { margin: 0; border: 0; padding: 0; min-width: 0; }
legend { margin-bottom: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; background: #f7faf4; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.choice:last-child { margin-bottom: 0; }
.auth-panel > p, .narrow > .muted, .narrow > .button { margin-top: 16px; }
.back { display: inline-block; margin-bottom: 16px; color: var(--forest); font-weight: 680; text-decoration: none; }
.back:hover { text-decoration: underline; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr)); gap: 12px; align-items: start; margin-bottom: 12px; }
.compact { padding: 14px 18px; }
.compact summary { font-weight: 680; cursor: pointer; }
.compact .form-stack { margin-top: 10px; }
.card-list { display: grid; gap: 8px; }
.card-row { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.card-row p { margin-top: 5px; }
.empty { padding: 20px 0; color: var(--muted); }
.delete-form { margin-top: 18px; }
.feedback { background: var(--mint); border-radius: 10px; padding: 10px 13px; margin-bottom: 14px; }
.feedback.error { background: #fae9e6; color: #80251d; }
.form-stack .feedback { margin-bottom: 0; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.eyebrow, .test-meta { color: var(--muted); font-weight: 680; margin-bottom: 12px; }
.reveal { margin-top: 20px; }
.reveal summary { width: max-content; max-width: 100%; list-style: none; }
.reveal summary::-webkit-details-marker { display: none; }
.reveal[open] summary { background: var(--mint); color: var(--ink); }
.answer { margin: 15px 0; background: #f1f7ed; padding: 18px; border-radius: 13px; font-size: 1.12rem; }
.rating { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.rating button { flex-direction: column; gap: 2px; padding-inline: 5px; }
.rating small { color: var(--muted); }
.test-meta { display: flex; justify-content: space-between; gap: 8px; }
progress { display: block; width: 100%; height: 10px; accent-color: var(--forest); margin-bottom: 24px; }
.response, blockquote { margin: 0; padding: 14px; border-radius: 12px; background: #f4f6f1; }
blockquote { margin-top: 10px; }
.response h2 { font-size: .92rem; color: var(--muted); }
.response.correct { background: var(--mint); }
.score { font-size: 2.6rem; font-weight: 760; margin-top: 10px; }
@media (max-width: 560px) {
    .top-inner, .wrap { padding-inline: max(16px, env(safe-area-inset-left), env(safe-area-inset-right)); }
    .wrap { padding-top: 25px; }
    .top-inner { min-height: 62px; }
    .account span { display: none; }
    .rating { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card-row { flex-direction: column; }
    .card-row .quiet { padding-inline: 0; }
}
