:root {
    --ink: #17150f;
    --muted: #6f6a5e;
    --paper: #f6f2e9;
    --paper-deep: #ebe4d7;
    --white: #fffdf8;
    --accent: #f05a36;
    --accent-dark: #c94224;
    --sage: #415a4b;
    --line: rgba(23, 21, 15, 0.14);
    --shadow: 0 24px 70px rgba(45, 35, 22, 0.12);
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 0%, rgba(240, 90, 54, 0.09), transparent 28rem),
        var(--paper);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
    line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--line);
    background: rgba(246, 242, 233, 0.9);
    backdrop-filter: blur(16px);
}

.site-nav, .site-main, .site-footer {
    width: min(1180px, calc(100% - 40px));
    margin-inline: auto;
}

.site-nav {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50% 50% 44% 56%;
    color: var(--white);
    background: var(--ink);
    font: 800 21px/1 Georgia, serif;
    transform: rotate(-5deg);
}
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.15; }
.brand strong { font-size: 16px; letter-spacing: 0.06em; }
.brand small { margin-top: 5px; color: var(--muted); font-size: 9px; letter-spacing: 0.18em; }

.nav-links { display: flex; gap: 8px; }
.nav-links a {
    padding: 10px 15px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 14px;
    transition: 160ms ease;
}
.nav-links a:hover { color: var(--ink); background: var(--white); }

.site-main { min-height: calc(100vh - 170px); padding: 56px 0 80px; }
.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 28px 0 36px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.eyebrow {
    display: block;
    margin-bottom: 12px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.2em;
}

.hero-panel {
    position: relative;
    min-height: 330px;
    display: grid;
    grid-template-columns: 1fr 230px;
    align-items: center;
    gap: 40px;
    overflow: hidden;
    padding: 58px 66px;
    border-radius: 34px;
    color: var(--white);
    background: var(--ink);
    box-shadow: var(--shadow);
}

.hero-panel::before,
.hero-panel::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 50%;
}
.hero-panel::before { width: 470px; height: 470px; right: -150px; top: -230px; }
.hero-panel::after { width: 310px; height: 310px; right: -20px; bottom: -250px; }
.hero-panel h1 { max-width: 720px; margin: 0; font: 700 clamp(38px, 6vw, 72px)/1.1 Georgia, "STSong", serif; letter-spacing: -.035em; }
.hero-panel p { max-width: 600px; margin: 24px 0 0; color: rgba(255,253,248,.68); font-size: 17px; }
.hero-panel .eyebrow { color: #ff9a7e; }
.hero-mark {
    position: relative;
    z-index: 1;
    width: 190px;
    height: 190px;
    display: grid;
    place-items: center;
    justify-self: end;
    border-radius: 50%;
    color: var(--ink);
    background: var(--accent);
    font: 110px/1 Georgia, serif;
    transform: rotate(7deg);
}

.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 58px 0 24px; }
.section-heading.compact { margin: 0 0 24px; }
.section-heading h2 { margin: 0; font: 700 34px/1.15 Georgia, "STSong", serif; }
.score-count { padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; }

.score-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.score-card {
    min-height: 290px;
    display: flex;
    flex-direction: column;
    padding: 25px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255,253,248,.74);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.score-card:hover { transform: translateY(-5px); border-color: rgba(240,90,54,.45); box-shadow: 0 18px 45px rgba(45,35,22,.10); }
.score-card-top { display: flex; justify-content: space-between; align-items: center; }
.file-badge, .row-file-icon { color: var(--accent-dark); background: #fde1d7; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.file-badge { padding: 6px 9px; border-radius: 8px; }
.card-arrow { color: var(--muted); font-size: 20px; }
.score-glyph { margin: 26px 0 18px; color: var(--sage); font: 58px/1 Georgia, serif; }
.score-card h3 { margin: 0; overflow-wrap: anywhere; font-size: 18px; line-height: 1.45; }
.score-card p { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.open-score { margin-top: auto; padding-top: 18px; color: var(--accent-dark); font-size: 13px; font-weight: 700; }

.empty-state { padding: 80px 30px; border: 1px dashed rgba(23,21,15,.22); border-radius: 28px; text-align: center; background: rgba(255,253,248,.45); }
.empty-state.small { padding: 45px 25px; }
.empty-state h3 { margin: 12px 0 6px; font-size: 20px; }
.empty-state p { margin: 0; color: var(--muted); }
.empty-icon { color: var(--accent); font: 62px/1 Georgia, serif; }

.primary-button, .secondary-button, .danger-button, .text-button {
    appearance: none;
    border: 0;
    cursor: pointer;
    border-radius: 12px;
    font-weight: 700;
    transition: 160ms ease;
}
.primary-button { padding: 13px 20px; color: white; background: var(--accent); box-shadow: 0 10px 24px rgba(240,90,54,.22); }
.primary-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.primary-button.wide { width: 100%; }
.secondary-button { padding: 11px 16px; border: 1px solid var(--line); color: var(--ink); background: var(--white); }
.secondary-button:hover { border-color: var(--ink); }
.danger-button { padding: 9px 12px; color: #a23324; background: #fde9e4; }
.danger-button:hover { color: white; background: #b93c2b; }
.text-button { padding: 9px 12px; color: var(--sage); background: transparent; }

.login-shell { min-height: 650px; display: grid; grid-template-columns: 1.2fr .8fr; overflow: hidden; border-radius: 32px; background: var(--ink); box-shadow: var(--shadow); }
.login-art { position: relative; overflow: hidden; padding: 72px; color: white; background: radial-gradient(circle at 20% 80%, rgba(240,90,54,.35), transparent 40%), var(--ink); }
.login-art h1 { margin: 0; font: 700 clamp(38px, 5vw, 62px)/1.15 Georgia, "STSong", serif; }
.staff-lines { position: absolute; left: 0; right: 0; bottom: 70px; height: 140px; border-top: 1px solid rgba(255,255,255,.18); border-bottom: 1px solid rgba(255,255,255,.18); }
.staff-lines::before, .staff-lines::after { content: ""; position: absolute; left: 0; right: 0; border-top: 1px solid rgba(255,255,255,.18); }
.staff-lines::before { top: 46px; }.staff-lines::after { top: 92px; }
.staff-lines span { position: relative; z-index: 1; display: inline-block; margin-left: 18%; color: #ff8d70; font: 72px/1 Georgia, serif; }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: 65px 54px; background: var(--white); }
.login-card h2 { margin: 0; font: 700 42px/1.2 Georgia, "STSong", serif; }
.login-card > p { margin: 12px 0 34px; color: var(--muted); }
.login-card label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.login-card input { width: 100%; margin-bottom: 16px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: var(--paper); }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240,90,54,.12); }
.quiet-link { align-self: center; margin-top: 24px; color: var(--muted); font-size: 13px; }
.validation-message { display: block; margin: 8px 0; color: #b72f22; font-size: 13px; }
.validation-message ul { margin: 0 0 12px; padding-left: 20px; }

.teacher-header { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 34px; }
.teacher-header h1 { margin: 0; font: 700 54px/1.05 Georgia, "STSong", serif; }
.teacher-header p { margin: 14px 0 0; color: var(--muted); }
.status-banner { margin-bottom: 22px; padding: 13px 16px; border-radius: 12px; color: #25543a; background: #dcebdd; }
.upload-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: center; padding: 34px; border-radius: 24px; color: white; background: var(--sage); }
.upload-copy { display: flex; align-items: center; gap: 20px; }
.upload-copy h2 { margin: 0; font-size: 23px; }
.upload-copy p { margin: 7px 0 0; color: rgba(255,255,255,.68); font-size: 13px; }
.upload-icon { width: 54px; height: 54px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; font-size: 24px; }
.upload-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.file-picker { min-width: 0; padding: 12px 15px; overflow: hidden; border: 1px dashed rgba(255,255,255,.4); border-radius: 12px; background: rgba(255,255,255,.08); cursor: pointer; white-space: nowrap; text-overflow: ellipsis; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-form .validation-message { grid-column: 1 / -1; color: #ffe0d7; }
.teacher-list-panel { margin-top: 28px; padding: 32px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,253,248,.72); }
.teacher-score-list { display: grid; }
.teacher-score-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; gap: 15px; align-items: center; padding: 17px 0; border-top: 1px solid var(--line); }
.teacher-score-row:first-child { border-top: 0; }
.row-file-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; }
.row-score-name { min-width: 0; display: flex; flex-direction: column; }
.row-score-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-score-name span { margin-top: 4px; color: var(--muted); font-size: 12px; }

.viewer-toolbar { position: sticky; top: 92px; z-index: 10; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-bottom: 18px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,253,248,.92); backdrop-filter: blur(15px); }
.back-link { color: var(--muted); font-size: 13px; }
.viewer-title { min-width: 0; display: flex; flex-direction: column; text-align: center; }
.viewer-title span { color: var(--muted); font-size: 10px; letter-spacing: .13em; }
.viewer-title strong { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-toolbar .secondary-button { justify-self: end; }
.score-viewer { position: relative; min-height: 680px; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); }
#alphaTab { padding: 24px 12px 60px; }
.viewer-loading, .viewer-error { position: absolute; inset: 0; z-index: 3; display: grid; align-content: center; justify-items: center; background: rgba(255,255,255,.94); text-align: center; }
.viewer-loading[hidden], .viewer-error[hidden] { display: none; }
.loading-note { color: var(--accent); font: 68px/1 Georgia, serif; animation: pulse 1.2s ease-in-out infinite; }
.viewer-loading p, .viewer-error p { color: var(--muted); }
@keyframes pulse { 50% { transform: translateY(-8px) rotate(8deg); opacity: .55; } }

@media (max-width: 850px) {
    .hero-panel { grid-template-columns: 1fr; padding: 45px 34px; }
    .hero-mark { display: none; }
    .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .login-shell { grid-template-columns: 1fr; }
    .login-art { min-height: 320px; padding: 44px; }
    .upload-panel { grid-template-columns: 1fr; }
    .viewer-toolbar { position: static; grid-template-columns: 1fr auto; }
    .viewer-title { grid-column: 1 / -1; grid-row: 1; }
}

@media (max-width: 580px) {
    .site-nav, .site-main, .site-footer { width: min(100% - 24px, 1180px); }
    .site-nav { min-height: 68px; }
    .brand small, .nav-links a:first-child { display: none; }
    .nav-links a { padding-inline: 10px; }
    .site-main { padding-top: 26px; }
    .hero-panel { min-height: 300px; padding: 38px 25px; border-radius: 24px; }
    .hero-panel h1 { font-size: 39px; }
    .score-grid { grid-template-columns: 1fr; }
    .score-card { min-height: 250px; }
    .site-footer { flex-direction: column; }
    .login-art { display: none; }
    .login-card { min-height: 580px; padding: 40px 26px; }
    .teacher-header { align-items: start; flex-direction: column; }
    .teacher-header h1 { font-size: 44px; }
    .upload-panel, .teacher-list-panel { padding: 24px 18px; }
    .upload-form { grid-template-columns: 1fr; }
    .teacher-score-row { grid-template-columns: 44px 1fr auto; }
    .teacher-score-row > form { grid-column: 3; }
    .teacher-score-row .text-button { display: none; }
    .viewer-toolbar .secondary-button { font-size: 12px; padding: 9px; }
    #alphaTab { padding-inline: 0; }
}

@media print {
    .site-header, .site-footer, .viewer-toolbar { display: none !important; }
    .site-main { width: 100%; padding: 0; }
    .score-viewer { border: 0; box-shadow: none; }
}
