/* 教科書ふうの紙面。白い紙に、緑・青・オレンジ。外部のフォントや画像は使わない（端末の文字をそのまま使う） */
:root {
  --paper: #ffffff; --tint: #f3f8f7; --ink: #24303a; --muted: #5a6872; --line: #d7dfe5;
  --green: #00857a; --green-pale: #e3f4f1; --blue: #1c74c4; --blue-pale: #e6f1fb;
  --orange: #e8590c; --orange-pale: #fff0e4; --red: #c9382f; --amber: #f2b705; --on: #ffffff;
  --ui: "Hiragino Maru Gothic ProN", "BIZ UDPGothic", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  --en: "Segoe UI", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --tabs-h: 58px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent }
html, body { height: 100%; margin: 0 }
body { background: var(--paper); color: var(--ink); font: 400 16px/1.7 var(--ui); overflow: hidden }
[hidden] { display: none !important }
button { font: inherit; color: inherit; cursor: pointer }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px }

#app { display: flex; flex-direction: column; height: 100%; padding-top: env(safe-area-inset-top, 0px) }
#page { flex: 1; overflow-y: auto; padding: 0 max(16px, env(safe-area-inset-left, 0px)) 24px max(16px, env(safe-area-inset-right, 0px)); -webkit-overflow-scrolling: touch }
#tabs { display: flex; border-top: 2px solid var(--green); background: var(--paper); padding-bottom: env(safe-area-inset-bottom, 0px) }
#tabs button { flex: 1; min-height: var(--tabs-h); border: 0; background: none; color: var(--muted); font-size: 11.5px; line-height: 1.3; display: grid; place-items: center; align-content: center; gap: 1px }
#tabs button .ic { font: 700 20px/1 var(--en) }
#tabs button.on { color: var(--green); font-weight: 700; background: var(--green-pale) }

.bar { display: flex; align-items: center; gap: 10px; padding: 12px 0 8px; min-height: 56px }
.bar h1 { flex: 1; margin: 0; font-size: 21px; line-height: 1.3 }
select, input[type="search"], textarea { font: inherit; color: var(--ink); background: var(--paper); border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; max-width: 100% }
select.deck { max-width: 62% }
.small { color: var(--muted); font-size: 13px }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 700 }

.cover { text-align: center; padding: 20px 0 10px; display: grid; gap: 2px; justify-items: center }
.cover img { width: 76px; height: 76px; border-radius: 18px }
.cover .t { font-size: 26px; font-weight: 700; color: var(--green); line-height: 1.3 }
.cover .t2 { font-size: 15px; font-weight: 700 }
.cover .s { font-size: 13px; color: var(--muted) }

.card { border: 2px solid var(--green); border-radius: 14px; padding: 16px; margin-top: 12px; display: grid; gap: 8px; background: var(--paper) }
.lap { display: inline-block; justify-self: start; background: var(--green); color: var(--on); font-weight: 700; font-size: 13px; padding: 2px 12px; border-radius: 999px }
.prog { height: 10px; background: var(--green-pale); border-radius: 999px; overflow: hidden }
.prog i { display: block; height: 100%; background: var(--orange) }
.chk { display: flex; gap: 8px; align-items: center; font-size: 14px }
.chk input { width: 20px; height: 20px; accent-color: var(--green) }

.btn { border: 0; border-radius: 999px; background: var(--orange); color: var(--on); font-weight: 700; font-size: 17px; padding: 13px 24px; box-shadow: 0 3px 0 #b84308; width: 100% }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #b84308 }
.btn:disabled { background: #c8d0d6; box-shadow: none; color: #fff }
.btn.out { background: var(--paper); color: var(--green); border: 2px solid var(--green); box-shadow: none }
.btn.text { background: none; color: var(--blue); box-shadow: none; padding: 8px; width: auto; font-size: 15px }

#overlay { position: fixed; inset: 0; z-index: 20; background: var(--paper); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px) }
#overlay .bar { background: var(--green); color: var(--on); padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); min-height: 52px }
#overlay .bar .ttl { flex: 1; font-weight: 700; font-size: 16px }
#overlay .back { border: 0; background: none; color: var(--on); font-size: 30px; line-height: 1; padding: 0 8px }
#overlay .small { color: #d8f1ee }
.thin { height: 5px; background: var(--green-pale) }
.thin i { display: block; height: 100%; background: var(--orange) }
.meta { display: flex; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); padding: 8px max(16px, env(safe-area-inset-left, 0px)) 0 }
.meta .sp { flex: 1 }
.meta .mk { color: var(--red); font-weight: 700; letter-spacing: 1px }
.stage { flex: 1; overflow-y: auto; padding: 8px max(16px, env(safe-area-inset-left, 0px)) 16px; display: flex; flex-direction: column; justify-content: center; text-align: center }
.stage .mid { width: 100%; max-width: 560px; margin: 0 auto }
.stage hr { border: 0; border-top: 2px dashed var(--line); margin: 14px 0 }
.w-big { font: 700 clamp(34px, 11vw, 52px)/1.25 var(--en); color: var(--ink); word-break: break-word }
.mean { font-size: 22px; font-weight: 700; line-height: 1.7; white-space: pre-line }
.sent { font-size: 21px; line-height: 1.7; font-family: var(--en); text-align: left }
.detail { text-align: left; margin-top: 10px; background: var(--tint); border-radius: 12px; padding: 4px 14px; font-size: 15px }
.detail .row { padding: 8px 0; border-bottom: 1px solid var(--line) }
.detail .row:last-child { border-bottom: 0 }
.detail .en { font: 600 16px/1.6 var(--en) }
.spk { border: 2px solid var(--blue); color: var(--blue); background: var(--paper); border-radius: 999px; padding: 4px 14px; font-size: 14px; margin-right: 8px }
.rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 10px max(16px, env(safe-area-inset-left, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) }
.rate button { border: 0; border-radius: 16px; font: 700 34px/1 var(--en); padding: 18px 0; color: var(--on); box-shadow: 0 4px 0 rgba(0, 0, 0, .22) }
.rate button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .22) }
.rate .x { background: var(--red) } .rate .t { background: var(--amber); color: #3a2c00 } .rate .o { background: var(--green) }
.rate button:disabled { background: #dfe5e9; color: #fff; box-shadow: none }
.done { display: grid; gap: 10px; justify-items: center; max-width: 420px; margin: 0 auto; width: 100% }
.done .big { font-size: 56px; line-height: 1.2 }
.done h2 { margin: 0; font-size: 24px }

.search { margin: 4px 0 8px } .search input { width: 100% }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px }
.chips button { border: 2px solid var(--green); background: var(--paper); color: var(--green); border-radius: 999px; padding: 3px 14px; font-size: 14px; font-weight: 700 }
.chips button.on { background: var(--green); color: var(--on) }
.list .it { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer }
.list .no { min-width: 44px; text-align: center; font: 700 15px/1.2 var(--en); color: var(--green) }
.list .no small { display: block; font-size: 11px; color: var(--muted); font-weight: 400 }
.list .tx { flex: 1; min-width: 0 } .list .tx div:first-child { font: 700 17px/1.4 var(--en) }
.list .m { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.list .mk { color: var(--red); font-weight: 700; font-size: 13px; white-space: nowrap }

#sheet { position: fixed; inset: 0; z-index: 30; background: rgba(20, 33, 61, .45); display: flex; align-items: flex-end }
#sheet .in { background: var(--paper); width: 100%; max-height: 82%; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px max(16px, env(safe-area-inset-left, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) }
.pron { color: var(--muted) }

.set { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer }
.set .tx { flex: 1 } .set .sub { font-size: 13px; color: var(--muted) }
.set input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--green) }
textarea { width: 100%; min-height: 110px; margin-top: 8px }

#toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 40; background: var(--ink); color: var(--on); padding: 10px 18px; border-radius: 999px; font-size: 14px; max-width: 90% }
.btn.blue { background: var(--blue); box-shadow: 0 3px 0 #11528d }
.lap.blue { background: var(--blue) }
.card.test { border-color: var(--blue) }
.card.test .big { font-size: 26px; color: var(--blue) }
.choices { display: grid; gap: 10px; text-align: left }
.ch { border: 2px solid var(--line); background: var(--paper); border-radius: 14px; padding: 14px 16px; font-size: 18px; font-weight: 700; text-align: left }
.ch.good { border-color: var(--green); background: var(--green-pale) }
.ch.bad { border-color: var(--red); background: #fdeceb }
.fb { font-size: 20px; font-weight: 700; margin-top: 12px }
.fb.good { color: var(--green) } .fb.bad { color: var(--red) }
.ph { font-size: 17px; margin: 18px 0 6px; color: var(--green) }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center }
.stats div { background: var(--green-pale); border-radius: 12px; padding: 10px 4px }
.stats b { font-size: 28px; color: var(--green) } .stats small { display: block; color: var(--muted) }
.money { background: var(--orange-pale); border-radius: 12px; padding: 12px 14px }
.money b { font-size: 22px; color: var(--orange) }
.code { font: 700 32px/1.4 var(--en); letter-spacing: 3px; text-align: center; background: var(--tint); border: 2px dashed var(--green); border-radius: 12px; padding: 14px; margin-top: 10px }
.errmsg { color: var(--red); font-weight: 700; margin: 8px 0 0 }
.mono { font-family: Consolas, monospace; word-break: break-all }
.ret { font-size: 11px; background: var(--green); color: var(--on); border-radius: 999px; padding: 1px 8px; font-weight: 700; vertical-align: middle }
.field input { font: inherit; color: var(--ink); border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100% }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important } }
