/* Writing Practice (v2 build item 5). Classes prefixed .wr-;
   the kanji heat colour matches review.css's scoped token. */
:root{ --wr-heat:#de5b2c; }
.btn-ghost{background:var(--white);color:var(--ink);border:1.5px solid var(--lav-2)!important;box-shadow:none}
.wr-head{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;flex-wrap:wrap;margin-bottom:14px}
.wr-head .rv-chips{margin:0}
.wr-note{color:var(--muted);font-weight:700;margin:4px 0 0}
.wr-prompt-row{display:flex;gap:20px;align-items:flex-start}
.wr-prompt-row>div{flex:1;min-width:0}
.wr-reading{font-family:var(--jp);font-size:2.5rem;font-weight:700;color:var(--ink);
  white-space:nowrap;flex:none}
.wr-reading-group{display:flex;align-items:baseline;gap:14px;flex:none}
.wr-romaji{color:var(--muted);font-size:.9375rem}
.wr-desc{font-weight:600;font-size:1rem;margin:14px 0 0}
.wr-head-note{color:var(--muted);font-size:.8125rem;font-weight:600;margin-left:auto;text-align:right}
.wr-gloss{font-size:1.125rem;font-weight:800;margin:4px 0}
.wr-hear{margin-top:14px;cursor:pointer;font:inherit}
.wr-draw-card{max-width:520px}
.wr-box{position:relative;width:min(100%,340px);aspect-ratio:1;margin:6px auto;
  border:1.5px solid var(--lav-2);border-radius:var(--r-md);background:var(--white);
  background-image:linear-gradient(to right, transparent calc(50% - .5px), var(--lav-1) calc(50% - .5px), var(--lav-1) calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(to bottom, transparent calc(50% - .5px), var(--lav-1) calc(50% - .5px), var(--lav-1) calc(50% + .5px), transparent calc(50% + .5px));}
.wr-guide{position:absolute;inset:0;display:grid;place-items:center;
  font-family:var(--jp);font-size:11rem;line-height:1;color:var(--wr-heat);pointer-events:none;user-select:none}
.wr-canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:crosshair}
.wr-hint{text-align:center;color:var(--muted);margin-top:10px}
.wr-hint-1{font-weight:600;font-size:.8125rem;margin:0}
.wr-hint-2{font-size:.8125rem;margin:2px 0 0}
.wr-controls{display:flex;gap:10px;flex-wrap:wrap;justify-content:center;margin-top:8px}
.wr-controls .btn{cursor:pointer;font:inherit}
.wr-controls .btn:disabled{opacity:.45;cursor:default;box-shadow:none}
.wr-verdict{margin-top:14px;text-align:center}
.wr-ok{color:#1e7a46;font-weight:800;font-size:1.0625rem}
.wr-bad{color:#7c1d12;font-weight:800;font-size:1.0625rem}

/* Board layout (Penpot Study / Writing): the 880 study column —
   prompt card, then draw card 440 beside the checked/after cards,
   controls as one row under both. */
.wr{max-width:880px}
.wr .card{border-radius:24px}
.wr-main{display:flex;gap:24px;align-items:flex-start;margin-top:24px}
.wr-draw-card{flex:0 0 440px;padding:32px;border-radius:24px}
.wr-box{width:min(100%,376px)}
.wr-side{flex:1;min-width:0;display:grid;gap:24px}
.wr-side .how{background:var(--lav-1);border:0;border-radius:20px;display:block}
.wr-side .sec-label{color:var(--muted)}
.wr-side .wr-how .sec-label{color:var(--violet)}
.wr-how-line{font-size:.9375rem;font-weight:600;margin:0 0 12px}
.wr-side .how .blurb{font-size:.8125rem}
.wr .wr-after{border-radius:20px}
.wr-after-label{color:var(--muted)}
.wr-sample{border-radius:12px;padding:14px 16px;font-size:.875rem;font-weight:700;margin-top:10px}
.wr-sample-ok{background:#e2f3e8;color:#1e7a46}
.wr-sample-bad{background:#fbeae4;color:#c2432b}
.wr-sample-line{margin:0;font-weight:700}
.wr-sample-sub{margin:4px 0 0;font-size:.75rem;font-weight:400;color:var(--ink)}
.wr-prompt-row .wr-hear{margin-left:auto;flex:none;width:128px;height:44px;min-height:44px;border-radius:12px;
  background:var(--lav-1);color:var(--violet);border:0;font-weight:700;padding:0}
.wr-controls{display:flex;gap:16px;margin-top:24px;justify-content:flex-start}
.wr-controls .btn{height:56px;border-radius:16px;display:grid;place-items:center;padding:0}
.wr-controls .btn-ghost{flex:0 0 200px;background:var(--white)}
.wr-controls .btn-violet{flex:1;box-shadow:0 4px 0 var(--violet-deep)}
.wr-verdict{margin-top:16px;text-align:left}
.wr-ok{background:#e2f3e8;color:#1e7a46;border-radius:12px;padding:14px 16px;font-size:.9375rem}
.wr-bad{background:#fbeae4;color:#c2432b;border-radius:12px;padding:14px 16px;font-size:.9375rem}
@media (max-width:900px){.wr-main{flex-direction:column}.wr-draw-card{flex:1;width:100%}}
@media (max-width:640px){
  /* The prompt row wraps: reading + gloss share the first line
     at a readable width, the Hear button drops to its own line.
     In one row the button's 128px left the gloss ~60px — one
     word per line. */
  .wr-prompt-row{flex-wrap:wrap}
  .wr-prompt-row>div{flex:1 1 160px}
  .wr-hear{order:3;margin-top:4px}
}

/* Phones, per the mobile board: the prompt leaves its card, the
   explainer cards move below the controls, and the controls are
   Clear/Undo halves over a full-width Check. */
@media (max-width:640px){
  .wr{display:flex;flex-direction:column}
  .wr-main{display:contents}
  .wr-prompt{background:none;border:0;padding:0}
  .wr-draw-card{order:3}
  .wr-controls{order:4;flex-wrap:wrap}
  .wr-controls .btn-ghost{flex:1 1 40%}
  .wr-controls .btn-violet{flex:1 1 100%;order:3}
  .wr-verdict{order:5}
  .wr-side{order:6;width:100%}
  .wr-head-note{display:none}
}

/* The shared drawing surface (drawbox.js, 2026-11-18): an SVG
   layer (ghost, guides, snapped strokes) under a canvas that
   carries the raw strokes. Hosts own the stage background. */
.db-box{position:relative;width:100%;aspect-ratio:1/1;border-radius:16px;overflow:hidden}
.db-svg{position:absolute;inset:0;width:100%;height:100%}
.db-canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:crosshair}
