:root{
  --bg:#eef1ff;
  --fg:#14183a;
  --card:#fff;
  --bd:#14183a;
  --ac:#e8212e;
  --ye:#ffd43b;
  --mu:#5b628f;
  --ok:#12864a;
  --soft:rgba(20,24,58,.06);
  box-sizing:border-box;
  padding-top:env(safe-area-inset-top,0px);
  padding-bottom:env(safe-area-inset-bottom,0px);
  color-scheme:light;
}
@media(prefers-color-scheme:dark){
  :root:not([data-theme=light]){
    --bg:#0e1233;
    --fg:#f3f5ff;
    --card:#1a2152;
    --bd:#7d88e0;
    --ac:#ff3b4a;
    --mu:#9aa3d6;
    --ok:#4ad98a;
    --soft:rgba(255,255,255,.06);
    color-scheme:dark;
  }
}
:root[data-theme=dark]{
  --bg:#0e1233;
  --fg:#f3f5ff;
  --card:#1a2152;
  --bd:#7d88e0;
  --ac:#ff3b4a;
  --mu:#9aa3d6;
  --ok:#4ad98a;
  --soft:rgba(255,255,255,.06);
  color-scheme:dark;
}
html{scroll-padding-top:env(safe-area-inset-top,0px);scroll-behavior:smooth}
*{box-sizing:inherit}
body{
  margin:0;
  min-height:100%;
  background:var(--bg);
  color:var(--fg);
  font-family:"Hiragino Sans","Noto Sans JP","Yu Gothic",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  -webkit-tap-highlight-color:transparent;
}
[hidden]{display:none!important}
button{font-family:inherit;cursor:pointer;touch-action:manipulation}
a{color:inherit}

/* Top compact utility bar */
.topbar{
  max-width:520px;
  margin:0 auto;
  padding:12px 16px 0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.topbar-group{
  display:flex;
  align-items:center;
  gap:6px;
}
.lang-select-wrap{
  position:relative;
  display:inline-flex;
  align-items:center;
}
.lang-select{
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:none;
  height:30px;
  padding:0 26px 0 11px;
  border:2px solid var(--bd);
  border-radius:99px;
  background-color:var(--ye);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2314183a' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 10px center;
  background-size:9px 6px;
  color:#14183a;
  font-family:inherit;
  font-size:12.5px;
  font-weight:900;
  line-height:26px;
  vertical-align:middle;
  cursor:pointer;
  box-shadow:2px 2px 0 var(--bd);
}
.lang-select::-ms-expand{display:none}
.lang-select::picker-icon{display:none}
.footer-langs{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:6px 12px;
  margin:8px 0 6px;
}
.icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  height:30px;
  min-width:30px;
  padding:0 9px;
  border:2px solid var(--bd);
  border-radius:99px;
  background:var(--card);
  color:var(--fg);
  font-size:13px;
  font-weight:800;
  box-shadow:2px 2px 0 var(--bd);
}
.icon-btn:active{transform:translate(1px,1px);box-shadow:1px 1px 0 var(--bd)}
.icon-btn[aria-pressed=false]{opacity:.6}

/* Main game container — 1:1 original geometry */
main{
  max-width:520px;
  margin:0 auto;
  padding:8px 16px 32px;
}
.game-stage{
  min-height:calc(100svh - 92px);
  display:flex;
  flex-direction:column;
}
@supports not (height:100svh){
  .game-stage{min-height:calc(100vh - 92px)}
}
.tel{
  color:var(--ye);
  -webkit-text-stroke:9px #14183a;
  paint-order:stroke fill;
  font-weight:900;
  text-align:center;
  line-height:1.15;
}
h1.tel{
  font-size:clamp(36px,11.5vw,60px);
  margin:5vh 0 18px;
  transform:rotate(-3deg);
}
html[lang=en] h1.tel{
  font-size:clamp(32px,9.6vw,54px);
  letter-spacing:-0.01em;
}
.lead,.mu{
  text-align:center;
  color:var(--mu);
  line-height:1.8;
  margin:0 0 20px;
}
#best{
  margin:0 0 18px;
  color:var(--fg);
  line-height:1.25;
}
#best span{
  display:block;
  font-size:18px;
  font-weight:800;
  color:var(--mu);
}
#best b{
  display:block;
  font-size:30px;
  font-weight:900;
  color:var(--mu);
}
.btn{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  width:100%;
  margin:14px 0;
  padding:16px 18px;
  border:3px solid var(--bd);
  border-radius:14px;
  background:var(--card);
  color:var(--fg);
  font-size:20px;
  font-weight:800;
  box-shadow:5px 5px 0 var(--bd);
}
.btn:active{transform:translate(4px,4px);box-shadow:1px 1px 0 var(--bd)}
.btn.p{background:var(--ye);color:#14183a}
.btn:disabled{opacity:.4;cursor:not-allowed}

/* Quiz play screen */
.hd{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-weight:800;
  margin:10px 0 12px;
}
#box{
  display:flex;
  gap:8px;
  margin-bottom:6px;
}
.k{
  flex:1;
  min-width:0;
  aspect-ratio:3/4;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:4px 2px;
  border:3px solid var(--bd);
  border-radius:12px;
  background:var(--card);
  opacity:.5;
}
.k b{
  font-family:"Hiragino Mincho ProN","Yu Mincho","Noto Serif JP",Georgia,serif;
  font-size:clamp(26px,10vw,48px);
  font-weight:900;
  line-height:1;
  color:var(--mu);
}
.k .gl{
  display:none;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:clamp(9px,2.5vw,11px);
  font-weight:800;
  color:var(--mu);
  line-height:1.1;
  padding:0 2px;
}
body.show-gloss .k.on .gl{display:block}
.k i{
  font-style:normal;
  padding:2px 8px;
  border-radius:99px;
  background:var(--ye);
  color:#14183a;
  font-size:12px;
  font-weight:900;
  white-space:nowrap;
}
.k.on{
  opacity:1;
  box-shadow:4px 4px 0 var(--bd);
}
.k.on b{
  color:var(--fg);
  animation:pop .35s cubic-bezier(.2,1.6,.4,1);
}
@keyframes pop{from{transform:scale(.3);opacity:0}}
.pt{
  text-align:center;
  font-weight:800;
  margin:14px 0 0;
}
.don{
  display:block;
  margin:14px auto 0;
  width:150px;
  height:150px;
  border:3px solid #14183a;
  border-radius:50%;
  background:var(--ac);
  color:#fff;
  font-size:38px;
  font-weight:900;
  box-shadow:0 9px 0 #a3141e;
}
html[lang=en] .don{font-size:34px;letter-spacing:.02em}
.don:active{transform:translateY(7px);box-shadow:0 2px 0 #a3141e}
.sk{
  display:block;
  margin:20px auto 0;
  padding:9px 26px;
  border:2px solid var(--mu);
  border-radius:99px;
  background:transparent;
  color:var(--mu);
  font-size:15px;
  font-weight:700;
}
.sk:active{background:var(--card)}
.bar{
  height:8px;
  border-radius:4px;
  background:var(--ac);
  transform-origin:left;
  animation:bar 15s linear forwards;
  margin:6px 0 10px;
}
@keyframes bar{to{transform:scaleX(0)}}
.row{display:flex;gap:8px}
#ans{
  flex:1;
  min-width:0;
  padding:12px 14px;
  border:3px solid var(--bd);
  border-radius:12px;
  background:var(--card);
  color:var(--fg);
  font-family:inherit;
  font-size:17px;
}
.row .btn{
  width:auto;
  margin:0;
  padding:10px 20px;
  font-size:17px;
  box-shadow:3px 3px 0 var(--bd);
}
#ch{padding-bottom:28vh}
#lst{
  max-height:34vh;
  overflow-y:auto;
  margin-top:10px;
  border:3px solid var(--bd);
  border-radius:12px;
  background:var(--card);
}
#lst .mu{margin:0;padding:14px}
.opt{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 14px;
  font-size:16px;
  font-weight:700;
  cursor:pointer;
}
.opt+.opt{border-top:1px solid var(--mu)}
.opt:has(input:checked){background:var(--ye);color:#14183a}
.opt input{flex:none;width:22px;height:22px;margin:0;accent-color:var(--ac)}
.opt-t{display:flex;flex-direction:column;min-width:0}
.opt-sub{font-size:12px;font-weight:600;opacity:.72}
#msg{
  text-align:center;
  font-size:18px;
  line-height:1.8;
  margin:10px 0 0;
}
#msg b{font-size:24px}
.ans-sub{display:block;font-size:14px;color:var(--mu);font-weight:700;margin-top:2px}
.ok{color:var(--ok)}
.ng{color:var(--ac)}
.no{color:var(--mu)}

/* Result screen */
#card{
  display:block;
  width:100%;
  height:auto;
  margin:0 0 4px;
  border:3px solid var(--bd);
  border-radius:12px;
  background:#14183a;
}
.big{font-size:72px;margin:4vh 0 8px}
#s2 h2{text-align:center;margin:0 0 6px;font-size:24px}
.esper-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  margin:4px auto 12px;
  padding:6px 14px;
  border:2px solid var(--bd);
  border-radius:99px;
  background:var(--ye);
  color:#14183a;
  font-size:13px;
  font-weight:900;
  box-shadow:3px 3px 0 var(--bd);
}
.center-wrap{text-align:center}
#shmsg a{text-decoration:underline;font-weight:800;color:var(--fg)}
.scroll-cue{
  margin-top:auto;
  padding-top:18px;
  text-align:center;
  font-size:13px;
  font-weight:700;
  color:var(--mu);
}
.scroll-cue a{text-decoration:none;opacity:.85}
.scroll-cue a:hover{text-decoration:underline;opacity:1}

/* Hide below-the-fold guide during active quiz play so mobile buzzing stays distraction-free */
body.playing .seo-wrap,
body.playing .scroll-cue{display:none}

/* Clean AdSense-ready container (collapses to 0 when empty) */
.ad-slot{
  margin:20px 0;
  text-align:center;
}
.ad-slot:empty{display:none}

/* Below-the-fold SEO & FAQ section */
.seo-wrap{
  margin-top:36px;
  padding-top:24px;
  border-top:3px dashed var(--bd);
}
.seo-card{
  background:var(--card);
  border:3px solid var(--bd);
  border-radius:14px;
  padding:18px 18px 16px;
  margin:0 0 18px;
  box-shadow:4px 4px 0 var(--bd);
}
.seo-card h2{
  text-align:left;
  font-size:19px;
  font-weight:900;
  margin:0 0 10px;
  line-height:1.35;
}
.seo-card p{
  margin:0 0 10px;
  line-height:1.75;
  font-size:14.5px;
  color:var(--mu);
}
.seo-card p:last-child{margin-bottom:0}
.rules-list{
  margin:0;
  padding-left:20px;
  line-height:1.8;
  font-size:14.5px;
  color:var(--fg);
}
.rules-list li{margin-bottom:6px}
.rank-grid{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
  margin-top:8px;
}
.rank-grid th,.rank-grid td{
  padding:8px 10px;
  border-bottom:1px solid var(--soft);
  text-align:left;
}
.rank-grid th{
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--mu);
}
.rank-grid tr:last-child td{border-bottom:0}
.rank-pill{
  display:inline-block;
  padding:2px 9px;
  border-radius:99px;
  background:var(--ye);
  color:#14183a;
  font-weight:900;
  font-size:12px;
}
.sample-item{
  border:2px solid var(--bd);
  border-radius:12px;
  padding:10px 12px;
  margin:10px 0;
  background:var(--soft);
}
.sample-kanji{
  display:flex;
  gap:6px;
  margin-bottom:6px;
}
.sample-kanji span{
  flex:1;
  text-align:center;
  padding:6px 0;
  border:2px solid var(--bd);
  border-radius:8px;
  background:var(--card);
  font-family:"Hiragino Mincho ProN","Yu Mincho","Noto Serif JP",serif;
  font-size:20px;
  font-weight:900;
}
.sample-item summary{
  cursor:pointer;
  font-size:13.5px;
  font-weight:800;
  color:var(--mu);
}
.sample-item p{
  margin:6px 0 0;
  font-size:14px;
  font-weight:800;
  color:var(--fg);
}
.faq-item{
  border-top:1px solid var(--soft);
  padding:10px 0;
}
.faq-item:first-of-type{border-top:0;padding-top:4px}
.faq-item summary{
  cursor:pointer;
  font-size:15px;
  font-weight:800;
  line-height:1.5;
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.faq-item summary::-webkit-details-marker{display:none}
.faq-item summary::after{
  content:"+";
  font-size:18px;
  font-weight:900;
  color:var(--mu);
  flex:none;
}
.faq-item[open] summary::after{content:"−"}
.faq-item p{
  margin:8px 0 2px;
  font-size:14px;
  line-height:1.75;
  color:var(--mu);
}
.kbd-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:8px;
}
.kbd-chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  font-weight:700;
  color:var(--mu);
}
kbd{
  display:inline-block;
  padding:2px 7px;
  border:2px solid var(--bd);
  border-radius:6px;
  background:var(--card);
  color:var(--fg);
  font-family:inherit;
  font-size:12px;
  font-weight:900;
  box-shadow:1px 2px 0 var(--bd);
}
.site-footer{
  text-align:center;
  font-size:12.5px;
  color:var(--mu);
  line-height:1.8;
  padding:8px 0 24px;
}
.site-footer a{font-weight:800;text-decoration:underline}

@media (max-width:380px){
  #box{gap:5px}
  .k{border-width:2.5px;gap:5px}
  .k i{font-size:11px;padding:1px 6px}
  .don{width:136px;height:136px;font-size:34px}
  html[lang=en] .don{font-size:30px}
}
