/* 習字の机を真上から見る。持ち主は ux。大きさは sprint/ux.md の「机の構図」。光は左上から1つ */
:root {
  --sumi: #16120f;
  --washi: #f4efe2;
  --felt: #1f2a3c;
  --desk: #4a3022;
  --shu: #d4402a;
  --kin: #b89a55;
  --h-head: 40px;
  --h-top: 100px;
  --h-foot: 104px;
  --h-credit: 28px;
  --mat-pad-top: 14px;
  --paper-w: min(calc(100vw - 28px), calc((100dvh - var(--h-head) - var(--h-top) - var(--h-foot) - var(--h-credit) - 30px) * 1000 / 1376));
}
@media (max-height: 719px) {
  :root { --h-head: 36px; --h-top: 80px; --h-foot: 80px; --h-credit: 24px; }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  --light: linear-gradient(152deg, rgba(255, 222, 176, .17), rgba(0, 0, 0, 0) 42%, rgba(10, 4, 0, .42));
  background-color: var(--desk);
  background-image: var(--light);
  color: var(--washi);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.desk { height: 100dvh; display: flex; flex-direction: column; align-items: center; }
.head, .top, .foot { width: 100%; max-width: 560px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; }
.head { height: var(--h-head); flex: none; letter-spacing: .08em; display: grid; grid-template-columns: 1fr auto 1fr; }
.head > :first-child { justify-self: start; }
.head-end { justify-self: end; display: flex; gap: 6px; }
.chip.sound { min-width: 38px; position: relative; font-size: 15px; }
.chip.sound[aria-pressed="false"] span { opacity: .55; }
.chip.sound[aria-pressed="false"]::after { content: ""; position: absolute; left: 11px; right: 11px; top: calc(50% - 1px); border-top: 1.5px solid #ff9d86; transform: rotate(-45deg); }
.toggles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 560px; margin: 22px auto 0; }
.toggles .chip { min-height: 36px; }
.toggles .chip[aria-pressed="true"] { background: rgba(120, 34, 16, .8); border-color: #f0a48f; }
.r-stage #r-petals { pointer-events: none; }.top { height: var(--h-top); flex: none; }
.foot { flex: 1; min-height: var(--h-foot); padding-left: 96px; }
.small { font: 12px/1.4 system-ui, sans-serif; text-wrap: balance; word-break: auto-phrase; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
.chip { background: rgba(0, 0, 0, .28); border: 1px solid rgba(244, 239, 226, .3); border-radius: 6px; padding: 4px 10px; font-size: 13px; min-width: 56px; }

/* お手本の札（半紙の外）、今日の一字と一行、右上の穂 */
.card-slot { width: calc((var(--h-top) - 8px) * .75); flex: none; }
.card-button { display: flex; flex-direction: column; width: 100%; height: calc(var(--h-top) - 8px); border: 0; background: #e9dfc6; border-radius: 3px; box-shadow: 1px 1px 0 #b9ab8c, 3px 4px 8px rgba(0, 0, 0, .45); transform: rotate(-1.2deg); }
.card { display: block; width: 100%; flex: 1; min-height: 0; border-radius: 3px 3px 0 0; }
/* 札が押せる事の手がかり。札の大きさは変えず、下の端に朱の小さな帯 */
.card-hint { display: block; flex: none; margin: 1px 3px 3px; border-radius: 3px; background: var(--shu); color: #fff8ec; font: 700 10px/15px system-ui, sans-serif; text-shadow: none; text-align: center; white-space: nowrap; overflow: hidden; box-shadow: 0 1px 2px rgba(60, 20, 0, .45); }
@media (max-height: 719px) {
  .card-hint { font-size: 9px; line-height: 13px; margin: 0 2px 2px; }
}
.today { flex: 1; text-align: center; min-width: 0; }
.today p:first-child { font-size: 16px; line-height: 20px; }
.today .small { line-height: 15px; }
.next { display: flex; align-items: center; justify-content: center; gap: 4px; color: #ffcdbb; min-height: 20px; }
.next canvas { width: 20px; height: 20px; flex: none; }
.next canvas[hidden] { display: none; }
.line { min-height: 30px; white-space: pre-line; }
.line.strong { font-size: 13px; }
@media (max-height: 719px) {
  .today p:first-child { font-size: 15px; line-height: 18px; }
  .today .small { font-size: 11px; line-height: 14px; }
  .next { min-height: 16px; }
  .next canvas { width: 16px; height: 16px; }
  .line { min-height: 28px; }
}
.gauge { display: flex; flex-direction: column; align-items: center; width: 50px; flex: none; padding: 3px 0 1px; border-radius: 3px; background: linear-gradient(155deg, #ded4bc, #b9ac8f); box-shadow: 3px 4px 8px rgba(0, 0, 0, .45); color: #2a2018; text-shadow: none; }
.gauge canvas { width: 32px; height: calc(var(--h-top) - 28px); }
.gauge.low { animation: low 1.8s ease-in-out infinite; }
@keyframes low {
  50% { box-shadow: 0 0 0 2px var(--shu), 0 0 14px 3px rgba(212, 64, 42, .7); }
}

/* 大きく開いた札。札の位置から下へ開く */
.model { position: fixed; z-index: 5; padding: 8px 8px 6px; text-align: center; color: #2a2018; text-shadow: none; background: linear-gradient(155deg, #fdf9ee, #e4d9bd); border-radius: 4px; box-shadow: 0 0 0 1px rgba(150, 120, 70, .5), 8px 12px 26px rgba(0, 0, 0, .6); cursor: pointer; transform-origin: top left; animation: unfold .18s ease-out; }
.model[hidden] { display: none; }
.model canvas { display: block; width: 100%; aspect-ratio: 3 / 4; margin: 4px 0; }
@keyframes unfold {
  from { transform: scale(.4); opacity: .3; }
}
.fatal { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; background: rgba(30, 18, 10, .94); }
.fatal[hidden] { display: none; }

/* 下敷き、半紙、文鎮 */
.mat {
  --light: linear-gradient(150deg, rgba(150, 170, 215, .13), rgba(0, 0, 0, 0) 45%, rgba(0, 0, 8, .3));
  position: relative;
  flex: none;
  width: calc(var(--paper-w) + 20px);
  padding: var(--mat-pad-top) 10px 10px;
  background-color: var(--felt);
  background-image: var(--light);
  border-radius: 3px;
  box-shadow: 5px 8px 16px rgba(0, 0, 0, .5), inset 1px 1px 0 rgba(160, 180, 220, .18);
}
.mat::before { content: ""; position: absolute; inset: 3px; border: 1px dashed rgba(150, 172, 214, .24); border-radius: 2px; pointer-events: none; }
.paper { position: relative; width: var(--paper-w); aspect-ratio: 1000 / 1376; touch-action: none; cursor: crosshair; box-shadow: 2px 3px 7px rgba(0, 0, 0, .45); }
.paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* 黒鉄の文鎮。半紙の上の辺にまたがり、半紙にかかるのは高さの 3% まで */
.weight {
  position: absolute;
  top: 3px;
  left: 17%;
  right: 17%;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(180deg, #55524f 0, #8b8782 16%, #3a3735 34%, #1b1918 68%, #0b0a09 90%, #2b2826 100%);
  box-shadow: 4px 6px 7px rgba(0, 0, 0, .45);
  pointer-events: none;
}
.weight::after {
  content: "";
  position: absolute;
  left: calc(50% - 11px);
  top: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #b9b4ac 0, #5b5753 20%, #24211f 55%, #0a0908 100%);
  box-shadow: 3px 4px 5px rgba(0, 0, 0, .5);
}

/* 手前の段: 左の 96px は感想の部品。硯と筆置き、朱の印の形の「書き上げ」 */
.suzuri-slot { flex: 1; display: flex; justify-content: center; min-width: 0; }
.suzuri { position: relative; width: 100%; max-width: 220px; height: min(112px, var(--h-foot)); border: 0; background: none; }
.suzuri canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* まだ墨をつけていない硯は、ゆっくり光って呼ぶ */
.suzuri::before { content: ""; position: absolute; inset: 12% 22% 12% 6%; border-radius: 40%; background: radial-gradient(ellipse, rgba(255, 224, 170, .5), rgba(255, 224, 170, 0) 70%); transform: scale(1.35); animation: calls 2.6s ease-in-out infinite; }
.suzuri.lidded { cursor: default; }
.suzuri.lidded::before { display: none; }
@keyframes calls {
  0%, 100% { opacity: .25; }
  50% { opacity: 1; }
}
.finish { width: 68px; height: 68px; flex: none; padding: 8px; border: 0; background: center / 100% 100% no-repeat; font-size: 15px; font-weight: 600; line-height: 1.25; letter-spacing: .04em; filter: drop-shadow(4px 5px 4px rgba(0, 0, 0, .5)); transform: rotate(-1.5deg); }
.finish span { display: block; white-space: pre-line; }
.finish:active { transform: rotate(-1.5deg) scale(.95); }
.finish.pulse { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse {
  50% { transform: rotate(-1.5deg) scale(1.12); filter: drop-shadow(0 0 10px rgba(255, 150, 120, .9)); }
}
@media (prefers-reduced-motion: reduce) {
  .suzuri::before, .gauge.low, .model { animation: none; }
}
/* 押せる幅は字の幅だけ。左右の 46px は感想の部品の場所なので、長い文は2行に折る */
.credit { height: var(--h-credit); flex: none; width: fit-content; max-width: calc(100% - 92px); overflow: hidden; border: 0; background: none; font: 10px/12px system-ui, sans-serif; opacity: .72; text-align: center; text-wrap: balance; padding: 0 2px; text-decoration: underline; text-underline-offset: 2px; }

/* 画面2（掛け軸と講評）と画面3（作品帳）。暗い土壁。下の帯の左 96px は感想の部品の場所 */
.screen { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; height: 100dvh; }
.screen[hidden], .screen [hidden] { display: none !important; }
.wall { position: absolute; inset: 0; z-index: -1; background-color: #7c6b55; }
.r-head { height: 40px; flex: none; display: grid; grid-template-columns: 84px 1fr 84px; align-items: center; gap: 6px; padding: 0 10px; }
.r-head h1 { font-size: 16px; font-weight: 500; letter-spacing: .08em; text-align: center; white-space: nowrap; }
.r-side { display: flex; align-items: center; }
.r-side.end { justify-content: flex-end; }
.r-scroll { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(244, 239, 226, .35) transparent; }
.r-stagebox { height: 53vh; height: 53dvh; display: flex; justify-content: center; align-items: flex-start; }
.r-stage { position: relative; flex: none; }
.r-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.r-stage #r-detail { pointer-events: none; }
/* 講評の印は札と同じ四角。画の番号（丸と素の数字）や先生の朱の丸と形で分ける */
.num { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 3px; border: 2px solid var(--shu); background: #fbf6ea; color: #b52c16; font: 700 15px/1 system-ui, sans-serif; text-shadow: none; box-shadow: 1px 2px 4px rgba(0, 0, 0, .4); }
.num[aria-pressed="true"] { background: var(--shu); color: #fff8ec; border-color: #fff3e2; transform: scale(1.18); }
.r-text { width: 100%; max-width: 560px; margin: 0 auto; padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.verdict { font-size: 17px; text-align: center; line-height: 1.4; text-wrap: balance; word-break: auto-phrase; }
.guide { text-align: center; white-space: pre-line; opacity: .92; }
/* 印の理由の一行。頭の図は掛け軸の上の印と同じ形（四隅の鉤。形の外れは線） */
.reason { width: 100%; display: flex; gap: 9px; align-items: center; text-align: left; padding: 7px 10px; border: 1px solid #f0a48f; border-radius: 4px; background: rgba(112, 30, 12, .86); font-size: 14px; font-weight: 600; line-height: 1.4; word-break: auto-phrase; box-shadow: 2px 3px 7px rgba(0, 0, 0, .35); }
.reason[aria-pressed="true"] { background: #b1311a; border-color: #fff3e2; box-shadow: 0 0 0 2px rgba(255, 214, 180, .55), 0 0 16px rgba(255, 190, 130, .65); }
.reason-mark { flex: none; width: 20px; height: 20px; border-radius: 2px; --c: #fff3e2;
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / 7px 3px, linear-gradient(var(--c), var(--c)) 0 0 / 3px 7px,
    linear-gradient(var(--c), var(--c)) 100% 0 / 7px 3px, linear-gradient(var(--c), var(--c)) 100% 0 / 3px 7px,
    linear-gradient(var(--c), var(--c)) 0 100% / 7px 3px, linear-gradient(var(--c), var(--c)) 0 100% / 3px 7px,
    linear-gradient(var(--c), var(--c)) 100% 100% / 7px 3px, linear-gradient(var(--c), var(--c)) 100% 100% / 3px 7px;
  background-repeat: no-repeat; }
.reason[data-kind="offShape"] .reason-mark { height: 4px; background: var(--c); }
.reason[data-code="offShapeMissing"] .reason-mark { background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px); }
.comments { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.comments li { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
.comments li.shown { opacity: 1; transform: none; }
.slip { width: 100%; display: flex; gap: 9px; align-items: flex-start; text-align: left; padding: 9px 11px; border: 2px solid transparent; border-radius: 3px; background: linear-gradient(165deg, #fbf7ea, #e9dfc4); color: #241a12; text-shadow: none; font-size: 14px; line-height: 1.5; box-shadow: 2px 3px 7px rgba(0, 0, 0, .35); word-break: auto-phrase; }
.slip[aria-pressed="true"] { border-color: var(--shu); box-shadow: 0 0 0 2px rgba(255, 214, 180, .55), 0 0 16px rgba(255, 190, 130, .65); }
.slip-no { flex: none; width: 21px; height: 21px; border-radius: 3px; border: 2px solid var(--shu); background: #fbf6ea; color: #b52c16; font: 700 12px/17px system-ui, sans-serif; text-align: center; }
.slip[aria-pressed="true"] .slip-no { background: var(--shu); color: #fff8ec; }
/* 下に続きがある時だけ、帯のすぐ上に出す */
.r-more-slot { flex: none; position: relative; height: 0; z-index: 1; }
.r-more { position: absolute; right: 8px; bottom: 4px; padding: 4px 12px; border-radius: 14px; border: 1px solid #f0a48f; background: rgba(40, 18, 8, .94); font: 700 12px/16px system-ui, sans-serif; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
/* 理由の一行や3つの講評がある縦の画面で、「朱を隠す」まで帯の上に収める */
@media (min-height: 720px) and (orientation: portrait) {
  .r-stagebox { height: 46vh; height: 46dvh; }
  .r-scroll:has(.ends) .r-stagebox { height: 45vh; height: 45dvh; }
}
/* 背の低い縦の画面は、掛け軸を少し小さくして講評を3つとも出す */
@media (max-height: 719px) and (orientation: portrait) {
  .r-stagebox { height: 39vh; height: 39dvh; }
  .r-text { gap: 5px; padding: 2px 10px 10px; }
  .verdict { font-size: 15px; line-height: 1.3; }
  .guide { font-size: 11px; line-height: 14px; }
  .comments { gap: 4px; }
  .slip { font-size: 13px; line-height: 1.35; padding: 5px 9px; }
  .reason { font-size: 13px; line-height: 1.3; padding: 4px 9px; }
}
#r-hide { align-self: center; }
.note { padding: 7px 10px; border-radius: 4px; background: rgba(60, 14, 4, .6); text-align: center; }
.status { flex: none; display: flex; gap: 8px; align-items: center; justify-content: center; padding: 5px 10px; background: rgba(20, 11, 4, .82); }
.status .chip { flex: none; }
.r-bar { flex: none; min-height: 64px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)) 96px; background: linear-gradient(180deg, #3d291c, #24170e); box-shadow: 0 -3px 10px rgba(0, 0, 0, .35); }
.act { flex: 1 1 0; min-width: 0; max-width: 190px; min-height: 48px; padding: 4px 5px; border-radius: 6px; border: 1px solid rgba(244, 239, 226, .38); background: rgba(244, 239, 226, .09); font-size: 13px; line-height: 1.3; text-wrap: balance; word-break: auto-phrase; }
.act.primary { background: linear-gradient(155deg, #dc4c32, #a92c18); border-color: #f0a48f; font-size: 15px; font-weight: 600; }
/* 保存の1枚に講評の印が入らない事を、ボタンのすぐ上で言う。帯の高さはほとんど増やさない */
.r-actions { flex-wrap: wrap; align-content: center; row-gap: 3px; padding-top: 4px; padding-bottom: calc(5px + env(safe-area-inset-bottom, 0px)); }
.r-actions .act { min-height: 44px; }
.save-note { flex: 0 0 100%; text-align: center; font: 10.5px/13px system-ui, sans-serif; opacity: .9; text-wrap: balance; word-break: auto-phrase; }
/* 終わり方の2つの絵（お手本の終わりの形と、この1枚の終わりの形） */
.reason-body, .slip-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
#r-reason-ends:empty { display: none; }
.ends { display: flex; gap: 8px; }
.end { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 6px; }
.end canvas { flex: none; width: 40px; height: 36px; border-radius: 3px; box-shadow: 1px 1px 3px rgba(0, 0, 0, .4); }
.end-words { display: flex; flex-direction: column; font: 11px/1.3 system-ui, sans-serif; }
.end-words b { font-size: 10px; opacity: .8; }
@media (max-height: 719px) and (orientation: portrait) {
  .reason-body, .slip-body { gap: 2px; }
  .end canvas { width: 31px; height: 28px; }
  /* 絵が増えた分は掛け軸を少し詰めて、「朱を隠す」まで帯の上に出す */
  .r-scroll:has(.ends) .r-stagebox { height: 36vh; height: 36dvh; }
}
.compare { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 4px; background: rgba(24, 14, 6, .55); }
.compare h2, .sources h2 { font-size: 14px; font-weight: 600; text-align: center; letter-spacing: .08em; }
.pair { display: flex; justify-content: center; gap: 22px; }
.pair figure { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mini-row { display: flex; align-items: flex-end; gap: 4px; }
.mini { width: 104px; height: auto; }
.wick { width: 26px; height: 84px; }
.pair figcaption { display: flex; flex-direction: column; text-align: center; font: 12px/1.45 system-ui, sans-serif; }
.changes { list-style: none; width: 100%; max-width: 300px; align-self: center; font: 12px/1.4 system-ui, sans-serif; }
.changes li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 4px; border-top: 1px solid rgba(244, 239, 226, .16); }
.changes li.up span:last-child { color: #ffab94; font-weight: 700; }

/* 墨を減らす挑戦の段の小さい朱の札 */
.shu-tag { display: inline-block; padding: 0 6px; border-radius: 3px; border: 1px solid #f6c3b3; background: var(--shu); color: #fff8ec; font: 700 11px/15px system-ui, sans-serif; text-shadow: none; white-space: nowrap; vertical-align: middle; }
.shu-tag[hidden] { display: none; }

/* 画ごとの墨の帯。掛け軸のすぐ下。墨の区切りは2色を交互、残りは半紙の色、いちばん食った画に朱の縁 */
.r-ink { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 7px 8px 6px; border-radius: 4px; background: rgba(24, 14, 6, .72); }
.ink-stage { align-self: center; }
.ink-bar { display: flex; flex-direction: column; gap: 4px; }
.ink-track { display: flex; align-items: stretch; gap: 1px; height: 24px; padding: 3px; border-radius: 3px; background: #8f8267; }
.ink-seg { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 3px; padding: 0; border: 0; border-radius: 1px; color: #f4efe2; font: 700 11px/1.1 system-ui, sans-serif; text-shadow: none; }
.ink-seg.odd { background: #15100c; }
.ink-seg.even { background: #4b4037; }
.ink-seg.left { background: #f7f2e4; color: #2a2018; }
.ink-seg.heavy { box-shadow: 0 0 0 3px #e8452b; z-index: 1; }
.ink-seg.missing { background: rgba(247, 242, 228, .22); border: 1.5px dashed #fff3e2; }
/* お手本の配分の目安: 墨色の細い縦線（墨の区切りの上でも見えるように紙の色の縁）。名指した画だけ朱 */
.ink-fair { position: absolute; top: -3px; bottom: -4px; width: 2px; margin-left: -1px; z-index: 3; background: #15100c; box-shadow: 0 0 0 .75px rgba(244, 239, 226, .8); pointer-events: none; }
.ink-fair.named { top: -5px; bottom: -6px; width: 3px; margin-left: -1.5px; background: #ff4a2c; box-shadow: 0 0 0 1px #fff8ec; }
.ink-guide { white-space: pre; }
.ink-legend { font-size: 10px; line-height: 13px; opacity: .8; }
.num.faint { opacity: .5; }
/* 背の低い画面は掛け軸が小さいので、番号の札も小さくする（字を隠さない） */
@media (max-height: 700px) { .num { width: 21px; height: 21px; margin: -10.5px 0 0 -10.5px; font-size: 12.5px; } }
/* 墨が回らなかった画: 朱の破線（使いすぎた画の朱の縁と対） */
.ink-seg.short { min-width: 9px; outline: 2.5px dashed #ff6a4d; outline-offset: 1.5px; z-index: 1; }
.ink-seg[aria-pressed="true"] { background: var(--shu); }
button.ink-seg::after { content: ""; position: absolute; inset: -8px 0; }
.ink-check { display: inline-block; width: 15px; height: 15px; border-radius: 50%; background: #fbf6ea; color: #c42d15; font: 900 12px/15px system-ui, sans-serif; text-align: center; font-style: normal; }
.ink-seg .ink-check { position: absolute; right: -6px; top: 50%; margin-top: -8px; z-index: 2; box-shadow: 0 0 0 1.5px var(--shu); }
.ink-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.ink-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 3px; border: 2px solid transparent; background: rgba(244, 239, 226, .13); color: #f4efe2; font: 600 11.5px/16px system-ui, sans-serif; text-shadow: none; white-space: nowrap; }
.ink-chip.heavy { border-color: #ff6a4d; }
.ink-chip.short { border: 2px dashed #ff6a4d; }
/* 太細の組の一手: 太くする画は太い金の下線、墨を取り返す画は細い金の二重線。朱の縁（墨の名指し）と分ける */
.ink-chip.move { border-color: #ffd77a; }
.ink-seg.slow::before, .ink-seg.fast::before { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; pointer-events: none; }
.ink-seg.slow::before { height: 5px; border-radius: 2px; background: #ffd77a; }
.ink-seg.fast::before { height: 1.5px; border-top: 1.5px solid #ffd77a; border-bottom: 1.5px solid #ffd77a; }
.ink-track:has(.slow, .fast) { margin-bottom: 5px; }
.ink-move { white-space: pre; color: #ffe2ac; }
.ink-chip[aria-pressed="true"] .ink-move { color: inherit; }
/* 挑戦の帯の下の、通常の墨の花丸の帯（薄く） */
.ink-ref { display: flex; flex-direction: column; gap: 1px; }
.ink-ref-track { display: flex; gap: 1px; height: 14px; padding: 2px 3px; border-radius: 3px; background: rgba(143, 130, 103, .55); opacity: .62; }
.ink-ref-track .ink-seg { font-size: 9px; line-height: 10px; overflow: hidden; }
.ink-ref-name { align-self: flex-end; font: 600 10.5px/13px system-ui, sans-serif; color: #e9dcc0; }
.ink-chip.missing { background: none; border: 1.5px dashed rgba(244, 239, 226, .6); opacity: .85; }
.ink-chip.left { background: #f7f2e4; color: #2a2018; }
.ink-chip[aria-pressed="true"] { background: var(--shu); color: #fff8ec; }
.ink-chip .ink-check { width: 13px; height: 13px; font-size: 10px; line-height: 13px; }
.ink-note { text-align: center; font: 11px/1.4 system-ui, sans-serif; text-wrap: balance; word-break: auto-phrase; }
/* 比べの欄: 前の1枚（上）と今回（下）を同じ幅で */
.ink-pair { display: flex; flex-direction: column; gap: 9px; width: 100%; max-width: 420px; align-self: center; }
.ink-row { display: flex; flex-direction: column; gap: 3px; }
.ink-row-name { display: flex; gap: 6px; align-items: center; font: 11px/15px system-ui, sans-serif; }
.ink-track.compact { height: 34px; }
.ink-track.compact small { font: 600 10px/1.1 system-ui, sans-serif; white-space: nowrap; }
.ink-track.compact .ink-seg.changed::before { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 4px; border-radius: 2px; background: #ffd77a; }
.ink-change { margin-top: 2px; text-align: center; font-size: 15px; font-weight: 600; color: #ffe2ac; word-break: auto-phrase; }
/* 花丸の後の次の目標（印の理由の一行の場所） */
.goal { padding: 7px 10px; border: 1px solid var(--kin); border-radius: 4px; background: rgba(60, 40, 8, .86); color: #ffedc2; text-align: center; font-size: 14px; font-weight: 600; line-height: 1.4; text-wrap: balance; word-break: auto-phrase; }
.act small { display: block; font: 700 10.5px/13px system-ui, sans-serif; }
.act.challenge { background: linear-gradient(155deg, #6d4c12, #43290a); border-color: #e4c36a; color: #ffedc2; font-weight: 600; }
/* 挑戦のボタンがある時は2段: 上に書き直し方、下に保存と作品帳 */
.row-break { display: none; }
.r-actions.with-challenge .row-break { display: block; flex: 0 0 100%; height: 0; margin-top: -3px; }
.r-actions.with-challenge .act { min-height: 40px; }
.r-actions.with-challenge #r-save, .r-actions.with-challenge #r-works { min-height: 32px; font-size: 12px; }
@media (max-height: 719px) and (orientation: portrait) {
  .r-ink { padding: 5px 6px 4px; gap: 3px; }
  .ink-track { height: 20px; }
  .ink-track.compact { height: 32px; }
  .ink-chip { font-size: 11px; line-height: 14px; padding: 0 4px; }
  .ink-chips { gap: 3px; }
  .goal { font-size: 13px; line-height: 1.3; padding: 4px 9px; }
  .r-actions.with-challenge .act { min-height: 36px; }
  .r-actions.with-challenge #r-save, .r-actions.with-challenge #r-works { min-height: 28px; }
}

.tile-stage { position: absolute; right: -4px; bottom: -4px; padding: 3px 5px; border-radius: 3px; border: 1px solid #f6c3b3; background: var(--shu); color: #fff8ec; font: 700 11px/13px "Hiragino Mincho ProN", "Yu Mincho", serif; text-shadow: none; box-shadow: 1px 2px 4px rgba(0, 0, 0, .5); transform: rotate(2deg); }

.b-scroll { padding: 6px 12px 16px; }
.b-scroll .note { margin: 0 auto 8px; max-width: 560px; }
.best-rule { margin: 0 auto 10px; max-width: 560px; text-align: center; line-height: 1.5; text-wrap: balance; word-break: auto-phrase; }
.loading { text-align: center; padding: 24px 0; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8vh 0 6vh; }
.empty canvas { width: 240px; height: 160px; }
.empty .act { flex: none; width: 220px; max-width: 80%; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px 10px; max-width: 900px; margin: 0 auto; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px 8px; border: 2px solid transparent; border-radius: 4px; background: rgba(34, 20, 8, .3); }
.tile.gold { border-color: #e4c36a; box-shadow: 0 0 0 1px #7d6023, 0 0 10px rgba(240, 205, 110, .45); }
.tile canvas { width: 100%; max-width: 160px; height: auto; aspect-ratio: 828 / 1276; }
.tile-text { display: flex; flex-direction: column; font: 11px/1.45 system-ui, sans-serif; }
.tile-text b { font: 600 13px/1.5 "Hiragino Mincho ProN", "Yu Mincho", serif; }
.tile-seal { color: #ffd0c0; }
.best { position: absolute; top: 4px; left: 4px; padding: 2px 6px; border-radius: 3px; background: var(--shu); font: 700 10px/1.4 system-ui, sans-serif; box-shadow: 1px 2px 4px rgba(0, 0, 0, .45); }
.sources { max-width: 560px; margin: 12px auto 0; padding: 12px; border-radius: 4px; background: rgba(24, 14, 6, .6); display: flex; flex-direction: column; gap: 6px; text-align: center; }
.sources a { color: #ffe2ac; text-decoration: underline; text-underline-offset: 2px; }

.keep { position: fixed; inset: 0; z-index: 12; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; background: rgba(18, 10, 4, .95); }
.keep[hidden] { display: none; }
.keep img { max-width: 100%; max-height: calc(100dvh - 130px); -webkit-touch-callout: default; user-select: auto; -webkit-user-select: auto; }

/* PC: 掛け軸を左、講評と操作を右 */
@media (min-width: 900px) and (orientation: landscape) {
  .result { display: grid; grid-template-columns: 1fr minmax(0, 520px) minmax(0, 520px) 1fr; grid-template-rows: 44px minmax(0, 1fr) auto auto; column-gap: 0; }
  .result .r-head { grid-area: 1 / 1 / 2 / 5; grid-template-columns: 110px 1fr 110px; padding: 0 20px; }
  .result .r-scroll { grid-area: 2 / 2 / 5 / 4; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr); overflow: hidden; }
  .result .r-stagebox { height: 100%; min-height: 0; padding-bottom: 12px; align-items: center; }
  .result .r-text { overflow-y: auto; padding: 20px 20px 96px; justify-content: safe center; }
  .result .status { grid-area: 3 / 3; align-self: end; margin-bottom: 76px; z-index: 1; }
  .result .r-bar { grid-area: 4 / 3; align-self: end; z-index: 1; margin: 0 20px 12px; padding: 8px; border-radius: 8px; }
  .result .r-more-slot { display: none; }
  /* 帯の区切りの印が、下の帯の上に出ないように */
  .result .r-bar { z-index: 3; }
  .result:has(.with-challenge) .r-text { padding-bottom: 140px; }
}

/* PC: 同じ机を横に広げ、左右の列を半紙の横へ寄せる */
@media (min-width: 900px) and (orientation: landscape) {
  :root { --h-head: 44px; --h-credit: 26px; --paper-w: min(509px, calc((100dvh - var(--h-head) - var(--h-credit) - 44px) * 1000 / 1376)); }
  .desk {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: var(--h-head) 1fr 1fr 1fr var(--h-credit);
    column-gap: 32px;
    align-items: center;
  }
  .head { grid-area: 1 / 1 / 2 / 4; max-width: none; padding: 0 20px; display: flex; justify-content: flex-end; }
  .head #date { margin-right: auto; margin-left: 16px; order: -1; }
  .head #works { position: fixed; left: 108px; bottom: 12px; }
  .top, .foot { display: contents; }
  .mat { grid-area: 2 / 2 / 5 / 3; }
  .card-slot { grid-area: 2 / 1; justify-self: end; align-self: end; width: 156px; }
  .card-button { height: 208px; }
  .card-hint { font-size: 13px; line-height: 21px; margin: 2px 5px 5px; }
  .today { grid-area: 3 / 1; justify-self: end; align-self: start; width: 220px; margin-top: 20px; }
  .today p:first-child { font-size: 22px; line-height: 30px; }
  .today .small { font-size: 14px; line-height: 21px; }
  .gauge { grid-area: 2 / 3; justify-self: start; align-self: end; width: 92px; padding: 8px 0 4px; }
  .gauge canvas { width: 62px; height: 140px; }
  .suzuri-slot { grid-area: 3 / 3; justify-self: start; width: 220px; }
  .suzuri { height: 130px; }
  .finish { grid-area: 4 / 3; justify-self: start; align-self: start; width: 84px; height: 84px; font-size: 18px; margin-left: 28px; }
  .credit { grid-area: 5 / 1 / 6 / 4; justify-self: center; padding: 0; }
}
