:root {
  --bg: #12131C; --surface: #1C1E2B; --surface-2: #262939; --line: #2C2F42; --line-2: #3A3D55;
  --text: #F2F2F7; --muted: #A9ABC2; --faint: #8487A3;
  --accent: #FFD23F; --accent-ink: #12131C; --cyan: #4DD6FF; --err: #FF7A85;
  --cjk: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Apple SD Gothic Neo', 'Noto Sans JP', 'Noto Sans KR', 'Yu Gothic', 'Malgun Gothic';
  --display: 'Unbounded', system-ui, var(--cjk), sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 'Onest', system-ui, var(--cjk), sans-serif; -webkit-tap-highlight-color: transparent; }
body.has-banner { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
main { max-width: 520px; margin: 0 auto; padding: 0 16px 40px; }
a { color: var(--accent); }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
[hidden] { display: none !important; }

header { display: flex; align-items: center; justify-content: space-between; padding: 16px 4px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand span { font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: .02em; text-transform: uppercase; }
.head-r { display: flex; align-items: center; gap: 8px; }
.chip { font-size: 12px; font-weight: 600; color: var(--accent-ink); background: var(--cyan); border-radius: 999px; padding: 5px 10px; }

.hero { padding: 18px 4px 0; }
.hero h1 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--cyan); letter-spacing: .02em; }
.hero .slogan { margin: 0; color: var(--text); font-family: var(--display); font-size: clamp(28px, 8.5vw, 36px); line-height: 1.1; font-weight: 800; }
.hero .slogan em { font-style: normal; color: var(--accent); }
.hero .slogan span { display: block; }
.hero p { margin: 12px 0 0; color: var(--muted); }

.card { margin-top: 22px; padding: 16px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); }
.drop { display: flex; align-items: center; justify-content: center; min-height: 180px; border-radius: 16px; background: var(--surface-2); border: 1.5px dashed var(--line-2); overflow: hidden; cursor: pointer; }
.drop.over { border-color: var(--accent); }
.drop img.preview { display: block; max-width: 100%; max-height: 320px; }
.drop .ph { color: var(--faint); font-size: 14px; text-align: center; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.drop .ph img { width: 64px; height: 64px; opacity: .9; }
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; border: 0; text-decoration: none; }
.btn-primary { margin-top: 12px; height: 58px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: .02em; text-transform: uppercase; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; }
.btn-ghost { margin-top: 10px; height: 48px; border-radius: 14px; background: transparent; color: var(--text); border: 1px solid var(--line-2); font-weight: 600; }
.hint { color: var(--faint); font-size: 13px; text-align: center; margin: 10px 0 0; }

.status { margin: 14px 4px 0; font-weight: 500; color: var(--muted); min-height: 1.5em; }
.status.err { color: var(--err); }
.loading { display: flex; align-items: center; gap: 12px; }
.spin { width: 28px; height: 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.spin i { border-radius: 2px; background: var(--line-2); animation: blink 1.2s infinite; }
.spin i:nth-child(2n) { animation-delay: .2s; } .spin i:nth-child(3n) { animation-delay: .4s; } .spin i:nth-child(5) { background: var(--accent); animation: none; }
@keyframes blink { 50% { background: var(--cyan); } }

.res-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 4px 4px; }
.res-head h2 { margin: 0; font-family: var(--display); font-size: 17px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.mine { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 12px; flex-shrink: 0; }
.mine img { width: 56px; height: 56px; border-radius: 10px; background: var(--surface-2); object-fit: contain; }
.res-sub { margin: 0 4px 14px; color: var(--muted); font-size: 14px; }

.player { border-radius: 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); margin-bottom: 14px; }
.player .frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.player .title { font-weight: 600; line-height: 1.3; }
.player .title a { color: var(--text); }
.player .alts { font-size: 13px; color: var(--faint); display: flex; flex-direction: column; gap: 2px; }
.player .alts a { color: var(--cyan); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cand { text-align: left; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; color: var(--text); }
.cand.best { border: 2px solid var(--accent); }
.cand.active { box-shadow: 0 0 0 2px var(--cyan); }
.cand .pic { aspect-ratio: 1; border-radius: 14px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cand .pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cand canvas { width: 78%; height: 78%; image-rendering: pixelated; }
.cand .row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.cand .score { font-family: var(--display); font-size: 20px; font-weight: 800; }
.cand.best .score { color: var(--accent); }
.cand .n { font-size: 12px; color: var(--faint); }
.cand .t { font-size: 13px; line-height: 1.3; color: #C9CBE0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.more { margin-top: 14px; width: 100%; border-radius: 20px; padding: 14px 16px; background: #1E2240; border: 1px solid #3B4280; display: flex; align-items: center; gap: 14px; color: var(--text); text-align: left; }
.more .ico { width: 44px; height: 44px; border-radius: 14px; background: var(--cyan); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.more b { display: block; font-size: 15px; }
.more small { display: block; font-size: 13px; color: var(--muted); }
.none { text-align: center; margin: 16px 0 0; color: var(--faint); font-size: 14px; }

.ad-native { margin-top: 14px; }
.ad-native:empty, .ad-rewarded:empty { display: none; }
.ad-label { font-size: 11px; color: var(--faint); letter-spacing: .06em; text-align: center; margin-bottom: 4px; text-transform: uppercase; }
.ad-banner { position: fixed; left: 0; right: 0; bottom: 0; padding: 8px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; z-index: 10; }

.sheet { position: fixed; inset: 0; background: rgba(8, 9, 14, .86); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.sheet .box { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 16px; }

footer { margin: 36px 4px 0; color: var(--faint); font-size: 13px; line-height: 1.6; }

.lang { position: relative; }
.lang summary { list-style: none; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.lang ul { position: absolute; right: 0; top: 36px; margin: 0; padding: 6px; list-style: none; min-width: 160px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; z-index: 30; box-shadow: 0 12px 32px rgba(0, 0, 0, .4); }
.lang a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.lang a:hover { background: var(--surface-2); }
.lang a[aria-current] { color: var(--accent); }

.suggest { display: flex; align-items: center; gap: 10px; margin: 0 4px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 14px; }
.suggest a { flex: 1; color: var(--text); font-weight: 600; }
.suggest button { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--faint); font-size: 18px; line-height: 1; }

.info { margin-top: 40px; }
.info h2 { margin: 0 4px 14px; font-family: var(--display); font-size: 17px; font-weight: 800; letter-spacing: .02em; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 10px; }
.steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.steps li::before { content: counter(step); flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-family: var(--display); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 4px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; color: var(--muted); }
footer .langs { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 12px; }
footer .langs a { color: var(--faint); }

.crumbs { margin: 4px 4px 0; font-size: 13px; color: var(--faint); }
.crumbs a { color: var(--muted); text-decoration: none; }
.level-hero .level-h1 { margin: 0; font-family: var(--display); font-size: clamp(24px, 7vw, 32px); line-height: 1.15; font-weight: 800; color: var(--text); letter-spacing: 0; }
.level-top { margin-top: 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.board { display: block; max-width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line); }
.level-note { margin: 0 4px; color: var(--faint); font-size: 13px; text-align: center; }
.facade { position: absolute; inset: 0; width: 100%; border: 0; background: radial-gradient(circle at 50% 40%, #262939, #0B0C12); color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-weight: 600; }
.facade .ico { width: 64px; height: 64px; border-radius: 20px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.facade:hover .ico { transform: scale(1.05); }
a.more { text-decoration: none; }
.pager { margin-top: 20px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; font-size: 14px; }
.pager a { color: var(--cyan); text-decoration: none; }
.pager a[rel="next"] { text-align: right; }
.level-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.level-list a { display: block; padding: 10px 0; text-align: center; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.level-list a:hover { border-color: var(--accent); }
.player .alts a.level-link { color: var(--accent); font-weight: 600; margin-top: 4px; }
footer .links { display: flex; gap: 16px; margin-bottom: 10px; }
footer .links a { color: var(--muted); }

.cards { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card-level { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; height: 100%; }
.card-level:hover { border-color: var(--accent); }
.card-level img { width: 100%; height: auto; aspect-ratio: auto; border-radius: 10px; background: var(--surface-2); }
.card-level b { font-family: var(--display); font-size: 18px; }
.card-level small { color: var(--faint); font-size: 12px; }
.same .level-note { text-align: left; margin: -6px 4px 12px; }
a.more.shot { margin-top: 18px; }
.find { display: flex; gap: 10px; margin-top: 16px; }
.find input { flex: 1; min-width: 0; height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-size: 18px; }
.find input:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
.find .btn-primary { margin-top: 0; width: auto; height: 52px; padding: 0 20px; font-size: 14px; }

.install { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; }
.install p { margin: 0; color: var(--muted); font-size: 14px; }
.hero-link { font-size: 14px; }
.hero-link a { color: var(--cyan); text-decoration: none; }
.prose { margin: 0 4px; color: var(--muted); }
footer .links { flex-wrap: wrap; row-gap: 6px; }
