@font-face {
    font-family: "Playwrite US Trad";
    src: url("fonts/playwrite-us-trad.woff2") format("woff2");
    font-weight: 100 400;
    font-display: block;
}
@font-face {
    font-family: "Playwrite US Modern";
    src: url("fonts/playwrite-us-modern.woff2") format("woff2");
    font-weight: 100 400;
    font-display: block;
}

:root {
    --prussian: #1b3a5c;
    --indigo: #2c4a6e;
    --cream: #f5ecd7;
    --rice: #ede3ca;
    --ochre: #c4923a;
    --vermillion: #c53d2d;
    --ink: #2a1f14;
    --bark: #5c3d2e;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Hiragino Mincho ProN", serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 16px/1.5 var(--serif); }

.masthead {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: .7rem 1.4rem; background: var(--prussian); color: var(--cream); border-bottom: 2px solid var(--ochre);
}
.brand { display: flex; align-items: baseline; gap: .8rem; }
.kanji { font-size: 1.7rem; font-weight: 700; letter-spacing: .12em; }
.brand-text { font-size: .85rem; letter-spacing: .28em; text-transform: uppercase; color: var(--rice); opacity: .85; }
.progress { font-size: .9rem; color: var(--rice); }
.progress b { color: var(--ochre); font-size: 1.15rem; }

.layout { display: flex; gap: 1.5rem; align-items: flex-start; padding: 1.5rem; }
.panel { width: 300px; flex-shrink: 0; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
.panel section { background: var(--rice); border: 1px solid rgba(180, 165, 135, .5); box-shadow: 3px 3px 0 rgba(42, 31, 20, .08); padding: 1rem 1.1rem; margin-bottom: 1rem; position: relative; }
.panel section::before { content: ""; position: absolute; left: 0; top: 0; width: 4px; height: 100%; background: var(--vermillion); }
.panel h2 { margin: 0 0 .6rem; font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; color: var(--vermillion); }

.lesson-nav { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.lesson-name { flex: 1; text-align: center; line-height: 1.25; }
.lesson-name b { display: block; font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; color: var(--bark); font-weight: 600; }
.lesson-name span { font-size: 1.15rem; color: var(--prussian); }
.buttons { display: flex; gap: .4rem; margin-top: .4rem; }
.buttons button { flex: 1; }

button, select, input[type="text"] {
    font: inherit; font-size: .9rem; color: var(--ink); background: var(--cream);
    border: 1px solid rgba(92, 61, 46, .4); border-radius: 2px; padding: .35rem .6rem;
}
button { cursor: pointer; transition: background .2s, color .2s; }
button:hover { background: #fff8e6; border-color: var(--ochre); }
button.primary { background: var(--prussian); color: var(--cream); border-color: var(--prussian); }
button.primary:hover { background: var(--indigo); }
button.is-done { background: var(--ochre); border-color: var(--ochre); color: var(--ink); }
.lesson-nav button { font-size: 1.2rem; line-height: 1; padding: .2rem .6rem; }

label { display: block; font-size: .82rem; color: var(--bark); margin-top: .55rem; }
label select, label input[type="text"] { display: block; width: 100%; margin-top: .15rem; }
label.check { display: flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--ink); }
.hint { font-size: .8rem; color: var(--bark); font-style: italic; margin: .35rem 0 0; line-height: 1.4; }
.advice ol { margin: 0; padding-left: 1.1rem; font-size: .88rem; line-height: 1.45; }
.advice li { margin-bottom: .4rem; }

/* ---------- the printable sheet (all sizes in millimetres) ---------- */
#sheets { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.sheet { background: #fff; box-shadow: 0 2px 14px rgba(42, 31, 20, .18); padding: 12mm; color: #1d2430; overflow: hidden; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6mm; height: 21mm; overflow: hidden; border-bottom: .3mm solid #1b3a5c; margin-bottom: 2mm; }
.sheet-title { font: 600 5.2mm/1.2 var(--serif); color: #1b3a5c; }
.sheet-title small { font-size: 3mm; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; color: #c53d2d; display: block; }
.sheet-tip { font: italic 3.1mm/1.35 var(--serif); color: #4a5262; margin-top: 1mm; max-width: 125mm; }
.sheet-meta { font: 3mm/1.9 var(--serif); color: #4a5262; white-space: nowrap; text-align: right; }
.sheet-meta i { display: inline-block; width: 30mm; border-bottom: .2mm solid #8894a8; }
.sheet svg { display: block; }
.sheet-foot { height: 11mm; overflow: hidden; margin-top: 1.5mm; padding-top: 1.5mm; border-top: .2mm solid #b9c2d0; font: 2.9mm/1.5 var(--serif); color: #4a5262; }
.sheet-foot b { color: #1b3a5c; }
.box { display: inline-block; width: 2.6mm; height: 2.6mm; border: .25mm solid #4a5262; vertical-align: -0.4mm; margin: 0 1mm 0 2.5mm; }

@media (max-width: 1150px) {
    .layout { flex-direction: column; }
    .panel { width: 100%; position: static; max-height: none; }
    #sheets { width: 100%; overflow-x: auto; align-items: flex-start; }
}

@media print {
    body { background: #fff; }
    .masthead, .panel { display: none !important; }
    .layout { display: block; padding: 0; }
    #sheets { display: block; }
    .sheet { box-shadow: none; padding: 0; margin: 0; break-after: page; }
    .sheet:last-child { break-after: auto; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
