/* =========================================================================
   在线钢琴 · 视觉与界面
   Ink, ivory, brass.
   ========================================================================= */

:root {
    --bg: #f1ebde;
    --bg-deep: #e5dccb;
    --paper: #fbf8f1;
    --paper-warm: #f6f0e4;
    --paper-deep: #eee5d5;
    --ink: #201d18;
    --ink-2: #393329;
    --ink-3: #5b5346;
    --muted: #746b5d;
    --faint: #988f80;
    --line: rgba(35, 30, 24, 0.14);
    --line-soft: rgba(35, 30, 24, 0.08);
    --brass: #a77b3f;
    --brass-deep: #8a632d;
    --brass-pale: #d3b786;
    --brass-soft: rgba(167, 123, 63, 0.12);
    --green: #436753;
    --green-soft: rgba(67, 103, 83, 0.11);
    --red: #a24b3e;
    --red-soft: rgba(162, 75, 62, 0.1);
    --shadow-card: 0 32px 70px -40px rgba(52, 41, 25, 0.45), 0 2px 7px rgba(52, 41, 25, 0.04);
    --shadow-soft: 0 18px 40px -28px rgba(52, 41, 25, 0.32);
    --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
    --font-sans: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --header-h: 74px;
    color-scheme: light dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none;
}

/* 这些容器自带 display，会盖过 [hidden]，用更高优先级补一刀 */
.round-progress[hidden],
.attempts[hidden],
.notation[hidden],
.setup-panel[hidden],
.play-panel[hidden],
.result-panel[hidden],
.result-stage[hidden] {
    display: none;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--ink);
    background-color: var(--bg);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 16% -8%, rgba(255, 253, 246, 0.95), transparent 58%),
        radial-gradient(ellipse 70% 70% at 94% 88%, rgba(207, 187, 154, 0.28), transparent 62%),
        linear-gradient(135deg, #f4eee2 0%, #f0e9db 50%, #ece3d3 100%);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.16;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.88' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.42'/%3E%3C/svg%3E");
}

::selection {
    color: var(--paper);
    background: var(--ink);
}

h1, h2, h3, h4, p, ol, ul {
    margin: 0;
}

ol, ul {
    padding: 0;
    list-style: none;
}

button, input, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

a {
    color: inherit;
    text-decoration: none;
}

img, svg {
    display: block;
}

:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 16px;
    z-index: 200;
    padding: 9px 14px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--paper);
    font-size: 12px;
    transform: translateY(-160%);
    transition: transform 180ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

/* =========================================================================
   Shared type and buttons
   ========================================================================= */

.eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--brass-deep);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.2em;
    line-height: 1.4;
}

.eyebrow > span {
    display: block;
    width: 26px;
    height: 1px;
    background: var(--brass);
    opacity: 0.7;
}

.eyebrow-on-dark {
    color: var(--brass-pale);
}

.eyebrow-on-dark > span {
    background: var(--brass-pale);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 44px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.03em;
    line-height: 1;
    white-space: nowrap;
    transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.btn svg {
    flex: 0 0 auto;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-ink {
    color: #faf5ea;
    background: var(--ink);
    box-shadow: 0 10px 22px -16px rgba(23, 19, 13, 0.8);
}

.btn-ink:hover {
    background: #080706;
    box-shadow: 0 14px 26px -16px rgba(23, 19, 13, 0.75);
}

.btn-paper {
    color: var(--ink);
    background: var(--paper);
    border-color: rgba(255, 255, 255, 0.14);
}

.btn-paper:hover {
    background: #fffdf8;
}

.btn-quiet-line {
    color: var(--ink);
    background: transparent;
    border-color: var(--line);
}

.btn-quiet-line:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(35, 30, 24, 0.24);
}

.btn-xs {
    height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 11.5px;
}

.text-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.6;
    letter-spacing: 0.02em;
    transition: color 160ms ease;
}

.text-button:hover {
    color: var(--ink);
}

.text-arrow-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--brass-pale);
    color: var(--ink);
    font-size: 12px;
    letter-spacing: 0.04em;
    transition: border-color 160ms ease, gap 160ms ease;
}

.text-arrow-link:hover {
    gap: 12px;
    border-color: var(--brass);
}

.avatar {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--paper);
    background: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    font-family: var(--font-serif);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
}

.avatar-lg {
    width: 42px;
    height: 42px;
    font-size: 17px;
}

/* =========================================================================
   Site header
   ========================================================================= */

.site-header {
    position: relative;
    z-index: 40;
    flex: 0 0 auto;
    height: var(--header-h);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 34px;
    width: 100%;
    max-width: 1520px;
    height: 100%;
    margin: 0 auto;
    padding: 0 34px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    flex: 0 0 auto;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.brand-logo img {
    display: block;
    width: auto;
    height: 34px;
}

.brand-logo img.brand-logo-light,
.brand-on-dark .brand-logo img.brand-logo-dark {
    display: none;
}

.brand-on-dark .brand-logo img.brand-logo-light {
    display: block;
}

.foot-logo {
    display: inline-flex;
    align-items: center;
}

.foot-logo img {
    display: block;
    width: auto;
    height: 22px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.brand-copy strong {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.1em;
}

.brand-copy > span {
    color: var(--muted);
    font-size: 7.5px;
    font-weight: 500;
    letter-spacing: 0.23em;
    line-height: 1.4;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 13px;
    border-radius: 7px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.05em;
    transition: color 160ms ease, background-color 160ms ease;
}

.nav-link:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.34);
}

.nav-link.is-active {
    color: var(--ink);
}

.nav-link.is-active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 3px;
    width: 13px;
    height: 1px;
    background: var(--brass);
    transform: translateX(-50%);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-left: auto;
}

.header-login {
    color: var(--ink-3);
    font-size: 12px;
    padding: 6px 2px;
    transition: color 160ms ease;
}

.header-login:hover {
    color: var(--ink);
}

.account-switch {
    position: relative;
}

.account-switch summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 7px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    list-style: none;
    transition: background-color 160ms ease;
}

.account-switch summary::-webkit-details-marker {
    display: none;
}

.account-switch summary:hover {
    background: rgba(255, 255, 255, 0.42);
}

.account-name {
    max-width: 110px;
    overflow: hidden;
    font-size: 12px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-week {
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
}

.account-week b {
    color: var(--brass-deep);
    font-family: var(--font-serif);
    font-size: 12px;
    font-weight: 600;
}

.account-switch .chevron {
    color: var(--faint);
    transition: transform 180ms ease;
}

.account-switch[open] .chevron {
    transform: rotate(180deg);
}

.account-pop {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 50;
    width: 252px;
    padding: 15px;
    border: 1px solid var(--line-soft);
    border-radius: 15px;
    background: var(--paper);
    box-shadow: 0 28px 50px -26px rgba(42, 33, 21, 0.42), 0 4px 12px -8px rgba(42, 33, 21, 0.1);
    transform-origin: top right;
    animation: popIn 160ms ease both;
}

.account-pop-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 2px 2px 12px;
    border-bottom: 1px solid var(--line-soft);
}

.account-pop-head > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.account-pop-head strong {
    font-family: var(--font-serif);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.account-pop-head span:not(.avatar) {
    color: var(--faint);
    font-size: 9.5px;
    letter-spacing: 0.05em;
}

.account-pop-score {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 11px 2px;
    border-bottom: 1px solid var(--line-soft);
}

.account-pop-score > span {
    color: var(--muted);
    font-size: 10px;
}

.account-pop-score > strong {
    color: var(--brass-deep);
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 500;
    line-height: 1;
}

.account-pop-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 2px;
    border: 0;
    background: none;
    color: var(--ink-2);
    font-size: 11px;
    text-align: left;
    transition: color 160ms ease;
}

.account-pop-link:hover {
    color: var(--brass-deep);
}

.account-pop-link.is-danger {
    border-top: 1px solid var(--line-soft);
    color: var(--muted);
}

.account-pop-link.is-danger:hover {
    color: var(--red);
}

.logout-form {
    margin: 0;
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(-5px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* =========================================================================
   Toast
   ========================================================================= */

.toast-stack {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    right: 24px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9px;
    color: #f7f1e5;
    background: var(--ink);
    box-shadow: 0 18px 36px -20px rgba(20, 16, 10, 0.7);
    font-size: 11.5px;
    line-height: 1.65;
    pointer-events: auto;
    animation: toastIn 240ms ease both;
}

.toast.is-out {
    animation: toastOut 220ms ease both;
}

.toast-dot {
    width: 5px;
    height: 5px;
    flex: 0 0 auto;
    margin-top: 8px;
    border-radius: 50%;
    background: var(--brass-pale);
}

.toast-success .toast-dot {
    background: #a8c4b1;
}

.toast-error .toast-dot {
    background: #d79b90;
}

.toast-text {
    flex: 1;
}

.toast-close {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin: -2px -3px 0 0;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: rgba(247, 241, 229, 0.4);
    font-size: 15px;
    line-height: 1;
}

.toast-close:hover {
    color: #f7f1e5;
    background: rgba(255, 255, 255, 0.06);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-4px); }
}

/* =========================================================================
   Game page shell
   ========================================================================= */

.page-game {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.studio {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(71, 59, 42, 0.26) transparent;
}

.studio::-webkit-scrollbar {
    width: 5px;
}

.studio::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(71, 59, 42, 0.22);
}

.studio-inner {
    display: grid;
    grid-template-columns: minmax(260px, 336px) minmax(0, 1fr);
    align-items: center;
    gap: clamp(30px, 4.2vw, 66px);
    width: 100%;
    max-width: 1520px;
    min-height: 100%;
    margin: 0 auto;
    padding: clamp(18px, 2.9vh, 32px) 34px clamp(20px, 3vh, 34px);
}

/* =========================================================================
   Intro column
   ========================================================================= */

.intro {
    max-width: 342px;
    padding-bottom: 2px;
}

.intro h1 {
    margin: 21px 0 17px;
    font-family: var(--font-serif);
    font-size: clamp(38px, 3.65vw, 55px);
    font-weight: 500;
    line-height: 1.28;
    letter-spacing: 0.01em;
}

.intro h1 em {
    position: relative;
    display: inline-block;
    font-style: normal;
    white-space: nowrap;
}

.intro h1 em::after {
    content: "";
    position: absolute;
    right: 2px;
    bottom: -8px;
    left: 2px;
    height: 1px;
    background: linear-gradient(90deg, var(--brass), rgba(167, 123, 63, 0));
}

.intro-copy {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 2;
    letter-spacing: 0.015em;
}

.intro-rules {
    margin-top: 27px;
    border-top: 1px solid var(--line-soft);
}

.intro-rule {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line-soft);
}

.rule-index {
    width: 22px;
    flex: 0 0 auto;
    padding-top: 1px;
    color: var(--brass);
    font-family: var(--font-serif);
    font-size: 10.5px;
    letter-spacing: 0.04em;
    line-height: 1.5;
}

.rule-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rule-copy strong {
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.55;
}

.rule-copy small {
    color: var(--faint);
    font-size: 9.5px;
    line-height: 1.6;
}

.intro-member {
    margin-top: 24px;
    padding: 12px 14px;
    border: 1px solid var(--line-soft);
    border-radius: 11px;
    background: rgba(251, 248, 241, 0.46);
}

.intro-member-label {
    color: var(--faint);
    font-size: 8.5px;
    letter-spacing: 0.12em;
}

.intro-member-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 5px;
}

.intro-member-score {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.intro-member-score strong {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 25px;
    font-weight: 500;
    line-height: 1;
}

.intro-member-score em {
    color: var(--muted);
    font-size: 9px;
    font-style: normal;
}

.intro-member-rank {
    color: var(--brass-deep);
    font-size: 10px;
    white-space: nowrap;
}

.intro-guest-link {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 24px;
    color: var(--faint);
    font-size: 9.5px;
    line-height: 1.7;
}

.intro-guest-link span:last-child {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-3);
    font-size: 10.5px;
    transition: gap 160ms ease, color 160ms ease;
}

.intro-guest-link:hover span:last-child {
    gap: 9px;
    color: var(--brass-deep);
}

/* =========================================================================
   Practice area
   ========================================================================= */

.practice-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.sheet-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: clamp(318px, 42vh, 400px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.66);
    border-radius: var(--radius-xl);
    background: var(--paper);
    box-shadow: var(--shadow-card);
    transition: box-shadow 260ms ease;
}

.sheet-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(88, 72, 49, 0.04);
    pointer-events: none;
}

.sheet-rule {
    position: absolute;
    top: 0;
    right: 12%;
    left: 12%;
    z-index: 2;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(167, 123, 63, 0.62), transparent);
    pointer-events: none;
}

.sheet-head {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 56px;
    padding: 14px 24px 12px;
    border-bottom: 1px solid var(--line-soft);
}

.sheet-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.13em;
    line-height: 1.5;
    white-space: nowrap;
}

.sheet-kicker i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--brass);
}

.round-progress {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-left: auto;
}

.progress-label {
    color: var(--ink-2);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.progress-steps {
    display: flex;
    gap: 4px;
}

.progress-steps i {
    width: 17px;
    height: 2px;
    border-radius: 999px;
    background: var(--line);
    transition: background-color 240ms ease, width 240ms ease;
}

.progress-steps i.is-done {
    background: var(--ink-3);
}

.progress-steps i.is-current {
    width: 23px;
    background: var(--brass);
}

.progress-steps i.is-failed {
    width: 23px;
    background: var(--red);
}

.attempts {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: 20px;
}

.attempts-label {
    color: var(--faint);
    font-size: 8.5px;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

.attempts-dots {
    display: flex;
    gap: 4px;
}

.attempts-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ink-3);
    opacity: 0.88;
    transition: background-color 220ms ease, box-shadow 220ms ease, opacity 220ms ease;
}

.attempts-dots i.is-spent {
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--line);
    opacity: 0.8;
}

.attempts.is-low .attempts-dots i:not(.is-spent) {
    background: var(--brass);
}

.result-tag {
    margin-left: auto;
    padding: 4px 9px;
    border: 1px solid rgba(167, 123, 63, 0.32);
    border-radius: 999px;
    color: var(--brass-deep);
    background: rgba(167, 123, 63, 0.05);
    font-size: 9px;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.sheet-card.is-result-fail .result-tag {
    border-color: rgba(162, 75, 62, 0.24);
    color: var(--red);
    background: rgba(162, 75, 62, 0.04);
}

.score-stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    min-height: 246px;
    padding: 2px 20px;
    overflow: hidden;
    background:
        radial-gradient(ellipse 54% 68% at 50% 48%, rgba(255, 255, 255, 0.66), transparent 72%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 23%, transparent 80%, rgba(237, 228, 211, 0.24));
}

.score-glow {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms ease;
}

.sheet-card.is-correct .score-glow {
    opacity: 1;
    background: radial-gradient(ellipse 50% 70% at 50% 55%, rgba(83, 122, 98, 0.13), transparent 70%);
}

.sheet-card.is-wrong .score-glow {
    opacity: 1;
    background: radial-gradient(ellipse 50% 70% at 50% 55%, rgba(162, 75, 62, 0.11), transparent 70%);
}

.sheet-card.is-correct {
    box-shadow: 0 32px 70px -40px rgba(52, 41, 25, 0.4), 0 0 0 1px rgba(83, 122, 98, 0.22), 0 12px 32px -28px rgba(83, 122, 98, 0.45);
}

.sheet-card.is-wrong {
    box-shadow: 0 32px 70px -40px rgba(52, 41, 25, 0.4), 0 0 0 1px rgba(162, 75, 62, 0.19);
}

.notation {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 180ms ease, transform 180ms ease;
}

.notation.is-leaving {
    opacity: 0;
    transform: translateY(-5px);
}

.notation svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    animation: noteArrive 420ms cubic-bezier(0.22, 0.7, 0.3, 1) both;
}

.notation-fallback {
    color: var(--faint);
    font-size: 11px;
    letter-spacing: 0.03em;
    text-align: center;
}

@keyframes noteArrive {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Result inside sheet */
.result-stage {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 8px 26px 10px;
    text-align: center;
    animation: resultIn 380ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes resultIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-headline {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin-bottom: 5px;
    color: var(--ink);
}

.result-headline strong {
    font-family: var(--font-serif);
    font-size: clamp(50px, 5.2vw, 66px);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.result-headline span {
    color: var(--faint);
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 400;
}

.result-title {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.result-description {
    max-width: 430px;
    margin: 6px auto 0;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.8;
}

.result-description .answer-name {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 12px;
    font-weight: 600;
}

.note-review {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 15px;
}

.note-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.28);
    font-size: 9.5px;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.note-pill::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--line);
}

.note-pill.is-passed {
    color: var(--ink-2);
    border-color: rgba(67, 103, 83, 0.2);
    background: rgba(67, 103, 83, 0.055);
}

.note-pill.is-passed::before {
    background: var(--green);
}

.note-pill.is-failed {
    color: var(--red);
    border-color: rgba(162, 75, 62, 0.26);
    background: rgba(162, 75, 62, 0.05);
}

.note-pill.is-failed::before {
    background: var(--red);
}

.note-pill.is-unseen {
    opacity: 0.48;
}

.result-stage.is-fail .result-headline strong {
    color: var(--ink);
}

.confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti i {
    position: absolute;
    top: 20%;
    left: var(--x, 50%);
    width: 4px;
    height: 9px;
    border-radius: 2px;
    background: var(--brass-pale);
    opacity: 0;
    animation: confettiDrift 1.8s ease-out var(--delay, 0s) both;
}

@keyframes confettiDrift {
    0% { opacity: 0; transform: translate3d(0, -14px, 0) rotate(0deg) scale(0.7); }
    20% { opacity: 0.8; }
    100% { opacity: 0; transform: translate3d(var(--drift, 16px), 90px, 0) rotate(190deg) scale(1); }
}

.sheet-foot {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 48px;
    padding: 9px 24px 13px;
    border-top: 1px solid var(--line-soft);
    background: linear-gradient(180deg, rgba(246, 240, 228, 0), rgba(246, 240, 228, 0.5));
}

.feedback-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.feedback-mark {
    width: 5px;
    height: 5px;
    flex: 0 0 auto;
    margin-top: 8px;
    border-radius: 50%;
    background: var(--brass);
    transition: background-color 200ms ease;
}

.feedback-text {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.7;
    letter-spacing: 0.015em;
}

.sheet-card.is-correct .feedback-text {
    color: var(--green);
}

.sheet-card.is-correct .feedback-mark {
    background: var(--green);
}

.sheet-card.is-wrong .feedback-text {
    color: var(--red);
}

.sheet-card.is-wrong .feedback-mark {
    background: var(--red);
}

.clef-badge {
    flex: 0 0 auto;
    padding: 3px 7px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    color: var(--faint);
    font-size: 8px;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

/* =========================================================================
   Console: setup / play / result
   ========================================================================= */

.console {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    background: rgba(251, 248, 241, 0.64);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
}

.setup-panel {
    padding: 15px 17px 16px;
}

.setup-main {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.setup-heading {
    flex: 0 0 auto;
    width: 73px;
    padding-top: 8px;
}

.console-label {
    display: block;
    color: var(--ink-2);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.console-sub {
    display: block;
    margin-top: 2px;
    color: var(--faint);
    font-size: 8.5px;
    letter-spacing: 0.06em;
}

.chip-scroller {
    flex: 1 1 auto;
    min-width: 0;
}

.register-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.chip {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 78px;
    height: 48px;
    padding: 5px 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.36);
    text-align: left;
    transition: background-color 170ms ease, border-color 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}

.chip::after {
    content: "";
    position: absolute;
    right: 10px;
    bottom: 4px;
    left: 10px;
    height: 1px;
    background: var(--brass-pale);
    opacity: 0;
    transition: opacity 170ms ease;
}

.chip:hover {
    border-color: rgba(167, 123, 63, 0.42);
    background: rgba(255, 255, 255, 0.62);
    transform: translateY(-1px);
}

.chip-name {
    color: var(--ink-2);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.chip-range {
    color: var(--faint);
    font-family: var(--font-mono);
    font-size: 8.5px;
    line-height: 1.4;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.chip.is-on {
    border-color: var(--ink);
    background: var(--ink);
    box-shadow: 0 8px 16px -12px rgba(24, 20, 14, 0.8);
}

.chip.is-on:hover {
    border-color: var(--ink);
    background: #0c0a08;
}

.chip.is-on .chip-name {
    color: #fbf6ec;
}

.chip.is-on .chip-range {
    color: rgba(251, 246, 236, 0.52);
}

.chip.is-on::after {
    opacity: 1;
}

.chip-tools {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    padding-top: 8px;
    color: var(--faint);
    font-size: 10px;
}

.setup-foot {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    cursor: pointer;
    user-select: none;
}

.switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.switch-track {
    position: relative;
    display: block;
    width: 29px;
    height: 17px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #e4dacb;
    transition: background-color 180ms ease, border-color 180ms ease;
}

.switch-track span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--paper);
    box-shadow: 0 1px 3px rgba(35, 28, 18, 0.25);
    transition: transform 180ms cubic-bezier(0.3, 0.7, 0.4, 1), background-color 180ms ease;
}

.switch input:checked + .switch-track {
    border-color: var(--ink);
    background: var(--ink);
}

.switch input:checked + .switch-track span {
    background: var(--brass-pale);
    transform: translateX(12px);
}

.switch input:focus-visible + .switch-track {
    outline: 2px solid var(--brass);
    outline-offset: 3px;
}

.switch-copy {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
}

.switch-copy strong {
    color: var(--ink-3);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.switch-copy small {
    color: var(--brass);
    font-size: 8px;
    letter-spacing: 0.04em;
}

.setup-hint {
    margin-right: auto;
    color: var(--faint);
    font-size: 9px;
    line-height: 1.6;
    letter-spacing: 0.015em;
    white-space: nowrap;
}

.btn-start {
    height: 43px;
    padding: 0 19px;
    flex: 0 0 auto;
}

.btn-start.is-loading {
    opacity: 0.68;
    pointer-events: none;
}

.play-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 18px 15px;
}

.play-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-2);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.live-badge i {
    position: relative;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--brass);
}

.live-badge i::after {
    content: "";
    position: absolute;
    inset: -3px;
    border: 1px solid rgba(167, 123, 63, 0.32);
    border-radius: 50%;
    animation: livePulse 1.9s ease-out infinite;
}

@keyframes livePulse {
    0% { opacity: 0.8; transform: scale(0.7); }
    75%, 100% { opacity: 0; transform: scale(1.45); }
}

.play-bottom {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding-top: 9px;
    border-top: 1px solid var(--line-soft);
}

.play-bottom p {
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.7;
}

.play-hint {
    color: var(--faint);
    font-size: 8.5px;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

.quit-button {
    color: var(--faint);
}

.quit-button:hover {
    color: var(--red);
}

.quit-button.is-arming {
    color: var(--red);
}

.result-panel {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 15px 18px 14px;
}

.result-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
}

.result-actions .btn {
    height: 40px;
    font-size: 11.5px;
}

.result-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    color: var(--muted);
    font-size: 10.5px;
    transition: color 160ms ease, gap 160ms ease;
}

.result-link:hover {
    gap: 9px;
    color: var(--ink);
}

.result-meta {
    color: var(--faint);
    font-size: 9.5px;
    line-height: 1.65;
}

.result-meta a {
    margin-left: 4px;
    color: var(--brass-deep);
    text-decoration: underline;
    text-decoration-color: rgba(138, 99, 45, 0.32);
    text-underline-offset: 3px;
}

.result-meta a:hover {
    text-decoration-color: var(--brass-deep);
}

/* =========================================================================
   Piano dock
   ========================================================================= */

.piano-dock {
    position: relative;
    z-index: 30;
    flex: 0 0 auto;
    color: #f5efe3;
    background: #191715;
    box-shadow: 0 -24px 50px -30px rgba(43, 33, 20, 0.38);
}

.piano-dock::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(211, 183, 134, 0.38) 30%, rgba(211, 183, 134, 0.38) 70%, transparent);
}

.piano-strip {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1520px;
    margin: 0 auto;
    padding: 7px 26px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent);
}

.piano-strip-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1 1 0;
    color: rgba(247, 241, 230, 0.58);
    font-size: 9px;
    letter-spacing: 0.16em;
    white-space: nowrap;
}

.piano-strip-brand em {
    padding: 1px 4px;
    border: 1px solid rgba(247, 241, 230, 0.16);
    border-radius: 3px;
    color: rgba(247, 241, 230, 0.4);
    font-size: 7px;
    font-style: normal;
    letter-spacing: 0.06em;
}

.strip-keymark {
    display: inline-flex;
    align-items: flex-start;
    gap: 2px;
    width: 18px;
    height: 12px;
    padding-top: 1px;
}

.strip-keymark i {
    display: block;
    width: 4px;
    height: 10px;
    border: 1px solid rgba(247, 241, 230, 0.3);
    border-radius: 0 0 1px 1px;
}

.strip-keymark i:nth-child(2) {
    height: 7px;
    border-color: rgba(211, 183, 134, 0.46);
}

.now-playing {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 7px;
    flex: 0 1 auto;
    min-width: 0;
    color: rgba(247, 241, 230, 0.42);
    font-size: 9px;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

.now-dot {
    width: 3px;
    height: 3px;
    align-self: center;
    border-radius: 50%;
    background: var(--brass-pale);
    opacity: 0.7;
}

.now-playing strong {
    min-width: 86px;
    overflow: hidden;
    color: rgba(247, 241, 230, 0.75);
    font-family: var(--font-serif);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.now-sub {
    color: rgba(247, 241, 230, 0.28);
    font-size: 8px;
    letter-spacing: 0.06em;
}

.now-playing.is-note strong {
    color: #fbf5e8;
}

.sound-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    flex: 1 1 0;
    min-width: 0;
    padding: 5px 0;
    border: 0;
    background: none;
    color: rgba(247, 241, 230, 0.5);
    font-size: 9px;
    letter-spacing: 0.08em;
    transition: color 160ms ease;
}

.sound-toggle:hover {
    color: rgba(247, 241, 230, 0.9);
}

.sound-icons {
    display: inline-flex;
    align-items: center;
}

.sound-off-icon {
    display: none;
}

.sound-toggle.is-muted {
    color: rgba(247, 241, 230, 0.3);
}

.sound-toggle.is-muted .sound-on-icon {
    display: none;
}

.sound-toggle.is-muted .sound-off-icon {
    display: block;
}

.sound-label {
    font-size: 8.5px;
    letter-spacing: 0.12em;
}

.piano-body {
    display: flex;
    align-items: stretch;
    gap: 8px;
    max-width: 1520px;
    margin: 0 auto;
    padding: 7px 12px 11px;
}

.cheek {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 22px;
    flex: 0 0 auto;
    padding-bottom: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #25211c 0%, #171410 54%, #0d0b09 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.cheek::after {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 50%;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(211, 183, 134, 0.13), transparent);
}

.cheek .screw {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #6b5a40, #221c14 68%);
    transform: translateX(-50%);
}

.cheek-word {
    position: relative;
    z-index: 1;
    color: rgba(247, 241, 230, 0.2);
    font-size: 6px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
}

.keybed {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 3px 5px;
    border-radius: 5px;
    background: #0b0a08;
    box-shadow: inset 0 7px 11px rgba(0, 0, 0, 0.72), inset 0 -1px 0 rgba(255, 255, 255, 0.05), 0 1px 0 rgba(255, 255, 255, 0.055);
}

.keyboard-scroll {
    position: relative;
    height: clamp(160px, 19.4vh, 188px);
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(247, 241, 230, 0.22) transparent;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.keyboard-scroll::-webkit-scrollbar {
    height: 5px;
}

.keyboard-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.keyboard-scroll::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(247, 241, 230, 0.18);
}

.keyboard {
    position: relative;
    width: 100%;
    min-width: 1180px;
    height: 100%;
    overflow: hidden;
    background: #12100d;
    border-radius: 1px;
    touch-action: pan-x;
    user-select: none;
    --white-w: calc(100% / 52);
}

.pkey {
    position: absolute;
    padding: 0;
    border: 0;
    outline: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.pkey.is-white {
    top: 0;
    bottom: 0;
    left: calc(var(--pos) * var(--white-w));
    z-index: 1;
    width: var(--white-w);
    border-right: 1px solid rgba(62, 49, 32, 0.2);
    border-bottom: 3px solid #c8b99f;
    border-radius: 0 0 5px 5px;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.5), transparent 12%, transparent 88%, rgba(94, 76, 52, 0.06)),
        linear-gradient(180deg, #f8f2e5 0%, #fdf9f1 54%, #f1e8d8 88%, #e9decc 100%);
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.72),
        inset 0 -7px 9px rgba(87, 67, 40, 0.075),
        0 1px 2px rgba(0, 0, 0, 0.18);
    transition: transform 55ms ease, filter 100ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.pkey.is-white::after {
    content: "";
    position: absolute;
    right: 4px;
    bottom: 9px;
    left: 4px;
    height: 1px;
    border-radius: 999px;
    background: rgba(72, 56, 35, 0.06);
}

.pkey-name {
    position: absolute;
    right: 0;
    bottom: 12px;
    left: 0;
    z-index: 2;
    color: rgba(82, 65, 42, 0.46);
    font-size: 8px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.02em;
    text-align: center;
    pointer-events: none;
}

.pkey.is-correct .pkey-name {
    color: rgba(76, 55, 23, 0.72);
}

.pkey.is-white.is-last-white {
    border-right: 0;
}

.pkey.is-white:last-of-type {
    border-right: 0;
}

.pkey.is-black {
    top: 0;
    left: calc((var(--pos) + 1) * var(--white-w));
    z-index: 3;
    width: calc(var(--white-w) * 0.62);
    height: 62%;
    border-radius: 0 0 4px 4px;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.055), transparent 26%, transparent 70%, rgba(0, 0, 0, 0.32)),
        linear-gradient(180deg, #3c3730 0%, #211e1a 42%, #100e0c 78%, #080706 100%);
    box-shadow:
        0 3px 0 #050504,
        0 6px 8px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.13),
        inset 0 -5px 6px rgba(0, 0, 0, 0.35);
    transform: translateX(-50%);
    transition: transform 55ms ease, filter 100ms ease, box-shadow 180ms ease;
}

.pkey.is-black::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 2px;
    left: 2px;
    height: 1px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
}

.pkey:hover.is-white {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.5), transparent 12%, transparent 88%, rgba(94, 76, 52, 0.06)),
        linear-gradient(180deg, #f7efdf 0%, #fffaf1 54%, #eee3d0 88%, #e5d7c1 100%);
}

.pkey:hover.is-black {
    filter: brightness(1.12);
}

.pkey.is-down.is-white {
    transform: translateY(2px);
    border-bottom-width: 1px;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.28), transparent 12%, transparent 88%, rgba(94, 76, 52, 0.1)),
        linear-gradient(180deg, #ece1ce 0%, #f6eee0 58%, #e4d5be 100%);
    box-shadow:
        inset 0 4px 7px rgba(77, 58, 34, 0.1),
        inset 0 -2px 4px rgba(77, 58, 34, 0.12);
}

.pkey.is-down.is-black {
    transform: translate(-50%, 2px);
    filter: brightness(0.9);
    box-shadow:
        0 1px 0 #050504,
        0 3px 5px rgba(0, 0, 0, 0.48),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.pkey:focus-visible {
    z-index: 12;
    outline: 2px solid var(--brass);
    outline-offset: -3px;
}

.pkey.is-white.is-correct {
    background:
        linear-gradient(180deg, #fbf2dc 0%, #f5e5c5 62%, #e8d2a8 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 0 0 2px rgba(167, 123, 63, 0.8),
        0 0 28px rgba(198, 158, 92, 0.5);
}

.pkey.is-black.is-correct {
    filter: brightness(1.12);
    box-shadow:
        0 3px 0 #050504,
        0 0 0 2px var(--brass-pale),
        0 0 26px rgba(198, 158, 92, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.pkey.is-white.is-wrong {
    background:
        linear-gradient(180deg, #f4e1dc 0%, #f7e8e4 54%, #e8cfc7 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        0 0 0 2px rgba(162, 75, 62, 0.65),
        0 0 22px rgba(162, 75, 62, 0.25);
}

.pkey.is-black.is-wrong {
    box-shadow:
        0 3px 0 #050504,
        0 0 0 2px rgba(194, 105, 90, 0.8),
        0 0 20px rgba(162, 75, 62, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.pkey.is-reveal.is-white {
    background:
        linear-gradient(180deg, #fbf2dc 0%, #f3e0ba 62%, #e6cca0 100%);
    animation: revealPulseWhite 1.65s ease-out infinite;
}

.pkey.is-reveal.is-black {
    animation: revealPulseBlack 1.65s ease-out infinite;
}

@keyframes revealPulseWhite {
    0%, 100% {
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 0 0 2px rgba(167, 123, 63, 0.7), 0 0 16px rgba(198, 158, 92, 0.25);
    }
    50% {
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 3px rgba(167, 123, 63, 0.9), 0 0 32px rgba(198, 158, 92, 0.58);
    }
}

@keyframes revealPulseBlack {
    0%, 100% {
        filter: brightness(1.08);
        box-shadow: 0 3px 0 #050504, 0 0 0 2px rgba(211, 183, 134, 0.72), 0 0 14px rgba(198, 158, 92, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    }
    50% {
        filter: brightness(1.2);
        box-shadow: 0 3px 0 #050504, 0 0 0 3px rgba(211, 183, 134, 0.95), 0 0 28px rgba(198, 158, 92, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.16);
    }
}

.key-float {
    position: absolute;
    top: 6px;
    z-index: 15;
    padding: 4px 8px 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: var(--ink);
    background: #fbf5e8;
    box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.7);
    font-family: var(--font-sans);
    font-size: 9.5px;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: 0.03em;
    white-space: nowrap;
    pointer-events: none;
    transform: translateX(-50%);
    animation: floatIn 160ms ease both;
}

.key-float::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 7px;
    height: 7px;
    background: #fbf5e8;
    transform: translateX(-50%) rotate(45deg);
}

.key-float.is-gold {
    color: #211a0e;
    background: var(--brass-pale);
}

.key-float.is-gold::after {
    background: var(--brass-pale);
}

.key-float.is-warn {
    color: #fff6ec;
    background: var(--red);
}

.key-float.is-warn::after {
    background: var(--red);
}

@keyframes floatIn {
    from { opacity: 0; transform: translate(-50%, 3px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.scroll-hint {
    position: absolute;
    right: 50%;
    bottom: 12px;
    z-index: 20;
    display: none;
    padding: 3px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: rgba(247, 241, 230, 0.55);
    background: rgba(10, 9, 7, 0.74);
    font-size: 8.5px;
    letter-spacing: 0.08em;
    pointer-events: none;
    transform: translateX(50%);
    transition: opacity 300ms ease;
}

.scroll-hint.is-hidden {
    opacity: 0;
}

.scroll-hint.is-hidden {
    opacity: 0;
}

/* =========================================================================
   Shared footer
   ========================================================================= */

.site-foot {
    border-top: 1px solid var(--line-soft);
    background: rgba(244, 238, 227, 0.55);
}

.site-foot-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 20px 34px;
}

.foot-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-2);
    font-family: var(--font-serif);
    font-size: 12px;
    letter-spacing: 0.06em;
}

.foot-brand img {
    border-radius: 7px;
}

.foot-brand small {
    color: var(--faint);
    font-family: var(--font-sans);
    font-size: 7px;
    letter-spacing: 0.16em;
}

.foot-note {
    color: var(--faint);
    font-size: 9px;
    letter-spacing: 0.04em;
}

.foot-links {
    display: flex;
    gap: 18px;
    margin-left: auto;
}

.foot-links a {
    color: var(--muted);
    font-size: 10px;
    transition: color 160ms ease;
}

.foot-links a:hover {
    color: var(--ink);
}

/* =========================================================================
   Account page
   ========================================================================= */

.page-account {
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--ink);
    background: #1b1814;
}

.page-account::before,
.page-account::after {
    display: none;
}

.account-shell {
    display: grid;
    grid-template-columns: minmax(360px, 0.92fr) minmax(470px, 1.08fr);
    min-height: 100vh;
    min-height: 100dvh;
}

.account-art {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    padding: 32px clamp(30px, 4vw, 58px) 28px;
    color: #f6efe2;
    background:
        radial-gradient(ellipse 80% 65% at 82% 10%, rgba(167, 123, 63, 0.17), transparent 60%),
        radial-gradient(ellipse 70% 60% at 5% 96%, rgba(94, 77, 50, 0.25), transparent 62%),
        linear-gradient(135deg, #1f1b16 0%, #191612 52%, #14110e 100%);
}

.account-art::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.13;
    pointer-events: none;
    mix-blend-mode: soft-light;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.account-art::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(211, 183, 134, 0.22) 25%, rgba(211, 183, 134, 0.12) 70%, transparent);
}

.account-art-top {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand-on-dark .brand-copy strong {
    color: #f9f3e7;
}

.brand-on-dark .brand-copy > span {
    color: rgba(249, 243, 231, 0.35);
}

.art-kicker {
    color: rgba(211, 183, 134, 0.54);
    font-size: 7.5px;
    letter-spacing: 0.25em;
}

.account-quote {
    position: relative;
    z-index: 2;
    max-width: 480px;
    margin-top: clamp(64px, 11vh, 120px);
}

.account-quote h1 {
    margin: 20px 0 18px;
    color: #faf4e8;
    font-family: var(--font-serif);
    font-size: clamp(40px, 4.8vw, 66px);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0.015em;
}

.account-quote h1 em {
    color: var(--brass-pale);
    font-style: normal;
}

.account-quote p {
    color: rgba(247, 240, 227, 0.5);
    font-size: 11.5px;
    line-height: 2.05;
}

.art-staff {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 148px;
    margin-top: auto;
    padding-top: 26px;
    opacity: 0.66;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}

.art-line {
    width: 100%;
    height: 1px;
    background: rgba(211, 183, 134, 0.22);
}

.art-note {
    position: absolute;
    top: var(--y);
    left: var(--x);
    width: 12px;
    height: 8px;
    border-radius: 50%;
    background: var(--brass-pale);
    transform: rotate(-17deg);
    box-shadow: 0 0 12px rgba(211, 183, 134, 0.12);
}

.art-note::after {
    content: "";
    position: absolute;
    right: 1px;
    bottom: 3px;
    width: 1px;
    height: 27px;
    background: rgba(211, 183, 134, 0.72);
}

.art-note-open {
    background: transparent;
    border: 1.5px solid var(--brass-pale);
}

.art-clef-mark {
    position: absolute;
    top: 18px;
    left: 1%;
    color: rgba(211, 183, 134, 0.3);
    font-family: var(--font-serif);
    font-size: 70px;
    line-height: 1;
}

.account-art-foot {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 26px;
    margin-top: 24px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    color: rgba(247, 240, 227, 0.24);
    font-size: 7.5px;
    letter-spacing: 0.2em;
}

.account-form-side {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px clamp(28px, 5.2vw, 76px) 20px;
    background:
        radial-gradient(ellipse 70% 55% at 90% 0%, rgba(255, 252, 245, 0.72), transparent 55%),
        linear-gradient(180deg, #f3ede1 0%, #f0e9dc 100%);
}

.account-form-side::before {
    content: "";
    position: absolute;
    top: 80px;
    right: 40px;
    width: 160px;
    height: 160px;
    border: 1px solid rgba(167, 123, 63, 0.1);
    border-radius: 50%;
    pointer-events: none;
}

.account-topline {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    font-size: 10px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 0;
    color: var(--ink-3);
    transition: color 160ms ease, gap 160ms ease;
}

.back-link:hover {
    gap: 8px;
    color: var(--ink);
}

.account-topline-note {
    color: var(--faint);
    font-size: 8.5px;
    letter-spacing: 0.1em;
}

.account-form-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 418px;
    margin: auto;
    padding: 22px 0 12px;
}

.account-tabs {
    display: flex;
    gap: 25px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--line);
}

.account-tab {
    position: relative;
    padding: 0 0 10px;
    color: var(--faint);
    font-size: 11.5px;
    letter-spacing: 0.05em;
    transition: color 160ms ease;
}

.account-tab:hover {
    color: var(--ink-2);
}

.account-tab.is-active {
    color: var(--ink);
}

.account-tab.is-active::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--ink);
}

.account-tab.is-active::before {
    content: "";
    position: absolute;
    right: 50%;
    bottom: -2px;
    z-index: 1;
    width: 18px;
    height: 2px;
    background: var(--brass);
    transform: translateX(50%);
}

.form-eyebrow {
    display: block;
    color: var(--brass-deep);
    font-size: 8px;
    font-weight: 500;
    letter-spacing: 0.22em;
    line-height: 1.5;
}

.form-heading h2 {
    margin: 8px 0 9px;
    font-family: var(--font-serif);
    font-size: 29px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: 0.02em;
}

.form-heading p {
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.85;
}

.form-alert {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-top: 17px;
    padding: 9px 10px;
    border: 1px solid rgba(162, 75, 62, 0.2);
    border-radius: 7px;
    color: #81382f;
    background: rgba(162, 75, 62, 0.065);
    font-size: 10.5px;
    line-height: 1.65;
}

.form-alert.is-info {
    border-color: var(--line-soft);
    color: var(--ink-3);
    background: rgba(255, 255, 255, 0.34);
}

.alert-dot {
    width: 4px;
    height: 4px;
    flex: 0 0 auto;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--red);
}

.form-alert.is-info .alert-dot {
    background: var(--brass);
}

.account-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-3);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.06em;
}

.field input {
    width: 100%;
    height: 49px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    letter-spacing: 0.02em;
    outline: none;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.field input::placeholder {
    color: #a59a8b;
}

.field input:hover {
    border-color: rgba(35, 30, 24, 0.24);
}

.field input:focus {
    border-color: var(--brass);
    background: var(--paper);
    box-shadow: 0 0 0 4px rgba(167, 123, 63, 0.1);
}

.field.has-error input {
    border-color: rgba(162, 75, 62, 0.55);
    background: rgba(255, 249, 247, 0.6);
}

.field-error {
    margin-top: 5px;
    color: var(--red);
    font-size: 9.5px;
    line-height: 1.55;
}

.input-with-action {
    position: relative;
}

.input-with-action input {
    padding-right: 52px;
}

.input-action {
    position: absolute;
    top: 5px;
    right: 5px;
    bottom: 5px;
    padding: 0 8px;
    border: 0;
    border-radius: 5px;
    color: var(--faint);
    background: none;
    font-size: 9px;
    letter-spacing: 0.03em;
    transition: color 160ms ease, background-color 160ms ease;
}

.input-action:hover {
    color: var(--ink-2);
    background: rgba(35, 30, 24, 0.05);
}

.btn-submit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 51px;
    margin-top: 3px;
    padding: 0 17px;
    font-size: 12px;
    letter-spacing: 0.07em;
}

.form-switch {
    margin-top: 18px;
    color: var(--muted);
    font-size: 10.5px;
    text-align: center;
}

.form-switch a {
    padding-bottom: 2px;
    border-bottom: 1px solid var(--brass-pale);
    color: var(--ink);
    transition: border-color 160ms ease;
}

.form-switch a:hover {
    border-color: var(--brass);
}

.privacy-note {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
    margin-top: 18px;
    color: var(--faint);
    font-size: 8.5px;
    line-height: 1.75;
    text-align: left;
}

.privacy-note svg {
    flex: 0 0 auto;
    margin-top: 2px;
    color: var(--brass);
    opacity: 0.75;
}

.account-footnote {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding-top: 18px;
    color: var(--faint);
    font-size: 8px;
    letter-spacing: 0.1em;
}

/* =========================================================================
   Leaderboard
   ========================================================================= */

.page-rank {
    background: var(--bg);
}

.rank-main {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 26px 34px 56px;
}

.rank-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 36px;
    overflow: hidden;
    padding: 16px 0 34px;
    border-bottom: 1px solid var(--line-soft);
}

.rank-hero-copy {
    position: relative;
    z-index: 2;
    max-width: 590px;
}

.rank-hero h1 {
    margin: 18px 0 14px;
    font-family: var(--font-serif);
    font-size: clamp(40px, 4.8vw, 61px);
    font-weight: 500;
    line-height: 1.27;
    letter-spacing: 0.01em;
}

.rank-hero h1 em {
    position: relative;
    color: var(--brass-deep);
    font-style: normal;
}

.rank-hero h1 em::after {
    content: "";
    position: absolute;
    right: 2px;
    bottom: -5px;
    left: 2px;
    height: 1px;
    background: linear-gradient(90deg, var(--brass-pale), transparent);
}

.rank-hero p {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.95;
}

.rank-hero-actions {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 9px;
    flex: 0 0 auto;
    padding-bottom: 2px;
}

.rank-hero-actions .btn {
    height: 43px;
    font-size: 11.5px;
}

.hero-note {
    color: var(--faint);
    font-size: 8.5px;
    letter-spacing: 0.03em;
}

.rank-hero-staff {
    position: absolute;
    top: 55px;
    right: 9%;
    z-index: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 290px;
    height: 84px;
    opacity: 0.46;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 35%, #000 85%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 35%, #000 85%, transparent);
}

.rank-hero-staff i {
    width: 100%;
    height: 1px;
    background: var(--line);
}

.rank-tabs-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin: 24px 0 20px;
}

.rank-tabs {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    background: rgba(251, 248, 241, 0.56);
}

.rank-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 66px;
    height: 33px;
    padding: 0 16px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: 0.05em;
    transition: color 160ms ease, background-color 160ms ease;
}

.rank-tab:hover {
    color: var(--ink);
}

.rank-tab.is-active {
    color: #fbf6ec;
    background: var(--ink);
    box-shadow: 0 7px 16px -12px rgba(24, 20, 14, 0.8);
}

.period-caption {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--faint);
    font-size: 8.5px;
    letter-spacing: 0.09em;
}

.period-caption i {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--brass);
    opacity: 0.8;
}

.my-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 28px;
    overflow: hidden;
    margin-bottom: 20px;
    padding: 20px 24px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    color: #f8f2e6;
    background: linear-gradient(125deg, #23201b 0%, #1b1814 58%, #171410 100%);
    box-shadow: 0 24px 48px -36px rgba(24, 20, 14, 0.72);
}

.my-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 130% at 92% 10%, rgba(167, 123, 63, 0.18), transparent 55%);
    pointer-events: none;
}

.my-card-person {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.my-card-person .avatar {
    color: var(--ink);
    background: var(--paper-warm);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.my-card-kicker {
    display: block;
    color: rgba(211, 183, 134, 0.7);
    font-size: 8px;
    letter-spacing: 0.14em;
    line-height: 1.5;
}

.my-card-person h2 {
    margin-top: 2px;
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.03em;
}

.my-card-person p {
    margin-top: 1px;
    color: rgba(248, 242, 230, 0.33);
    font-size: 8.5px;
    letter-spacing: 0.04em;
}

.my-card-stats {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: clamp(24px, 4vw, 54px);
    margin-left: auto;
}

.my-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 55px;
}

.my-stat > span {
    color: rgba(248, 242, 230, 0.36);
    font-size: 8px;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.my-stat strong {
    color: #faf4e8;
    font-family: var(--font-serif);
    font-size: 30px;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.my-stat:nth-child(2) strong {
    font-size: 22px;
    letter-spacing: 0;
}

.my-stat strong em {
    margin-left: 2px;
    color: rgba(248, 242, 230, 0.34);
    font-family: var(--font-sans);
    font-size: 8px;
    font-style: normal;
    font-weight: 400;
}

.my-card-action {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    flex: 0 0 auto;
}

.my-card-action .btn {
    height: 36px;
    padding: 0 13px;
    border-radius: 7px;
    font-size: 10px;
}

.my-card-hint {
    color: rgba(248, 242, 230, 0.3);
    font-size: 8px;
    line-height: 1.5;
    white-space: nowrap;
}

.my-card-ring {
    position: absolute;
    right: -42px;
    bottom: -68px;
    width: 190px;
    height: 190px;
    border: 1px solid rgba(211, 183, 134, 0.13);
    border-radius: 50%;
    pointer-events: none;
}

.my-card.is-empty {
    background: linear-gradient(125deg, #27231d 0%, #1d1915 62%, #181510 100%);
}

.guest-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
    padding: 19px 22px;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: rgba(251, 248, 241, 0.52);
}

.guest-kicker {
    display: block;
    color: var(--brass-deep);
    font-size: 8px;
    letter-spacing: 0.17em;
    line-height: 1.5;
}

.guest-callout h2 {
    margin: 4px 0 3px;
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.guest-callout p {
    color: var(--muted);
    font-size: 9.5px;
    line-height: 1.7;
}

.guest-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.guest-actions .btn {
    height: 38px;
    padding: 0 16px;
    font-size: 10.5px;
}

.board {
    overflow: hidden;
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    background: var(--paper);
    box-shadow: var(--shadow-card);
}

.board-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 26px 17px;
    border-bottom: 1px solid var(--line-soft);
}

.board-kicker {
    display: block;
    color: var(--brass);
    font-size: 8px;
    letter-spacing: 0.18em;
    line-height: 1.4;
}

.board-head h2 {
    margin-top: 3px;
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

.board-count {
    color: var(--faint);
    font-size: 9px;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.board-columns {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr) 110px;
    align-items: center;
    gap: 14px;
    padding: 9px 26px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--faint);
    font-size: 8px;
    letter-spacing: 0.14em;
}

.board-columns span:last-child {
    text-align: right;
}

.rank-list {
    display: flex;
    flex-direction: column;
}

.rank-row {
    position: relative;
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr) 110px;
    align-items: center;
    gap: 14px;
    min-height: 61px;
    padding: 11px 26px 12px;
    border-bottom: 1px solid var(--line-soft);
    transition: background-color 180ms ease;
}

.rank-row:hover {
    background: rgba(246, 240, 228, 0.46);
}

.rank-number {
    color: var(--faint);
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}

.rank-person {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.rank-avatar {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border: 1px solid var(--line-soft);
    border-radius: 50%;
    color: var(--ink-3);
    background: var(--paper-warm);
    font-family: var(--font-serif);
    font-size: 11px;
    line-height: 1;
}

.rank-name-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.rank-name-wrap strong {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    color: var(--ink);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-name-wrap small {
    color: var(--faint);
    font-size: 8.5px;
    line-height: 1.3;
    letter-spacing: 0.03em;
}

.rank-score {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 2px;
    color: var(--ink);
}

.rank-score strong {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.rank-score em {
    color: var(--faint);
    font-size: 8px;
    font-style: normal;
    font-weight: 400;
}

.rank-meter {
    position: absolute;
    right: 26px;
    bottom: -1px;
    left: 26px;
    height: 1px;
    pointer-events: none;
}

.rank-meter::after {
    content: "";
    display: block;
    width: calc(var(--ratio, 0) * 100%);
    height: 1px;
    background: linear-gradient(90deg, rgba(167, 123, 63, 0.34), rgba(167, 123, 63, 0.02));
}

.rank-row.is-top .rank-number {
    color: var(--ink);
    font-size: 22px;
}

.rank-row.is-top .rank-avatar {
    border-color: rgba(167, 123, 63, 0.35);
}

.rank-row[data-rank="1"] .rank-number {
    color: var(--brass-deep);
}

.rank-row[data-rank="1"] .rank-score strong {
    color: var(--brass-deep);
}

.rank-row.is-top .rank-meter::after {
    background: linear-gradient(90deg, rgba(167, 123, 63, 0.58), rgba(167, 123, 63, 0.03));
}

.rank-row.is-me {
    background: linear-gradient(90deg, rgba(167, 123, 63, 0.09), rgba(167, 123, 63, 0.025));
    box-shadow: inset 2px 0 0 var(--brass);
}

.rank-row.is-me:hover {
    background: linear-gradient(90deg, rgba(167, 123, 63, 0.12), rgba(167, 123, 63, 0.035));
}

.me-label {
    display: inline-flex;
    align-items: center;
    height: 15px;
    padding: 0 4px;
    border-radius: 3px;
    color: var(--brass-deep);
    background: var(--brass-soft);
    font-family: var(--font-sans);
    font-size: 7.5px;
    font-style: normal;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1;
}

.rank-outside {
    padding: 5px 0 0;
    border-top: 1px dashed var(--line);
    background: rgba(246, 240, 228, 0.24);
}

.outside-label {
    display: block;
    padding: 6px 26px 2px;
    color: var(--faint);
    font-size: 8px;
    letter-spacing: 0.14em;
}

.rank-row.is-outside {
    border-bottom: 0;
}

.board-note {
    padding: 13px 26px 16px;
    border-top: 1px solid var(--line-soft);
    color: var(--faint);
    font-size: 8.5px;
    line-height: 1.6;
    letter-spacing: 0.02em;
    text-align: center;
}

.board-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 360px;
    margin: 0 auto;
    padding: 58px 20px 64px;
    text-align: center;
}

.empty-mark {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 188px;
    height: 46px;
    margin-bottom: 25px;
    opacity: 0.5;
}

.empty-mark span {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brass-pale) 25%, var(--brass-pale) 75%, transparent);
}

.empty-mark i {
    position: absolute;
    top: 5px;
    left: 56%;
    width: 14px;
    height: 9px;
    border-radius: 50%;
    background: var(--brass);
    transform: rotate(-17deg);
}

.empty-mark i::after {
    content: "";
    position: absolute;
    right: 1px;
    bottom: 3px;
    width: 1px;
    height: 34px;
    background: var(--brass);
}

.board-empty h3 {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.board-empty p {
    margin-top: 7px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.8;
}

.board-empty .btn {
    margin-top: 17px;
    height: 38px;
    padding: 0 17px;
    font-size: 10.5px;
}

.rank-bottom-cta {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 34px 2px 0;
}

.rank-bottom-kicker {
    display: block;
    color: var(--brass);
    font-size: 8px;
    letter-spacing: 0.18em;
    line-height: 1.5;
}

.rank-bottom-cta h2 {
    margin-top: 4px;
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

/* =========================================================================
   Responsive: game
   ========================================================================= */

@media (max-width: 1360px) {
    .header-inner,
    .studio-inner {
        padding-right: 26px;
        padding-left: 26px;
    }

    .studio-inner {
        grid-template-columns: minmax(240px, 302px) minmax(0, 1fr);
        gap: 34px;
    }

    .intro h1 {
        font-size: 44px;
    }

    .chip {
        min-width: 72px;
        padding-right: 8px;
        padding-left: 8px;
    }

    .setup-heading {
        width: 66px;
    }

    .setup-main {
        gap: 11px;
    }

    .register-chips {
        gap: 6px;
    }

    .setup-hint {
        font-size: 8.5px;
    }
}

@media (max-width: 1180px) {
    .page-game .header-inner {
        height: var(--header-h);
    }

    .studio-inner {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        min-height: 100%;
        padding-top: 16px;
        padding-bottom: 20px;
    }

    .intro {
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        gap: 24px;
        width: 100%;
        max-width: none;
        padding: 0;
    }

    .intro > .eyebrow {
        display: none;
    }

    .intro h1 {
        margin: 0;
        font-size: 29px;
        line-height: 1.3;
        letter-spacing: 0.02em;
    }

    .intro h1 br {
        display: none;
    }

    .intro h1 em::after {
        display: none;
    }

    .intro-copy,
    .intro-rules {
        display: none;
    }

    .intro-member {
        display: flex;
        align-items: baseline;
        gap: 10px;
        flex: 0 0 auto;
        margin: 0;
        padding: 8px 13px;
        border-radius: 999px;
        background: rgba(251, 248, 241, 0.5);
    }

    .intro-member-label {
        font-size: 8px;
    }

    .intro-member-row {
        display: flex;
        align-items: baseline;
        gap: 10px;
        margin: 0;
    }

    .intro-member-score strong {
        font-size: 19px;
    }

    .intro-member-rank {
        font-size: 9px;
    }

    .intro-guest-link {
        display: inline-flex;
        flex: 0 0 auto;
        flex-direction: row;
        align-items: center;
        gap: 7px;
        margin: 0;
        padding-bottom: 4px;
        font-size: 9px;
    }

    .intro-guest-link span:first-child {
        display: none;
    }

    .practice-shell {
        width: 100%;
        gap: 12px;
    }

    .sheet-card {
        min-height: clamp(320px, 42vh, 400px);
    }

    .piano-dock {
        position: relative;
    }
}

@media (max-width: 900px) {
    :root {
        --header-h: 64px;
    }

    .header-inner {
        gap: 18px;
        padding-right: 17px;
        padding-left: 17px;
    }

    .brand-copy > span {
        display: none;
    }

    .brand-copy strong {
        font-size: 16px;
    }

    .brand-logo img {
        height: 26px;
    }

    .main-nav {
        margin-left: 3px;
    }

    .nav-link {
        padding: 0 9px;
        font-size: 11.5px;
    }

    .account-week {
        display: none;
    }

    .account-name {
        max-width: 74px;
    }

    .studio-inner {
        padding-right: 17px;
        padding-left: 17px;
    }

    .sheet-card {
        min-height: 322px;
        border-radius: 17px;
    }

    .sheet-head {
        min-height: 50px;
        padding: 11px 17px 10px;
        gap: 12px;
    }

    .sheet-kicker {
        font-size: 8.5px;
        letter-spacing: 0.09em;
    }

    .round-progress {
        gap: 9px;
    }

    .progress-label {
        font-size: 9px;
    }

    .progress-steps {
        gap: 3px;
    }

    .progress-steps i {
        width: 12px;
    }

    .progress-steps i.is-current {
        width: 17px;
    }

    .attempts {
        gap: 7px;
        margin-left: 12px;
    }

    .attempts-label {
        display: none;
    }

    .attempts-dots i {
        width: 5px;
        height: 5px;
    }

    .result-tag {
        font-size: 8px;
    }

    .score-stage {
        min-height: 213px;
        padding: 0 10px;
    }

    .sheet-foot {
        min-height: 43px;
        padding: 8px 17px 11px;
    }

    .feedback-text {
        font-size: 10.5px;
    }

    .clef-badge {
        font-size: 7.5px;
    }

    .setup-panel {
        padding: 12px 13px 13px;
    }

    .setup-main {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 7px 10px;
        align-items: center;
    }

    .setup-heading {
        grid-column: 1;
        grid-row: 1;
        width: auto;
        padding: 0;
        display: flex;
        align-items: baseline;
        gap: 6px;
    }

    .console-sub {
        margin: 0;
        display: inline;
    }

    .chip-tools {
        grid-column: 2;
        grid-row: 1;
        padding: 0;
    }

    .chip-scroller {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
    }

    .chip-scroller::-webkit-scrollbar {
        display: none;
    }

    .register-chips {
        flex-wrap: nowrap;
        gap: 6px;
        padding-bottom: 2px;
        width: max-content;
    }

    .chip {
        min-width: 84px;
        height: 45px;
        flex: 0 0 auto;
    }

    .setup-foot {
        gap: 10px;
        margin-top: 10px;
        padding-top: 10px;
        flex-wrap: wrap;
    }

    .setup-hint {
        order: 3;
        width: 100%;
        margin: 0;
        font-size: 8.5px;
    }

    .switch {
        min-height: 30px;
    }

    .btn-start {
        height: 39px;
        margin-left: auto;
        padding: 0 15px;
        font-size: 11.5px;
    }

    .play-panel {
        padding: 11px 14px 12px;
        gap: 8px;
    }

    .play-bottom p {
        font-size: 9.5px;
    }

    .play-hint {
        display: none;
    }

    .result-panel {
        padding: 12px 14px 11px;
    }

    .result-actions .btn {
        height: 37px;
        font-size: 10.5px;
    }

    .result-link {
        font-size: 9.5px;
    }

    .keyboard-scroll {
        height: 162px;
    }

    .keyboard {
        min-width: 1352px;
    }

    .piano-strip {
        padding-right: 14px;
        padding-left: 14px;
    }

    .piano-strip-brand {
        font-size: 8.5px;
    }

    .piano-body {
        padding: 6px 7px 8px;
        gap: 5px;
    }

    .cheek {
        width: 17px;
    }

    .cheek-word {
        display: none;
    }

    .scroll-hint {
        display: block;
    }

    .toast-stack {
        top: calc(var(--header-h) + 8px);
        right: 12px;
        left: 12px;
        max-width: none;
    }

    .account-pop {
        position: fixed;
        top: calc(var(--header-h) + 6px);
        right: 12px;
        width: min(252px, calc(100vw - 24px));
    }

    .site-foot-inner {
        padding: 18px 17px;
        flex-wrap: wrap;
        gap: 8px 16px;
    }

    .foot-note {
        order: 3;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .header-inner {
        gap: 10px;
    }

    .brand {
        gap: 8px;
    }

    .brand-logo img {
        height: 24px;
    }

    .brand-copy strong {
        font-size: 15px;
        letter-spacing: 0.06em;
    }

    .main-nav {
        margin-left: 0;
    }

    .nav-link {
        height: 30px;
        padding: 0 8px;
        font-size: 11px;
    }

    .nav-link.is-active::after {
        bottom: 1px;
        width: 10px;
    }

    .nav-link[href="index.php"] {
        display: none;
    }

    .header-actions {
        gap: 6px;
    }

    .header-login {
        font-size: 10.5px;
        padding: 5px 4px;
    }

    .btn-xs {
        height: 31px;
        padding: 0 10px;
        border-radius: 7px;
        font-size: 10.5px;
    }

    .account-switch summary {
        padding: 3px;
    }

    .account-name,
    .account-switch .chevron {
        display: none;
    }

    .avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .studio-inner {
        gap: 10px;
        padding: 10px 12px 14px;
    }

    .intro {
        min-height: 24px;
        align-items: center;
    }

    .intro h1 {
        font-size: 22px;
        letter-spacing: 0.02em;
    }

    .intro h1 em::after {
        display: none;
    }

    .intro-member,
    .intro-guest-link {
        display: none;
    }

    .sheet-card {
        min-height: 306px;
        border-radius: 15px;
    }

    .sheet-head {
        min-height: 46px;
        padding: 9px 13px 8px;
        gap: 8px;
    }

    .sheet-kicker {
        font-size: 8px;
        letter-spacing: 0.05em;
    }

    .sheet-kicker i {
        width: 3px;
        height: 3px;
    }

    .round-progress {
        margin-left: auto;
        gap: 7px;
    }

    .progress-steps i {
        width: 10px;
        height: 2px;
    }

    .progress-steps i.is-current {
        width: 14px;
    }

    .attempts {
        margin-left: 8px;
    }

    .score-stage {
        min-height: 205px;
        padding: 0 4px;
    }

    .sheet-foot {
        gap: 8px;
        min-height: 39px;
        padding: 7px 13px 9px;
    }

    .feedback-mark {
        margin-top: 6px;
    }

    .feedback-text {
        font-size: 9.5px;
        line-height: 1.55;
    }

    .clef-badge {
        font-size: 7px;
        padding: 2px 5px;
    }

    .setup-panel {
        padding: 10px 11px 11px;
    }

    .console-label {
        font-size: 9.5px;
    }

    .console-sub {
        display: none;
    }

    .chip {
        min-width: 78px;
        height: 43px;
        border-radius: 8px;
    }

    .chip-name {
        font-size: 10.5px;
    }

    .chip-range {
        font-size: 8px;
    }

    .setup-foot {
        margin-top: 8px;
        padding-top: 8px;
    }

    .switch-copy strong {
        font-size: 9.5px;
    }

    .setup-hint {
        font-size: 8px;
    }

    .btn-start {
        height: 38px;
        padding: 0 13px;
        font-size: 10.5px;
    }

    .play-panel {
        padding: 10px 12px 11px;
    }

    .play-top {
        gap: 10px;
    }

    .live-badge {
        font-size: 9.5px;
    }

    .play-bottom {
        padding-top: 7px;
    }

    .play-bottom p {
        font-size: 9px;
    }

    .text-button {
        font-size: 9.5px;
    }

    .result-panel {
        padding: 10px 12px;
    }

    .result-actions {
        gap: 6px;
    }

    .result-actions .btn {
        height: 35px;
        padding: 0 11px;
        font-size: 9.5px;
    }

    .result-link {
        margin-left: 0;
        width: 100%;
        padding-top: 2px;
        font-size: 9px;
    }

    .result-meta {
        font-size: 8.5px;
    }

    .result-stage {
        padding: 6px 13px 8px;
    }

    .result-headline strong {
        font-size: 47px;
    }

    .result-headline span {
        font-size: 16px;
    }

    .result-title {
        font-size: 14px;
    }

    .result-description {
        font-size: 9.5px;
    }

    .note-review {
        gap: 4px;
        margin-top: 11px;
    }

    .note-pill {
        padding: 3px 6px;
        font-size: 8.5px;
    }

    .piano-strip {
        gap: 8px;
        padding: 6px 10px 5px;
    }

    .piano-strip-brand {
        gap: 6px;
        font-size: 8px;
    }

    .piano-strip-brand em,
    .strip-keymark {
        display: none;
    }

    .now-playing strong {
        min-width: 74px;
        font-size: 9.5px;
    }

    .now-sub,
    .sound-label {
        display: none;
    }

    .now-playing {
        gap: 5px;
        font-size: 8px;
    }

    .sound-toggle {
        gap: 4px;
    }

    .piano-body {
        padding: 5px 5px 7px;
        gap: 0;
    }

    .cheek {
        display: none;
    }

    .keybed {
        padding: 0 2px 4px;
        border-radius: 4px;
    }

    .keyboard-scroll {
        height: 148px;
    }

    .keyboard {
        min-width: 1404px;
    }

    .pkey.is-white {
        border-bottom-width: 2px;
    }

    .key-float {
        top: 4px;
        padding: 3px 6px;
        font-size: 8.5px;
    }

    .scroll-hint {
        bottom: 9px;
        font-size: 8px;
    }

    .site-foot-inner {
        padding: 16px 12px;
    }

    .account-pop {
        right: 8px;
        width: min(240px, calc(100vw - 16px));
    }

    .toast {
        font-size: 10.5px;
    }
}

@media (min-width: 901px) and (max-height: 830px) {
    .studio-inner {
        padding-top: 13px;
        padding-bottom: 16px;
    }

    .intro h1 {
        margin: 14px 0 11px;
        font-size: 37px;
    }

    .intro-copy {
        font-size: 11.5px;
        line-height: 1.85;
    }

    .intro-rules {
        margin-top: 17px;
    }

    .intro-rule {
        padding: 9px 0;
    }

    .rule-copy small {
        display: none;
    }

    .intro-member,
    .intro-guest-link {
        margin-top: 15px;
    }

    .sheet-card {
        min-height: 306px;
    }

    .sheet-head {
        min-height: 48px;
        padding-top: 10px;
        padding-bottom: 9px;
    }

    .score-stage {
        min-height: 192px;
    }

    .sheet-foot {
        min-height: 41px;
        padding-top: 7px;
        padding-bottom: 9px;
    }

    .setup-panel {
        padding-top: 11px;
        padding-bottom: 11px;
    }

    .chip {
        height: 43px;
    }

    .setup-foot {
        margin-top: 9px;
        padding-top: 9px;
    }

    .keyboard-scroll {
        height: 156px;
    }

    .piano-body {
        padding-bottom: 8px;
    }

    .practice-shell {
        gap: 10px;
    }
}

/* =========================================================================
   Responsive: account
   ========================================================================= */

@media (max-width: 1020px) {
    .account-shell {
        grid-template-columns: minmax(330px, 0.86fr) minmax(430px, 1.14fr);
    }

    .account-art {
        padding-right: 34px;
        padding-left: 34px;
    }

    .account-form-side {
        padding-right: 36px;
        padding-left: 36px;
    }

    .account-quote h1 {
        font-size: 44px;
    }
}

@media (max-width: 860px) {
    .account-shell {
        display: flex;
        flex-direction: column;
        min-height: 100dvh;
    }

    .account-art {
        min-height: 0;
        padding: 22px 24px 26px;
    }

    .account-art::after {
        display: none;
    }

    .account-quote {
        margin-top: 42px;
    }

    .account-quote h1 {
        margin: 15px 0 12px;
        font-size: 35px;
        line-height: 1.35;
    }

    .account-quote p {
        font-size: 10.5px;
        line-height: 1.9;
    }

    .art-staff,
    .account-art-foot {
        display: none;
    }

    .account-form-side {
        flex: 1;
        min-height: 0;
        padding: 20px 20px 18px;
    }

    .account-form-card {
        max-width: 430px;
        padding-top: 8px;
    }

    .account-footnote {
        padding-top: 16px;
    }
}

@media (max-width: 560px) {
    .account-art {
        padding: 17px 17px 21px;
    }

    .account-art-top {
        align-items: center;
    }

    .brand-logo img {
        height: 24px;
    }

    .brand-copy strong {
        font-size: 16px;
    }

    .brand-copy > span {
        font-size: 6.5px;
    }

    .art-kicker {
        font-size: 6.5px;
    }

    .account-quote {
        margin-top: 31px;
    }

    .account-quote .eyebrow {
        font-size: 8px;
    }

    .account-quote h1 {
        font-size: 29px;
        margin-top: 12px;
    }

    .account-quote p {
        display: none;
    }

    .account-form-side {
        padding: 17px 16px 15px;
    }

    .account-topline {
        font-size: 9.5px;
    }

    .account-topline-note {
        display: none;
    }

    .account-form-card {
        padding-top: 16px;
    }

    .account-tabs {
        margin-bottom: 23px;
    }

    .form-heading h2 {
        font-size: 25px;
    }

    .form-heading p {
        font-size: 9.5px;
    }

    .account-form {
        gap: 14px;
        margin-top: 17px;
    }

    .field input {
        height: 47px;
        font-size: 11.5px;
    }

    .btn-submit {
        height: 49px;
    }

    .account-footnote {
        font-size: 7px;
        letter-spacing: 0.05em;
    }

    .account-footnote span:last-child {
        display: none;
    }
}

/* =========================================================================
   Responsive: leaderboard
   ========================================================================= */

@media (max-width: 1080px) {
    .rank-main {
        padding-right: 26px;
        padding-left: 26px;
    }

    .my-card {
        gap: 20px;
    }

    .my-card-stats {
        gap: 26px;
    }
}

@media (max-width: 900px) {
    .rank-main {
        padding: 18px 17px 38px;
    }

    .rank-hero {
        align-items: flex-start;
        gap: 22px;
        padding-top: 10px;
        padding-bottom: 26px;
    }

    .rank-hero h1 {
        font-size: 38px;
        margin-top: 14px;
    }

    .rank-hero p {
        font-size: 10.5px;
    }

    .rank-hero-actions {
        padding-top: 30px;
    }

    .rank-hero-actions .btn {
        height: 38px;
        padding: 0 14px;
        font-size: 10px;
    }

    .hero-note {
        display: none;
    }

    .rank-hero-staff {
        display: none;
    }

    .rank-tabs-wrap {
        margin: 19px 0 15px;
    }

    .rank-tabs {
        width: 100%;
        justify-content: space-between;
    }

    .rank-tab {
        flex: 1;
        min-width: 0;
        padding: 0 8px;
        height: 31px;
    }

    .period-caption {
        font-size: 8px;
    }

    .my-card {
        flex-wrap: wrap;
        gap: 16px;
        padding: 17px;
    }

    .my-card-person {
        min-width: 150px;
    }

    .my-card-stats {
        flex: 1;
        justify-content: space-between;
        gap: 16px;
    }

    .my-stat {
        min-width: 0;
    }

    .my-stat strong {
        font-size: 26px;
    }

    .my-stat:nth-child(2) strong {
        font-size: 20px;
    }

    .my-card-action {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.07);
    }

    .my-card-hint {
        white-space: normal;
    }

    .guest-callout {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 12px;
        padding: 16px;
    }

    .guest-actions {
        width: 100%;
    }

    .guest-actions .btn {
        flex: 1;
    }

    .board-head {
        padding: 18px 17px 14px;
    }

    .board-head h2 {
        font-size: 21px;
    }

    .board-columns {
        grid-template-columns: 44px minmax(0, 1fr) 78px;
        padding: 8px 17px;
        gap: 10px;
    }

    .rank-row {
        grid-template-columns: 44px minmax(0, 1fr) 78px;
        padding: 10px 17px 11px;
        gap: 10px;
        min-height: 58px;
    }

    .rank-number {
        font-size: 16px;
    }

    .rank-row.is-top .rank-number {
        font-size: 20px;
    }

    .rank-avatar {
        width: 27px;
        height: 27px;
        font-size: 10px;
    }

    .rank-person {
        gap: 9px;
    }

    .rank-name-wrap strong {
        font-size: 10.5px;
    }

    .rank-name-wrap small {
        font-size: 8px;
    }

    .rank-score strong {
        font-size: 21px;
    }

    .rank-meter {
        right: 17px;
        left: 17px;
    }

    .outside-label {
        padding-left: 17px;
    }

    .board-note {
        padding-right: 17px;
        padding-left: 17px;
    }

    .rank-bottom-cta {
        padding-top: 26px;
    }

    .rank-bottom-cta h2 {
        font-size: 19px;
    }
}

@media (max-width: 560px) {
    .rank-hero {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
    }

    .rank-hero h1 {
        font-size: 33px;
    }

    .rank-hero p br {
        display: none;
    }

    .rank-hero-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding-top: 0;
    }

    .rank-tab {
        font-size: 9.5px;
    }

    .period-caption {
        width: 100%;
        justify-content: flex-start;
    }

    .my-card-person {
        width: 100%;
    }

    .my-card-stats {
        width: 100%;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.07);
    }

    .my-stat > span {
        font-size: 7.5px;
    }

    .my-stat strong {
        font-size: 23px;
    }

    .my-stat:nth-child(2) strong {
        font-size: 18px;
    }

    .guest-callout h2 {
        font-size: 18px;
    }

    .guest-callout p {
        font-size: 9px;
    }

    .board {
        border-radius: 15px;
    }

    .board-columns {
        display: none;
    }

    .rank-row {
        padding-top: 11px;
        padding-bottom: 11px;
    }

    .rank-name-wrap small {
        display: none;
    }

    .rank-score em {
        display: none;
    }

    .rank-score strong {
        font-size: 19px;
    }

    .board-note {
        font-size: 8px;
    }

    .rank-bottom-cta {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }
}

/* =========================================================================
   手机竖屏时自动横过来（仅练琴页）
   把整个 body 旋转 90 度，让琴键和谱表横着铺满屏幕。
   ========================================================================= */

html.is-rotated {
    overflow: hidden;
}

html.is-rotated body {
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
    transform: rotate(90deg) translateY(-100%);
    transform-origin: top left;
}

html.is-compact .site-header,
html.is-compact .header-inner {
    height: 38px;
}

html.is-compact .header-inner {
    height: 38px;
    gap: 12px;
    padding-right: 12px;
    padding-left: 12px;
}

html.is-compact .brand-logo img {
    height: 20px;
}

html.is-compact .brand-copy strong {
    font-size: 12.5px;
}

html.is-compact .brand-copy > span {
    display: none;
}

html.is-compact .nav-link {
    padding: 0 7px;
    font-size: 10.5px;
}

html.is-compact .account-week {
    display: none;
}

html.is-compact .account-name {
    max-width: 56px;
    font-size: 10.5px;
}

html.is-compact .header-login {
    font-size: 10.5px;
}

html.is-compact .btn-xs {
    height: 25px;
    padding: 0 9px;
    font-size: 9.5px;
}

html.is-compact .intro {
    display: none;
}

html.is-compact .studio-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 100%;
    padding: 6px 10px 7px;
}

html.is-compact .practice-shell {
    gap: 6px;
}

html.is-compact .sheet-card {
    min-height: 0;
    border-radius: 12px;
}

html.is-compact .sheet-head {
    min-height: 26px;
    padding: 4px 12px 3px;
    gap: 10px;
}

html.is-compact .sheet-kicker {
    font-size: 7.5px;
}

html.is-compact .progress-label {
    font-size: 8.5px;
}

html.is-compact .progress-steps {
    gap: 3px;
}

html.is-compact .progress-steps i {
    width: 10px;
}

html.is-compact .progress-steps i.is-current,
html.is-compact .progress-steps i.is-failed {
    width: 14px;
}

html.is-compact .attempts {
    gap: 6px;
    margin-left: 8px;
}

html.is-compact .attempts-dots i {
    width: 4px;
    height: 4px;
}

html.is-compact .result-tag {
    padding: 2px 7px;
    font-size: 7.5px;
}

html.is-compact .score-stage {
    min-height: 78px;
    padding: 0 8px;
}

html.is-compact .sheet-foot {
    min-height: 24px;
    padding: 3px 12px 4px;
}

html.is-compact .feedback-text {
    font-size: 9.5px;
    line-height: 1.5;
}

html.is-compact .clef-badge {
    padding: 2px 6px;
    font-size: 7px;
}

html.is-compact .result-stage {
    padding: 2px 14px 4px;
}

html.is-compact .result-headline {
    margin-bottom: 2px;
}

html.is-compact .result-headline strong {
    font-size: 32px;
}

html.is-compact .result-headline span {
    font-size: 13px;
}

html.is-compact .result-title {
    font-size: 11.5px;
}

html.is-compact .result-description {
    margin-top: 2px;
    font-size: 9px;
    line-height: 1.6;
}

html.is-compact .note-review {
    gap: 4px;
    margin-top: 6px;
}

html.is-compact .note-pill {
    padding: 2px 6px;
    font-size: 8px;
}

html.is-compact .console {
    border-radius: 12px;
}

html.is-compact .setup-panel {
    padding: 6px 10px 7px;
}

html.is-compact .setup-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

html.is-compact .setup-heading,
html.is-compact .chip-tools {
    display: none;
}

html.is-compact .chip-scroller {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

html.is-compact .chip-scroller::-webkit-scrollbar {
    display: none;
}

html.is-compact .register-chips {
    flex-wrap: nowrap;
    gap: 5px;
    width: max-content;
}

html.is-compact .chip {
    min-width: 60px;
    height: 30px;
    flex: 0 0 auto;
    padding-right: 7px;
    padding-left: 7px;
}

html.is-compact .chip-name {
    font-size: 9.5px;
}

html.is-compact .chip-range {
    font-size: 7px;
}

html.is-compact .setup-foot {
    gap: 8px;
    margin-top: 5px;
    padding-top: 5px;
}

html.is-compact .switch {
    min-height: 26px;
}

html.is-compact .switch-copy strong {
    font-size: 9.5px;
}

html.is-compact .switch-copy small,
html.is-compact .setup-hint {
    display: none;
}

html.is-compact .btn-start {
    height: 30px;
    margin-left: auto;
    padding: 0 12px;
    font-size: 10.5px;
}

html.is-compact .play-panel {
    gap: 4px;
    padding: 6px 10px 7px;
}

html.is-compact .live-badge {
    font-size: 9.5px;
}

html.is-compact .play-bottom {
    padding-top: 4px;
}

html.is-compact .play-bottom p {
    font-size: 9px;
}

html.is-compact .play-hint {
    display: none;
}

html.is-compact .quit-button {
    font-size: 9.5px;
}

html.is-compact .result-panel {
    gap: 5px;
    padding: 7px 10px;
}

html.is-compact .result-actions {
    gap: 7px;
}

html.is-compact .result-actions .btn {
    height: 30px;
    font-size: 10px;
}

html.is-compact .result-link {
    font-size: 9px;
}

html.is-compact .result-meta {
    font-size: 8.5px;
}

html.is-compact .piano-strip {
    gap: 10px;
    padding: 2px 10px;
}

html.is-compact .piano-strip-brand {
    font-size: 7.5px;
}

html.is-compact .now-playing strong {
    min-width: 56px;
    font-size: 9px;
}

html.is-compact .now-sub,
html.is-compact .sound-label {
    display: none;
}

html.is-compact .piano-body {
    gap: 4px;
    padding: 3px 6px 4px;
}

html.is-compact .cheek {
    width: 12px;
}

html.is-compact .keyboard-scroll {
    height: 92px;
}

html.is-compact .key-float {
    padding: 2px 6px;
    font-size: 8px;
}

html.is-compact .pkey-name {
    bottom: 7px;
    font-size: 6.5px;
}

html.is-compact .scroll-hint {
    bottom: 6px;
    font-size: 7.5px;
}

html.is-compact .toast-stack {
    top: 44px;
    right: 8px;
    left: 8px;
}

/* 更窄的手机（竖屏宽 ≤ 380）再压缩一点，保证一屏放下 */
@media (max-width: 380px) {
    html.is-compact .score-stage {
        min-height: 66px;
    }

    html.is-compact .keyboard-scroll {
        height: 76px;
    }

    html.is-compact .result-headline strong {
        font-size: 27px;
    }

    html.is-compact .chip {
        min-width: 54px;
        height: 28px;
    }
}

/* =========================================================================
   深色模式：跟随系统设置自动切换
   ========================================================================= */

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #171512;
        --bg-deep: #100e0c;
        --paper: #211e19;
        --paper-warm: #262219;
        --paper-deep: #2c2721;
        --ink: #efe8db;
        --ink-2: #d9d0c1;
        --ink-3: #b5ab9b;
        --muted: #968d7e;
        --faint: #6f6759;
        --line: rgba(240, 233, 220, 0.16);
        --line-soft: rgba(240, 233, 220, 0.09);
        --brass: #c99a5b;
        --brass-deep: #d8b57e;
        --brass-pale: #e4cb9a;
        --brass-soft: rgba(201, 154, 91, 0.16);
        --green: #8fb59d;
        --green-soft: rgba(143, 181, 157, 0.14);
        --red: #cf8576;
        --red-soft: rgba(207, 133, 118, 0.14);
        --shadow-card: 0 30px 62px -38px rgba(0, 0, 0, 0.78), 0 2px 7px rgba(0, 0, 0, 0.32);
        --shadow-soft: 0 16px 36px -26px rgba(0, 0, 0, 0.66);
    }

    body::before {
        background:
            radial-gradient(ellipse 80% 60% at 16% -8%, rgba(255, 250, 240, 0.05), transparent 58%),
            radial-gradient(ellipse 70% 70% at 94% 88%, rgba(201, 154, 91, 0.08), transparent 62%),
            linear-gradient(135deg, #1b1815 0%, #171512 50%, #12100d 100%);
    }

    body::after {
        opacity: 0.07;
    }

    ::selection {
        color: #171512;
        background: var(--brass-pale);
    }

    .brand-logo-dark {
        display: none;
    }

    .brand-logo img.brand-logo-dark {
        display: none;
    }

    .brand-logo img.brand-logo-light {
        display: block;
    }

    .btn-ink {
        color: #191612;
    }

    .btn-ink:hover {
        background: #fffdf8;
    }

    .btn-quiet-line:hover {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(240, 233, 220, 0.3);
    }

    .nav-link:hover,
    .account-switch summary:hover {
        background: rgba(255, 255, 255, 0.06);
    }

    .rank-tab.is-active {
        color: #191612;
    }

    .console {
        background: rgba(255, 255, 255, 0.035);
    }

    .chip {
        background: rgba(255, 255, 255, 0.05);
    }

    .chip:hover {
        background: rgba(255, 255, 255, 0.09);
        border-color: rgba(201, 154, 91, 0.45);
    }

    .switch-track {
        background: #3a352c;
    }

    .field input {
        background: rgba(255, 255, 255, 0.05);
    }

    .field input::placeholder {
        color: #6f6759;
    }

    .field input:hover {
        border-color: rgba(240, 233, 220, 0.3);
    }

    .intro-member {
        background: rgba(255, 255, 255, 0.045);
    }

    .sheet-card {
        border-color: rgba(255, 255, 255, 0.07);
    }

    .sheet-card::before {
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
    }

    .score-stage {
        background:
            radial-gradient(ellipse 54% 68% at 50% 48%, rgba(255, 255, 255, 0.05), transparent 72%),
            linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 23%, transparent 80%, rgba(0, 0, 0, 0.25));
    }

    .sheet-card.is-correct .score-glow {
        background: radial-gradient(ellipse 50% 70% at 50% 55%, rgba(143, 181, 157, 0.16), transparent 70%);
    }

    .sheet-card.is-wrong .score-glow {
        background: radial-gradient(ellipse 50% 70% at 50% 55%, rgba(207, 133, 118, 0.14), transparent 70%);
    }

    .sheet-foot {
        background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2));
    }

    .result-tag {
        border-color: rgba(201, 154, 91, 0.35);
        background: rgba(201, 154, 91, 0.1);
    }

    .sheet-card.is-result-fail .result-tag {
        border-color: rgba(207, 133, 118, 0.35);
        background: rgba(207, 133, 118, 0.08);
    }

    .note-pill {
        background: rgba(255, 255, 255, 0.045);
    }

    .note-pill.is-passed {
        border-color: rgba(143, 181, 157, 0.24);
        background: rgba(143, 181, 157, 0.1);
    }

    .note-pill.is-failed {
        border-color: rgba(207, 133, 118, 0.3);
        background: rgba(207, 133, 118, 0.1);
    }

    .key-float {
        border-color: rgba(255, 255, 255, 0.12);
        background: var(--paper-deep);
    }

    .key-float::after {
        background: var(--paper-deep);
    }

    .guest-callout {
        background: rgba(255, 255, 255, 0.04);
    }

    .account-form-side {
        background:
            radial-gradient(ellipse 70% 55% at 90% 0%, rgba(255, 252, 245, 0.045), transparent 55%),
            linear-gradient(180deg, #1c1916 0%, #171512 100%);
    }

    .account-form-side::before {
        border-color: rgba(201, 154, 91, 0.16);
    }

    .rank-row:hover {
        background: rgba(255, 255, 255, 0.045);
    }

    .rank-tabs {
        background: rgba(255, 255, 255, 0.05);
    }

    .studio {
        scrollbar-color: rgba(240, 233, 220, 0.24) transparent;
    }

    .studio::-webkit-scrollbar-thumb {
        background: rgba(240, 233, 220, 0.2);
    }
}

/* =========================================================================
   Motion preferences
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        scroll-behavior: auto;
        transition-duration: 0.01ms;
    }
}
