  :root {
    --bg: #ffffff; --ink: #17181b; --muted: #5a5d66; --lane: #f4f4f5; --line: #e4e4e7;
    --red: #d83a2e; --blue: #2e6fd8; --yellow: #e8b830; --green: #2e9e4f;
    --fade: 255, 255, 255;
  }
  :root[data-bg="paper"] { --bg: #f0eadf; --lane: #e6dfd1; --line: #d3cbbb; --fade: 240, 234, 223; }
  :root[data-bg="mist"]  { --bg: #f3f4f6; --lane: #e8eaee; --line: #d6d9df; --fade: 243, 244, 246; }
  :root[data-bg="floor"] { --bg: #ffffff; --lane: #f3f2ee; }
  :root[data-bg="floor"] body { background: linear-gradient(#ffffff 0%, #ffffff 52%, #ece9e2 100%); }
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
  body { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Yu Gothic UI", Meiryo, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; }
  #stage { position: relative; height: 100vh; height: 100svh; max-width: 720px; margin: 0 auto;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  #score { position: absolute; left: 0; right: 0; top: 0; width: 100%; opacity: 0; transition: opacity .5s; }
  #score.show { opacity: 1; }
  #three { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; touch-action: none;
    transition: none; }
  @media (prefers-reduced-motion: reduce) { #count.pop { animation: none; } #aboutBtn { transition: none; } }
  .center { position: absolute; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none; }
  .btn { pointer-events: auto; font: inherit; font-size: 16px; font-weight: 700; letter-spacing: .04em; padding: 16px 40px;
    border-radius: 999px; border: 0; background: var(--ink); color: #fff; cursor: pointer; }
  .btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
  .btn:disabled { opacity: .55; cursor: default; }
  .btn.failed { opacity: 1; background: none; color: var(--ink); font-size: 14px; font-weight: 700; white-space: normal; max-width: 320px; line-height: 1.6; }
  #doneBox .doneRow { display: flex; gap: 8px; }
  #appBadge { pointer-events: auto; display: block; line-height: 0; margin-top: 4px; border-radius: 8px; }
  #appBadge img { height: 44px; width: auto; display: block; }
  #appBadge:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
  #doneBox .btn.ghost { background: rgba(255,255,255,.94); text-decoration: none; padding: 12px 24px; }
  .btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); font-size: 14px; padding: 12px 32px; }
  .corner { position: absolute; z-index: 3; margin: 0; border: 0; background: none; padding: 0; font: inherit; font-size: 14px;
    line-height: 20px; color: var(--muted); white-space: nowrap; }
  #aboutBtn { transition: left .6s cubic-bezier(.65, 0, .35, 1); }
  button.corner { cursor: pointer; padding: 12px 8px; margin: -12px -8px; }
  button.corner:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
  #aboutBtn { top: max(12px, env(safe-area-inset-top)); left: 16px; }
  #topRight { position: absolute; z-index: 3; top: max(12px, env(safe-area-inset-top)); right: 16px; display: flex; gap: 16px; }
  #topRight .corner { position: static; }
  button.corner:not([hidden]) { display: inline-flex; align-items: center; gap: 4px; }
  button.corner::before { content: ''; flex: none; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
  #aboutBtn { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='6.25'/%3E%3Cpath d='M8 7.4v3.5M8 5v.1'/%3E%3C/svg%3E"); }
  #autoBtn { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3.2v9.6l7.6-4.8z'/%3E%3C/svg%3E"); }
  #autoBtn[aria-pressed="true"] { color: var(--ink); --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='3.5' width='9' height='9' rx='1'/%3E%3C/svg%3E"); }
  #restart { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8a5 5 0 1 0 1.6-3.7'/%3E%3Cpath d='M4.2 1.7v2.9h2.9'/%3E%3C/svg%3E"); }
  #songName { bottom: max(12px, env(safe-area-inset-bottom)); left: 16px; }
  #songName { max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
  #aboutBtn { top: max(12px, env(safe-area-inset-top)); }
  #about { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px;
    background: rgba(23, 24, 27, .35); }
  #about .card { max-height: calc(100dvh - 32px); overflow-y: auto; box-sizing: border-box; background: #fff; border-radius: 16px; padding: 24px; max-width: 420px; width: 100%; color: var(--ink);
    box-shadow: 0 8px 24px rgba(0,0,0,.12); line-height: 1.75; font-size: 16px; }
  #about h2 { margin: 0 0 8px; font-size: 22px; }
  #about p { margin: 0 0 8px; word-break: auto-phrase; text-wrap: pretty; }
  #about .dots { display: inline-flex; gap: 4px; vertical-align: middle; margin: 0 4px; }
  #about .dots i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
  #about h3 { margin: 16px 0 8px; font-size: 16px; }
  #about .map { list-style: none; margin: 0 0 8px; padding: 0; }
  #about .map li { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
  #about .map i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
  #about .aboutBtns { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
  #about .close { display: block; margin: 0; }
  #about .btn.ghost { width: 8em; padding: 12px 0; font-size: 14px; white-space: nowrap; text-align: center; letter-spacing: 0; }
  #about .fine { font-size: 12px; line-height: 1.6; color: var(--muted); margin-top: 16px; }
  #count { width: 104px; height: 104px; border-radius: 50%; background: var(--ink); color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.12); display: flex; align-items: center; justify-content: center;
    font-size: 58px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
  #count span { display: block; transform: translateY(var(--count-dy, 0px)); }
  #count.pop { animation: pop .35s ease-out; }
  @keyframes pop { from { transform: scale(1.25); opacity: .4; } to { transform: scale(1); opacity: 1; } }
  #tipBox { z-index: 6; }
  #tip { font-size: 14px; font-weight: 700; color: #fff; background: var(--ink); padding: 8px 16px; border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0,0,0,.12); max-width: calc(100vw - 32px); text-align: center; }
  #kbdWrap { position: absolute; top: max(32px, calc(env(safe-area-inset-top) + 24px)); }
  #kbd, #marks { position: absolute; left: 0; width: 100%; }
  .pk { position: absolute; top: 0; border-radius: 0 0 4px 4px; box-sizing: border-box; transition: background .05s, box-shadow .05s; }
  .pk.w { background: #fbfaf7; border: 1px solid #c9c1b2; border-top: 0; }
  .pk.b { background: #23262c; border: 1px solid #000; border-top: 0; z-index: 2; }
  .pk.lit { background: #ffd45e; box-shadow: 0 0 10px 2px rgba(255, 212, 94, .75); border-color: #c79a1e; }
  .mk { position: absolute; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.45);
    transition: opacity .35s ease-in; }
  #kbdWrap.playing .mk { opacity: 0; transition: opacity .08s; }
  #nowName { position: absolute; left: 0; right: 0; text-align: center; opacity: 0; transition: opacity .12s; pointer-events: none;
    font-variant-numeric: tabular-nums; white-space: nowrap; }
  #kbdWrap.playing #nowName { opacity: 1; }
  #nowName b { font-size: 22px; font-weight: 700; color: var(--ink); }
  #homeLogo { position: absolute; left: 50%; transform: translateX(-50%); width: min(56%, 240px); pointer-events: none; z-index: 2; }
  [hidden] { display: none !important; }
