/* Writing Practice only; other level lessons retain their existing design. */
/* REMOVED: a second declaration of nine --lp-* names.
   .level-page:has(.writing-today) used to re-declare --lp-blue, --lp-blue-dk,
   --lp-blue-soft, --lp-blue-faint, --lp-bg, --lp-ink, --lp-muted, --lp-line
   and --lp-card-line in a GREEN family, against level-page.css's BLUE family
   for the same names. This sheet never read them itself — they existed only
   to re-point level-page.css's rules, and in a browser without :has() the
   page rendered both palettes at once.
   level-page.css now declares those nine names as aliases of the shared
   theme tokens (the brand / character-area green), so the two sheets already
   agree and nothing here genuinely means something different. The :has()
   scope is kept below only for the rules that DO differ — layout, radii and
   this page's own surfaces. */
.level-page:has(.writing-today) .lp-main{max-width:1180px;margin:0 auto;padding:48px 40px 36px}
.level-page:has(.writing-today) .lp-title-row h1{font-family:var(--t-display);font-weight:500;font-size:clamp(30px,3.5vw,44px);letter-spacing:-.04em}
.level-page:has(.writing-today) .lp-kicker{letter-spacing:.2em;font-weight:600}
.level-page:has(.writing-today) .lp-sub{margin-top:14px;line-height:1.7}
.level-page:has(.writing-today) .lp-stats:empty{display:none}
.level-page:has(.writing-today) .lp-strip-head{margin-top:30px}
.level-page:has(.writing-today) .lp-strip{display:flex;flex-wrap:wrap;gap:8px;max-width:none}
.level-page:has(.writing-today) .lp-strip .lp-quiet{min-width:44px;min-height:44px;border:1px solid var(--t-line);border-radius:10px;background:var(--t-white);font-family:var(--lp-hanzi);font-size:22px;color:var(--t-area-char-ink);text-decoration:none}
.level-page:has(.writing-today) .lp-lesson{border-radius:24px;border-color:var(--t-line);box-shadow:var(--t-sh-3)}
.level-page:has(.writing-today) .lp-card-body>h2{color:var(--t-green-deep)}
.level-page:has(.writing-today) .lp-bottom{color:var(--t-muted)}
.level-page:has(.writing-today) .lp-write .lp-panel{background:var(--t-sunk);border:1px solid var(--t-line);border-radius:18px}
.level-page:has(.writing-today) .lp-panel-label{color:var(--t-muted)}
.level-page:has(.writing-today) .lp-panel-btns button{border-color:var(--t-line);box-shadow:none}
.level-page:has(.writing-today) .lp-panel-btns button:hover{background:var(--t-green-tint)}
/* alpha preserved: #456c3a17 was this page's own green at ~9%. */
.level-page:has(.writing-today) .lp-go{box-shadow:0 4px 10px rgba(var(--t-green-rgb),.09)}
.writing-today{margin:38px 0 28px;padding-top:30px;border-top:1px solid var(--t-line);color:var(--t-ink)}
.writing-today-eyebrow{font-size:10px;font-weight:600;letter-spacing:.19em;color:var(--t-muted);margin-bottom:7px}
.writing-today>h2{font-family:var(--t-display);font-size:26px;font-weight:500;letter-spacing:-.035em;line-height:1.35;margin:0}
.writing-today>p{font-size:14px;color:var(--t-muted);margin:8px 0 22px}
.writing-today-groups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
/* The four collection tiers, on the ORDINAL ramp (theme §7) instead of on
   four unrelated hues. They were green / gold / rust / blue-grey, which read
   as four categories; they are one axis — how much this collection is owed.
   Strongest step = most owed: must ▸ mistakes ▸ recommended ▸ all. Each tier
   pairs --group-soft with its matching --t-step-N-ink, which is what the
   ramp's ink tokens exist for, and --group-line takes the next step up so
   the chip keeps an edge. Identity is still carried in words by each card's
   own h3 and description — never by the colour alone. */
.writing-today-group{--group-ink:var(--t-step-4-ink);--group-soft:var(--t-step-4);--group-line:var(--t-step-4);background:var(--t-white);border:1px solid var(--t-line);border-radius:18px;padding:24px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 12px;align-content:start;align-items:center;box-shadow:var(--t-sh-1)}
.writing-today-group[data-group="recommended"]{--group-ink:var(--t-step-2-ink);--group-soft:var(--t-step-2);--group-line:var(--t-step-3)}
.writing-today-group[data-group="mistakes"]{--group-ink:var(--t-step-3-ink);--group-soft:var(--t-step-3);--group-line:var(--t-step-4)}
.writing-today-group[data-group="all"]{--group-ink:var(--t-step-1-ink);--group-soft:var(--t-step-1);--group-line:var(--t-step-2)}
.writing-today-group h3{margin:0;font-size:17px;font-weight:600;letter-spacing:-.02em;display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.writing-group-count{display:inline-flex;align-items:center;justify-content:center;min-width:27px;height:27px;padding:0 7px;border-radius:8px;background:var(--group-soft);color:var(--group-ink);font-size:12px;font-weight:600;font-variant-numeric:tabular-nums}
.writing-group-description{grid-column:1/-1;color:var(--t-muted);font-size:12px;line-height:1.5}
.writing-today-group .writing-group-characters{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:7px;align-content:flex-start;min-height:50px;margin:14px 0 0;padding-top:17px;border-top:1px solid var(--t-line-soft);line-height:1.4}
.writing-character{display:inline-flex;align-items:center;justify-content:center;width:43px;height:47px;border:1px solid var(--group-line);border-radius:8px;background:var(--group-soft);color:var(--group-ink);font-size:25px}
.writing-group-empty{font:13px/1.6 var(--lp-ui);color:var(--t-muted);padding:10px 0}
.writing-today-group button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:40px;border:1px solid var(--t-line);border-radius:9px;background:var(--t-cream);color:var(--t-area-char-ink);padding:9px 12px;font:500 12px var(--lp-ui);cursor:pointer;white-space:nowrap;transition:background .15s,border-color .15s,box-shadow .15s}
.writing-today-group button::before{content:'';width:14px;height:14px;background:currentColor;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M6 9V3h12v6M6 18H3V9h18v9h-3M6 14h12v7H6z'/%3E%3Cpath d='M17 11h1'/%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat}
/* alpha preserved: #36592d0d was a green-black at ~5%. */
.writing-today-group button:hover:not(:disabled){background:var(--t-green-tint);border-color:var(--t-action-edge);box-shadow:0 3px 9px rgba(var(--t-green-rgb),.05)}
/* Was #969e91 on #fafbf8 — 2.66:1, a deliberate contrast FAILURE used as the
   "disabled" signal. Now the theme's locked trio, so the state is carried by
   a recognisable pair rather than by being too faint to read. (The brief
   mentioned keeping "the existing opacity": this rule never had one, and the
   locked pair is what replaces the opacity-alone pattern, so none is added.) */
.writing-today-group button:disabled{color:var(--t-locked-ink);background:var(--t-locked-tint);border-color:var(--t-locked-edge);cursor:default}
/* The one focus token. It was #517749, a green — the same family this page
   now uses for "current" and for its own accents, so focused and chosen
   would have merged. */
.writing-today-group button:focus-visible{outline:2px solid var(--t-focus);outline-offset:3px}
.writing-today>[role="status"]{margin:15px 0 0;font-size:12px;color:var(--t-muted)}
@media(max-width:760px){.level-page:has(.writing-today) .lp-main{padding:30px 20px}.writing-today-groups{grid-template-columns:1fr;gap:12px}.writing-today-group{padding:20px}.writing-today{margin-top:28px;padding-top:25px}.writing-today>h2{font-size:24px}.writing-today-group button{min-height:44px}}
@media(max-width:380px){.level-page:has(.writing-today) .lp-main{padding:26px 16px}.writing-today-group{padding:16px;gap:10px 6px}.writing-today-group h3{font-size:15px;gap:6px}.writing-today-group button{padding:9px;font-size:11px}}
@media(prefers-reduced-motion:reduce){.writing-today-group button{transition:none}}

.writing-today-page .writing-today{margin-top:26px;padding-top:0;border-top:0;}
.writing-today-page .writing-today>.writing-today-eyebrow,.writing-today-page .writing-today>h2{display:none;}

/* Date-based writing history. */
.writing-history{background:var(--t-white);border:1px solid var(--t-line);border-radius:22px;padding:22px 24px;box-shadow:var(--t-sh-1);margin-bottom:28px;}
.writing-history-toolbar{display:flex;align-items:center;gap:16px;flex-wrap:wrap;}
.writing-month-nav{display:flex;align-items:center;gap:14px;margin-right:auto;}
.writing-month-nav strong{min-width:150px;text-align:center;font-size:16px;}
.writing-history button,.writing-history-retry{font:500 14px var(--lp-ui);border:1px solid var(--t-line);border-radius:999px;padding:9px 17px;min-height:42px;background:var(--t-cream);color:var(--t-green-deep);cursor:pointer;}
.writing-month-nav button{padding:0;width:42px;font-size:24px;}
.writing-history button:hover:not(:disabled){background:var(--t-green-tint);border-color:var(--t-action-edge);}
.writing-history button:disabled{opacity:.45;cursor:default;}
.writing-history button:focus-visible,.writing-history input:focus-visible{outline:2px solid var(--t-focus);outline-offset:3px;}
.writing-date-label{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--t-muted);}
.writing-date-label input{min-width:0;font:500 14px var(--lp-ui);color:var(--t-ink);border:1px solid var(--t-line);border-radius:12px;padding:10px;background:var(--t-white);}
.writing-history-dates{display:flex;flex-wrap:wrap;gap:9px;margin-top:20px;}
.writing-history-dates button{display:inline-flex;align-items:center;gap:10px;background:var(--t-white);}
.writing-history-dates button span{font-size:11px;min-width:20px;padding:2px 5px;border-radius:99px;background:var(--t-green-tint);color:var(--t-green-deep);}
.writing-history-dates button[aria-pressed="true"]{background:var(--t-green-deep);border-color:var(--t-green-deep);color:white;box-shadow:var(--t-sh-1);}
.writing-history-help,.writing-history-empty{font-size:12px;color:var(--t-muted);line-height:1.6;}
.writing-history-help{margin:16px 0 0;}
.writing-selected-date{font-family:var(--t-display);font-size:22px;font-weight:500;margin:0 0 18px;color:var(--t-ink);}
.writing-history-retry[hidden]{display:none;}
@media(max-width:600px){.writing-history{padding:18px 16px;}.writing-history-toolbar{gap:12px;}.writing-month-nav{width:100%;justify-content:space-between;margin:0;}.writing-date-label{flex:1;flex-wrap:wrap;gap:5px;}.writing-date-label input{max-width:100%;}.writing-selected-date{font-size:20px;}}

.writing-history .writing-history-dates button[aria-pressed="true"]:hover:not(:disabled){background:var(--t-green-deep);border-color:var(--t-green-deep);color:white;}
