/* 例の件プロトコル 共通スタイル
   トークン: パーティションの灰緑 / モニターのベージュ / 古い PC のティール / 付箋の黄 / 判子の朱 / 墨 */
:root {
  --felt: #5E6B66;
  --felt-dark: #46514D;
  --bezel: #D8D0BC;
  --bezel-dark: #B3AA93;
  --screen: #2F7473;
  --win: #D4D6DA;
  --win-title: #1C2E6B;
  --sticky: #FFE873;
  --stamp: #C8102E;
  --ink: #1F2328;
  --paper: #FBFAF6;
  --muted: #5F676B;
  --ok: #2E7D4F;
  --font-body: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-pc: "DotGothic16", "BIZ UDPGothic", monospace;
  --font-title: "Zen Old Mincho", "Hiragino Mincho ProN", serif;
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  height: 100vh; height: 100dvh;
  overflow: hidden; overscroll-behavior: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  color: var(--ink);
  /* パーティションのフェルト地 */
  background-color: var(--felt);
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgba(0,0,0,.04) 0 1px, transparent 1px 4px);
  font-family: var(--font-body);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
#app { position: relative; width: 100%; height: 100%; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.screen[hidden] { display: none; }
:focus-visible { outline: 3px solid var(--sticky); outline-offset: 2px; }

/* ---- ボタン（事務用品の厚紙） ---- */
.btn {
  min-height: 48px; padding: .6rem 1.2rem; border: 2px solid var(--ink); border-radius: 6px;
  background: var(--paper); color: var(--ink); box-shadow: 0 3px 0 var(--ink);
  font: 700 1rem/1.3 var(--font-body); cursor: pointer; touch-action: manipulation;
  transition: transform .06s, box-shadow .06s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--stamp); color: #fff; border-color: #7a0a1c; box-shadow: 0 3px 0 #7a0a1c; }
.btn[disabled] { opacity: .45; cursor: default; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper);
  color: var(--ink); font-size: 1rem; cursor: pointer; touch-action: manipulation;
}
.muted { color: var(--muted); font-size: .9rem; }
.center-text { text-align: center; }

/* ---- タイトル（業務連絡の紙＋至急の判子） ---- */
.title-wrap {
  margin: auto; width: min(100%, 440px); padding: 1.25rem; overflow-y: auto; max-height: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 1.1rem; text-align: center;
}
.memo-sheet {
  position: relative; width: 100%; background: var(--paper); padding: 1.1rem 1.1rem 1.2rem;
  box-shadow: 0 10px 24px rgba(0,0,0,.35); transform: rotate(-1.2deg);
  background-image: repeating-linear-gradient(transparent 0 27px, rgba(28,46,107,.12) 27px 28px);
}
.memo-head { font-size: .8rem; letter-spacing: .4em; color: var(--muted); border-bottom: 2px solid var(--ink); padding-bottom: .3rem; text-align: left; }
.logo { display: flex; flex-direction: column; align-items: center; line-height: 1; margin-top: .9rem; font-weight: normal; }
.logo-main { font: 900 clamp(3rem, 18vw, 4.6rem) var(--font-title); letter-spacing: .06em; }
.logo-sub { font: 1rem var(--font-pc); letter-spacing: .5em; margin-top: .35rem; padding-left: .5em; }
.logo-tag { font-size: .85rem; margin-top: .6rem; font-weight: 700; }
.hanko {
  position: absolute; top: 1.6rem; right: .4rem; width: clamp(3.2rem, 13vw, 4.2rem); height: clamp(3.2rem, 13vw, 4.2rem); border: 3px solid var(--stamp); border-radius: 50%;
  display: grid; place-items: center; color: var(--stamp); font: 900 1.15rem var(--font-title); transform: rotate(14deg);
  opacity: .85; animation: hanko-in .5s cubic-bezier(.2, 1.6, .4, 1) .2s both;
}
@keyframes hanko-in { from { transform: rotate(14deg) scale(2.2); opacity: 0; } }
.nowrap { white-space: nowrap; }
.lead { line-height: 1.9; margin-top: .9rem; font-size: .95rem; text-align: left; }
.menu { display: flex; flex-direction: column; gap: .75rem; width: min(100%, 280px); }
.back-link { color: #fff; font-weight: 700; font-size: .9rem; padding: .6rem; }

/* ---- 汎用ページ ---- */
.page-head { flex: none; display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; width: min(100%, 560px); margin: 0 auto; color: #fff; }
.page-head h2 { font: 900 1.3rem var(--font-title); }
.page-body { flex: 1; min-height: 0; overflow-y: auto; width: min(100%, 560px); margin: 0 auto; padding: .25rem 1rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.page-body > .muted { color: #E6EAE8; }

.stage-list { list-style: none; display: flex; flex-direction: column; gap: .7rem; }
.chapter-head { font: 900 1rem var(--font-title); color: #fff; margin-top: .4rem; }
.stage-card {
  width: 100%; display: grid; grid-template-columns: 2.6rem 1fr; align-items: center; column-gap: .75rem; row-gap: .25rem; text-align: left;
  padding: .7rem .9rem; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper); box-shadow: 0 3px 0 var(--ink);
  font: inherit; color: inherit; cursor: pointer; touch-action: manipulation;
}
.stage-card[disabled] { background: #C9CEC9; cursor: default; box-shadow: none; }
.stage-no { font: 1.5rem var(--font-pc); text-align: center; grid-row: span 2; }
.stage-title { font-weight: 700; }
.stage-meta { font-size: .8rem; color: var(--muted); }
.stage-badges { grid-column: 2; display: flex; align-items: center; gap: .5rem; font-size: .85rem; white-space: nowrap; }
.stars { letter-spacing: .05em; color: #D99A00; }
.stars .off { color: #C5C8C4; }
.s-mark { font: 700 .75rem var(--font-body); border: 2px solid var(--stamp); color: var(--stamp); padding: 0 .35rem; border-radius: 50%; }

.panel { background: var(--paper); border: 2px solid var(--ink); border-radius: 4px; padding: 1rem; box-shadow: 0 3px 0 var(--ink); }
.panel h3 { font: 900 1rem var(--font-title); margin-bottom: .5rem; }
.debt-panel { background: var(--sticky); }
.debt-panel ul { list-style: none; display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.debt-panel li::before { content: "□ "; }

/* 結果 */
.result { justify-content: center; }
.result-head { text-align: center; font: 900 clamp(1.8rem, 9vw, 2.6rem) var(--font-title); color: #fff; text-shadow: 0 3px 0 var(--ink); }
.result-head.s { color: var(--sticky); }
.result-head.bad { color: #FFB4B4; }
.result-sub { text-align: center; font-weight: 700; color: #fff; }
.result-text { line-height: 1.8; }
.result-text .news { margin-top: .6rem; font-size: .9rem; color: var(--muted); border-top: 1px dashed var(--muted); padding-top: .5rem; }
.checks { list-style: none; display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; }
.checks li::before { content: "—  "; color: var(--muted); }
.checks li.ok::before { content: "★ "; color: #D99A00; }
.result-actions { display: flex; flex-direction: column; gap: .7rem; }
.result .muted { color: #E6EAE8; }
.result .panel .muted { color: var(--muted); }

/* 図鑑・青いファイル */
.zukan-summary { display: flex; justify-content: space-around; text-align: center; font-weight: 700; }
.zukan-summary b { display: block; font: 1.5rem var(--font-pc); }
.zukan-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.zukan-item { width: 100%; min-height: 44px; text-align: left; padding: .5rem .75rem; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper); font: inherit; font-weight: 700; color: inherit; cursor: pointer; touch-action: manipulation; }
.zukan-item[disabled] { color: var(--muted); background: #E3E5E1; border-style: dashed; cursor: default; }
.detail-text { line-height: 1.8; text-align: left; }

/* 設定 */
.setting-row { display: flex; flex-direction: column; gap: .5rem; }
.setting-row label { font-weight: 700; }
.setting-row input[type=range] { width: 100%; height: 44px; accent-color: var(--stamp); }

/* ---- モーダル ---- */
.overlay {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; background: rgba(20, 24, 22, .6);
}
.overlay[hidden] { display: none; }
.dialog {
  width: min(100%, 360px); max-height: 100%; overflow-y: auto; padding: 1.4rem; border: 2px solid var(--ink); border-radius: 6px;
  background: var(--paper); box-shadow: 0 6px 0 var(--ink); text-align: center; display: flex; flex-direction: column; gap: 1rem;
}
.dialog-title { font: 900 1.15rem var(--font-title); }
.dialog .actions { display: flex; flex-direction: column; gap: .75rem; }

#rotate { display: none; z-index: 40; }
@media (orientation: landscape) and (max-height: 500px) {
  body[data-orientation="portrait"] #rotate { display: flex; }
}

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