/* tmux からくり屋敷 — a night house of sliding doors.
   Indigo night, washi paper, wood, lamplight (行灯) and vermilion (朱).
   The light theme is the same house by day. */

:root {
  --mincho: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "Noto Serif CJK JP", "Noto Serif JP", serif;
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans CJK JP", "Noto Sans JP", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Noto Sans Mono CJK JP", monospace;

  /* fixed materials: the paper and the wood look the same day and night */
  --washi: #f3eadb; --washi-2: #e9dfca; --washi-3: #fff8e8;
  --wood: #8a6a3a; --wood-d: #5a4322; --wood-l: #b08a52;
  --sumi: #2b2622; --sumi-dim: #6f6558;
  --andon: #f0a33a; --andon-2: #ffd27a; --andon-glow: rgba(240, 163, 58, 0.45);
  /* moss reads on the paper (4.8:1 on the darkest washi); on the page itself the themed --moss-ink */
  --shu: #b9322a; --moss: #4a6639; --ai: #2b4a7a; --ai-d: #16283f;
  --paper-line: #cdbf9f;
  /* the miss red on the page itself (the count, the ghost, a bad conf line): a shade deeper than 朱 to reach AA on the day's beige */
  --miss: #a52b24;

  /* the terminal is washi in both themes */
  --term-bg: var(--washi); --term-fg: #3b3328; --term-dim: #9a8f7c;
  --term-border: var(--wood); --active: var(--andon);
  --copy-bg: var(--ai); --copy-fg: #fff;
  --status-bg: var(--ai); --status-fg: #e8f0ff;
  --outer-bg: #1b1814; --outer-fg: #d9cfbd;

  /* the theme: day */
  --bg: #e6ddca; --bg-2: #d8ccb3; --ink: var(--sumi); --ink-dim: #6a6052;
  --hero-ink: var(--sumi); --hero-accent: #85500f; --line: #bfae8c; --moss-ink: var(--moss);
  --panel: var(--washi-3); --shadow: 0 12px 30px rgba(60, 40, 10, 0.18);
  --glow: radial-gradient(1200px 520px at 70% 100%, #efe6d2 0%, var(--bg) 60%);
  color-scheme: light;
}

/* the theme: night */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121a2b; --bg-2: #1a2438; --ink: #e8e2d4; --ink-dim: #a3abbd;
    --hero-ink: #fff; --hero-accent: var(--andon-2); --line: #33405c;
    --panel: #1f2a42; --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    --glow: radial-gradient(1200px 500px at 70% 100%, #1f2b44 0%, var(--bg) 60%);
    --miss: #e46f61; --moss-ink: #8dd3a0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121a2b; --bg-2: #1a2438; --ink: #e8e2d4; --ink-dim: #a3abbd;
  --hero-ink: #fff; --hero-accent: var(--andon-2); --line: #33405c;
  --panel: #1f2a42; --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  --glow: radial-gradient(1200px 500px at 70% 100%, #1f2b44 0%, var(--bg) 60%);
  --miss: #e46f61; --moss-ink: #8dd3a0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); background-image: var(--glow); background-attachment: fixed;
  color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
}
button { font: inherit; color: inherit; }
kbd {
  display: inline-block; font-family: var(--mono); font-size: 14px; line-height: 1.2;
  padding: 4px 8px; min-width: 1.9em; text-align: center;
  border: 1px solid #9b8a6a; border-bottom-width: 3px; border-radius: 4px;
  background: #fff; color: var(--sumi);
}
kbd.pfx { background: var(--ai); color: #fff; border-color: var(--ai-d); }
.arr { color: var(--sumi-dim); margin: 0 2px; }
[hidden] { display: none !important; }

/* ---- top bar ------------------------------------------------------------------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 24px; flex: none;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--hero-ink); }
.brand-mark { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; width: 22px; height: 22px; padding: 2px; background: var(--wood-d); border-radius: 2px; }
.brand-mark i { background: #ece2cc; }
.brand-mark i:first-child { grid-row: 1 / 3; background: var(--andon-2); box-shadow: 0 0 8px var(--andon-glow); }
.brand-name { font-family: var(--mincho); font-size: 18px; font-weight: 700; letter-spacing: 0.08em; }
.brand-name em { font-style: normal; font-family: var(--mono); font-size: 15px; color: var(--hero-accent); margin-right: 6px; letter-spacing: 0.04em; font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.meta { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); }
.sound-toggle, .theme-toggle {
  width: 34px; height: 34px; border-radius: 3px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--ink);
}
.sound-toggle:hover, .theme-toggle:hover { border-color: var(--andon); }

.screen { flex: 1 1 auto; min-height: 0; }

/* ---- buttons --------------------------------------------------------------------- */

.btn {
  font-family: var(--sans); font-size: 17px; font-weight: 600; letter-spacing: 0.06em; line-height: 1.3;
  padding: 14px 26px; border-radius: 3px; cursor: pointer;
  border: 1px solid var(--wood); background: var(--washi); color: var(--sumi);
  transition: transform 80ms, box-shadow 120ms;
}
.btn small { display: block; font-size: 12px; font-weight: 400; letter-spacing: 0.04em; opacity: 0.8; margin-top: 3px; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .wing:focus-visible, .seg button:focus-visible, .brand:focus-visible, .lang-toggle:focus-visible, .sound-toggle:focus-visible, .theme-toggle:focus-visible, .confbox summary:focus-visible, .key:focus-visible { outline: 3px solid var(--andon); outline-offset: 2px; }
.btn.primary { background: var(--andon); border-color: #b8741a; color: #2b1a05; box-shadow: 0 0 26px var(--andon-glow); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.cta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.seg button {
  background: transparent; border: 0; padding: 7px 14px; cursor: pointer; font-family: var(--mono); font-size: 13px; color: var(--ink);
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button small { display: block; font-family: var(--sans); font-size: 11.5px; color: var(--ink-dim); }
.seg button[aria-pressed="true"] { background: var(--washi); color: var(--sumi); }
.seg button[aria-pressed="true"] small { color: var(--sumi-dim); }

/* ---- title ------------------------------------------------------------------------ */

.title {
  position: relative; overflow: auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 540px); gap: 48px; align-items: start;
  grid-template-rows: 1fr auto;
  padding: 40px 48px 0; max-width: 1280px; width: 100%; margin: 0 auto;
}
.hero .eyebrow { font-family: var(--mincho); font-size: 16px; letter-spacing: 0.25em; color: var(--hero-accent); margin: 0; }
.hero-title { margin: 14px 0 0; font-family: var(--mincho); font-size: clamp(44px, 7vw, 84px); line-height: 1.05; font-weight: 700; letter-spacing: 0.04em; color: var(--hero-ink); }
.hero-title .en { display: block; font-size: 0.43em; letter-spacing: 0.12em; color: var(--hero-accent); font-weight: 500; font-family: var(--mono); }
.lead { font-size: 16px; line-height: 2; margin: 22px 0 0; max-width: 560px; color: var(--ink); }
.lead b { color: var(--hero-ink); font-weight: 700; }
.hero .cta { margin-top: 28px; }
.confbox { margin-top: 18px; max-width: 600px; font-size: 13px; color: var(--ink-dim); }
.confbox summary { cursor: pointer; font-size: 14px; color: var(--ink); }
.confbox summary b { font-weight: 600; color: var(--hero-accent); margin-left: 6px; }
.confbox p { margin: 8px 0; }
.confbox code { font-family: var(--mono); }
.confbox textarea { width: 100%; box-sizing: border-box; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; padding: 8px 10px; background: var(--bg-2); color: var(--ink); border: 1px solid var(--line); border-radius: 3px; resize: vertical; }
.conf-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.conf-btns .btn { padding: 6px 14px; font-size: 13px; }
.conf-report { margin-top: 10px; }
.conf-report h4 { margin: 10px 0 4px; font-size: 12.5px; color: var(--ink); font-weight: 600; }
.conf-report ul { margin: 0; padding: 0; list-style: none; }
.conf-report li { display: block; padding: 3px 0; font-size: 12px; }
.conf-report li code { display: block; font-family: var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.conf-report li .no { display: inline-block; min-width: 3ch; margin-right: 6px; font-style: normal; color: var(--ink-dim); text-align: right; }
.conf-report li span { display: block; padding-left: calc(3ch + 6px); }
.conf-report .err { color: var(--miss); }
.ob-alt, .sz-alt { font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.ob-alt kbd, .sz-alt kbd { opacity: 0.85; }
.sz-alt { display: block; margin-top: 6px; white-space: normal; }
.fine { font-size: 12.5px; color: var(--ink-dim); margin-top: 20px; max-width: 560px; }
.fine.ver { margin-top: 8px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.fine.ver a { color: inherit; }

/* 見取り図: the courses */
.plan { position: relative; background: var(--washi); color: var(--sumi); border-radius: 3px; padding: 22px 18px 14px; box-shadow: var(--shadow); margin-top: 16px; }
.plan-label { position: absolute; top: -14px; left: 18px; background: var(--ai); color: #fff; font-size: 13px; font-weight: 600; padding: 4px 14px; letter-spacing: 0.1em; }
.wings { list-style: none; margin: 0; padding: 0; }
.wings li + li { border-top: 1px dashed var(--paper-line); }
.wing {
  width: 100%; text-align: left; cursor: pointer; background: transparent; border: 0; color: var(--sumi);
  display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 8px; border-radius: 2px;
}
.wing:hover { background: #fff6dd; }
.wing.hot { background: #fff1d0; box-shadow: inset 3px 0 0 var(--andon); }
.mini { display: grid; gap: 2px; background: var(--wood); padding: 2px; border: 2px solid var(--wood); aspect-ratio: 4 / 3; }
.mini i { background: #faf4e6; }
.mini i.lit { background: var(--andon-2); box-shadow: 0 0 8px var(--andon-glow); }
.wing-main { min-width: 0; }
.wing-name { font-family: var(--mincho); font-size: 21px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.wing-n { font-size: 12px; font-family: var(--mono); color: var(--sumi-dim); font-weight: 400; }
.wing-mode { font-size: 11px; font-family: var(--sans); font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--paper-line); color: var(--sumi-dim); }
.wing-mode.rec { background: var(--shu); border-color: var(--shu); color: #fff; }
.wing-desc { display: block; font-size: 12.5px; color: var(--sumi-dim); margin-top: 3px; line-height: 1.6; }
.wing-best { text-align: right; font-family: var(--mono); font-size: 11.5px; color: var(--sumi-dim); line-height: 1.5; white-space: nowrap; }
.wing-best small { display: block; font-size: 11.5px; }
.wing-best b { display: block; font-size: 19px; color: var(--sumi); }
.plan-note { border-top: 1px solid var(--paper-line); margin: 8px 0 0; padding-top: 10px; font-size: 12px; color: var(--sumi-dim); line-height: 1.7; }

/* the house front at the bottom: lit shoji */
.facade {
  position: relative; grid-column: 1; align-self: end; margin-top: 40px; width: min(600px, 100%); height: 110px; box-sizing: border-box;
  display: grid; grid-template-columns: repeat(10, 1fr); grid-template-rows: repeat(2, 1fr); gap: 6px; padding: 6px;
  background: var(--wood-d); border: 8px solid var(--wood-d); border-bottom: 0; border-radius: 4px 4px 0 0;
  box-shadow: 0 -10px 40px rgba(240, 163, 58, 0.15);
}
.facade i { background: #ece2cc; opacity: 0.3; }
.facade i.lit { background: var(--andon-2); opacity: 1; box-shadow: 0 0 22px rgba(240, 163, 58, 0.7); animation: flicker 5s ease-in-out infinite; }
.facade i.warm { background: #f7dca6; opacity: 0.7; }
.facade i:nth-child(17) { animation-delay: -2.3s; }
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: 0.86; } 50% { opacity: 0.97; } 70% { opacity: 0.9; } }

/* ---- game ---------------------------------------------------------------------------- */

.game { display: flex; flex-direction: column; padding: 0 24px 16px; gap: 12px; min-height: 0; overflow: hidden; }
.playbar {
  display: flex; align-items: center; gap: 18px; flex: none;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.pb-course { font-size: 15px; }
.pb-course b { color: var(--hero-accent); font-family: var(--mono); }
.pb-streak { font-size: 13px; color: var(--moss-ink); border: 1px solid var(--moss-ink); padding: 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--moss-ink) 12%, transparent); }
.pb-sp { flex: 1; }
.pb-pen { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--miss); }
.pb-time { font-family: var(--mono); font-size: 30px; line-height: 1; color: var(--hero-ink); min-width: 4.5ch; text-align: right; }
.pb-time small { font-size: 13px; color: var(--ink-dim); margin-left: 4px; }

.play-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 22px; }
/* the side panel is the detail; the order itself is in the house */
body:not([data-detail="1"]) .play-body { grid-template-columns: minmax(0, 1fr); }
body:not([data-detail="1"]) .side { display: none; }
.game-foot { display: flex; gap: 10px; flex: none; }
.detail-toggle { font-size: 13px; padding: 6px 14px; }
.side { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: auto; }

/* 指図: the order */
.sashizu { background: var(--washi); color: var(--sumi); border-radius: 3px; padding: 16px 18px 16px; box-shadow: var(--shadow); }
.sz-lab { font-size: 12px; letter-spacing: 0.1em; color: var(--sumi-dim); border-bottom: 1px solid var(--paper-line); padding-bottom: 8px; display: flex; justify-content: space-between; }
.sz-lab b { font-family: var(--mono); letter-spacing: 0; font-weight: 400; }
.sz-q { font-size: 22px; font-weight: 700; line-height: 1.45; margin: 12px 0 14px; min-height: 1.45em; text-wrap: balance; }
.sz-keys { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
kbd.done { opacity: 0.4; }
/* The tick of a done step keeps its width whether shown or not: nothing in
   the order moves when a step is ticked off. */
.tick { display: inline-block; width: 1.1em; margin-left: 0.2em; text-align: center; font-style: normal; visibility: hidden; }
.tick.on { visibility: visible; }
.ob-note, .sz-note { font-size: 12px; color: var(--sumi-dim); margin-top: 3px; }
.sz-note { margin: -6px 0 10px; }
kbd.next { border-color: var(--andon); background: #fff3d6; box-shadow: 0 0 0 3px var(--andon-glow); transform: scale(1.12); }
kbd.pfx.next { background: var(--ai); }
@keyframes lamp { 50% { box-shadow: 0 0 0 5px rgba(240, 163, 58, 0.25), 0 0 16px var(--andon-glow); } }
.sz-hint { font-size: 12px; color: var(--sumi-dim); margin-top: 12px; line-height: 1.6; }
.sz-cmd { font-size: 11.5px; color: var(--sumi-dim); margin-top: 6px; }
.sz-cmd code { font-family: var(--mono); color: var(--ai); }
.sz-free { font-size: 13px; color: var(--sumi-dim); margin: 0 0 8px; line-height: 1.6; }

/* 行灯: the 目安 and the overrun */
.andon { margin-top: 14px; border: 1px solid var(--paper-line); border-radius: 3px; padding: 10px 12px; background: var(--washi-3); }
.andon.lit { border-color: var(--andon); box-shadow: 0 0 0 1px var(--andon), 0 0 22px var(--andon-glow); }
.andon-l { font-size: 12px; color: var(--sumi-dim); display: flex; justify-content: space-between; align-items: center; }
.andon-over { color: var(--shu); font-size: 13px; }
.andon.lit .gauge { display: none; }
.pause { position: absolute; inset: 0; z-index: 9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(27, 24, 20, 0.82); color: var(--washi); cursor: pointer; text-align: center; padding: 16px; }
.pause[hidden] { display: none; }
.pb-ghost { font-size: 13px; color: var(--ink-dim); white-space: nowrap; }
.pb-ghost small { font-size: 11px; }
.pb-ghost b { font-family: var(--mono); color: var(--ink); }
.pb-ghost.ahead b { color: var(--moss-ink); }
.pb-ghost.behind b { color: var(--miss); }
@media (max-width: 760px) { .pb-ghost small { display: none; } }
.pause b { font-family: var(--mincho); font-size: 34px; letter-spacing: 0.3em; }
.pause span { font-size: 13px; color: #d9cfbd; }
.gauge { height: 10px; background: #e6dcc6; border-radius: 999px; overflow: hidden; margin-top: 6px; border: 1px solid var(--paper-line); position: relative; }
.gauge i { position: absolute; top: 0; bottom: 0; }
.gauge .left { left: 0; width: 100%; background: linear-gradient(90deg, var(--moss), #9cc27a); }
.gauge .over { right: 0; width: 0; background: var(--shu); }
.andon-note { margin: 8px 0 0; font-size: 12.5px; color: #9a5b12; }
.shinan { margin-top: 12px; border: 1px solid var(--paper-line); border-left: 3px solid var(--andon); border-radius: 3px; padding: 8px 12px; background: var(--washi-3); }
.shinan-t { font-size: 13px; font-weight: 600; color: var(--shu); letter-spacing: 0.05em; display: flex; align-items: center; gap: 8px; }
.shinan ol { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.shinan li { display: flex; align-items: baseline; gap: 8px; color: var(--sumi-dim); }
.shinan li.now { color: var(--sumi); font-weight: 700; }
.shinan li.done { text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, 0.25); }
.shinan .no { font-family: var(--mono); width: 1.4em; flex: none; }

/* the chips go right under the guide card (placeCard sets left/top) */
.chips { position: absolute; bottom: 14px; left: 10px; z-index: 8; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; pointer-events: none; }
/* 指図 in the house: at the top of the room you stand in, like a login message */
.motd {
  position: absolute; left: 0; right: 0; top: 20px; z-index: 3;
  padding: 6px 1ch 7px; background: var(--washi-3); color: var(--sumi);
  border-bottom: 2px solid var(--andon); box-shadow: 0 2px 6px rgba(43, 26, 5, 0.12);
  font-family: var(--sans); font-size: 13px; line-height: 1.4; white-space: normal; word-break: normal;
}
.motd-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.motd-go { color: #c47a12; font-size: 12px; }
.motd .ob-alt { margin-top: 3px; white-space: normal; }
.pane.cramped .motd .ob-txt, .pane.cramped .motd .ob-alt, .pane.cramped .motd .ob-note { display: none; }
/* the room you stand in: a lit frame and a いまここ tag; the others recede */
.pane.active::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; box-shadow: inset 0 0 0 3px var(--andon); }
.pane:not(.active):not(.wanted) > .pane-body, .pane:not(.active):not(.wanted) > .decor { opacity: 0.5; }
.pt-here { font-size: 11px; font-weight: 700; color: #2b1a05; background: var(--andon); padding: 0 6px; line-height: 16px; border-radius: 2px; }
/* the way to the room the question wants */
.goal-arrow { position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none; overflow: visible; }
.goal-arrow line { stroke: #c47a12; stroke-width: 4; stroke-linecap: round; }
.goal-arrow path { fill: #c47a12; }
.goal-key { position: absolute; z-index: 7; transform: translate(-50%, -50%); pointer-events: none; font-family: var(--mono); font-size: 12px; font-weight: 700; white-space: nowrap; background: #fff3d2; color: #2b1a05; border: 2px solid #c47a12; border-radius: 3px; padding: 1px 7px; }
.ob-n { font-family: var(--mono); font-size: 12px; color: var(--sumi-dim); }
.ob-q { font-size: 17px; line-height: 1.35; }
.ob-guide { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 5px; }
.ob-keys { display: inline-flex; align-items: center; gap: 5px; }
.ob-keys kbd { font-size: 13px; padding: 2px 8px; }
.ob-keys kbd.next { transform: none; }
.ob-txt { font-size: 12.5px; color: var(--sumi-dim); }
.ob-guide.learnt { color: var(--moss); font-weight: 700; font-size: 13px; gap: 8px; }
.ob-guide.learnt .ob-txt { font-weight: 400; }
/* 完成図: what to change, marked on the rooms and wings. Still, never moving. */
.goal { position: absolute; z-index: 5; pointer-events: none; border: 2px dashed var(--andon); border-radius: 2px; }
.goal-tag { position: absolute; right: 6px; top: 24px; font-size: 12.5px; font-weight: 700; line-height: 1.5; background: var(--andon); color: #2b1a05; padding: 0 8px; border-radius: 2px; white-space: nowrap; }
.goal.close { border-color: var(--shu); background: repeating-linear-gradient(135deg, rgba(185, 50, 42, 0.07) 0 8px, transparent 8px 16px); }
.goal.close .goal-tag { background: var(--shu); color: #fff; }
.goal.split-v::after { content: ""; position: absolute; top: 22px; bottom: 6px; left: 50%; border-left: 3px dashed var(--andon); }
.goal.split-h::after { content: ""; position: absolute; left: 6px; right: 6px; top: calc(50% + 10px); border-top: 3px dashed var(--andon); }
.goal.zoom { border-width: 3px; }
.goal.unzoom { border-style: dotted; }
.goal.resize::after { content: "⇠ ⇢"; position: absolute; top: 50%; right: -2px; transform: translate(50%, -50%); font-size: 20px; color: #9a5b12; background: var(--washi-3); border: 1px solid var(--andon); border-radius: 3px; padding: 0 4px; }
.goal.to-left::after { content: "⇠"; position: absolute; left: 6px; top: 50%; transform: translateY(-50%); font-size: 30px; color: #9a5b12; }
.goal.top::after { content: "⇡"; position: absolute; right: 12px; top: 50px; font-size: 30px; color: #9a5b12; }
.st-win.goal-tab { position: relative; outline: 2px dashed var(--andon); outline-offset: 1px; }
.st-win.goal-tab.close { outline-color: #ff8a80; }
.st-win.goal-tab.new { color: var(--andon-2); }
.st-win .goal-tag { position: static; margin-left: 6px; font-size: 11px; padding: 0 5px; }
/* the session questions mark the [name] on the status bar and its row in the list */
.st-session.goal-tab { outline: 2px dashed var(--andon); outline-offset: 1px; }
.st-session .goal-tag, .picker-row .goal-tag { position: static; margin-left: 6px; font-size: 11px; padding: 0 5px; transform: none; }
.picker-row.goal-row { outline: 2px dashed var(--andon); outline-offset: -2px; }
/* 腕前 */
.skill { margin-top: 18px; max-width: 460px; }
.sk-row { display: flex; align-items: baseline; gap: 10px; }
.sk-lab { font-size: 13px; letter-spacing: 0.1em; color: var(--ink-dim); }
.sk-lv { font-family: var(--mono); font-size: 26px; font-weight: 700; color: var(--hero-accent); }
.sk-lv small { font-size: 14px; color: var(--ink-dim); font-weight: 400; }
.sk-lv.up { color: var(--miss); }
.sk-title { font-size: 18px; }
.sk-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 6px 0 4px; }
.sk-bar i { display: block; height: 100%; background: var(--andon); }
.sk-note, .sk-none { font-size: 12px; color: var(--ink-dim); }
.em-skill { margin: 14px 0 0; max-width: none; }
.em-skill .sk-lab, .em-skill .sk-note, .em-skill .sk-none { color: var(--sumi-dim); }
.em-skill .sk-lv { color: #9a5b12; }
.em-skill .sk-lv.up { color: var(--shu); }
.em-skill .sk-bar { background: var(--paper-line); }
.em-learnt { margin: 8px 0 0; font-size: 13.5px; color: var(--moss); }
.em-learnt.lost { color: var(--sumi-dim); }
kbd.hk { display: inline-block; margin-left: 8px; font-family: var(--mono); font-size: 11px; padding: 0 5px; border: 1px solid currentColor; border-radius: 3px; opacity: 0.85; vertical-align: middle; background: none; box-shadow: none; color: inherit; }
.btn small + kbd.hk { margin-left: 0; margin-top: 2px; }
.wing-name kbd.hk { margin-left: 0; }
@media (pointer: coarse) { kbd.hk { display: none; } }
.learnt-note { margin: 12px 0 0; font-size: 13px; color: var(--moss); }
.chip { font-size: 12.5px; padding: 6px 12px; border-radius: 3px; background: var(--washi); color: var(--sumi); border: 1px solid var(--paper-line); animation: rise 200ms ease-out; }
.chip.good { border-color: var(--moss); color: var(--moss); font-weight: 600; }
.chip.miss { border-color: var(--shu); color: var(--shu); font-weight: 600; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 屋敷: the tmux */
.yashiki {
  min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 8px;
  background: linear-gradient(180deg, #6b4f2a, #553c1f); border: 8px solid var(--wood-d); border-radius: 4px; padding: 10px;
  box-shadow: var(--shadow);
}
/* status-position top: the bar above the panes, from the start of the run (no jump). */
body[data-status="top"] .yashiki { grid-template-rows: auto minmax(0, 1fr) auto; }
body[data-status="top"] .yashiki .status { order: -1; }
.term-wrap { position: relative; min-height: 0; }
.term {
  position: absolute; inset: 0;
  background: var(--term-bg); color: var(--term-fg);
  background-image: repeating-linear-gradient(90deg, rgba(120, 90, 40, 0.05) 0 1px, transparent 1px 28px);
  font-family: var(--mono); font-size: 14px; line-height: 20px;
  border: 3px double var(--wood);
  overflow: hidden;
  transition: box-shadow 120ms;
}
body[data-armed="1"] .term { box-shadow: 0 0 0 2px var(--andon), 0 0 26px var(--andon-glow); }
body[data-armed="repeat"] .term { box-shadow: 0 0 0 2px var(--moss); }
.probe { position: absolute; visibility: hidden; white-space: pre; font-family: var(--mono); font-size: 14px; line-height: 20px; top: 0; left: 0; }
@media (max-width: 760px) { .probe { font-size: 13px; } }

.pane { position: absolute; overflow: hidden; z-index: 1; transition: left 280ms cubic-bezier(.3,.7,.2,1), top 280ms cubic-bezier(.3,.7,.2,1), width 280ms cubic-bezier(.3,.7,.2,1), height 280ms cubic-bezier(.3,.7,.2,1); }
.pane-title, .pane-body { z-index: 1; }
.pane-title { position: relative; }
/* the lantern light: glides to the room you stand in, flares on a hit */
.glow { position: absolute; z-index: 0; pointer-events: none; background: radial-gradient(closest-side, rgba(255, 233, 180, 0.95), rgba(255, 233, 180, 0.35) 70%, transparent); transition: left 260ms ease-out, top 260ms ease-out, width 260ms ease-out, height 260ms ease-out; }
.glow.flare { animation: flare 320ms ease-out; }
@keyframes flare { 30% { filter: brightness(1.12) saturate(1.4); transform: scale(1.03); } }
/* 襖: a paper door with a wooden frame, a 腰板 and an 引手. One lies over a
   new room and slides away; one slides shut over a room that is closed. */
.fusuma {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    radial-gradient(circle, rgba(138, 106, 58, 0.14) 0 1.5px, transparent 2px) 0 0 / 26px 26px,
    linear-gradient(180deg, var(--washi-3) 0 82%, var(--wood-l) 82% 83%, var(--wood-d) 83%);
  box-shadow: inset 0 0 0 4px var(--wood-d), inset 0 0 0 5px var(--wood-l), -6px 0 16px rgba(40, 25, 5, 0.3);
}
.fusuma i { position: absolute; left: 12px; top: 50%; width: 10px; height: 26px; margin-top: -13px; border-radius: 5px; background: #2b2622; opacity: 0.75; }
.fusuma.open-y, .fusuma.shut-y { box-shadow: inset 0 0 0 4px var(--wood-d), inset 0 0 0 5px var(--wood-l), 0 -6px 16px rgba(40, 25, 5, 0.3); }
.fusuma.open-y i, .fusuma.shut-y i { left: 50%; top: 12px; width: 26px; height: 10px; margin: 0 0 0 -13px; }
.fusuma.open-x { animation: door-open-x 360ms cubic-bezier(.4,.1,.2,1) forwards; }
.fusuma.open-y { animation: door-open-y 360ms cubic-bezier(.4,.1,.2,1) forwards; }
.fusuma.shut-x { animation: door-shut-x 260ms cubic-bezier(.4,0,.6,1) forwards; }
.fusuma.shut-y { animation: door-shut-y 260ms cubic-bezier(.4,0,.6,1) forwards; }
@keyframes door-open-x { to { transform: translateX(103%); } }
@keyframes door-open-y { to { transform: translateY(103%); } }
@keyframes door-shut-x { from { transform: translateX(-103%); } }
@keyframes door-shut-y { from { transform: translateY(-103%); } }
/* a new room: its door slides away (the room itself only brightens) */
.pane.enter-x, .pane.enter-y { animation: room-open 360ms ease-out; }
.pane.enter-fade { animation: room-fade 300ms ease-out; }
@keyframes room-open { from { filter: brightness(1.05); } }
@keyframes room-fade { from { opacity: 0; } }
/* a closed room: the door shuts over it, then the wall is gone */
.pane.leaving { z-index: 2; pointer-events: none; animation: room-gone 360ms ease-in forwards; }
@keyframes room-gone { 0%, 72% { opacity: 1; } 100% { opacity: 0; } }
/* 大広間: zooming lifts the other walls away; unzooming drops them back */
.pane.leaving.lift { animation: wall-lift 320ms ease-in forwards; }
.pane.enter-drop { animation: wall-drop 320ms cubic-bezier(.3,.7,.2,1); }
@keyframes wall-lift { to { transform: translateY(-14%); opacity: 0; } }
@keyframes wall-drop { from { transform: translateY(-14%); opacity: 0; } }
.border { z-index: 2; transition: left 280ms cubic-bezier(.3,.7,.2,1), top 280ms cubic-bezier(.3,.7,.2,1), width 280ms, height 280ms; }
.border.settle { animation: settle 420ms ease-out; }
@keyframes settle { 0%, 55% { opacity: 0; } 100% { opacity: 1; } }
/* another wing: a big fusuma sweeps off the house while the view slides in */
.term.slide-next { animation: slide-next 380ms cubic-bezier(.3,.7,.2,1); }
.term.slide-prev { animation: slide-prev 380ms cubic-bezier(.3,.7,.2,1); }
@keyframes slide-next { from { transform: translateX(6%); opacity: 0.4; } }
@keyframes slide-prev { from { transform: translateX(-6%); opacity: 0.4; } }
.wipe {
  position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background:
    radial-gradient(circle, rgba(138, 106, 58, 0.14) 0 1.5px, transparent 2px) 0 0 / 26px 26px,
    linear-gradient(180deg, var(--washi-3) 0 84%, var(--wood-l) 84% 85%, var(--wood-d) 85%);
  box-shadow: inset 0 0 0 6px var(--wood-d), inset 0 0 0 7px var(--wood-l), 0 0 30px rgba(40, 25, 5, 0.4);
}
.wipe i { position: absolute; left: 50%; top: 50%; width: 14px; height: 42px; margin: -21px 0 0 -7px; border-radius: 7px; background: #2b2622; opacity: 0.75; }
.wipe.next { animation: wipe-next 400ms cubic-bezier(.4,.1,.2,1) forwards; }
.wipe.prev { animation: wipe-prev 400ms cubic-bezier(.4,.1,.2,1) forwards; }
@keyframes wipe-next { to { transform: translateX(-104%); } }
@keyframes wipe-prev { to { transform: translateX(104%); } }

/* furnishing: the 鴨居 under the title row, a 柱 at the left, tatami at the
   foot, furniture on it, sometimes a lamp overhead or something on the wall */
.decor { position: absolute; inset: 20px 0 0 0; z-index: 0; pointer-events: none; }
.kamoi { position: absolute; left: 0; right: 0; top: 0; height: 5px; background: linear-gradient(180deg, #b08a52, #6e4a22 55%, #4a3016); box-shadow: 0 2px 4px rgba(60, 40, 10, 0.16); opacity: 0.8; }
.hashira { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(90deg, #b08a52, #7a5a32 55%, #5a4322); opacity: 0.7; }
.tatami {
  position: absolute; left: 0; right: 0; bottom: 0; height: min(24%, 42px);
  background:
    repeating-linear-gradient(0deg, rgba(90, 80, 30, 0.10) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, #cfc58c 0 calc(50% - 4px), #3f4a2c calc(50% - 4px) 50%);
  background-size: auto, 220px 100%;
  border-top: 3px solid #8a6a3a; opacity: 0.6;
}
.pane.active .tatami { opacity: 0.85; }
.pane.cramped .tatami { height: 10px; border-top-width: 2px; }
.decor .furn { position: absolute; right: 5%; bottom: min(7%, 12px); height: min(50%, 150px); width: auto; max-width: 72%; opacity: 0.45; transition: opacity 260ms; }
.decor .wall { position: absolute; top: 8px; right: 12px; height: min(32%, 90px); width: auto; opacity: 0.45; transition: opacity 260ms; }
.decor .lamp { position: absolute; top: 4px; right: 30%; height: min(36%, 110px); width: auto; opacity: 0.5; transition: opacity 260ms; }
.pane.active .decor .furn, .pane.active .decor .wall, .pane.active .decor .lamp { opacity: 0.85; }
/* only the room you stand in is alive, and only just: the clock ticks, the
   tea steams, a flame breathes. Nothing else loops. */
.decor .pendulum { transform-box: fill-box; transform-origin: 50% 0; }
.pane.active .decor .pendulum { animation: pendulum 1.6s ease-in-out infinite alternate; }
@keyframes pendulum { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
.decor .steam { opacity: 0; }
.pane.active .decor .steam { animation: steam 4s ease-in-out infinite; }
@keyframes steam { 0% { opacity: 0; transform: translateY(3px); } 40% { opacity: 0.6; } 100% { opacity: 0; transform: translateY(-5px); } }
.decor .flame { transform-box: fill-box; transform-origin: 50% 100%; }
.pane.active .decor .flame { animation: flame 2.2s ease-in-out infinite alternate; }
@keyframes flame { from { transform: scale(0.94, 0.96); opacity: 0.9; } to { transform: scale(1.03, 1.06); opacity: 1; } }
/* 欄間: the title row sits in the strip above the 鴨居 */
.pane-title { height: 20px; line-height: 20px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; padding: 0 0.5ch; color: var(--term-dim); background: linear-gradient(180deg, rgba(138, 106, 58, 0.12), rgba(138, 106, 58, 0.04)); }
.pt-idx { font-size: 11px; color: var(--term-dim); }
.pt-name { font-size: 12.5px; background: #fff; border: 1px solid var(--paper-line); padding: 0 7px; line-height: 16px; color: var(--sumi-dim); }
.pane.active .pt-name { color: #2b1a05; border-color: var(--andon); background: #fff3d2; font-weight: 700; }
.pane.active .pt-idx { color: #9a5b12; font-weight: 700; }
.zoom-flag { margin-left: auto; font-size: 11px; color: #fff; background: var(--shu); padding: 0 6px; line-height: 16px; }
.pane-body { position: absolute; left: 0; right: 0; top: 20px; bottom: 0; overflow: hidden; padding: 0 1ch; white-space: pre-wrap; word-break: break-all; }
.pane-body.copy { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ai) 45%, transparent); }
.copy-ind { position: sticky; top: 0; float: right; background: var(--copy-bg); color: var(--copy-fg); padding: 0 1ch; z-index: 2; }
/* 襖: a double line between rooms; the ones next to where you stand are lit */
.border { position: absolute; }
.border.v { background: linear-gradient(90deg, transparent calc(50% - 3px), var(--wood) calc(50% - 3px), var(--wood) calc(50% - 1px), transparent calc(50% - 1px), transparent calc(50% + 1px), var(--wood) calc(50% + 1px), var(--wood) calc(50% + 3px), transparent calc(50% + 3px)); }
.border.h { background: linear-gradient(180deg, transparent calc(50% - 3px), var(--wood) calc(50% - 3px), var(--wood) calc(50% - 1px), transparent calc(50% - 1px), transparent calc(50% + 1px), var(--wood) calc(50% + 1px), var(--wood) calc(50% + 3px), transparent calc(50% + 3px)); }
.border.v.near { background: linear-gradient(90deg, transparent calc(50% - 3px), var(--andon) calc(50% - 3px), var(--andon) calc(50% + 3px), transparent calc(50% + 3px)); }
.border.h.near { background: linear-gradient(180deg, transparent calc(50% - 3px), var(--andon) calc(50% - 3px), var(--andon) calc(50% + 3px), transparent calc(50% + 3px)); }

.sh-line { min-height: 20px; }
.sh-prompt { color: var(--ai); }
.sh-dim { color: var(--term-dim); }
.sh-head { color: var(--ai); font-weight: 700; }
.sh-gold { color: #9a5b12; font-weight: 700; }
.sh-err { color: var(--shu); font-weight: 700; }
.sh-clear { height: 100vh; }
/* a steady block: nothing on the screen blinks */
.cursor { display: inline-block; width: 1ch; height: 18px; vertical-align: -3px; background: var(--term-fg); }
.cursor.on-char { width: auto; height: auto; vertical-align: baseline; color: var(--term-bg); }
.pane:not(.active) .cursor { display: none; }
.pane-body.copy .sh-line.cl { background: color-mix(in srgb, var(--ai) 20%, transparent); box-shadow: inset 3px 0 0 var(--ai); }
.pane-body.copy .sh-line.sel, .pane-body.copy .sh-line span.sel { background: color-mix(in srgb, var(--ai) 60%, transparent); color: #fff; }
.pane-body.copy span.sel.cursor.on-char { color: var(--term-bg); }


/* outside tmux */
.outer-shell { position: absolute; inset: 0; background: var(--outer-bg); color: var(--outer-fg); z-index: 6; }
.outer-body { position: absolute; inset: 0; overflow: hidden; padding: 6px 1ch; white-space: pre-wrap; word-break: break-all; }
.outer-body .sh-prompt { color: var(--outer-fg); }
.outer-body .cursor { background: var(--outer-fg); display: inline-block; }
.term.powering-down { animation: doors-shut 0.7s ease-in forwards; }
.term.powering-up { animation: doors-open 0.9s ease-out; }
@keyframes doors-shut { to { clip-path: inset(0 50% 0 50%); } }
@keyframes doors-open { from { clip-path: inset(0 50% 0 50%); } to { clip-path: inset(0 0 0 0); } }

/* status bar */
.status {
  display: flex; align-items: center; gap: 0; height: 26px; line-height: 26px;
  background: var(--status-bg); color: var(--status-fg); font-family: var(--mono); font-size: 13px;
  padding: 0 8px; overflow: hidden; white-space: nowrap; border-radius: 2px;
}
.status.gone { visibility: hidden; }
.st-session { color: var(--andon-2); font-weight: 700; margin-right: 1ch; }
.st-wins { display: flex; gap: 2px; min-width: 0; overflow: hidden; }
.st-win { padding: 0 1ch; }
.st-win.cur { background: var(--andon-2); color: var(--sumi); font-weight: 700; border-radius: 2px; }
.st-right { margin-left: auto; display: flex; align-items: center; gap: 1ch; }
.st-prefix { background: var(--andon); color: #2b1a05; font-weight: 700; padding: 0 1ch; }
.st-prefix.repeat { background: var(--moss); color: #fff; }
.st-mode { background: #fff; color: var(--ai); padding: 0 1ch; font-weight: 700; }
.st-host { color: #a9b7d3; }
.st-prompt .cursor { background: var(--status-fg); height: 16px; vertical-align: -2px; }
.st-msg { color: var(--andon-2); font-weight: 700; }
.st-clip { font-size: 12px; }

.picker { position: absolute; left: 6%; right: 6%; top: 12%; z-index: 8; background: var(--washi); color: var(--sumi); border: 2px solid var(--ai); box-shadow: var(--shadow); padding: 4px 0; }
.picker-head { color: var(--term-dim); padding: 0 1ch 4px; border-bottom: 1px solid var(--paper-line); }
.picker-row { padding: 0 1ch; }
.picker-row.on { background: var(--ai); color: #fff; font-weight: 700; }

/* hits and misses */
.term-wrap.shake { animation: shake 260ms ease-in-out; }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.term-wrap::before { content: ""; position: absolute; inset: 0; z-index: 7; pointer-events: none; opacity: 0; }
.term-wrap.flash-hit::before { box-shadow: inset 0 0 0 3px var(--andon), inset 0 0 30px var(--andon-glow); animation: term-flash 260ms ease-out; }
.term-wrap.flash-miss::before { box-shadow: inset 0 0 0 3px var(--shu), inset 0 0 30px rgba(185, 50, 42, 0.35); animation: term-flash 300ms ease-out; }
@keyframes term-flash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* the countdown: 三・二・一・始め */
.banner {
  position: absolute; left: 50%; top: 42%; z-index: 20; transform: translate(-50%, -50%);
  padding: 6px 26px; background: var(--washi); color: var(--sumi);
  border: 3px double var(--wood); border-radius: 2px;
  font-family: var(--mincho); font-weight: 700; font-size: 44px; letter-spacing: 0.1em;
  pointer-events: none; opacity: 0; white-space: nowrap; box-shadow: var(--shadow);
}
.banner.show { animation: pop 700ms ease-out forwards; }
/* 成: the seal on a solved question, while its rooms finish moving. */
.seal {
  position: absolute; right: 18px; top: 14px; z-index: 21; width: 64px; height: 64px;
  display: grid; place-items: center; border: 3px solid var(--shu); border-radius: 50%;
  color: var(--shu); background: rgba(255, 250, 240, 0.85);
  font-family: var(--mincho); font-weight: 700; font-size: 34px;
  pointer-events: none; opacity: 0; transform: rotate(-8deg);
}
.seal.show { animation: stamp 260ms ease-out both; }
@media (prefers-reduced-motion: reduce) { .seal.show { animation: none; opacity: 0.9; } }
.banner.go { color: var(--shu); }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

.quit { align-self: flex-start; font-size: 13px; padding: 6px 14px; flex: none; }

/* on-screen keys (phones) */
.keybar { display: none; flex-wrap: wrap; gap: 6px; flex: none; }
.key {
  min-width: 44px; height: 40px; padding: 0 10px;
  background: var(--washi); border: 1px solid #9b8a6a; border-bottom-width: 3px; border-radius: 4px;
  font-family: var(--mono); font-size: 15px; cursor: pointer; color: var(--sumi);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.key:active { border-bottom-width: 1px; transform: translateY(2px); }
.key.k-prefix { background: var(--ai); color: #fff; border-color: var(--ai-d); font-weight: 700; }
.key.k-prefix[aria-pressed="true"] { background: var(--andon); color: #2b1a05; border-color: #b8741a; }
.key.k-level { border-color: var(--andon); }
.key.k-type { margin-left: auto; color: var(--sumi-dim); }
/* やめる is in the key bar only where the buttons under the house are hidden */
.key.k-quit { display: none; color: var(--sumi-dim); }
.sink { position: fixed; bottom: 0; left: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; pointer-events: none; }

/* ---- the result and the records: one sheet ---------------------------------- */

.result, .records { overflow: auto; padding: 40px 16px 56px; display: grid; justify-items: center; align-content: start; }
.emaki { display: grid; grid-template-columns: minmax(0, 1fr); width: min(780px, 100%); filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.4)); }
.emaki.wide { width: min(860px, 100%); }
.emaki-body {
  background: var(--washi); color: var(--sumi); padding: 28px 36px 26px; position: relative; min-width: 0; border-radius: 4px;
}
.em-hd { font-family: var(--mono); font-size: 12px; letter-spacing: 0.05em; color: var(--sumi-dim); }
.em-title { font-family: var(--mincho); font-size: clamp(26px, 4.5vw, 36px); margin: 6px 0 2px; letter-spacing: 0.02em; line-height: 1.3; }
/* the sheet's title takes the focus when the sheet opens (said by a screen reader, Tab goes on into the sheet); no ring on a heading */
.em-title:focus { outline: none; }
.em-sub { font-size: 14px; color: var(--sumi-dim); }
.em-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 26px; align-items: end; margin-top: 14px; }
.em-time { font-family: var(--mono); font-size: clamp(54px, 10vw, 76px); line-height: 1; }
.em-time small { font-size: 22px; margin-left: 6px; }
.em-verdict { font-size: 17px; line-height: 1.5; padding-bottom: 4px; }
.em-verdict b { color: var(--shu); font-size: 23px; }
.em-tip { display: block; font-size: 13px; color: var(--sumi-dim); margin-top: 4px; }
.emaki-body.is-rec .em-tip { color: var(--shu); font-weight: 600; }
.em-rank { display: flex; align-items: center; gap: 14px; margin: 16px 0 6px; font-size: 16px; }
.em-rank b { color: var(--shu); }
.em-rank small { display: block; font-size: 13px; color: var(--sumi-dim); margin-top: 2px; }
.hanko {
  width: 64px; height: 64px; flex: none; border: 3px solid var(--shu); border-radius: 4px; color: var(--shu);
  font-family: var(--mincho); font-weight: 700; font-size: 16px; line-height: 1.15; text-align: center;
  display: grid; place-items: center; transform: rotate(-8deg); opacity: 0.9;
}
.em-rank.up .hanko { animation: stamp 520ms ease-out both; }
@keyframes stamp { 0% { transform: rotate(-8deg) scale(2); opacity: 0; } 60% { opacity: 1; } 100% { transform: rotate(-8deg) scale(1); opacity: 0.9; } }
.em-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin: 12px 0 0; border-top: 1px solid var(--wood); border-bottom: 1px solid var(--wood); padding: 8px 0; }
.em-facts div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 4px 0; }
.em-facts dt { color: var(--sumi-dim); }
.em-facts dd { margin: 0; font-family: var(--mono); }
.em-types { margin-top: 14px; }
.em-types .rec-table td.c-n { text-align: right; }
.em-next { margin: 12px 0 0; font-size: 14.5px; }
.em-next b { color: var(--shu); }
.rec-drill .cta { margin-top: 8px; }
.spark { display: flex; align-items: flex-end; gap: 5px; height: 44px; margin: 14px 0 0; padding: 0 4px; }
.spark i { flex: 1; background: #cdbd9a; border-radius: 2px 2px 0 0; }
.spark i.rec { background: var(--shu); }
.spark i.now { background: var(--ai); }
.spark-l { font-size: 12px; color: var(--sumi-dim); display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.tips { margin-top: 14px; border-left: 3px solid var(--andon); padding: 4px 12px; background: var(--washi-3); }
.tips-head { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; color: #9a5b12; }
.tips p { margin: 2px 0 0; font-size: 13px; }
.emaki-body .cta { margin-top: 20px; }
.emaki-body .btn { font-size: 16px; padding: 11px 20px; }
.emaki-body .btn.ghost { color: var(--sumi); border-color: var(--paper-line); }

.rec-seg { margin: 14px 0 6px; border-color: var(--paper-line); }
.rec-seg button { color: var(--sumi); border-color: var(--paper-line); font-family: var(--sans); font-size: 14px; }
.rec-seg button small { color: var(--sumi-dim); }
.rec-seg button[aria-pressed="true"] { background: var(--ai); color: #fff; }
.rec-seg button[aria-pressed="true"] small { color: #cdd9ee; }
.records-body { display: grid; gap: 16px; margin-top: 12px; }
.rec-log p { margin: 4px 0; font-size: 16px; }
.rec-log b { color: var(--shu); }
.rec-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.rec-tile { border: 1px solid var(--paper-line); background: var(--washi-3); padding: 8px 10px; }
.rec-tile small { display: block; font-size: 11.5px; color: var(--sumi-dim); }
.rec-tile b { font-size: 19px; }
.rec-panel { border-top: 1px solid var(--wood); padding-top: 8px; }
.rec-head { font-size: 13px; font-weight: 600; letter-spacing: 0.05em; color: var(--sumi-dim); margin-bottom: 8px; }
.rec-chart { position: relative; height: 170px; }
.rec-svg { width: 100%; height: 100%; display: block; }
.rec-svg .bar { fill: #cdbd9a; }
.rec-svg .bar.rec { fill: var(--shu); }
.rec-svg .bar.now { fill: var(--ai); }
.rec-svg .bar.rec.now { fill: var(--shu); }
.rec-svg .par { stroke: var(--moss); stroke-width: 1; stroke-dasharray: 2 4; }
.rec-svg .best { stroke: var(--shu); stroke-width: 1.5; stroke-dasharray: 4 3; }
.rec-chart .lbl { position: absolute; right: 0; transform: translateY(-110%); font-size: 11px; background: var(--washi); padding: 0 4px; }
.rec-chart .par-l { color: var(--moss); }
.rec-svg.daily .line { fill: none; stroke: var(--ai); stroke-width: 2; }
.daily-chart .dot { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--ai); }
.daily-chart { height: 140px; }
.daily-l { display: flex; justify-content: space-between; font-size: 12px; color: var(--sumi-dim); margin-top: 4px; }
.daily-l b { color: var(--shu); }
.learnt-list .rec-head { margin-bottom: 8px; }
.learnt-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.learnt-list li { font-size: 12.5px; border: 1px solid var(--paper-line); border-radius: 3px; padding: 2px 8px; color: var(--sumi-dim); }
.learnt-list li.ok { border-color: var(--moss); color: var(--moss); font-weight: 700; }
.learnt-list li small { margin-left: 6px; font-weight: 400; font-size: 11px; }
.rec-chart .best-l { color: var(--shu); left: 0; right: auto; }
.weak-list { margin: 0; padding-left: 1.4em; display: grid; gap: 10px; }
.weak-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
.w-text { font-weight: 700; }
.w-num { font-family: var(--mono); font-size: 12px; color: var(--sumi-dim); text-align: right; }
.w-keys { grid-column: 1 / -1; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.w-keys kbd { font-size: 12px; padding: 2px 6px; }
.w-tip { grid-column: 1 / -1; font-size: 12.5px; color: var(--sumi-dim); border-left: 2px solid var(--andon); padding-left: 8px; }
.w-strong { font-size: 13px; color: var(--sumi-dim); margin: 8px 0 0; }
.rec-empty { font-size: 13px; color: var(--sumi-dim); margin: 0; }
.rec-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rec-table th { text-align: left; font-weight: 400; font-size: 12px; color: var(--sumi-dim); border-bottom: 1px solid var(--wood); padding: 4px 6px; }
.rec-table td { padding: 5px 6px; border-bottom: 1px dashed var(--paper-line); }
.rec-table .r-time { font-family: var(--mono); }
.rec-table .c-n { font-family: var(--mono); color: var(--sumi-dim); }
.rec-table tr.is-rec .r-time, .rec-table .r-star { color: var(--shu); font-weight: 700; }
.records .emaki-body .cta { justify-content: flex-end; }
.rec-tab { margin: 4px 0 0; border-color: var(--paper-line); }
.rec-tab button, .rec-span button { color: var(--sumi); border-color: var(--paper-line); font-family: var(--sans); font-size: 14px; }
.rec-tab button[aria-pressed="true"], .rec-span button[aria-pressed="true"] { background: var(--wood-d); color: #fff; }
/* the 引き継ぎ tab has no course: the row keeps its space so nothing jumps */
.rec-seg.off { visibility: hidden; }
.rec-span { margin: 0 0 10px; border-color: var(--paper-line); }
.rec-span button { font-size: 13px; padding: 4px 14px; }
.rec-table.board tr.is-me td { background: #fff1d0; font-weight: 700; }
.rec-table.board .r-own { font-size: 11px; font-weight: 400; color: var(--sumi-dim); white-space: nowrap; }
.sync-key { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.sync-key code { font-family: var(--mono); font-size: 18px; background: var(--washi-3); border: 1px solid var(--paper-line); padding: 4px 10px; color: var(--sumi); word-break: break-all; }
.name-form { display: grid; gap: 4px; }
.name-form label { font-size: 13px; color: var(--sumi-dim); }
.nf-row { display: flex; gap: 8px; flex-wrap: wrap; }
.nf-row input { flex: 1 1 180px; min-width: 0; font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid var(--paper-line); background: #fff; color: var(--sumi); border-radius: 3px; }
.nf-row .btn { font-size: 14px; padding: 8px 14px; }
.nf-msg { font-size: 12px; color: var(--sumi-dim); min-height: 1em; }
.em-board, .em-ghost { margin: 10px 0 0; font-size: 14px; }
.em-board b, .em-ghost.win b { color: var(--shu); }
.em-board a { color: var(--ai); }
.em-board.dim { color: var(--sumi-dim); font-size: 12.5px; }
.em-board.name-form { border: 1px dashed var(--paper-line); padding: 10px 12px; background: var(--washi-3); }

/* confetti for a record: paper and lamplight */
#fx { position: fixed; left: 50%; top: 40%; width: 0; height: 0; z-index: 60; pointer-events: none; }
#fx .p { position: absolute; width: 9px; height: 13px; left: -4px; top: -6px; animation: burst 1.2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards; }
#fx .c1 { background: var(--andon); } #fx .c2 { background: var(--shu); } #fx .c3 { background: var(--washi); } #fx .c4 { background: var(--andon-2); }
@keyframes burst {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 140px)) rotate(var(--rot)); opacity: 0; }
}

/* ---- narrow screens ------------------------------------------------------------- */

@media (max-width: 960px) {
  .title { grid-template-columns: minmax(0, 1fr); gap: 36px; padding: 28px 16px 40px; }
  .facade { display: none; }
  .play-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
  body:not([data-detail="1"]) .play-body { grid-template-rows: minmax(0, 1fr); }
  .side { overflow: visible; }
  .motd .ob-q { font-size: 15px; }
  .ob-q { font-size: 16px; }
  .ob-guide { margin-left: 0; }
  /* The keys say it all on a phone, unless the step is words (a name to type, Esc). */
  .ob-guide:not(.ob-prompt) .ob-txt { display: none; }
}
@media (max-width: 760px), (pointer: coarse) {
  .keybar { display: flex; }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .topbar { padding: 6px 12px; }
  .brand-name { font-size: 16px; }
  .meta { display: none; }
  .wing { grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
  .wing-best { grid-column: 2; text-align: left; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .wing-best b { font-size: 17px; }
  .game { padding: 0 8px 8px; gap: 6px; }
  .playbar { gap: 10px; padding: 6px 0; }
  .pb-course { font-size: 13px; }
  .pb-time { font-size: 22px; }
  .pb-pen { display: none; }
  .sashizu { padding: 10px 12px; }
  .sz-lab { display: none; }
  .sz-q { font-size: 18px; margin: 0 0 8px; }
  .sz-hint, .sz-cmd { display: none; }
  .andon { margin-top: 8px; padding: 6px 8px; }
  .yashiki { border-width: 4px; padding: 5px; gap: 5px; }
  .term { font-size: 13px; }
  .game-foot { display: none; }
  .key.k-quit { display: inline-block; }
  .result, .records { padding: 24px 8px 40px; }
  .emaki-body { padding: 20px 16px 18px; }
  /* the title's buttons fill the row, two to a row */
  .hero .cta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .hero .cta .btn { width: 100%; padding: 12px 8px; font-size: 15px; }
  .em-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .em-facts { grid-template-columns: minmax(0, 1fr); }
  .rec-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec-table .r-note { display: none; }
  .weak-list li { grid-template-columns: minmax(0, 1fr); }
  .w-num { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ==== plain tmux: the play screen looks like tmux itself ===================
   No rooms, no furniture, no fusuma. A dark terminal, tmux's green status
   bar, the pane numbers prefix q shows (always on, dim), the active pane's
   border green. The order is printed as shell comments above the prompt. */
.yashiki {
  --term-bg: #0d1117; --term-fg: #c9d1d9; --term-dim: #6e7681;
  --t-line: #30363d; --t-green: #3fb950; --t-red: #f85149; --t-yellow: #e3b341; --t-blue: #58a6ff;
  --status-bg: #2d9a4a; --status-fg: #04210d;
  background: #161b22; border: 0; border-radius: 6px; padding: 8px; box-shadow: var(--shadow);
}
.yashiki .term { background: var(--term-bg); background-image: none; color: var(--term-fg); border: 1px solid var(--t-line); }
.yashiki .decor, .yashiki .glow, .yashiki .fusuma, .yashiki .wipe { display: none !important; }
body[data-armed="1"] .yashiki .term { box-shadow: none; }
/* panes: numbers instead of titles */
.yashiki .pane-title { position: absolute; top: 2px; right: 8px; left: auto; height: auto; line-height: 1; background: none; padding: 0; z-index: 3; pointer-events: none; display: flex; gap: 6px; align-items: center; }
/* dim but readable (about 5:1); yellow where the question points, red
   where it closes; green where you stand, whatever else it is */
.yashiki .pnum { font-family: var(--mono); font-size: 28px; font-weight: 700; color: #7d8590; }
.yashiki .pane.wanted .pnum { color: var(--t-yellow); }
.yashiki .pane.wanted-close .pnum { color: var(--t-red); }
.yashiki .pane.active .pnum { color: var(--t-green); }
.yashiki .pane.cramped .pnum { font-size: 18px; }
.yashiki .zoom-flag { font-family: var(--mono); font-size: 12px; font-weight: 700; color: #04210d; background: var(--t-green); padding: 0 5px; border-radius: 2px; }
.yashiki .pt-name { font-family: var(--mono); font-size: 12px; background: none; border: 0; color: var(--term-dim); }
.yashiki .pane-body { top: 0; padding: 4px 1ch 0; }
.yashiki .pane.active::after { box-shadow: inset 0 0 0 2px var(--t-green); }
.yashiki .pane:not(.active):not(.wanted) > .pane-body { opacity: 0.6; }
.yashiki .border.v, .yashiki .border.h { background: none; }
.yashiki .border.v::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px solid var(--t-line); }
.yashiki .border.h::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--t-line); }
.yashiki .border.v.near::before { border-left-color: var(--t-green); }
.yashiki .border.h.near::before { border-top-color: var(--t-green); }
.yashiki .sh-prompt { color: var(--t-blue); }
.yashiki .sh-dim { color: var(--term-dim); }
.yashiki .sh-head { color: var(--t-blue); }
.yashiki .sh-gold { color: var(--t-yellow); }
.yashiki .sh-err { color: var(--t-red); }
.yashiki .cursor { background: var(--term-fg); }
.yashiki .cursor.on-char { color: var(--term-bg); }
/* the order: comment lines above the prompt */
.yashiki .motd { position: static; background: none; border: 0; box-shadow: none; padding: 4px 0 2px; color: #8b949e; font-family: var(--mono); font-size: 13px; line-height: 1.55; white-space: normal; }
.yashiki .motd.pinned { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 4px 1ch; background: rgba(13, 17, 23, 0.94); border-top: 1px solid var(--t-line); }
.yashiki .motd > div { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: 0; }
.yashiki .ob-c { color: #6e7681; }
.yashiki .ob-n { font-family: var(--mono); font-size: 12px; color: #8b949e; letter-spacing: 0; }
.yashiki .ob-q { font-family: var(--sans); font-size: 15px; font-weight: 700; color: #f0f6fc; line-height: 1.4; }
.yashiki .ob-cmd { font-size: 12px; color: var(--t-blue); }
.yashiki .ob-txt { color: #c9d1d9; font-family: var(--sans); font-size: 13px; }
.yashiki .motd-go { color: var(--t-yellow); font-size: 11px; }
.yashiki .ob-alt, .yashiki .ob-note { color: #8b949e; font-size: 12px; }
.yashiki .ob-guide.learnt { color: var(--t-green); }
.yashiki .motd kbd { background: #21262d; color: #e6edf3; border: 1px solid #444c56; box-shadow: 0 1px 0 #444c56; }
.yashiki .motd .arr { color: #8b949e; }
.yashiki .motd kbd.next, .yashiki .motd kbd.pfx.next { background: var(--t-yellow); color: #111; border-color: #b08800; box-shadow: 0 1px 0 #b08800; }
.yashiki .motd kbd.done { background: #1f3b2a; color: #8dd3a0; border-color: #2f5a3e; }
/* the target: a dashed outline and a stamp in its middle */
.yashiki .goal { border: 2px dashed var(--t-yellow); background: rgba(227, 179, 65, 0.06); }
.yashiki .goal.close { border-color: var(--t-red); background: rgba(248, 81, 73, 0.08); }
.yashiki .goal-tag { left: 50%; right: auto; top: 50% !important; transform: translate(-50%, -50%); font-family: var(--sans); font-size: 15px; padding: 2px 12px; background: var(--t-yellow); color: #111; border-radius: 3px; }
.yashiki .goal.close .goal-tag { background: var(--t-red); color: #fff; }
.yashiki .goal.split-v::after, .yashiki .goal.split-h::after { border-color: var(--t-yellow); }
.yashiki .goal-arrow line { stroke: var(--t-yellow); }
.yashiki .goal-arrow path { fill: var(--t-yellow); }
.yashiki .goal-key { background: #161b22; color: #f0f6fc; border-color: var(--t-yellow); }
/* tmux's own status bar */
.yashiki .status { background: var(--status-bg); color: var(--status-fg); border-radius: 0; }
.yashiki .st-session { color: var(--status-fg); }
.yashiki .st-win.cur { background: none; color: var(--status-fg); font-weight: 700; }
.yashiki .st-host { color: var(--status-fg); }
.yashiki .st-win.goal-tab { outline-color: #111; }
.yashiki .st-win .goal-tag { background: #111; color: var(--t-yellow); }
.yashiki .st-session.goal-tab { outline-color: #111; }
.yashiki .st-session .goal-tag, .yashiki .picker-row .goal-tag { background: #111; color: var(--t-yellow); transform: none; }
.yashiki .picker-row.goal-row { outline-color: var(--t-yellow); }
.yashiki .seal { border-color: var(--t-green); color: var(--t-green); background: rgba(13, 17, 23, 0.85); }
/* the guide card: the one place the order lives, on the arrow or the pane */
.yashiki .guide-card.motd {
  position: absolute; z-index: 8; max-width: min(420px, calc(100% - 12px)); pointer-events: none;
  background: #161b22; border: 2px solid var(--t-yellow); border-radius: 6px; padding: 8px 12px 9px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); color: #c9d1d9;
}
.yashiki .guide-card .gc-tag { display: inline-block; margin-bottom: 4px; font-family: var(--sans); font-size: 12px; font-weight: 700; color: #111; background: var(--t-yellow); padding: 0 8px; border-radius: 3px; }
.yashiki .guide-card .ob-q { font-size: 16px; }
.yashiki .guide-card .ob-guide { margin-top: 6px; }
.yashiki .guide-card .ob-keys kbd { font-size: 14px; padding: 2px 9px; }
.yashiki .goal.close .goal-tag + .gc-tag { display: none; }
.facade { display: none !important; }
/* where you stand: said in words, above everything */
.here-tag { display: none; }
.yashiki .here-tag { display: block; position: absolute; z-index: 9; pointer-events: none; font-family: var(--sans); font-size: 13px; font-weight: 700; line-height: 1.5; color: #04210d; background: var(--t-green); padding: 0 8px; border-radius: 3px; }
.yashiki .pane.active::after { box-shadow: inset 0 0 0 3px var(--t-green); }
.yashiki .pane.active { background: rgba(63, 185, 80, 0.06); }
.yashiki .ob-whole { font-family: var(--sans); font-size: 12px; color: #8b949e; margin-bottom: 2px; }
.yashiki .ob-over { font-family: var(--sans); font-size: 12px; font-weight: 700; color: var(--t-red); }
.yashiki .ob-step { font-family: var(--sans); font-size: 12px; font-weight: 700; color: #111; background: var(--t-yellow); padding: 0 6px; border-radius: 3px; }
/* the language switch: a word, so as wide as it needs */
.lang-toggle { height: 34px; padding: 0 9px; border-radius: 3px; cursor: pointer; background: transparent; border: 1px solid var(--line); color: var(--ink); font-size: 13px; }
.lang-toggle:hover { border-color: var(--andon); }
/* the result to paste: a preview of exactly what is copied */
.share { margin: 12px 0 4px; display: grid; gap: 8px; }
.share-text { margin: 0; padding: 10px 12px; background: var(--bg-2); border: 1px dashed var(--line); border-radius: 3px; font-family: var(--mono); font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; user-select: all; }
.share-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.share-btns .btn { text-decoration: none; }
.share-msg { color: var(--ink-dim); }
/* 今日の問題: the day everyone shares, above the courses */
.today { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 6px 0 10px; padding: 0 2px 8px; border-bottom: 1px dashed var(--paper-line); font-size: 14px; }
.today b { font-family: var(--mincho); letter-spacing: 0.05em; }
.today-day { font-family: var(--mono); }
.today-streak { color: var(--shu); font-weight: 700; }
.today small { flex-basis: 100%; color: var(--sumi-dim); font-size: 12px; }
.wing-top:empty { display: none; }
.wing-top { color: var(--shu); }
.wing-next { color: var(--shu); font-weight: 700; }
.today-again { font-weight: 600; }
/* the key bar: the next key stands out; a steady height so the panes do not jump */
.key.k-level { border-color: #9b8a6a; }
.key.k-next { border-color: var(--andon); background: #fff3d2; box-shadow: 0 0 0 2px var(--andon); }
.key.k-prefix.k-next { background: var(--andon); color: #2b1a05; }
@media (max-width: 700px) { .keybar { min-height: calc(2 * 43px + 6px); align-content: flex-start; } }
.pb-conf { font-size: 12px; padding: 0 8px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink-dim); }
.pb-free { font-size: 13px; color: var(--ink-dim); text-align: right; }
/* the resize mark sat on the right edge whatever border moves: the card and the green borders say it */
.yashiki .goal.resize::after { display: none; }
/* the copy-mode [pos/history] keeps left of the pane number */
.yashiki .pane-body.copy .copy-ind { margin-right: var(--numw, 46px); }
/* いまここ as a dot, for a pane too narrow for the word */
.yashiki .here-tag.dot { padding: 0 4px; line-height: 18px; font-size: 10px; }
/* the bars say their time; the legend shows its colours */
.spark i { position: relative; }
.spark i b { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); font: 400 10px var(--mono); color: var(--sumi-dim); white-space: nowrap; }
.spark { margin-top: 26px; }
.spark-key i { display: inline-block; width: 10px; height: 10px; margin: 0 4px 0 8px; vertical-align: -1px; border-radius: 2px; }
.spark-key i.rec { background: var(--shu); }
.spark-key i.now { background: var(--ai); }
.here-tag { white-space: nowrap; }
/* a phone: the window list needs the whole bar; the host and clock step
   aside, and the tag on the wanted tab (the card says it) */
@media (max-width: 700px) {
  .yashiki .st-host, .yashiki .st-clock, .yashiki .st-win .goal-tag { display: none; }
  .yashiki .st-win { padding: 0 0.5ch; }
}
/* the three slowest questions on the result */
.em-slow { margin: 14px 0 0; }
.em-slow ol { margin: 0; padding-left: 1.4em; display: grid; gap: 2px; font-size: 14px; }
.em-slow li { display: flex; justify-content: space-between; gap: 12px; }
.em-slow b { font-family: var(--mono); font-weight: 400; white-space: nowrap; }
.em-slow small { margin-left: 8px; color: var(--shu); font-family: var(--sans); font-size: 12px; }
/* display-panes (prefix → q): the pane numbers, big, for a second */
#term > .dp-num { position: absolute; z-index: 9; display: flex; align-items: center; justify-content: center; pointer-events: none; font-family: var(--mono); font-size: 56px; font-weight: 700; color: #fff; text-shadow: 0 0 8px #000, 0 0 2px #000; }
#term > .dp-num.active { color: var(--andon-2); }
/* belts: a title's colour as a small still mark (the name is always written
   beside it); past 黒帯 the belt stays black and gains gold stripes, 名人
   wears the red one. A sumi edge keeps the white and the black belt visible
   on the paper by day and on the night page alike. */
.belt { display: inline-block; box-sizing: border-box; width: 24px; height: 10px; border-radius: 2px; vertical-align: 0; margin-right: 6px; border: 1px solid #6f6558; background: #f6f2e8; }
.belt.b-green { background-color: #2f8a4b; }
.belt.b-brown { background-color: #7a4a1e; }
.belt.b-black { background-color: #1c1a18; }
.belt.b-red { background-color: #c4302b; }
.belt.s1 { background-image: linear-gradient(90deg, transparent 0 16px, #f0c04a 16px 18px, transparent 18px); }
.belt.s2 { background-image: linear-gradient(90deg, transparent 0 12px, #f0c04a 12px 14px, transparent 14px 16px, #f0c04a 16px 18px, transparent 18px); }
.belt.s3 { background-image: linear-gradient(90deg, transparent 0 8px, #f0c04a 8px 10px, transparent 10px 12px, #f0c04a 12px 14px, transparent 14px 16px, #f0c04a 16px 18px, transparent 18px); }
/* the name tag on a course card: the title reached there */
.wing-title { font-size: 12px; font-family: var(--sans); font-weight: 600; color: var(--sumi); white-space: nowrap; }
.wing-title .belt { margin-right: 4px; }
/* the ladder, from the course select */
.plan-ladder { margin: 6px 0 0; font-size: 12.5px; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; color: var(--sumi-dim); text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--sumi); }
/* the result: 昇格 in words; the Lv is いまの調子, small, under the title */
.em-promo { color: var(--shu); font-size: 22px; }
.em-held { display: block; font-size: 13px; color: var(--sumi-dim); }
.em-rank .belt { margin-right: 6px; }
.em-rank .rank { display: inline-block; }
.sk-form { font-size: 12px; font-family: var(--sans); font-weight: 400; color: var(--ink-dim); letter-spacing: 0.05em; }
.em-skill .sk-form { color: var(--sumi-dim); }
.em-skill .sk-lv { font-size: 18px; }
.em-skill .sk-lv small { font-size: 12px; }
.rec-next { margin: 8px 0 0; font-size: 13.5px; color: var(--shu); font-weight: 600; }
.rec-menjo td { white-space: nowrap; }

/* ---- ghost race, replay, shared configs ---------------------------------------- */

/* the strip under the bar: words only, one line on a phone; never over the house */
.ghostbar { display: flex; align-items: center; gap: 14px; flex: none; margin-top: -6px; padding: 4px 0 6px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-dim); min-height: 30px; white-space: nowrap; overflow: hidden; }
.ghostbar[hidden] { display: none; }
.gb-who b { color: var(--ink); font-weight: 600; }
.gb-q { font-family: var(--mono); color: var(--ink); }
.gb-keys { display: inline-flex; gap: 4px; align-items: center; min-width: 0; overflow: hidden; }
.gb-keys kbd { font-size: 12px; padding: 0 5px; flex: none; }
.gb-keys small, .gb-state { color: var(--ink-dim); }
.gb-ctl { display: inline-flex; gap: 6px; }
.gb-ctl .btn { padding: 2px 10px; font-size: 13px; }
.gb-ctl .btn[aria-pressed="true"] { background: var(--washi); color: var(--sumi); }
.pb-replay { color: var(--shu); font-weight: 700; letter-spacing: 0.1em; }

/* the ghost to race, on the course select and under the board */
.ghost-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 10px; padding: 0 2px 8px; border-bottom: 1px dashed var(--paper-line); font-size: 13px; color: var(--sumi-dim); }
.records-body .ghost-pick { border-bottom: 0; margin: 12px 0 0; padding: 0; }
.ghost-pick .seg button { padding: 3px 10px; font-size: 13px; }

/* the result: the questions that took more keys than the fewest */
.em-overkeys { margin-top: 12px; font-size: 13px; }
.em-overkeys .ok-head { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; color: var(--sumi-dim); }
.em-overkeys ul { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.em-overkeys li span { font-family: var(--mono); color: var(--sumi-dim); margin-left: 6px; }
.em-watch { margin: 12px 0 0; }
.watch-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 4px 0 0; font-size: 12.5px; }
.watch-link a { color: var(--ai); overflow-wrap: anywhere; }
.watch-link .btn { padding: 2px 10px; font-size: 12.5px; }
.watch-link .watch-msg { color: var(--sumi-dim); }

/* a published .tmux.conf, read-only */
.conf-view { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; background: var(--washi-3); color: var(--sumi); border: 1px solid var(--paper-line); padding: 10px 12px; max-height: 50vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 10px; }
.conf-dialog { border: 1px solid var(--line); border-radius: 3px; background: var(--washi); color: var(--sumi); padding: 18px 20px; width: min(720px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.conf-dialog::backdrop { background: rgba(20, 16, 10, 0.6); }
.conf-dialog h3 { margin: 0 0 8px; font-family: var(--mincho); font-weight: 600; }
.conf-dialog .warn { margin: 0 0 10px; font-size: 13.5px; color: #8a2d1c; border-left: 3px solid var(--shu); padding-left: 10px; }
.conf-dialog .fine { margin: 0 0 10px; color: var(--sumi-dim); }
.conf-dialog .cta .nf-msg { color: var(--sumi-dim); }
.rec-table .r-watch, .rec-table.board .r-own a { color: var(--ai); font-size: 12px; white-space: nowrap; }
.rec-table.keylist .k-keys { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.rec-table.keylist .k-keys kbd { font-size: 11.5px; padding: 0 4px; }
.rec-table.keylist .k-keys small { color: var(--sumi-dim); font-family: var(--mono); margin-left: 4px; }
.rec-table.keylist tr.over .k-keys small { color: var(--shu); }
@media (max-width: 760px) {
  .ghostbar { gap: 8px; font-size: 12px; margin-top: -2px; padding: 2px 0 4px; }
  .gb-ctl .btn { padding: 1px 7px; }
  .gb-keys kbd { font-size: 11px; }
  .gb-state, .pb-who { display: none; }
  .records-body .ghost-pick .gp-l { flex-basis: 100%; }
}

/* --- tatsujin --- */
/* a replay has its own controls: the play buttons under the house go */
body[data-watching="1"] .game-foot, body[data-watching="1"] .keybar { display: none !important; }
/* the 完成図 of a layout question, small, in the guide card */
.ob-fig { position: relative; width: 120px; max-width: 40%; margin-top: 6px; border: 1px solid var(--sumi-dim); background: var(--washi-3); }
.ob-fig i { position: absolute; box-sizing: border-box; border: 1px solid var(--sumi-dim); display: flex; align-items: center; justify-content: center; font-style: normal; }
.ob-fig i b { font-family: var(--mono); font-size: 10px; font-weight: 700; }
.ob-fig i.me { background: rgba(63, 185, 80, 0.25); }
.yashiki .ob-fig { border-color: #8b949e; background: #0d1117; }
.yashiki .ob-fig i { border-color: #8b949e; color: #c9d1d9; }
.yashiki .ob-fig i.me { background: rgba(63, 185, 80, 0.3); border-color: var(--t-green); }
/* 今日の達人, one line under 今日の問題 */
.today-daily { flex-basis: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 0; font-size: 13.5px; }
.today-daily .td-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-daily .td-go { flex: none; padding: 3px 12px; font-size: 13px; }
.daily-board { margin-top: 12px; }
/* the share text keeps its own ink on its own ground (it was dark on dark in the dark theme) */
.share-text { color: var(--ink); }

/* ---- ux 3 ---- */
/* 上級・達人: the steps start hidden from the second run (the card and the bar say so) */
.wing-blind { display: block; font-size: 12px; color: var(--wood); margin-top: 2px; }
.pb-note { font-size: 12px; padding: 0 8px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink-dim); white-space: nowrap; }
@media (max-width: 760px) { .pb-course { white-space: nowrap; } .pb-note { font-size: 11px; padding: 0 5px; white-space: normal; } }
/* the first run's result: the next belt, not the お手本 gap in red */
.em-verdict.em-goal b { color: var(--moss); }
/* key golf: fewer keys than 標準 */
.em-parbeat { margin: 8px 0 0; font-size: 14px; font-weight: 700; color: var(--moss); }
/* はじめての回: the two words, kept on a small pane too */
.yashiki .ob-words { color: var(--t-yellow); }
.pane.cramped .motd .ob-note.ob-words { display: block; }
/* list-keys: one line of plain words above the English list */
.yashiki .view-hint { color: var(--t-yellow); white-space: normal; }
/* 練習: the keys learnt so far */
.cheat { flex: none; font-size: 13px; color: var(--ink); border-top: 1px solid var(--line); padding-top: 4px; }
.cheat summary { cursor: pointer; font-size: 13px; color: var(--ink-dim); padding: 2px 0; }
.cheat .ch-how { margin: 2px 0 4px; color: var(--ink-dim); font-size: 12px; }
.cheat .ch-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 18px; max-height: 24vh; overflow: auto; }
.cheat .ch-list li { display: flex; gap: 8px; align-items: baseline; line-height: 1.5; }
.cheat .ch-list li.ch-house { grid-column: 1 / -1; font-weight: 700; color: var(--hero-accent); font-size: 12px; margin-top: 2px; }
.cheat .ch-keys { flex: none; min-width: 5.5em; font-family: var(--mono); white-space: nowrap; }
.cheat .ch-keys code { font-size: 12px; }
.cheat .ch-keys small { font-family: var(--sans); color: var(--ink-dim); }
.cheat kbd { font-size: 12px; padding: 0 5px; }
.cheat .ch-what { color: var(--ink); }
@media (max-width: 760px) { .cheat .ch-list { grid-template-columns: minmax(0, 1fr); max-height: 22vh; } .cheat { font-size: 12.5px; } }
