html, body {
  margin: 0; height: 100%; background: #07060c; overflow: hidden; overscroll-behavior: none;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  font-family: "M PLUS 1p", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
}
#stage { position: fixed; left: 50%; top: 50%; width: 100vw; height: 100vh; transform: translate(-50%, -50%); overflow: hidden; --sw: 100vw; --edge: 14px; }
#game { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: block; background: #000; touch-action: none; width: 100%; aspect-ratio: 16 / 9; }
#mute {
  --oct: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: clamp(30px, calc(var(--sw) * .045), 42px); height: clamp(30px, calc(var(--sw) * .045), 42px); padding: 0; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; background: linear-gradient(#b4c6f2, #2a3c78); clip-path: var(--oct); filter: drop-shadow(0 0 4px #3a7aff);
}
#mute::before { content: ''; position: absolute; inset: 2.5px; background: radial-gradient(circle at 50% 30%, #30458a, #0a1030 75%); clip-path: var(--oct); }
#mute svg { position: relative; width: 58%; height: 58%; }
#mute .x, #mute.off .wave { display: none; }
#mute.off .x { display: inline; }
#pauseBtn { --oct: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%);
  position: absolute; top: 8px; left: 50%; transform: translateX(calc(50% + 10px)); width: clamp(30px, calc(var(--sw) * .045), 42px); height: clamp(30px, calc(var(--sw) * .045), 42px); padding: 0; border: 0; cursor: pointer;
  display: none; align-items: center; justify-content: center; background: linear-gradient(#b4c6f2, #2a3c78); clip-path: var(--oct); filter: drop-shadow(0 0 4px #3a7aff); }
#pauseBtn::before { content: ''; position: absolute; inset: 2.5px; background: radial-gradient(circle at 50% 30%, #30458a, #0a1030 75%); clip-path: var(--oct); }
#pauseBtn svg { position: relative; width: 52%; height: 52%; }
body.touch.canpause #pauseBtn { display: flex; }
#mute[data-lv="2"] .w3, #mute[data-lv="1"] .w2, #mute[data-lv="1"] .w3 { display: none; } 
#voltip { position: absolute; top: calc(12px + clamp(30px, calc(var(--sw) * .045), 42px)); left: 50%; transform: translateX(-50%); padding: 3px 10px; border-radius: 6px; background: rgba(10, 16, 48, .88); color: #fff; font: 700 13px/1.4 sans-serif; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .25s; }
#voltip.on { opacity: 1; }
#rk { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 12, .62); font-family: 'M PLUS 1p', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif; }
#rk[hidden] { display: none; }
#rk, #gd, #sv { touch-action: pan-y; } 
body.rot #rk, body.rot #gd, body.rot #sv { touch-action: none; } 
#rk .rk-box { width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); display: flex; flex-direction: column; background: #0d1230; color: #fff; border: 2px solid #ffc93c; border-radius: 10px; box-shadow: 0 0 18px rgba(255, 180, 60, .45); overflow: hidden; }
#rk .rk-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: linear-gradient(#3a2408, #1a1004); }
#rk .rk-title { font-size: 20px; font-weight: 800; color: #ffe08a; letter-spacing: .05em; }
#rk .rk-x { width: 36px; height: 36px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 22px; cursor: pointer; }
#rk { container: rk / size; } 
#rk .rk-body { padding: 12px 16px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; min-height: 0; }
#rk .rk-ranks { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 17px; font-weight: 700; }
#rk .rk-ranks b { color: #ffd23c; font-size: 22px; }
#rk .rk-label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
#rk input { font-size: 20px; padding: 8px 10px; border-radius: 6px; border: 2px solid #8fa2d8; background: #fff; color: #111; }
#rk .rk-err { margin: 0; min-height: 1.2em; color: #ff8a8a; font-size: 14px; font-weight: 700; }
#rk .rk-note, #rk .rk-foot { margin: 0; font-size: 12.5px; line-height: 1.6; color: #c9d1ee; }
#rk a { color: #9fd0ff; }
#rk .rk-btns { display: flex; gap: 10px; }
#rk .rk-btns button, #rk .rk-tabs button { min-height: 44px; padding: 0 16px; border-radius: 8px; border: 2px solid #ffc93c; background: #2a1a06; color: #fff; font-family: inherit; font-size: 16px; font-weight: 800; cursor: pointer; }
#rk .rk-btns .rk-ok { background: #c2410c; }
#rk .rk-btns .rk-skip { border-color: #8fa2d8; background: transparent; }
#rk .rk-done { margin: 12px 0 4px; font-weight: 700; }
#rk .rk-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
#rk .rk-tabs button { flex: 1 1 auto; font-size: 14px; padding: 0 6px; white-space: nowrap; border-color: #6c78a8; background: transparent; } 
#rk .rk-tabs button.on { border-color: #ffc93c; background: #3a2408; color: #ffe08a; }
#rk .rk-list { flex: 1 1 auto; min-height: 96px; overflow-y: auto; border-radius: 6px; background: rgba(255, 255, 255, .04); } 
#rk .rk-list .rk-foot { padding: 8px 10px 10px; }
#rk table { width: 100%; border-collapse: collapse; font-size: 15px; }
#rk td { padding: 6px 10px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
#rk .rk-n { width: 3em; text-align: right; font-weight: 800; color: #ffd23c; }
#rk .rk-name { word-break: break-all; }
#rk .rk-v { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
#rk tr.me td { background: rgba(255, 201, 60, .2); }
#rk .rk-you { margin-left: 8px; padding: 1px 6px; border-radius: 4px; background: #ffc93c; color: #2a1a06; font-size: 11px; font-weight: 800; }
#rk .rk-wait { margin: 0; padding: 18px; text-align: center; color: #c9d1ee; }
#rktoast { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 40; padding: 6px 14px; border-radius: 8px; background: rgba(10, 16, 48, .9); color: #fff; font: 700 14px/1.5 sans-serif; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .3s; }
#rktoast.on { opacity: 1; }
#gd { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 12, .62); font-family: 'M PLUS 1p', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif; }
#gd[hidden] { display: none; }
#gd .gd-box { container: gd / inline-size; width: min(720px, calc(100% - 24px)); max-height: calc(100% - 24px); display: flex; flex-direction: column; background: #0d1230; color: #fff; border: 2px solid #ffc93c; border-radius: 10px; box-shadow: 0 0 18px rgba(255, 180, 60, .45); overflow: hidden; }
#gd .gd-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: linear-gradient(#3a2408, #1a1004); }
#gd .gd-title { font-size: 20px; font-weight: 800; color: #ffe08a; letter-spacing: .05em; }
#gd .gd-n { flex: 1; font-size: 14px; font-weight: 700; color: #fff3cf; }
#gd .gd-x, #gd .gd-back { width: 36px; height: 36px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 20px; cursor: pointer; }
#gd .gd-back[hidden] { display: none; }
#gd .gd-body { padding: 12px 14px 12px; overflow-y: auto; }
#gd .gd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
#gd .gd-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; border: 2px solid #6c78a8; border-radius: 8px; background: rgba(255, 255, 255, .05); color: #fff; font-family: inherit; cursor: pointer; }
#gd .gd-card:hover, #gd .gd-card:focus-visible { border-color: #ffc93c; background: rgba(255, 201, 60, .14); outline: none; }
#gd .gd-card img, #gd .gd-pic img { image-rendering: pixelated; width: 64px; height: 64px; }
#gd img.sm { image-rendering: auto; }
#gd .lock img { filter: brightness(0) opacity(.45); }
#gd .gd-no { font-size: 11px; font-weight: 800; color: #ffd23c; }
#gd .gd-name { font-size: 11.5px; font-weight: 700; line-height: 1.3; min-height: 2.6em; text-align: center; word-break: break-all; }
#gd .lock .gd-name { color: #8f97b8; }
#gd .gd-new { position: absolute; top: 3px; right: 4px; padding: 0 5px; border-radius: 4px; background: #ffc93c; color: #2a1a06; font-size: 10px; font-weight: 800; }
#gd .gd-foot { margin: 10px 0 0; font-size: 12.5px; color: #c9d1ee; }
#gd .gd-item { display: flex; gap: 18px; align-items: flex-start; }
#gd .gd-pic { flex: 0 0 auto; padding: 10px; border-radius: 10px; background: radial-gradient(circle, rgba(255, 220, 130, .25), rgba(255, 255, 255, .03) 70%); }
#gd .gd-pic img { width: 192px; height: 192px; }
#gd .gd-photo { flex: 0 0 auto; width: 240px; padding: 8px; border-radius: 10px; background: #fff; box-shadow: 0 0 14px rgba(255, 201, 60, .35); }
#gd .gd-photo img { display: block; width: 100%; height: auto; max-height: 300px; object-fit: contain; }
#gd .gd-txt { flex: 1; display: flex; flex-direction: column; gap: 10px; }
#gd .gd-txt h3 { margin: 0; font-size: 20px; color: #ffe08a; }
#gd .gd-txt p { margin: 0; font-size: 15px; line-height: 1.7; }
#gd .gd-shop { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 2px solid #ffc93c; background: #c2410c; color: #fff; font-size: 16px; font-weight: 800; text-decoration: none; }
#gd .gd-shop:focus-visible { outline: 3px solid #fff; }
#gd .gd-txt .gd-note { font-size: 12px; color: #c9d1ee; }
@container gd (max-width: 520px) { #gd .gd-item { flex-direction: column; align-items: center; } #gd .gd-pic img { width: 144px; height: 144px; } #gd .gd-photo { width: 200px; } }
.fontload { position: absolute; left: -9999px; top: 0; opacity: 0; pointer-events: none; }
#touch { display: none; position: absolute; inset: 0; pointer-events: none; }
body.touch #touch { display: block; }
body.nopad #touch { display: none; } 
.pad { position: absolute; bottom: 14px; pointer-events: none; }
.pad.left { left: var(--edge); display: grid; grid-template-columns: repeat(3, auto); gap: 2px; }
#dzone { position: absolute; inset: -40%; pointer-events: auto; touch-action: none; z-index: 2; }
.pad.left button { pointer-events: none; }
.pad.left .up { grid-area: 1 / 2; } .pad.left .lf { grid-area: 2 / 1; } .pad.left .rt { grid-area: 2 / 3; } .pad.left .dn { grid-area: 3 / 2; }
.pad.right { right: var(--edge); display: grid; grid-template-columns: repeat(2, auto); gap: 8px 10px; align-items: end; }
.pad button {
  pointer-events: auto; touch-action: none; width: clamp(58px, calc(var(--sw) * .11), 86px); height: clamp(58px, calc(var(--sw) * .11), 86px); padding: 0;
  border-radius: 50%; border: 2px solid rgba(255, 201, 60, .6); background: rgba(10, 14, 40, .28); color: rgba(255, 255, 255, .9); box-shadow: 0 0 6px rgba(255, 170, 40, .3); text-shadow: 0 1px 3px #000; 
  font: bold clamp(11px, calc(var(--sw) * .021), 15px) inherit; font-family: inherit;
}
.pad.left button { width: clamp(42px, calc(var(--sw) * .075), 60px); height: clamp(42px, calc(var(--sw) * .075), 60px); font-size: clamp(20px, calc(var(--sw) * .04), 30px); }
.pad.right #btnSpecial { grid-area: 1 / 2; justify-self: end; width: clamp(50px, calc(var(--sw) * .09), 70px); height: clamp(50px, calc(var(--sw) * .09), 70px); }
.pad.right .jp { grid-area: 2 / 1; }
.pad.right .atk { grid-area: 2 / 2; width: clamp(70px, calc(var(--sw) * .13), 100px); height: clamp(70px, calc(var(--sw) * .13), 100px); background: rgba(200, 40, 30, .32); }
.pad.left button.on, .pad.right button.on { background: rgba(255, 200, 60, .6); }
#btnSpecial { opacity: .4; }
#btnSpecial.ready { opacity: 1; background: rgba(255, 110, 20, .8); box-shadow: 0 0 16px #ffb030; }
#sv { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 12, .62); font-family: 'M PLUS 1p', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, sans-serif; }
#sv[hidden] { display: none; }
#sv .sv-box { width: min(520px, calc(100% - 24px)); max-height: calc(100% - 24px); display: flex; flex-direction: column; background: #0d1230; color: #fff; border: 2px solid #ffc93c; border-radius: 10px; box-shadow: 0 0 18px rgba(255, 180, 60, .45); overflow: hidden; }
#sv .sv-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: linear-gradient(#3a2408, #1a1004); }
#sv .sv-title { font-size: 20px; font-weight: 800; color: #ffe08a; letter-spacing: .05em; }
#sv .sv-x { width: 36px; height: 36px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 22px; cursor: pointer; }
#sv .sv-body { padding: 12px 16px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
#sv .sv-lead { margin: 0; font-size: 15px; font-weight: 800; }
#sv .sv-code { margin: 0; padding: 10px; border-radius: 8px; background: #fff; color: #111; font: 800 28px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .08em; text-align: center; user-select: all; }
#sv .sv-warn { margin: 0; color: #ffd23c; font-size: 15px; font-weight: 800; }
#sv .sv-note { margin: 0; font-size: 12.5px; line-height: 1.6; color: #c9d1ee; }
#sv hr { width: 100%; border: 0; border-top: 1px solid rgba(255, 255, 255, .15); margin: 4px 0; }
#sv .sv-label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
#sv input { font: 800 20px ui-monospace, Consolas, monospace; letter-spacing: .06em; padding: 8px 10px; border-radius: 6px; border: 2px solid #8fa2d8; background: #fff; color: #111; text-transform: uppercase; }
#sv .sv-err { margin: 0; min-height: 1.2em; color: #ff8a8a; font-size: 14px; font-weight: 700; }
#sv .sv-btns { display: flex; gap: 10px; }
#sv .sv-btns button { min-height: 44px; padding: 0 18px; border-radius: 8px; border: 2px solid #ffc93c; background: #c2410c; color: #fff; font-family: inherit; font-size: 16px; font-weight: 800; cursor: pointer; }
#sv .sv-btns button:disabled { opacity: .5; cursor: default; }
#rk .rk-bd { display: inline-block; width: 24px; height: 24px; margin-right: 6px; vertical-align: -6px; border-radius: 50%; background-size: auto 24px; background-repeat: no-repeat; background-color: rgba(255, 255, 255, .12); }
#gd .gd-code { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
#gd .gd-sv { min-height: 36px; padding: 0 12px; border-radius: 8px; border: 2px solid #ffc93c; background: #2a1a06; color: #fff; font-family: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
#sv .sv-big { font-size: 22px; color: #ffe08a; text-align: center; }
#rk .rk-soon { margin: 0; padding: 8px 10px; border-radius: 8px; background: rgba(255, 201, 60, .14); color: #fff3cf; font-size: 14px; line-height: 1.6; text-align: center; }
#rk .rk-soon b { color: #ffd23c; }
#rk .rk-mine:empty { display: none; }
#rk .rk-mine { padding: 8px 10px; border-radius: 8px; background: rgba(255, 201, 60, .12); border: 1px solid rgba(255, 201, 60, .35); display: flex; flex-direction: column; gap: 8px; }
#rk .rk-mine-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 14px; }
#rk .rk-mine-k { color: #ffe08a; font-weight: 800; }
#rk .rk-mine-v { font-size: 18px; font-variant-numeric: tabular-nums; }
#rk .rk-mine-r { font-size: 18px; color: #ffd23c; }
#rk .rk-mine-s, #rk .rk-mine-none { color: #c9d1ee; font-size: 13px; }
#rk .rk-mine-btn { min-height: 36px; padding: 0 12px; border-radius: 8px; border: 2px solid #ffc93c; background: #c2410c; color: #fff; font-family: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
#rk .rk-mine-btn[hidden] { display: none; }
#rk .rk-mine-x { min-height: 36px; margin-left: auto; padding: 0 12px; border-radius: 8px; border: 2px solid #8fa2d8; background: #000; color: #fff; font-family: inherit; font-size: 14px; font-weight: 800; cursor: pointer; } 
#rk .rk-mine-note { margin: 0; font-size: 12.5px; line-height: 1.6; color: #ffd6a0; }
@container rk (max-height: 480px) {
  #rk .rk-box { max-height: calc(100% - 12px); }
  #rk .rk-head { padding: 4px 10px; }
  #rk .rk-title { font-size: 16px; }
  #rk .rk-x { width: 30px; height: 30px; font-size: 18px; }
  #rk .rk-body { padding: 6px 10px 8px; gap: 6px; }
  #rk .rk-tabs button { min-height: 32px; font-size: 12px; padding: 0 4px; }
  #rk .rk-mine { padding: 4px 8px; gap: 4px; }
  #rk .rk-mine-row { font-size: 13px; }
  #rk .rk-mine-v, #rk .rk-mine-r { font-size: 15px; }
  #rk .rk-mine-btn, #rk .rk-mine-x { min-height: 30px; font-size: 13px; }
  #rk td { padding: 3px 8px; }
  #rk table { font-size: 14px; }
}
