* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
body { font-family:"Hiragino Maru Gothic ProN","Hiragino Sans","Noto Sans JP",sans-serif; color:#263238;
  background:linear-gradient(180deg,#283593 0%,#3949ab 45%,#7986cb 80%,#c5cae9 130%); min-height:100vh; overflow-x:hidden; }
#app { max-width:640px; margin:0 auto; padding:10px; position:relative; z-index:1; }
.hidden { display:none !important; }
.screen { animation:fadein .3s; }
@keyframes fadein { from{opacity:0} to{opacity:1} }
.title-video-wrap { position:relative; border-radius:18px; overflow:hidden; box-shadow:0 10px 30px rgba(0,0,0,.4); }
.title-video { width:100%; height:260px; object-fit:cover; display:block; }
.game-title { position:absolute; inset:auto 0 12px 0; text-align:center; font-size:38px; color:#fff;
  text-shadow:0 2px 0 #1a237e, 0 4px 14px rgba(0,0,0,.55); letter-spacing:2px; }
.game-title .title-sub { display:block; font-size:18px; color:#c5cae9; letter-spacing:6px; margin-top:2px; }
.game-title.small { position:static; font-size:25px; margin:8px 0 4px; }
.panel { background:rgba(255,253,247,.96); border-radius:18px; padding:16px; margin-top:12px; box-shadow:0 8px 24px rgba(0,0,0,.3); }
.panel.center { text-align:center; }
.host-img { width:112px; animation:bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%,100%{ transform:translateY(0) } 50%{ transform:translateY(-6px) } }
.host-line { font-size:15px; font-weight:bold; color:#37474f; margin:4px 0 8px; line-height:1.5; }
.progress-summary { font-size:13.5px; color:#546e7a; margin-bottom:6px; }
.progress-summary b { color:#e65100; font-size:16px; }
.diff-row { display:flex; gap:7px; flex-wrap:wrap; justify-content:center; margin:8px 0; }
.diff-btn { padding:8px 15px; border-radius:999px; border:2.5px solid #b0bec5; background:#fff; font-weight:bold; font-size:14px; cursor:pointer; color:#37474f; font-family:inherit; }
.diff-btn.sel { background:linear-gradient(180deg,#ffb300,#fb8c00); color:#fff; border-color:#fb8c00; box-shadow:0 3px 0 #d35400; }
.big-btn { display:block; width:100%; margin:12px 0 6px; padding:15px; font-size:19px; font-weight:bold; color:#fff; font-family:inherit;
  background:linear-gradient(180deg,#ff7043,#e53935); border:none; border-radius:999px; cursor:pointer; box-shadow:0 5px 0 #b71c1c; }
.big-btn:active { transform:translateY(3px); box-shadow:0 1px 0 #b71c1c; }
.sub-btn { display:block; width:100%; padding:11px; font-size:15px; font-weight:bold; color:#37474f; background:#eceff1; border:2px solid #b0bec5; border-radius:999px; cursor:pointer; margin-top:6px; font-family:inherit; }
.mini-btn { padding:7px 13px; border-radius:999px; border:2px solid #ccc; background:#fff; cursor:pointer; font-size:13px; font-family:inherit; }
.title-footer { display:flex; gap:8px; justify-content:center; margin-top:10px; }
.puzzle-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(100px,1fr)); gap:8px; margin:10px 0 14px; }
.pcard { background:rgba(255,253,247,.96); border-radius:12px; padding:10px 6px; text-align:center; cursor:pointer; border:2.5px solid transparent; box-shadow:0 3px 8px rgba(0,0,0,.25); }
.pcard:hover { border-color:#ffb300; }
.pcard .pno { font-size:12px; color:#90a4ae; font-weight:bold; }
.pcard .pg { font-size:16px; font-weight:bold; color:#263238; margin:2px 0; }
.pcard .ptime { font-size:11px; color:#78909c; min-height:14px; }
.pcard .pstar { font-size:14px; color:#ddd; }
.pcard.cleared .pstar { color:#ffb300; }
.pcard .pdoing { font-size:11px; color:#3949ab; font-weight:bold; }
/* play */
.play-head { display:flex; align-items:center; gap:9px; color:#fff; font-weight:bold; margin:4px 2px 8px; font-size:14px; flex-wrap:wrap; }
.badge { background:linear-gradient(180deg,#ffb300,#fb8c00); padding:4px 11px; border-radius:999px; font-size:13px; box-shadow:0 2px 0 #d35400; }
#hud-time { background:rgba(0,0,0,.35); padding:4px 11px; border-radius:999px; font-size:13px; }
#hud-miss { margin-left:auto; background:rgba(0,0,0,.35); padding:4px 11px; border-radius:999px; font-size:13px; }
#board-wrap { display:flex; justify-content:center; }
#board { display:grid; grid-template-columns:repeat(9,1fr); width:min(94vw,470px); aspect-ratio:1; background:#fffdf7;
  border:3.5px solid #263238; border-radius:10px; overflow:hidden; box-shadow:0 12px 30px rgba(0,0,0,.45); }
.cell { position:relative; border-right:1px solid #cfd8dc; border-bottom:1px solid #cfd8dc; cursor:pointer; display:flex; align-items:center; justify-content:center; background:#fffdf7; }
.cell:nth-child(9n) { border-right:none; }
.cell:nth-child(n+73) { border-bottom:none; }
.cell.br { border-right:2.5px solid #37474f; }
.cell.bb { border-bottom:2.5px solid #37474f; }
.cell .v { font-weight:bold; color:#3949ab; line-height:1; pointer-events:none; }
.cell.given .v { color:#263238; }
.cell.hinted .v { color:#2e8b2e; }
.cell.wrong .v { color:#e53935; }
.cell.sel { background:#ffe082 !important; }
.cell.peer { background:#fff3c4; }
.cell.samev { background:#dbe7ff; }
.cell.conflict { background:#ffdde0 !important; }
.cell .notes { display:grid; grid-template-columns:repeat(3,1fr); width:88%; height:88%; pointer-events:none; }
.cell .notes span { display:flex; align-items:center; justify-content:center; color:#78909c; font-weight:bold; line-height:1; }
#board { --cellpx:48px; }
.cell .v { font-size:calc(var(--cellpx) * 0.52); }
.cell .notes span { font-size:calc(var(--cellpx) * 0.21); }
/* numpad */
#numpad { display:grid; grid-template-columns:repeat(9,1fr); gap:5px; margin-top:12px; }
.nkey { position:relative; padding:11px 0 13px; border-radius:11px; border:2px solid #9fa8da; background:#fff; cursor:pointer; font-family:inherit; }
.nkey b { font-size:21px; color:#283593; display:block; line-height:1; }
.nkey .remain { font-size:10px; color:#90a4ae; }
.nkey:active { background:#ffe082; }
.nkey.done { opacity:.32; pointer-events:none; }
.play-btns { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
.act-btn { flex:1; padding:11px 4px; font-size:13px; font-weight:bold; border-radius:999px; cursor:pointer; white-space:nowrap; font-family:inherit; }
.act-btn.alt { background:#fff; color:#37474f; border:2px solid #b0bec5; }
.act-btn.on { background:linear-gradient(180deg,#ffb300,#fb8c00); color:#fff; border-color:#fb8c00; }
.msg-bar { margin-top:10px; background:#fffdf7; border:2.5px solid #9fa8da; border-radius:12px; padding:8px 13px; font-size:14px; min-height:42px; display:flex; align-items:center; }
.msg-bar.good { border-color:#81c784; background:#e8f5e9; }
.msg-bar.warn { border-color:#ef9a9a; background:#ffebee; }
.clear-video { width:100%; height:180px; object-fit:cover; border-radius:14px; display:block; margin:14px 0 4px; box-shadow:0 8px 22px rgba(0,0,0,.35); }
#confetti { position:fixed; inset:0; pointer-events:none; z-index:80; }
@media (max-width:560px) { .title-video { height:210px; } .game-title { font-size:31px; } }
