:root {
  --ink: #171815;
  --ink-soft: #24251f;
  --paper: #f3f0e8;
  --paper-2: #e9e5da;
  --line: rgba(23, 24, 21, .14);
  --muted: #74766d;
  --acid: #d8ff57;
  --coral: #ff745c;
  --blue: #81b9ff;
  --white: #fffef9;
  --danger: #d94839;
  --radius: 20px;
  --shadow: 0 16px 40px rgba(23, 24, 21, .08);
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; overflow-x: hidden; }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; background:
  radial-gradient(circle at 5% 0%, rgba(216,255,87,.22), transparent 24rem),
  radial-gradient(circle at 100% 30%, rgba(255,116,92,.12), transparent 28rem),
  var(--paper); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.brand-mark { width: 48px; height: 48px; position: relative; margin: auto; }
.brand-mark span { position: absolute; border-radius: 50% 45% 55% 40%; background: var(--acid); transform: rotate(20deg); }
.brand-mark span:nth-child(1) { width: 22px; height: 18px; top: 2px; left: 5px; }
.brand-mark span:nth-child(2) { width: 18px; height: 24px; right: 2px; top: 15px; background: var(--coral); transform: rotate(-18deg); }
.brand-mark span:nth-child(3) { width: 20px; height: 14px; bottom: 2px; left: 4px; background: var(--blue); }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); }
.auth-art { min-height: 100vh; padding: clamp(28px, 5vw, 76px); color: var(--white); background: var(--ink); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art::before, .auth-art::after { content: ""; position: absolute; border-radius: 48% 52% 41% 59%; transform: rotate(-14deg); }
.auth-art::before { width: 28vw; height: 32vw; min-width: 320px; min-height: 380px; right: -6vw; top: 18%; background: var(--acid); }
.auth-art::after { width: 17vw; height: 15vw; min-width: 220px; min-height: 190px; right: 18%; bottom: -5%; background: var(--coral); }
.auth-logo { display: flex; align-items: center; gap: 14px; font-size: 24px; font-weight: 900; letter-spacing: -.04em; position: relative; z-index: 1; }
.auth-copy { max-width: 630px; position: relative; z-index: 1; }
.auth-copy h1 { margin: 0; font-size: clamp(48px, 6.5vw, 92px); line-height: .93; letter-spacing: -.075em; }
.auth-copy p { max-width: 500px; margin: 28px 0 0; color: #bbbdb4; font-size: clamp(17px, 1.5vw, 21px); line-height: 1.6; }
.auth-foot { color: #85877f; font-size: 13px; position: relative; z-index: 1; }
.auth-panel { padding: clamp(28px, 6vw, 90px); display: grid; align-items: center; }
.auth-card { width: min(100%, 460px); margin: auto; }
.auth-card h2 { margin: 0; font-size: clamp(32px, 4vw, 50px); letter-spacing: -.055em; }
.auth-card > p { margin: 12px 0 34px; color: var(--muted); line-height: 1.6; }
.field { display: grid; gap: 8px; margin: 0 0 18px; }
.field label, .field-label { font-size: 13px; font-weight: 800; }
.field input, .field select, .field textarea, .input {
  width: 100%; min-height: 50px; padding: 13px 15px; border: 1px solid var(--line);
  border-radius: 13px; background: rgba(255,255,255,.55); outline: none; transition: .18s;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23,24,21,.08); }
.btn { min-height: 46px; border: 0; border-radius: 999px; padding: 0 21px; background: var(--ink); color: var(--white); font-weight: 850; display: inline-flex; align-items: center; justify-content: center; gap: 9px; transition: transform .18s, background .18s, opacity .18s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.btn-acid { background: var(--acid); color: var(--ink); }
.btn-coral { background: var(--coral); color: var(--ink); }
.btn-ghost { color: var(--ink); background: transparent; border: 1px solid var(--line); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(217,72,57,.3); }
.btn-block { width: 100%; min-height: 54px; }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.form-error { min-height: 22px; color: var(--danger); font-size: 13px; margin: -5px 0 10px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px 20px; background: var(--ink); color: var(--white); display: flex; flex-direction: column; z-index: 20; }
.sidebar-logo { display: flex; align-items: center; gap: 12px; padding: 0 10px 30px; font-size: 21px; font-weight: 900; letter-spacing: -.045em; }
.sidebar-logo .brand-mark { width: 34px; height: 34px; margin: 0; transform: scale(.72); transform-origin: left center; }
.nav-list { display: grid; gap: 7px; }
.nav-link { width: 100%; min-height: 46px; border: 0; border-radius: 13px; padding: 0 15px; color: #999c92; background: transparent; display: flex; align-items: center; gap: 12px; text-align: left; font-weight: 750; }
.nav-link svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.nav-link.active { background: #303129; color: var(--acid); }
.sidebar-user { margin-top: auto; padding: 18px 10px 2px; border-top: 1px solid rgba(255,255,255,.12); }
.user-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-content: center; border-radius: 50%; background: var(--coral); color: var(--ink); font-weight: 900; }
.user-meta { min-width: 0; }
.user-meta strong, .user-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { color: #85877f; font-size: 11px; margin-top: 2px; }
.logout { margin-top: 12px; border: 0; background: none; padding: 3px 0; color: #85877f; font-size: 12px; }
.main { min-width: 0; padding: 34px clamp(24px, 4vw, 66px) 70px; }
.topbar { min-height: 58px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-title h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); line-height: 1; letter-spacing: -.055em; }
.page-title p { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.hero { position: relative; overflow: hidden; min-height: 270px; padding: clamp(24px, 4vw, 46px); border-radius: 30px; background: var(--ink); color: var(--white); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; width: 300px; height: 330px; right: -65px; top: -70px; background: var(--acid); border-radius: 46% 54% 63% 37%; transform: rotate(23deg); }
.hero::before { content: ""; position: absolute; width: 120px; height: 100px; right: 205px; bottom: -30px; background: var(--coral); border-radius: 54% 46% 41% 59%; }
.hero-content { position: relative; z-index: 2; max-width: 650px; }
.hero-tag { display: inline-flex; align-items: center; gap: 8px; color: var(--acid); font-size: 12px; font-weight: 900; letter-spacing: .1em; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px rgba(216,255,87,.13); }
.hero h2 { margin: 17px 0 12px; font-size: clamp(35px, 5vw, 60px); line-height: 1; letter-spacing: -.06em; }
.hero p { color: #b7b9b0; line-height: 1.65; margin: 0 0 25px; }
.session-live-row { display: flex; flex-wrap: wrap; align-items: center; gap: 15px 30px; margin: 22px 0 28px; }
.session-live-row strong { display: block; font-size: 28px; }
.session-live-row span { color: #8f9188; font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 18px; }
.stat-card { min-height: 190px; padding: 25px; background: rgba(255,255,255,.56); border: 1px solid rgba(255,255,255,.75); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card.acid { background: var(--acid); border-color: var(--acid); }
.stat-card.coral { background: var(--coral); border-color: var(--coral); }
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stat-icon { width: 36px; height: 36px; border-radius: 50%; background: rgba(23,24,21,.08); display: grid; place-content: center; font-size: 17px; }
.stat-value { margin: 28px 0 4px; font-size: clamp(27px, 3vw, 38px); font-weight: 900; line-height: 1; letter-spacing: -.05em; }
.stat-sub { color: rgba(23,24,21,.6); font-size: 13px; }
.section { margin-top: 32px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 15px; }
.section-head h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.panel { padding: 24px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.72); background: rgba(255,255,255,.5); box-shadow: var(--shadow); }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: 16px; overflow: hidden; }
.summary-cell { padding: 18px; background: rgba(255,255,255,.82); }
.summary-cell strong { display: block; font-size: 25px; letter-spacing: -.04em; }
.summary-cell span { color: var(--muted); font-size: 12px; }

.gym-picker { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.gym-picker::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.5); font-size: 13px; font-weight: 800; }
.chip.active { background: var(--ink); color: var(--white); border-color: var(--ink); }
.empty { min-height: 220px; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 30px; }
.empty-mark { width: 64px; height: 64px; margin: 0 auto 16px; border: 2px dashed var(--line); border-radius: 50%; display: grid; place-content: center; font-size: 25px; }
.empty h3 { color: var(--ink); margin: 0 0 7px; }
.empty p { margin: 0 auto 20px; max-width: 350px; line-height: 1.6; font-size: 13px; }

.session-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .7fr); gap: 20px; align-items: start; }
.quick-card { min-width: 0; padding: clamp(20px, 3vw, 32px); background: var(--ink); color: var(--white); border-radius: 28px; box-shadow: var(--shadow); }
.quick-card h2 { margin: 0 0 5px; font-size: 27px; letter-spacing: -.04em; }
.quick-card > p { color: #8f9188; margin: 0 0 25px; font-size: 13px; }
.grade-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 9px; }
.grade-btn { min-height: 58px; border: 1px solid #3b3c35; background: #24251f; color: #b5b7ae; border-radius: 13px; font-weight: 900; }
.grade-btn small { display: block; font-size: 10px; color: #6e7068; margin-top: 2px; }
.grade-btn.active { color: var(--ink); background: var(--acid); border-color: var(--acid); }
.grade-btn.active small { color: rgba(23,24,21,.55); }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.result-btn { min-width: 0; min-height: 68px; border: 0; border-radius: 15px; padding: 8px; font-weight: 900; line-height: 1.25; }
.result-btn small { display: block; font-size: 11px; opacity: .65; margin-top: 4px; }
.result-flash { background: var(--acid); }
.result-send { background: var(--blue); }
.result-failed { background: #383933; color: var(--white); }
.quick-meta { margin-top: 17px; display: grid; gap: 13px; }
.attempt-row, .color-row { display: flex; gap: 7px; flex-wrap: wrap; }
.attempt-btn { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid #404139; background: transparent; color: #9c9e95; font-size: 12px; }
.attempt-btn.active { background: var(--white); border-color: var(--white); color: var(--ink); }
.color-dot { width: 31px; height: 31px; border-radius: 50%; border: 3px solid var(--ink); outline: 1px solid #4d4e46; }
.color-dot.active { outline: 2px solid var(--white); outline-offset: 2px; }
.quick-meta label { display: block; color: #878980; font-size: 11px; margin-bottom: 8px; font-weight: 800; }
.quick-note { width: 100%; padding: 12px 14px; border: 1px solid #3d3e37; border-radius: 12px; color: var(--white); background: #24251f; outline: none; }
.quick-tip { min-height: 54px; margin-top: 16px; padding: 13px 15px; border-radius: 13px; background: #24251f; color: #85877f; font-size: 12px; display: flex; align-items: center; }
.route-list { display: grid; gap: 10px; }
.route-item { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.58); display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; }
.route-result { width: 42px; height: 42px; border-radius: 13px; display: grid; place-content: center; font-weight: 950; font-size: 12px; background: var(--paper-2); }
.route-result.flash { background: var(--acid); }
.route-result.send { background: var(--blue); }
.route-result.failed { color: var(--white); background: #55564f; }
.route-main strong { font-size: 16px; }
.route-main p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.route-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; display: grid; place-content: center; color: var(--muted); }
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }
.thumb { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; }

.history-list { display: grid; gap: 12px; }
.history-card { padding: 20px; border: 1px solid rgba(255,255,255,.8); background: rgba(255,255,255,.5); border-radius: 18px; box-shadow: var(--shadow); display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 18px; }
.date-box { width: 64px; height: 64px; border-radius: 16px; background: var(--ink); color: var(--white); display: grid; place-content: center; text-align: center; }
.date-box strong { font-size: 23px; line-height: 1; }
.date-box span { margin-top: 4px; color: var(--acid); font-size: 10px; font-weight: 900; }
.history-main h3 { margin: 0; font-size: 17px; }
.history-main p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.history-stats { display: flex; gap: 25px; text-align: right; }
.history-stats strong { display: block; font-size: 19px; }
.history-stats span { color: var(--muted); font-size: 10px; }

.chart-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 18px; }
.chart-panel { min-height: 320px; }
.chart-panel h3 { margin: 0; font-size: 17px; }
.chart-panel > p { margin: 5px 0 18px; color: var(--muted); font-size: 12px; }
.chart { width: 100%; min-height: 220px; position: relative; }
.chart svg { width: 100%; height: 240px; overflow: visible; }
.chart-gridline { stroke: rgba(23,24,21,.1); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: url(#areaGradient); }
.chart-dot { fill: var(--acid); stroke: var(--ink); stroke-width: 2; }
.axis-label { fill: var(--muted); font-size: 10px; }
.distribution { display: grid; gap: 12px; margin-top: 18px; }
.bar-row { display: grid; grid-template-columns: 52px 1fr 42px; gap: 10px; align-items: center; font-size: 12px; }
.bar-row strong { font-size: 12px; }
.bar-track { height: 9px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--coral); }
.success-ring { width: 170px; height: 170px; margin: 26px auto; border-radius: 50%; display: grid; place-content: center; text-align: center; }
.success-ring strong { font-size: 34px; line-height: 1; }
.success-ring span { color: var(--muted); font-size: 11px; margin-top: 6px; }

.gym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.gym-card { min-height: 190px; padding: 23px; border-radius: 20px; background: rgba(255,255,255,.56); border: 1px solid rgba(255,255,255,.8); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.gym-card:nth-child(3n+1) .gym-symbol { background: var(--acid); }
.gym-card:nth-child(3n+2) .gym-symbol { background: var(--coral); }
.gym-card:nth-child(3n+3) .gym-symbol { background: var(--blue); }
.gym-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.gym-symbol { width: 48px; height: 48px; border-radius: 15px 19px 12px 18px; display: grid; place-content: center; font-size: 20px; transform: rotate(-5deg); }
.gym-card h3 { margin: 17px 0 5px; font-size: 20px; }
.gym-card p { margin: 0; color: var(--muted); font-size: 12px; }
.gym-card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: end; color: var(--muted); font-size: 11px; }
.gym-card-foot button { padding: 0; border: 0; background: none; color: var(--ink); font-weight: 850; }

.modal-backdrop { position: fixed; inset: 0; padding: 20px; background: rgba(23,24,21,.72); backdrop-filter: blur(8px); z-index: 100; display: grid; place-content: center; overflow-y: auto; }
.modal { width: min(560px, calc(100vw - 30px)); max-height: calc(100vh - 40px); overflow-y: auto; border-radius: 24px; padding: 28px; background: var(--paper); box-shadow: 0 25px 80px rgba(0,0,0,.28); }
.modal-wide { width: min(760px, calc(100vw - 30px)); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 25px; }
.modal-head h2 { margin: 0; font-size: 26px; letter-spacing: -.04em; }
.modal-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.modal-close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--paper-2); font-size: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.mapping-row { display: grid; grid-template-columns: 1fr 1fr 90px 32px; gap: 8px; margin-bottom: 8px; }
.mapping-row input { min-width: 0; min-height: 42px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.upload-drop { padding: 25px; border: 2px dashed var(--line); border-radius: 16px; text-align: center; background: rgba(255,255,255,.45); }
.upload-drop input { width: 100%; }
.toast-region { position: fixed; right: 20px; top: 20px; z-index: 200; display: grid; gap: 8px; }
.toast { width: min(360px, calc(100vw - 30px)); padding: 13px 16px; border-radius: 13px; background: var(--ink); color: var(--white); box-shadow: var(--shadow); font-size: 13px; animation: toast-in .25s ease-out; }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.mobile-nav { display: none; }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 24px 20px 96px; }
  .mobile-nav { position: fixed; display: grid; grid-template-columns: repeat(5, 1fr); left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); min-height: 67px; padding: 7px; border-radius: 20px; background: rgba(23,24,21,.94); backdrop-filter: blur(18px); z-index: 50; box-shadow: 0 14px 45px rgba(0,0,0,.2); }
  .mobile-nav .nav-link { min-height: 51px; padding: 3px; display: grid; place-content: center; justify-items: center; gap: 3px; border-radius: 14px; font-size: 9px; }
  .mobile-nav .nav-link svg { width: 18px; height: 18px; }
  .session-layout, .chart-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-art { min-height: 280px; padding: 25px; }
  .auth-art::before { min-width: 190px; min-height: 210px; top: 25%; }
  .auth-art::after { display: none; }
  .auth-logo { font-size: 19px; }
  .auth-copy h1 { font-size: 44px; }
  .auth-copy p { display: none; }
  .auth-foot { display: none; }
  .auth-panel { padding: 34px 22px 50px; }
  .auth-card h2 { font-size: 34px; }
  .main { padding-inline: 15px; }
  .topbar { align-items: center; }
  .page-title h1 { font-size: 31px; }
  .page-title p { display: none; }
  .top-actions .btn span.optional { display: none; }
  .hero { min-height: 310px; border-radius: 24px; padding: 28px 23px; }
  .hero::after { width: 190px; height: 220px; right: -100px; }
  .hero::before { right: 40px; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 145px; }
  .stat-value { margin-top: 18px; }
  .summary-strip { grid-template-columns: 1fr 1fr 1fr; }
  .summary-cell { padding: 13px 9px; text-align: center; }
  .summary-cell strong { font-size: 20px; }
  .quick-card { border-radius: 22px; }
  .result-grid { gap: 7px; }
  .result-btn { min-height: 72px; font-size: 13px; }
  .history-card { grid-template-columns: 56px 1fr; gap: 13px; }
  .date-box { width: 54px; height: 58px; }
  .history-stats { grid-column: 2; justify-content: flex-start; text-align: left; }
  .chart-panel { padding: 18px; }
  .gym-grid { grid-template-columns: 1fr; }
  .mapping-row { grid-template-columns: 1fr 1fr 60px 28px; gap: 5px; }
  .modal { padding: 21px; }
}
