/* img_9: 生成りの紙+黒の線+黄色。ドット風の文字(DotGothic16 を置いたら使う。なければ等幅のゴシック) */
@font-face { font-family: "DotGothic16"; src: url("fonts/DotGothic16-Regular.ttf") format("truetype"); font-display: swap; }
:root {
  --paper: #f5ecda; --win: #fbf6ea; --ink: #1e1a14; --sub: #6b6253; --yellow: #f0be2a; --miss: #c8452c;
  --main-w: 760px; --ad-line: #1e1a1466; --ad-text: var(--sub); --focus: var(--yellow);
  --font: "DotGothic16", "MS Gothic", "Osaka-Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #191712; --win: #221f19; --ink: #f2ead8; --sub: #b3a991; --ad-line: #f2ead866; }
}
html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--font); -webkit-font-smoothing: none; }
.layout { padding-bottom: 32px; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

.bar { flex-wrap: wrap; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0 8px; border-bottom: 2px solid var(--ink); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.brand svg { width: 22px; height: 14px; stroke: var(--yellow); stroke-width: 2; fill: none; }
.bar-right { display: flex; align-items: center; gap: 16px; }
.bar-sub { font-size: 13px; color: var(--sub); }
.vol { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.vol input { width: 110px; min-height: 32px; accent-color: var(--yellow); }
.vol b { font-weight: normal; width: 2.2em; text-align: right; }
.cat-badge { display: inline-block; margin: 12px auto 0; border: 2px solid var(--ink); border-radius: 4px; padding: 2px 12px; font-size: 14px; background: var(--paper); }
.cat-badge[hidden] { display: none; }
/* 広告は遊ぶ画面・ホーム・難易度の選択には出さない(遊んでいる間と、スマホの最初の画面を広告で埋めない) */
body[data-view="v-battle"] .ad-slot, body[data-view="v-menu"] .ad-slot, body[data-view="v-home"] .ad-slot { display: none !important; }
.title { text-align: center; font-size: clamp(22px, 5vw, 34px); font-weight: normal; letter-spacing: .04em; margin: 14px 0 12px; }

.tabs { display: flex; gap: 8px; justify-content: center; margin: 0 0 14px; }
.tabs button { border: 2px solid var(--ink); background: var(--win); border-radius: 4px; padding: 4px 16px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.tabs button:disabled { opacity: .3; cursor: not-allowed; box-shadow: none; }
.diffs { display: grid; gap: 10px; margin-top: 12px; }
.diff { display: grid; gap: 2px; text-align: left; border: 3px solid var(--ink); border-radius: 6px; background: var(--win); box-shadow: 3px 3px 0 var(--ink); padding: 10px 14px; cursor: pointer; }
.diff b { font-weight: normal; font-size: 22px; }
.diff span { font-size: 13px; color: var(--sub); }
.diff:hover, .diff:focus-visible { background: var(--yellow); color: #1e1a14; }
.diff:hover span, .diff:focus-visible span { color: #1e1a14; }
/* まだ ひらいていない難易度(前の難易度を クリアすると ひらく) */
.diff:disabled { cursor: not-allowed; opacity: .55; box-shadow: none; }
.diff:disabled:hover { background: var(--win); color: inherit; }
.lock-msg:empty { display: none; }
.result-msg { margin: 12px 0 4px; font-size: 18px; line-height: 1.6; white-space: pre-line; }
.book-top { margin: 0 0 10px; }
.set-row { margin-top: 12px; font-size: 17px; }
.set-row input { width: min(320px, 60vw); }
.vol-row { display: flex; justify-content: flex-end; margin-top: 10px; }
.say-msg { margin: 8px 0 0; font-size: 13px; color: var(--sub); }
.say-msg.warn { color: var(--miss); }
.ready { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 50; margin: 0; font-size: clamp(40px, 12vw, 80px);
  background: var(--yellow); color: #1e1a14; border: 4px solid var(--ink); border-radius: 8px; box-shadow: 4px 4px 0 var(--ink); padding: 4px 36px; white-space: nowrap; }
.ready[hidden] { display: none; }
body.counting .tabs, body.counting #v-battle > :not(#ready) { opacity: .2; pointer-events: none; transition: opacity .2s; }
.tut { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 14px; }
.tut li { display: grid; grid-template-columns: minmax(0, 240px) 1fr; gap: 16px; align-items: center; border-bottom: 2px dashed var(--ink); padding-bottom: 14px; }
.tut-fig { border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); padding: 10px; text-align: center; }
.tut-fig .hp { margin-top: 8px; }
.tut-text b { display: block; font-weight: normal; font-size: 19px; }
.tut-text p { margin: 4px 0 0; line-height: 1.8; }
.tut-pads { grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; }
.tut-pads .pad { min-height: 40px; font-size: 16px; display: grid; place-items: center; cursor: default; }
.tut-word { font-size: 44px; margin: 4px 0; }
.tut-cap { margin: 0; font-size: 13px; }
.tut-item { display: inline-block; margin-top: 8px; cursor: default; }
.tut-stars { font-size: 36px; }
.tut-book { display: flex; gap: 6px; justify-content: center; }
.tut-book span { width: 40px; height: 40px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 4px; background: var(--yellow); font-size: 20px; }
.tut-book .unknown { background: var(--win); color: var(--sub); }
@media (max-width: 600px) { .tut li { grid-template-columns: 1fr; } }
.confirm { border: 4px solid var(--ink); border-radius: 8px; background: var(--win); color: var(--ink); box-shadow: 4px 4px 0 var(--ink);
  padding: 18px 22px; max-width: min(440px, calc(100vw - 32px)); font-family: inherit; }
.confirm::backdrop { background: rgba(30, 26, 20, .55); }
.confirm p { margin: 0 0 14px; font-size: 17px; line-height: 1.7; }
.confirm-btns { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.confirm-btns button { min-height: 40px; font-size: 16px; padding: 4px 18px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--yellow); }
.keys-help { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: 14px; }
kbd { font-family: inherit; font-size: .8em; border: 2px solid var(--ink); border-bottom-width: 3px; border-radius: 4px; padding: 0 5px; background: var(--paper); color: var(--ink); }
.key { display: none; margin-left: 6px; }
body.keys .key { display: inline-block; }
.pad { position: relative; }
body.keys #pads .pad::after { content: attr(data-n); position: absolute; top: 3px; left: 6px; font-size: 13px; color: var(--sub); }
.home-btn { border: 2px solid var(--ink); background: var(--win); border-radius: 4px; padding: 0 10px; min-height: 32px; font-size: 13px; cursor: pointer; }
.trial[aria-pressed="true"] { background: var(--yellow); color: #1e1a14; }
.pads.trying .pad { border-style: dashed; }

.win { position: relative; background: var(--win); border: 3px solid var(--ink); border-radius: 6px; box-shadow: 3px 3px 0 var(--ink); padding: 14px 18px; margin: 0 0 14px; }
.win::before, .win::after { content: ""; position: absolute; width: 6px; height: 6px; background: var(--yellow); left: 6px; }
.win::before { top: 6px; } .win::after { bottom: 6px; }
.win-head { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; flex-wrap: wrap; }
.hint-text { color: var(--sub); font-size: 13px; }

.enemy { text-align: center; }
.word { font-size: clamp(40px, 11vw, 72px); letter-spacing: .08em; margin: 6px 0 6px; line-height: 1.1; min-height: 1.1em; }
.word .got { color: var(--sub); }
.word .now { text-decoration: underline 4px var(--yellow); text-underline-offset: 8px; }
.cry { border: 2px solid var(--ink); background: var(--yellow); color: #1e1a14; border-radius: 4px; padding: 2px 16px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.hp { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 12px; font-size: 14px; white-space: nowrap; }
.hp b { font-weight: normal; }
.bar-hp { flex: 0 1 360px; min-width: 80px; height: 14px; border: 2px solid var(--ink); background: var(--win); }
.bar-hp i { display: block; height: 100%; width: 100%; background: var(--yellow); transition: width .2s; }

/* 伝言の行数が変わっても下の音のボタンが動かないよう、高さを決める(4行。あふれたら この中で送る) */
.msg p { margin: 0; font-size: 18px; line-height: 1.5; height: 6em; overflow-y: auto; white-space: pre-line; }

.pads { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin: 12px 0; }
.pad { min-height: 64px; border: 3px solid var(--ink); background: var(--win); border-radius: 6px; font-size: 30px; cursor: pointer; }
.pad:active { transform: translateY(2px); }
.pad.lit { background: var(--yellow); color: #1e1a14; }
.pad.bad { background: var(--miss); color: #fff; }

.played { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.slots { display: flex; gap: 6px; flex-wrap: wrap; }
.slots span { width: 34px; height: 34px; border: 2px solid var(--ink); display: grid; place-items: center; font-size: 18px; }
.foot-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 2px solid var(--ink); margin-top: 12px; padding-top: 10px; }
.foot-row .hp { margin: 0; justify-content: flex-start; flex: 1 1 300px; }
.item { border: 2px solid var(--ink); background: var(--win); border-radius: 4px; padding: 2px 12px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.item:disabled { opacity: .45; cursor: default; }
.foot-row .item { margin-left: auto; padding: 4px 22px; font-size: 18px; }
.stars { font-size: 20px; letter-spacing: .1em; color: var(--yellow); -webkit-text-stroke: 1px var(--ink); }
.book-stars { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 15px; }
.book-stars b { color: var(--yellow); -webkit-text-stroke: 1px var(--ink); font-weight: normal; }
.big { display: block; margin: 12px auto 0; border: 3px solid var(--ink); background: var(--yellow); color: #1e1a14; border-radius: 6px; padding: 6px 28px; font-size: 18px; cursor: pointer; }

.say { display: flex; gap: 8px; margin-top: 10px; }
.say input { flex: 1; min-width: 0; border: 2px solid var(--ink); background: var(--paper); border-radius: 4px; padding: 6px 10px; font-size: 20px; }
.say button { border: 2px solid var(--ink); background: var(--yellow); color: #1e1a14; border-radius: 4px; padding: 0 18px; cursor: pointer; }
.say .say-sub { background: var(--win); color: var(--ink); padding: 0 10px; font-size: 14px; }
.grid { display: grid; grid-template-rows: repeat(5, auto); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin-top: 10px; direction: rtl; }
.grid > * { direction: ltr; }
.grid button { min-height: 40px; border: 2px solid var(--ink); background: var(--win); border-radius: 4px; font-size: 18px; cursor: pointer; padding: 0; }
.grid .blank { visibility: hidden; }
.grid3 { grid-template-rows: repeat(3, auto); }
.grid3 button { font-size: 15px; }
.sub-head { margin-top: 14px; }
.grid button:active { background: var(--yellow); color: #1e1a14; }

.book-kana { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-top: 10px; }
.book-kana button { min-height: 44px; border: 2px solid var(--ink); background: var(--win); border-radius: 4px; font-size: 20px; cursor: pointer; }
.book-kana button.unknown { color: var(--sub); border-style: dashed; cursor: default; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.book-table { border-collapse: collapse; width: 100%; font-size: 15px; }
.book-table th, .book-table td { border-bottom: 2px solid var(--ink); padding: 4px 8px; text-align: center; white-space: nowrap; }
.book-table th:first-child, .book-table td:first-child { text-align: left; }
.book-table th { font-weight: normal; font-size: 13px; color: var(--sub); }
.book-table button { border: 2px solid var(--ink); background: var(--yellow); color: #1e1a14; border-radius: 4px; padding: 0 10px; min-height: 36px; cursor: pointer; font-size: 17px; }
.book-table .unfound { color: var(--sub); }
.book-table .st { color: var(--yellow); -webkit-text-stroke: 1px var(--ink); letter-spacing: .05em; }
.ach { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.ach li { border: 2px dashed var(--ink); border-radius: 6px; padding: 8px 10px; color: var(--sub); }
.ach li.done { border-style: solid; background: var(--yellow); color: #1e1a14; box-shadow: 2px 2px 0 var(--ink); }
.ach b { display: block; font-weight: normal; font-size: 17px; color: var(--ink); }
.ach li.done b { color: #1e1a14; }
.ach small { font-size: 12px; }
.book-words { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.book-words li button { border: 2px solid var(--ink); background: var(--yellow); color: #1e1a14; border-radius: 4px; padding: 2px 12px; cursor: pointer; font-size: 18px; }
.book-words .empty { color: var(--sub); }

.how { margin-top: 24px; font-size: 14px; color: var(--sub); }
.how summary { cursor: pointer; color: var(--ink); }
.foot { margin-top: 16px; font-size: 13px; color: var(--sub); }

@media (max-width: 560px) {
  .win { padding: 12px; }
  .pads { grid-template-columns: repeat(3, 1fr); }
  .grid { grid-template-rows: none; grid-auto-flow: row; grid-template-columns: repeat(5, 1fr); direction: ltr; }
  .grid3 { grid-template-columns: repeat(3, 1fr); }
  .bar-sub { display: none; }
  .vol input { width: 90px; }
}
@media (min-width: 1160px) { .ad-slot.rail { display: flex; } .ad-slot.inline { display: none; } }
@media (max-width: 480px) {
  /* スマホ: 聞くボタンと音のボタンが1画面に入るよう、上の窓を詰める */
  .word { font-size: 40px; margin: 2px 0; }
  .enemy .hp { margin-top: 6px; }
  .msg p { font-size: 14px; line-height: 1.4; height: 5.6em; }
  .pads { gap: 8px; margin: 8px 0; }
  .pad { min-height: 54px; }
  .title { margin: 8px 0 6px; }
  .book-table { font-size: 12px; }
  .book-table th, .book-table td { padding: 4px 3px; }
  .book-table th { font-size: 11px; }
  .book-table button { font-size: 14px; padding: 0 6px; }
}
