/* NAZO LOG。出典は参照モック（nazo-log-proto.html）の <style>。
   Notebook: light only, monochrome. Dot-grid paper, ink lines, status by line style (not color).
   モックとの差分: ボタンを <a> / フォーム部品に置き換えた分の補足、#app.wide を @media に置き換え、
   .scrim を dialog::backdrop に置き換え。 */
:root {
  --bg: #f6f4ee;
  --dot: #d9d5ca;
  --surface: #fffefa;
  --surface2: #efece4;
  --line: #cfcabd;
  --rule: #1c1c1c;
  --fg: #1c1c1c;
  --muted: #6b6a66;
  --accent: #1c1c1c;
  --accent-ink: #fffefa;
  --danger: var(--pen-red);
  /* ペン: 蛍光ペン（意味は持たせない）・赤ペン（失敗・期限・戻せない操作）・青ペン（文字リンク） */
  --hl: #ffe45c;
  /* 蛍光マーカーの色。黄以外は統計のグラフ系列とそれを指す KPI だけに使う（docs/visual-design.md §3.3） */
  --mk-yellow: var(--hl);
  --mk-pink: #ff9ec4; /* 失敗 */
  --mk-green: #8fdc7a; /* 成功 */
  --mk-cyan: #86d0f2; /* Web */
  --mk-orange: #ffb257; /* 周遊 */
  --mk-purple: #c3a6f2; /* LINE */
  --mk-teal: #7ad9c0; /* カフェ */
  --mk-periwinkle: #a9b8f5; /* 箱 */
  --mk-gray: #d3cfc4; /* その他・形式未設定 */
  /* 模様（インク 60% の細線。色と必ず組にする） */
  --ink-pat: rgb(28 28 28 / 0.6);
  --pat-diag: repeating-linear-gradient(45deg, var(--ink-pat) 0 1px, transparent 1px 5px);
  --pat-back: repeating-linear-gradient(-45deg, var(--ink-pat) 0 1px, transparent 1px 5px);
  --pat-horiz: repeating-linear-gradient(0deg, var(--ink-pat) 0 1px, transparent 1px 4px);
  --pat-vert: repeating-linear-gradient(90deg, var(--ink-pat) 0 1px, transparent 1px 4px);
  /* --ps: 4px 4px と組 */
  --pat-dot: radial-gradient(var(--ink-pat) 0.9px, transparent 1.3px);
  --pat-cross:
    repeating-linear-gradient(45deg, var(--ink-pat) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(-45deg, var(--ink-pat) 0 1px, transparent 1px 6px);
  --pat-grid:
    repeating-linear-gradient(0deg, var(--ink-pat) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, var(--ink-pat) 0 1px, transparent 1px 4px);
  --pen-red: #b4302a;
  --pen-blue: #1f4fa3;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --info: #1c1c1c;
  --warn: #1c1c1c;
  --sans: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  /* 詳細の 1 番目（docs/visual-design.md §2.2） */
  --fs-xl: 22px;
  color-scheme: light;
}
html,
body {
  height: 100%;
  font-variant-numeric: tabular-nums;
}
body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 20px 20px;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}
* {
  box-sizing: border-box;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100%;
  position: relative;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px 110px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  border-bottom: 2px solid var(--rule);
  margin-bottom: 4px;
}
.top h1,
.top h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.back {
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -10px;
}
/* index tabs */
.tabs {
  display: flex;
  gap: 0;
  margin: 12px 0 14px;
  border-bottom: 1px solid var(--rule);
}
.tab {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: -1px;
}
.tab.on {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--rule);
}
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* entry = notebook page strip with a margin rule */
.ticket {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  min-height: 88px;
  padding: 0;
  text-align: left;
  width: 100%;
  position: relative;
  box-shadow: 2px 2px 0 var(--surface2);
}
.stub {
  width: 72px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-right: 3px double var(--line);
}
.stub .m {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.stub .d {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
}
.stub .nd {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}
.tbody {
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  background-image: linear-gradient(transparent calc(100% - 1px), var(--surface2) 0);
  background-size: 100% 26px;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.meta {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.title {
  font-size: 17px;
  font-weight: 700;
  line-height: 26px;
  font-feature-settings: "palt";
}
/* 詳細ページの 1 番目 */
.title.xl {
  font-size: var(--fs-xl);
}
/* 数字（日付など）の桁揃え */
.mono {
  font-family: var(--mono);
}
/* list: cut long titles at 2 lines; detail pages show the full title */
.ticket .title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
/* status = stamp; distinguished by line style */
.chip {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1.5px solid var(--fg);
  background: transparent;
  color: var(--fg);
  min-width: 4.5em;
  text-align: center;
}
.st-cleared {
  background: var(--fg);
  color: var(--surface);
}
.st-in_progress {
  border-style: solid;
}
.st-purchased {
  border-style: dashed;
}
.st-failed {
  border-style: double;
  border-width: 3px;
  padding: 1px 6px;
  border-color: var(--pen-red);
  color: var(--pen-red);
}
.st-dropped {
  border-color: var(--muted);
  color: var(--muted);
  text-decoration: line-through;
}
.mark {
  font-size: 12px;
  font-weight: 700;
}
.fab {
  position: fixed;
  right: max(20px, calc(50% - 210px));
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  height: 52px;
  padding: 0 20px;
  border-radius: 6px;
  border: none;
  background: var(--fg);
  color: var(--surface);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 3px 3px 0 var(--line);
  z-index: 5;
}
nav.bn {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  z-index: 6;
  background: var(--surface);
  border-top: 2px solid var(--rule);
}
nav.bn .in {
  max-width: 460px;
  margin: 0 auto;
  height: 58px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
nav.bn a {
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
nav.bn a.on {
  color: var(--fg);
}
nav.bn a.on::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 22%;
  right: 22%;
  height: 4px;
  background: var(--fg);
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: none;
  border-bottom: 1.5px solid var(--rule);
  padding: 0 4px;
  height: 46px;
  margin-top: 8px;
}
.search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  min-width: 0;
}
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 0;
  margin-bottom: 4px;
}
.fchip {
  flex-shrink: 0;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 19px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
}
.fchip.on {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--surface);
  font-weight: 700;
}
.note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 2px 2px 0 var(--surface2);
}
.sect {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.sect h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  padding-bottom: 2px;
  border-bottom: 1px dashed var(--line);
}
.row h2 {
  border-bottom: none;
}
.kv {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 0 12px;
  font-size: 14px;
}
.kv dt,
.kv dd {
  padding: 6px 0;
  border-bottom: 1px solid var(--surface2);
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
}
.nums {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px dashed var(--rule);
  padding-top: 12px;
}
.num span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.num b {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
}
.btn {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 4px;
  border: 1.5px solid var(--fg);
  background: var(--surface);
  font-weight: 700;
  font-size: 14px;
}
.btn.pri {
  background: var(--fg);
  color: var(--surface);
}
.btn.ghost {
  border-color: var(--line);
}
.btn.danger {
  border-style: dashed;
  color: var(--pen-red);
  border-color: var(--pen-red);
}
.btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btns .btn {
  flex: 1 1 140px;
}
/* wishlist row: ticket + remove button side by side */
.wrow > .ticket {
  flex: 1;
  min-width: 0;
}
.wrow > form {
  flex-shrink: 0;
}
.wrow .btn {
  white-space: nowrap;
}
.seg {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border: 1.5px solid var(--fg);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
}
.seg button {
  min-height: 44px;
  border: none;
  border-right: 1px solid var(--line);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  padding: 0;
}
.seg button:last-child {
  border-right: none;
}
.seg button.on {
  background: var(--fg);
  color: var(--surface);
}
.dots {
  display: flex;
  gap: 6px;
}
.dots button {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.dots button.on {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--surface);
}
.gtags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gtag {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
}
button.gtag.on {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--surface);
  font-weight: 700;
}
/* spoiler = sealed page */
.spoil {
  border: 1.5px dashed var(--fg);
  border-radius: 4px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
}
.spoil .lock {
  font-size: 12px;
  color: var(--muted);
}
.veil {
  height: 44px;
  border-radius: 2px;
  background: repeating-linear-gradient(-45deg, var(--surface2) 0 6px, var(--line) 6px 7px);
}
.photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.ph {
  aspect-ratio: 1;
  max-width: 100%;
  border-radius: 2px;
  background: var(--surface2);
  border: 6px solid var(--surface);
  outline: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  padding: 4px;
  font-size: 12px;
  color: var(--muted);
}
.ph.sp {
  background: repeating-linear-gradient(-45deg, var(--surface2) 0 6px, var(--line) 6px 7px);
  align-items: center;
  justify-content: center;
  color: var(--fg);
  text-align: center;
  font-weight: 700;
}
.ph.add {
  border: 1.5px dashed var(--line);
  outline: none;
  background: transparent;
  justify-content: center;
  align-items: center;
  font-size: 24px;
}
.log {
  display: flex;
  gap: 12px;
}
.log .rail {
  width: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.log .dot {
  width: 10px;
  height: 10px;
  border-radius: 5px;
  border: 2px solid var(--fg);
  background: var(--surface);
  margin-top: 14px;
}
.log .ln {
  flex: 1;
  width: 0;
  border-left: 1.5px dotted var(--fg);
}
.log .body {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
}
.hint {
  border: 1.5px dashed var(--fg);
  border-radius: 4px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  background: var(--surface);
}
.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.field input,
.field textarea,
.field select {
  min-height: 44px;
  border: none;
  border-bottom: 1.5px solid var(--rule);
  border-radius: 0;
  background: transparent;
  padding: 8px 2px;
  font-size: 16px;
  color: var(--fg);
}
.field textarea {
  min-height: 84px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  line-height: 26px;
  background-image: linear-gradient(transparent 25px, var(--surface2) 0);
  background-size: 100% 26px;
  background-attachment: local;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  max-height: 88%;
  overflow: auto;
  background: var(--surface);
  border-top: 2px solid var(--rule);
  border-radius: 10px 10px 0 0;
  padding: 8px max(16px, env(safe-area-inset-left, 0px))
    calc(20px + env(safe-area-inset-bottom, 0px));
}
.sheet .in {
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.grab {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 4px auto 6px;
}
.sheet h3 {
  margin: 0;
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 700;
}
.pick {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 260px;
  overflow: auto;
  border-top: 1px solid var(--line);
}
.pick button {
  text-align: left;
  min-height: 52px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 8px 4px;
}
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  background: var(--fg);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  z-index: 30;
  max-width: 90%;
}
.bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bar {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 88px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.bar .tr {
  height: 10px;
  border: 1px solid var(--fg);
  border-radius: 1px;
  background: var(--surface);
  overflow: hidden;
}
.bar .fl {
  height: 100%;
}
.bar .v {
  text-align: right;
  font-family: var(--mono);
  color: var(--muted);
}
/* 団体名・同行者名は自由入力なので、長い語でも列からはみ出さない */
.bar > span:first-child {
  overflow-wrap: anywhere;
}
/* 「得意」の印（docs/visual-design.md §4.5） */
.bar .pen {
  font-size: 12px;
}
/* 棒の下の注記（団体別の平均評価）。字は本文と同じ（.v の等幅にしない） */
.bar-note {
  grid-column: 2 / -1;
  margin-top: -6px;
  font-family: inherit;
  color: var(--muted);
}
/* ラベルを棒の上の行に置く（団体別・同行者別。長い名前でも棒の幅を削らない） */
.bars.label-top .bar {
  grid-template-columns: minmax(0, 1fr) 88px;
  row-gap: 4px;
}
.bars.label-top .bar > span:first-child {
  grid-column: 1 / -1;
}
.bars.label-top .bar-note {
  grid-column: 1 / -1;
}
.cols {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
  height: 100px;
  border-bottom: 1.5px solid var(--fg);
}
.col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  height: 100%;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
}
/* グラフの系列: 色 + 模様（docs/visual-design.md §3.7）。塗る側は --c / --p / --ps を読むだけ */
.r-ok {
  --c: var(--mk-green);
  --p: var(--pat-diag);
}
.r-ng {
  --c: var(--mk-pink);
  --p: none;
}
.k-stroll {
  --c: var(--mk-orange);
  --p: var(--pat-diag);
}
.k-line {
  --c: var(--mk-purple);
  --p: var(--pat-dot);
  --ps: 4px 4px;
}
.k-web {
  --c: var(--mk-cyan);
  --p: var(--pat-horiz);
}
.k-takeaway {
  --c: var(--mk-yellow);
  --p: none;
}
.k-cafe {
  --c: var(--mk-teal);
  --p: var(--pat-vert);
}
.k-box {
  --c: var(--mk-periwinkle);
  --p: var(--pat-cross);
}
.k-other {
  --c: var(--mk-gray);
  --p: var(--pat-back);
}
.k-none {
  --c: var(--mk-gray);
  --p: var(--pat-grid);
}
.bar .fl,
.stk i,
.key {
  background-color: var(--c, var(--fg));
  background-image: var(--p, none);
  background-size: var(--ps, auto);
}
/* 横棒: 成功と失敗を 1 本に並べる。境目にインクの線 */
.bar .tr {
  display: flex;
}
.r-ok + .r-ng {
  box-shadow: inset 1px 0 0 var(--fg);
}
/* 月別の積み上げ（DOM 順 = 下から上） */
.stk {
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
  border: 1px solid var(--fg);
  border-bottom: 0;
}
.stk i {
  display: block;
  min-height: 3px;
}
.stk i + i {
  border-bottom: 1px solid var(--fg);
}
/* 凡例 */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  font-size: 12px;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 4px;
}
.key {
  display: inline-block;
  width: 14px;
  height: 10px;
  border: 1px solid var(--fg);
}
/* 強制カラーでも模様を残す */
@media (forced-colors: active) {
  .bar .fl,
  .stk i,
  .key {
    forced-color-adjust: none;
  }
}
.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
}
.kpi span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.kpi b {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
}
.switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  font-size: 14px;
}
.sw {
  width: 52px;
  height: 30px;
  border-radius: 15px;
  border: 1.5px solid var(--fg);
  background: var(--surface);
  position: relative;
  flex-shrink: 0;
}
.sw::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 11px;
  background: var(--line);
  transition: left 0.15s;
}
.sw.on {
  background: var(--fg);
}
.sw.on::after {
  left: 24px;
  background: var(--surface);
}
.menu {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.menu > *,
.menu > form > button {
  min-height: 52px;
  padding: 10px 16px;
  border: none;
  border-bottom: 1px solid var(--surface2);
  background: none;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.menu > *:last-child,
.menu > form:last-child > button {
  border-bottom: none;
}
.badge {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--fg);
  color: var(--surface);
  border-radius: 10px;
  padding: 1px 8px;
}
.diff {
  font-size: 13px;
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}
.diff .o {
  color: var(--muted);
  text-decoration: line-through;
}
.diff .n {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* 承認画面（/admin/proposals/:id）。値の URL は折り返す。出典の行は 3 列をまたぐ。採用されなかった項目は muted */
.diff .o,
.diff .n {
  overflow-wrap: anywhere;
}
.diff .full {
  grid-column: 1 / -1;
}
.diff details.full {
  margin-top: -4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--surface2);
}
.diff label {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.diff .off {
  color: var(--muted);
}
.diff .n.off {
  font-weight: 400;
}
/* 名寄せ候補の 1 行（.ticket と同じ枠） */
.cand {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 2px 2px 0 var(--surface2);
}
.cand label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
}
/* まとめて承認の選択（承認待ちの .ticket の左に Checkbox。選べない行も同じ幅を空けて揃える） */
.pick {
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.pick > .ticket {
  flex: 1;
  min-width: 0;
}
.pick-box {
  flex-shrink: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pick-box input {
  width: 20px;
  height: 20px;
  margin: 0;
}
.login {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}
.login h1 {
  font-family: var(--sans);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0;
  border-bottom: 2px solid var(--rule);
  padding-bottom: 6px;
}
.proto {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 2px 6px;
  background: var(--surface);
}
@media (prefers-reduced-motion: reduce) {
  .sw::after {
    transition: none;
  }
}

/* ===== モックの <button> を <a> / フォーム部品にした分の補足 ===== */
a.btn,
a.fab,
a.tab,
a.fchip,
a.back,
a.ticket,
nav.bn a,
.idx a,
.menu > a {
  text-decoration: none;
}
/* 統計の積み謎: 長い題名は折り返し、経過日数は折り返さず右端に残す */
.menu.backlog > a {
  overflow-wrap: anywhere;
}
.menu.backlog > a > * {
  min-width: 0;
}
.menu.backlog > a > .note {
  white-space: nowrap;
  flex-shrink: 0;
}
a.btn,
a.fab,
a.tab,
a.fchip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
a.ticket {
  color: inherit;
}
.tab[aria-current] {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--rule);
}
/* MenuItem の action 変種。form の箱を消し、中の button を行として並べる */
.menu > form {
  display: contents;
}
/* 作品ページのマイリストボタン。form の箱を消し、中の button を .btns の並びに入れる */
.btns > form {
  display: contents;
}
.menu [aria-disabled="true"],
.btn[aria-disabled="true"] {
  color: var(--muted);
  cursor: not-allowed;
}
/* 戻る版 TopBar の見出し（h1.sub）は .sub と同じ見た目にする */
.top h1.sub {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: normal;
  color: var(--muted);
}
/* 検索欄（form） */
form.search {
  margin-bottom: 0;
}
/* 記録の編集のジャンル欄・進行ログの結果欄。fieldset の枠と余白を消す */
fieldset.genres,
fieldset.outcome {
  border: none;
  margin: 0;
  padding: 0;
}
/* StatusSeg: fieldset.seg 内の radio + label。radio は隠し、checked の label を .on と同じ見た目にする */
fieldset.seg {
  position: relative;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
}
.seg input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.seg label {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.seg label:last-child {
  border-right: none;
}
.seg input:checked + label {
  background: var(--fg);
  color: var(--surface);
}
.seg input:focus-visible + label {
  outline: 2px solid var(--fg);
  outline-offset: -4px;
}
.seg input:checked:focus-visible + label {
  outline-color: var(--surface);
}
/* Switch: <input type="checkbox" role="switch" class="sw"> */
input.sw {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  cursor: pointer;
}
input.sw:checked {
  background: var(--fg);
}
input.sw:checked::after {
  left: 24px;
  background: var(--surface);
}
input.sw:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
/* SpoilerCard: 本文は public/app.js が表示操作時に取得して .spoil-body に入れる */
.spoil-title {
  margin: 0;
  color: var(--pen-red);
  font-size: 14px;
  font-weight: 700;
}
.spoil .row .btn {
  min-height: 40px;
}
.spoil .btn[aria-busy="true"] {
  opacity: 0.5;
  cursor: progress;
}
.spoil-error {
  margin: 0;
}
/* Sheet: <dialog class="sheet">。UA の dialog 既定値を打ち消す */
dialog.sheet {
  top: auto;
  margin: 0;
  width: auto;
  max-width: none;
  border: none;
  border-top: 2px solid var(--rule);
  color: var(--fg);
}
dialog.sheet::backdrop {
  background: rgba(28, 28, 28, 0.35);
}
.sheet .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.sheet .head .btn {
  min-height: 40px;
}

/* ===== スマホ（1023px 以下）: 一覧と詳細を出し分ける ===== */
@media (max-width: 1023px) {
  main.book.has-detail .pane-l {
    display: none;
  }
  main.book:not(.has-detail) .pane-r {
    display: none;
  }
}

/* ===== PC: 見開きノート（1024px 以上） ===== */
.side,
.cover {
  display: none;
}
@media (min-width: 1024px) {
  body {
    background-color: #e4e1d9;
    background-image: none;
  }
  #app.wide-able {
    max-width: 1360px;
    height: 100vh;
    padding: 24px;
    display: grid;
    grid-template-columns: 176px minmax(0, 1fr);
  }
  nav.bn,
  a.fab {
    display: none;
  }
  .side {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 8px 0;
  }
  .brand {
    font-family: var(--sans);
    font-size: 24px;
    font-weight: 700;
    border-bottom: 2px solid var(--rule);
    padding-bottom: 6px;
    margin-right: 16px;
  }
  .side > .btn {
    margin-right: 16px;
  }
  .idx {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
  }
  .idx a {
    display: flex;
    align-items: center;
    text-align: left;
    min-height: 46px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-right: none;
    border-radius: 6px 0 0 6px;
    background: var(--surface2);
    font-weight: 700;
    color: var(--muted);
    font-size: 14px;
  }
  .idx a.on {
    background: var(--surface);
    color: var(--fg);
    border-color: var(--rule);
    position: relative;
    z-index: 2;
    margin-right: -1px;
  }
  .idx a:hover:not(.on) {
    color: var(--fg);
  }
  .side .proto {
    margin-top: auto;
    align-self: flex-start;
  }
  .book {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    border: 1px solid var(--rule);
    border-radius: 3px 10px 10px 3px;
    box-shadow: 5px 5px 0 var(--line);
    overflow: hidden;
    min-height: 0;
    background: var(--surface);
  }
  .book.one {
    grid-template-columns: minmax(0, 1fr);
  }
  .page {
    overflow: auto;
    padding: 20px 36px 48px;
    min-height: 0;
    background-color: var(--bg);
    background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
    background-size: 20px 20px;
  }
  .book:not(.one) .pane-l {
    border-right: 1px solid var(--line);
    box-shadow: inset -18px 0 18px -18px rgba(0, 0, 0, 0.22);
  }
  .pane-r {
    box-shadow: inset 18px 0 18px -18px rgba(0, 0, 0, 0.22);
  }
  .pane-r .top .back {
    visibility: hidden;
  }
  .ticket.sel {
    border-color: var(--fg);
    box-shadow: 3px 3px 0 var(--fg);
  }
  .ticket:hover:not(.sel) {
    border-color: var(--muted);
  }
  .book.one .pane-l {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 64px;
    align-content: start;
    grid-auto-rows: max-content;
  }
  .book.one .pane-l > .top,
  .book.one .pane-l > .kpis,
  .book.one .pane-l > .chips,
  .book.one .pane-l > .switch,
  .book.one .pane-l > .note {
    grid-column: 1 / -1;
  }
  .cover {
    display: flex;
    min-height: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
    text-align: center;
    color: var(--muted);
    padding: 40px 0;
  }
  .cover .big {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 22px;
    color: var(--fg);
  }
  .cover .kpis,
  .cover .list {
    color: var(--fg);
  }
  .cover .kpis {
    width: 100%;
    max-width: 440px;
    text-align: left;
  }
  .book.one .cols {
    max-width: 520px;
  }
  dialog.sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, 92vw);
    max-height: 86vh;
    border: 1.5px solid var(--rule);
    border-radius: 6px;
    box-shadow: 6px 6px 0 var(--line);
    padding: 20px 24px;
  }
  .grab {
    display: none;
  }
  .toast {
    bottom: 40px;
  }
}

/* ===== ペンと重心 ===== */
/* 蛍光ペン: 字の下に引く。意味は持たせず、muted の字には引かない（AA を切る） */
.hl {
  background: linear-gradient(transparent 58%, var(--hl) 58%, var(--hl) 94%, transparent 94%)
    no-repeat;
  background-size: 100% 100%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hl {
  padding-inline: 0.12em;
}
/* 黄以外のマーカー。要素側で --hl を上書きする。統計のグラフ系列を指す字だけに使う */
.hl.mk-green {
  --hl: var(--mk-green);
}
.hl.mk-pink {
  --hl: var(--mk-pink);
}
/* .note（muted）の中の「保存しました」は字を --fg にしてから引く */
.hl.saved {
  color: var(--fg);
}
/* 青ペン: 枠の無い文字リンクは青＋下線（メニューの a は除く） */
a:not([class]):not(nav a, .menu > a),
a.meta,
.kv a,
.card a:not(.btn) {
  color: var(--pen-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
/* 結果の行の短い注記（回数・日目）。リンクと紛れないよう黒のまま */
.pen {
  font-weight: 500;
  font-size: 15px;
  color: var(--fg);
}
.chip.lg {
  font-size: 15px;
  padding: 4px 12px;
}
/* 記録詳細の結果の行: ステータス・日付・注記 */
.res {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.res-date {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
}
/* 統計の主役（成功率） */
.kpis:has(.kpi.hero) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.kpi.hero {
  grid-column: 1 / -1;
}
.kpi.hero b {
  font-size: 40px;
  line-height: 1.1;
}
.kpi.hero b .hl {
  display: inline;
  padding-inline: 0;
  font-size: inherit;
  color: inherit;
}
.work-nums {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}
/* 押すと沈む・保存直後の蛍光ペン・ステータスのハンコ */
.btn,
.fab,
.fchip,
.seg label,
.gtag,
.ticket {
  transition: transform 140ms var(--ease-out);
}
.btn:active,
.fab:active,
.fchip:active,
.seg label:active,
.gtag:active {
  transform: scale(0.97);
}
.ticket:active {
  transform: scale(0.99);
}
.hl.draw {
  background-size: 0% 100%;
  animation: hl-draw 260ms var(--ease-out) 120ms forwards;
}
@keyframes hl-draw {
  to {
    background-size: 100% 100%;
  }
}
.chip.stamp {
  animation: stamp 180ms var(--ease-out);
}
@keyframes stamp {
  from {
    transform: scale(1.12) rotate(-4deg);
    opacity: 0.5;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn,
  .fab,
  .fchip,
  .seg label,
  .gtag,
  .ticket {
    transition: none;
  }
  .btn:active,
  .fab:active,
  .fchip:active,
  .seg label:active,
  .gtag:active,
  .ticket:active {
    transform: none;
  }
  .hl.draw {
    animation: none;
    background-size: 100% 100%;
  }
  .chip.stamp {
    animation: none;
  }
}
