:root {
  --ink: #0c1024;
  --hot: #3f7cff;
  --gold: #ffd54a;
  --paper: #eef3ff;
  --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: #070a16;
  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, #sharebox, #confirm, #settings, #data, #zukan {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10;
  padding: 16px; background: rgba(5, 8, 20, .7);
}
#title[hidden], #result[hidden], #sharebox[hidden], #confirm[hidden], #settings[hidden], #data[hidden], #zukan[hidden] { display: none; }
#data, #zukan { z-index: 12; }
.dsess { font-size: 12px; font-weight: 700; margin: 6px 0; line-height: 1.6; }
.dhist { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 6px 0; }
.dhist span { font-size: 11px; font-weight: 700; background: #fff; border: 1px solid var(--ink); border-radius: 8px; padding: 2px 6px; }
.dtab { width: 100%; border-collapse: collapse; font-size: 12px; margin: 6px 0; }
.dtab th, .dtab td { border: 1px solid rgba(0,0,0,.15); padding: 3px 4px; text-align: center; }
.dtab th { background: rgba(0,0,0,.06); font-weight: 800; }
.dtab tr.on td { font-weight: 700; } .dtab tr:not(.on) td { opacity: .55; }
.achs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0 14px; }
.ach { border: 2px solid rgba(0,0,0,.15); border-radius: 10px; padding: 6px; text-align: left; opacity: .5; }
.ach.on { opacity: 1; border-color: #d08a00; background: #fff6d8; }
.ach b { display: block; font-size: 13px; } .ach small { font-size: 11px; line-height: 1.3; display: block; }
#confirm { z-index: 12; } #settings { z-index: 12; }
.panel.small { width: min(80vw, 320px); }
.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; min-width: 28px; text-align: right; }
.opt { border: 2px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 800; font-size: 12px; padding: 5px 9px; cursor: pointer; }
.opt.on { background: var(--hot); color: #fff; }
.sel { font-size: 12px; font-weight: 800; }
.sel select { font: inherit; font-weight: 800; padding: 4px 6px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; margin-left: 2px; }
.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; }
.howto li.pc { display: none; }
@media (pointer: fine) { .howto li.pc { display: list-item; } }
.howto a { color: var(--hot); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(0,0,0,.08); font-weight: 700; font-size: 14px; text-align: left; }
.row input[type=range] { width: 46%; }
.row select { font: inherit; font-weight: 700; padding: 3px 6px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; }
.row input[type=checkbox] { width: 22px; height: 22px; }
.rhist { font-size: 12px; font-weight: 600; opacity: .8; margin-top: 6px; line-height: 1.5; }
.rday { font-size: 12px; font-weight: 700; margin-top: 6px; color: #b05000; }
.panel {
  width: min(92vw, 420px); max-height: calc(100% - 20px); overflow-y: auto;
  background: var(--paper); border: 4px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow);
  padding: 18px 16px; text-align: center;
}
.logo {
  font-weight: 900; font-size: min(40px, 10vw); line-height: 1.1; color: var(--hot);
  text-shadow: 3px 3px 0 var(--ink); letter-spacing: 1px;
}
.logo img { width: 88%; max-width: 360px; display: block; margin: 0 auto; }
.logo small { display: block; font-size: 16px; color: var(--ink); text-shadow: none; letter-spacing: 6px; }
.lead { margin-top: 8px; font-weight: 700; font-size: 14px; }
#tbest { margin-top: 8px; font-size: 14px; 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 li { padding-left: 4px; }
.howto b { color: var(--hot); }
.howto b.k { display: inline-block; min-width: 64px; }
.howto b.r { color: #e03030; } .howto b.y { color: #c99400; } .howto b.v { color: #a040d0; }

.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); margin-top: 0; font-size: 16px; }
.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: var(--hot); 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.6; }
.rbest { font-weight: 800; font-size: 15px; margin-top: 6px; min-height: 1.2em; }
.rbest.new { color: #d08a00; }
.rbtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

#shareimg { width: 100%; border-radius: 10px; border: 2px solid var(--ink); }
.note { font-size: 12px; margin: 6px 0; }
#sharetext { width: 100%; height: 72px; font-size: 12px; border: 2px solid var(--ink); border-radius: 8px; padding: 6px; }
