/* 清潔検品室 — 薄いグレーの紙、黒い罫線、朱色の判子1色 */
:root {
  --paper: #e8e6e0;
  --sheet: #f4f3ef;
  --ink: #23221f;
  --muted: #7a776f;
  --rule: #23221f;
  --stamp: #c4432f;
  --bar-own: #23221f;
  --bar-other: #b9b5ab;
  --dark: #141413;
  --dark-ink: #d9d6ce;
  --font: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100%; position: relative; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.screen { display: none; min-height: 100dvh; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); flex-direction: column; }
.screen.is-active { display: flex; animation: fade-in .5s ease; }
body { transition: background 2s ease; }
body.is-dark { background: var(--dark); }
.screen--dark { color: var(--dark-ink); }

.label { font-size: 12px; letter-spacing: .2em; color: var(--muted); margin: 0 0 4px; border-bottom: 1px solid var(--rule); display: inline-block; padding-bottom: 2px; }
.label--dark { color: #8a877f; border-color: #5a5852; }
.small { font-size: 13px; color: var(--muted); }

/* タイトル */
.sheet { background: var(--sheet); border: 1px solid var(--rule); padding: 28px 22px; margin-top: 4vh; }
.title { font-family: var(--font-serif); font-size: 40px; letter-spacing: .15em; margin: 8px 0 16px; font-weight: 600; }
.lead { margin: 0 0 6px; }
.lead.strong { font-weight: 700; margin-bottom: 18px; }
.notice { font-size: 13px; color: #4a4843; border-top: 1px dashed var(--muted); border-bottom: 1px dashed var(--muted); padding: 10px 0; margin-bottom: 22px; }
.notice p { margin: 4px 0; }
.footer { margin-top: auto; padding-top: 24px; display: flex; gap: 18px; font-size: 13px; }
.footer a { color: var(--muted); }

/* 判子ボタン */
.stamp-btn {
  border: 2.5px solid var(--stamp); color: var(--stamp); background: transparent;
  border-radius: 999px; padding: 12px 28px; font-weight: 700; letter-spacing: .2em;
  transition: transform .08s ease, background .2s ease;
}
.stamp-btn:active { transform: scale(.94); background: rgba(196, 67, 47, .08); }
.stamp-btn--start { display: block; margin: 0 auto 10px; font-size: 18px; }
.stamp-btn--next { margin-left: auto; }

/* 問い */
.q-header { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--rule); padding-bottom: 6px; letter-spacing: .1em; }
.conveyor { position: relative; margin: 26px 0 18px; min-height: 230px; overflow: hidden; }
.belt { height: 10px; margin-top: 12px; background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 22px); opacity: .35; }
.belt.is-moving { animation: belt 0.6s linear; }
.item-card { position: relative; background: var(--sheet); border: 1px solid var(--rule); padding: 18px 18px 22px; min-height: 210px; }
.item-card.slide-in { animation: slide-in .6s cubic-bezier(.2, .8, .2, 1); }
.item-card.slide-out { animation: slide-out .45s ease-in forwards; }
.item-name { font-family: var(--font-serif); font-size: 26px; margin: 4px 0 10px; padding-right: 92px; min-height: 2.6em; }
.stamp-mark.is-long { font-size: 12px; }
.q-text { font-size: 18px; margin: 0; }
.stamp-mark {
  position: absolute; right: 12px; top: 10px; width: 86px; height: 86px; border: 3px solid var(--stamp); border-radius: 50%;
  color: var(--stamp); display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 700;
  font-size: 15px; line-height: 1.3; padding: 8px; transform: rotate(-12deg) scale(1.6); opacity: 0; pointer-events: none;
  font-family: var(--font-serif);
}
.stamp-mark.is-stamped { animation: stamp .28s ease-out forwards; }

.answer-area { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.answer-area .stamp-btn { min-width: 120px; font-size: 17px; }
.answer-area.is-many .stamp-btn { min-width: 0; flex: 1 1 40%; padding: 12px 10px; letter-spacing: .05em; font-size: 15px; }
.slider-box { width: 100%; text-align: center; }
.slider-value { font-family: var(--font-serif); font-size: 34px; margin: 0 0 4px; }
.slider-box input[type="range"] { width: 100%; accent-color: var(--stamp); height: 36px; }
.slider-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 14px; }

/* 結果 */
.result-area { animation: fade-in .5s ease; }
.bar-row { margin: 10px 0; }
.bar-row-head { display: flex; justify-content: space-between; font-size: 14px; }
.bar-row-head .you { font-size: 11px; border: 1px solid var(--ink); padding: 0 4px; margin-left: 6px; letter-spacing: .1em; }
.bar { height: 10px; background: rgba(0, 0, 0, .06); margin-top: 3px; }
.bar > span { display: block; height: 100%; background: var(--bar-other); width: 0; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.bar-row.is-own .bar > span { background: var(--bar-own); }
.hist { width: 100%; height: auto; display: block; margin: 8px 0 4px; }
.result-note { font-size: 13px; color: var(--muted); min-height: 1em; }
.result-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.text-btn { background: none; border: none; border-bottom: 1px solid currentColor; padding: 2px 0; font-size: 14px; color: var(--muted); }
.quit-btn { margin-top: auto; align-self: center; background: none; border: none; font-size: 12px; color: var(--muted); padding: 18px 0 0; }

/* 終業 */
.ending-pairs { margin-top: 10vh; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; opacity: 0; transition: opacity 1.2s ease; }
.pair.is-shown { opacity: 1; }
.pair.is-faded { opacity: .25; }
.pair.single { grid-template-columns: 1fr; }
.pair-card { border: 1px solid #5a5852; padding: 10px 12px; font-size: 14px; line-height: 1.6; }
.pair-card b { display: block; font-weight: 400; color: #8a877f; font-size: 12px; }
.ending-line { font-family: var(--font-serif); font-size: 19px; line-height: 1.9; min-height: 3em; opacity: 0; transition: opacity 2s ease; }
.ending-line.is-shown { opacity: 1; }
.ending-next { align-self: center; background: none; border: 1px solid #5a5852; color: var(--dark-ink); padding: 8px 32px; margin-top: 10px; letter-spacing: .2em; }
.final-area { margin-top: 18vh; animation: fade-in 1.5s ease; }
.final-text { font-family: var(--font-serif); font-size: 22px; line-height: 1.9; margin: 12px 0 28px; }
.final-options { display: flex; gap: 10px; flex-wrap: wrap; }
.final-options button { flex: 1; background: none; border: 1px solid #8a877f; color: var(--dark-ink); padding: 12px 6px; letter-spacing: .1em; }
.ending-done { margin-top: 30vh; text-align: center; animation: fade-in 2s ease; }
.ending-done .small { color: #8a877f; }
.ending-links { margin-top: 40px; display: flex; flex-direction: column; align-items: center; gap: 14px; animation: fade-in 1s ease 4s both; }
.text-btn--dark, .tip-link--dark { color: #8a877f; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(110%); } to { transform: translateX(0); } }
@keyframes slide-out { to { transform: translateX(-110%); } }
@keyframes belt { from { background-position: 0 0; } to { background-position: -66px 0; } }
@keyframes stamp {
  0% { opacity: 0; transform: rotate(-12deg) scale(1.6); }
  70% { opacity: 1; transform: rotate(-12deg) scale(.95); }
  100% { opacity: .9; transform: rotate(-12deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; transition-duration: .01s !important; }
}
