:root {
  --ink: #2a1408;
  --hot: #c0201a;
  --gold: #ffd54a;
  --paper: #fbf3e2;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%; margin: 0; overflow: hidden; background: #05060c;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  color: var(--ink); -webkit-user-select: none; user-select: none; touch-action: none;
}
button { font: inherit; }
#safe { position: fixed; left: 0; top: 0; width: 0; height: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); visibility: hidden; pointer-events: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#mute, #quit, #gear {
  position: fixed; top: max(8px, env(safe-area-inset-top)); z-index: 5;
  width: 36px; height: 36px; border-radius: 18px; border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-size: 16px; cursor: pointer;
}
#mute { right: 8px; }
#gear { right: 50px; }
#quit { left: 8px; }
#quit[hidden] { display: none; }
#title, #result, #confirm, #settings {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10;
  padding: 16px; background: rgba(5, 4, 2, .72);
}
#title[hidden], #result[hidden], #confirm[hidden], #settings[hidden] { display: none; }
#settings { z-index: 12; }
.row { display: grid; grid-template-columns: 64px 1fr 34px; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,213,74,.15); font-weight: 700; font-size: 14px; text-align: left; }
.row input[type=range] { width: 100%; accent-color: #ffcf40; }
.row input[type=checkbox] { width: 22px; height: 22px; accent-color: #ffcf40; }
.row b { font-size: 12px; color: #ffcf40; text-align: right; }
#confirm { z-index: 12; }
.panel {
  width: min(92vw, 420px); max-height: calc(100% - 20px); overflow-y: auto;
  background: linear-gradient(180deg, #2a0c06, #120604); color: #f4e6c8; border: 3px solid #c99a3a; border-radius: 18px; box-shadow: var(--shadow);
  padding: 18px 16px; text-align: center;
}
.panel.small { width: min(80vw, 320px); }
.logo { font-family: "Dela Gothic One", serif; font-size: min(46px, 12vw); line-height: 1.1; color: var(--hot); text-shadow: 3px 3px 0 var(--gold), 5px 5px 0 var(--ink); letter-spacing: 2px; }
.logo img { width: 100%; max-width: 380px; display: block; margin: -6px auto 0; }
.logo small { display: block; font-size: 15px; color: var(--ink); text-shadow: none; letter-spacing: 6px; font-family: inherit; font-weight: 800; }
.lead { margin-top: 10px; font-weight: 700; font-size: 14px; line-height: 1.6; }
.opts { display: flex; gap: 6px; justify-content: center; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.ol { font-size: 12px; font-weight: 700; opacity: .7; }
.opt { border: 2px solid #c99a3a; border-radius: 10px; background: #fff; color: var(--ink); font-weight: 800; font-size: 16px; width: 40px; padding: 6px 0; cursor: pointer; }
.opt.on { background: var(--hot); color: #fff; }
#rate { font-size: 13px; font-weight: 700; margin-top: 4px; }
#tbest { margin-top: 8px; font-size: 13px; font-weight: 700; opacity: .8; }
.howto { list-style: none; padding: 0; margin: 12px 0 14px; text-align: left; font-size: 13px; line-height: 1.7; }
.howto b.k { display: inline-block; min-width: 70px; color: #ffcf5a; }
.howto li.pc { display: none; }
@media (pointer: fine) { .howto li.pc { display: list-item; } }
.main, .sub { border: 3px solid var(--ink); border-radius: 14px; padding: 10px 22px; font-weight: 800; font-size: 18px; cursor: pointer; box-shadow: 0 4px 0 var(--ink); }
.main { background: var(--hot); color: #fff; }
button.sub { background: #fff; color: var(--ink); font-size: 15px; }
button[hidden] { display: none; }
.main:active, button.sub:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.rtitle { font-weight: 900; font-size: 22px; }
.rnum { font-weight: 900; font-size: 54px; line-height: 1.1; color: #ffd54a; font-variant-numeric: tabular-nums; text-shadow: 3px 3px 0 var(--ink); }
.rnum .unit { font-size: 22px; margin-left: 4px; }
.rsub { font-weight: 700; font-size: 14px; margin-top: 6px; line-height: 1.7; }
.rbest { font-weight: 800; font-size: 15px; margin-top: 6px; min-height: 1.2em; color: #ffcf5a; }
.rbtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.loadwrap { height: 6px; background: rgba(0,0,0,.12); border-radius: 3px; margin: 8px 20px 0; overflow: hidden; }
.loadwrap.done { opacity: 0; transition: opacity .6s; }
#loadbar { height: 100%; width: 0; background: var(--hot); transition: width .2s; }
