:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #1e1b30;
  background: #f7f7fa;
  --muted: #625e74;
  --line: #e6e3ee;
  --purple: #6141c6;
  --surface: #fff;
  --page-gutter: clamp(14px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid #724bdf;
  outline-offset: 3px;
}
svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; fill: none; flex: 0 0 auto; }
.icon-library, .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.header-inner, .page { width: min(1120px, calc(100% - 2 * var(--page-gutter))); margin-inline: auto; }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { text-decoration: none; color: #211d32; display: inline-flex; align-items: center; gap: 11px; font-size: 24px; font-weight: 800; letter-spacing: -.065em; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: white; background: #6b4bd4; box-shadow: inset 0 -3px 0 #5434b9; }
.brand-mark svg { width: 23px; height: 23px; }
.brand-label { margin-left: 7px; border-left: 1px solid var(--line); padding-left: 16px; font-size: 13px; color: var(--muted); font-weight: 550; letter-spacing: .025em; }

.button { color: #3d3551; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 37px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: #fff; font-size: 14px; font-weight: 650; white-space: nowrap; }
.button:hover:not(:disabled) { border-color: #c9b9f0; color: var(--purple); background: #f8f5ff; }
.button:disabled { color: #666174; background: #f4f2f7; }
.button svg { width: 16px; height: 16px; }
.sound-toggle { min-height: 38px; }

.page { padding: 34px 0 40px; }
.desktop-audio { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; color: var(--muted); font-size: 14px; }
.desktop-audio[hidden] { display: none; }
.hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(270px, 1fr); align-items: center; gap: clamp(16px, 3vw, 32px); padding: clamp(18px, 3vw, 32px); border: 1px solid #e6ddf6; border-radius: 22px; background: radial-gradient(ellipse at 13% 95%, #f9f4ff, transparent 67%), linear-gradient(105deg, #f8f5ff 15%, #eee7ff 100%); }
.intro h1 { font-size: clamp(35px, 4.4vw, 58px); line-height: 1.22; font-weight: 800; letter-spacing: -.045em; margin: 0 0 14px; }
.intro h1 span { color: var(--purple); }
.intro p { font-size: 16px; color: #59516c; line-height: 1.75; margin: 0; }
.monitor { min-width: 0; padding: 15px 17px; border: 1px solid #e2d7fa; border-radius: 15px; background: #fcfaff; box-shadow: 0 5px 16px #3a257808; }
.monitor-header, .monitor-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.monitor-title, .monitor-state { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 650; }
.monitor-title svg { color: #704dcc; }
.monitor-state { color: #58496e; }
.monitor-state > span:first-child { flex: 0 0 7px; height: 7px; border-radius: 50%; background: var(--selected-color, #e16374); }
#monitor-state { max-width: 185px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
#waveform { width: 100%; height: 59px; display: block; margin: 7px 0 10px; }
.preview-button { min-height: 34px; padding-inline: 11px; color: #5a38b8; border-color: #e6dcfb; background: #f1ebff; }
.preview-button svg { fill: currentColor; width: 14px; }
.volume-control { display: flex; width: min(100%, 169px); align-items: center; gap: 7px; color: #665878; font-size: 13px; }
.volume-control svg { width: 16px; height: 16px; }
.volume-control input { width: 100%; min-width: 35px; accent-color: #774fdb; cursor: pointer; }
.volume-control output { min-width: 32px; font-variant-numeric: tabular-nums; text-align: right; }

.switch-section { margin-top: 28px; }
.section-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 13px; }
h2 { margin: 0; font-size: 22px; font-weight: 750; letter-spacing: -.025em; }
.section-heading p, .lab-header p { margin: 0; color: var(--muted); font-size: 14px; }
.switch-heading { justify-content: space-between; align-items: center; }
.switch-heading-title, .switch-controls { display: flex; align-items: center; gap: 9px; }
.switch-heading-title { flex-wrap: wrap; }
.switch-search { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 0 9px; background: white; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); }
.switch-search:focus-within { border-color: #a688ef; }
.switch-search input { width: min(26vw, 195px); min-height: 35px; min-width: 0; border: 0; outline: 0; background: transparent; color: #322842; font-size: 14px; }
.switch-search input:focus-visible { outline: 0; }
.carousel-button { width: 37px; padding: 0; }
.switches { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(230px, 26%, 300px); gap: 12px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #bfabd9 #efebf5; scroll-snap-type: inline mandatory; scroll-padding-inline: 4px; padding: 4px; margin-inline: -4px; }
.switch-card { display: grid; grid-template-columns: 50px minmax(0, 1fr) 20px; gap: 10px; align-items: center; min-height: 104px; text-align: left; color: inherit; padding: 12px 11px; background: #fff; border: 1px solid var(--line); border-radius: 14px; scroll-snap-align: start; }
.switch-card[hidden] { display: none; }
.switch-edition { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.switch-edition-options { display: flex; flex-wrap: wrap; gap: 6px; }
.switch-edition-options label { position: relative; cursor: pointer; }
.switch-edition-options span {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: #3d3551;
}
.switch-edition-options label:hover span { border-color: #bda9f1; }
.switch-edition-options input:checked + span { border-color: #9a7be9; background: #f2ebff; color: var(--purple); font-weight: 700; }
.switch-edition-options input:focus-visible + span { outline: 2px solid #724bdf; outline-offset: 2px; }
@media (pointer: coarse) {
  .switch-edition-options span { min-height: 44px; }
}
.switch-empty { color: var(--muted); font-size: 14px; }
.switches[hidden] { display: none; }
.switch-card:hover { border-color: #bda9f1; }
.switch-card[aria-pressed="true"] { border-color: #9a7be9; box-shadow: inset 0 0 0 1px #9a7be9; background: #fdfbff; }
.switch-tile { width: 49px; height: 49px; display: grid; place-items: center; background: var(--tile); border-radius: 11px; }
.switch-body { display: grid; place-items: center; position: relative; width: 34px; height: 34px; border: 1px solid var(--rim); border-radius: 7px; background: linear-gradient(145deg, #ffffff 15%, var(--tile) 100%); box-shadow: 0 2px 0 var(--rim), inset 0 0 0 2px #ffffffbf, 0 4px 7px #2c183019; transform: rotate(-12deg); }
.switch-body::before { content: ""; position: absolute; inset: 5px; border-radius: 4px; background: var(--stem); box-shadow: inset 0 2px 1px #ffffff50, inset 0 -2px 1px #30173945; }
.switch-body::after { content: ""; position: absolute; width: 12px; height: 12px; background: var(--core); clip-path: polygon(35% 0, 65% 0, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0 65%, 0 35%, 35% 35%); }
.switch-name, .switch-description { display: block; }
.switch-name { font-size: 16px; font-weight: 750; line-height: 1.25; margin-bottom: 4px; }
.switch-type { font-size: 13px; font-weight: 550; color: #665d76; white-space: nowrap; }
.switch-description { font-size: 13px; color: #655b73; line-height: 1.4; }
.switch-check { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #744cd7; visibility: hidden; }
.switch-check svg { width: 13px; height: 13px; stroke-width: 2.4; }
.switch-card[aria-pressed="true"] .switch-check { visibility: visible; }

.lab { margin-top: 24px; border: 1px solid var(--line); border-radius: 18px; padding: 20px 23px 15px; background: #fff; }
.lab-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 15px; }
.lab-header p { margin-top: 5px; }
.lab-actions { display: flex; gap: 8px; }
#record svg { color: #aa415b; }
#record[aria-pressed="true"] { color: #942d48; background: #fff0f4; border-color: #efb6c3; }
#record[aria-pressed="true"] svg { fill: currentColor; }
.export-button:not(:disabled) { color: #5938b5; background: #f5efff; border-color: #e4d9fc; }
.typing { display: flex; align-items: start; gap: 10px; background: #faf9fd; border: 1px solid #e9e5f0; border-radius: 10px; padding: 8px 11px; margin-bottom: 14px; }
.typing:focus-within { border-color: #a688ef; box-shadow: 0 0 0 2px #ede5ff; }
.typing textarea { border: 0; background: transparent; padding: 2px; outline: 0; width: 100%; min-width: 0; resize: vertical; min-height: 39px; color: inherit; font-size: 15px; line-height: 1.45; }
.typing textarea:focus-visible { outline: none; }
.typing textarea::placeholder { color: #6d657d; }
.clear-button { padding: 3px 5px; border: 0; border-radius: 4px; background: transparent; color: #5a37bd; flex: 0 0 auto; font-size: 14px; }
.clear-button:disabled { color: #6b637b; }

.board-viewport {
  overflow-x: auto;
  border: 1px solid #e9e2f2;
  border-radius: 13px;
  background: radial-gradient(ellipse at 50% 24%, #fdfbff, #efebf7 85%);
}
.board-scene {
  display: grid;
  place-items: center;
  isolation: isolate;
  position: relative;
  min-width: 560px;
  min-height: 325px;
  padding: 57px clamp(43px, 6vw, 74px) 69px;
}
.board-scene::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(80%, 820px);
  height: 52%;
  top: 30%;
  border-radius: 23%;
  background: #432766;
  opacity: .28;
  filter: blur(22px);
  transform: translateY(23px);
}
.board {
  --unit-gap: 7px;
  --unit-size: calc((100% + var(--unit-gap)) / 16);
  width: min(100%, 852px);
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 15px;
  border: 1px solid #ac99c6;
  background: linear-gradient(136deg, #eae1f7, #c9b8e4 68%, #e1d2f2);
  box-shadow: inset 0 1px 0 #fff9, inset 0 0 0 4px #d8c9ea,
    0 5px 0 #a490bf, 0 9px 0 #8c76a9, 0 12px 0 #79638f;
}
.key-row { display: flex; gap: var(--unit-gap); min-width: 0; }
.key {
  --cap-depth: 4px;
  --cap-offset: 0px;
  --cap-top: #fffdfd;
  --cap-base: #f3edf7;
  --cap-border: #d8cde7;
  --cap-front: #a99aba;
  width: calc(var(--units) * var(--unit-size) - var(--unit-gap));
  flex: 0 0 auto;
  height: clamp(34px, 3.6vw, 44px);
  min-width: 0;
  border: none;
  border-radius: 6px;
  background: #b09ac7;
  box-shadow: 1px 2px 3px #71589750;
  color: #372e48;
  font-size: clamp(10px, 1.04vw, 14px);
  font-weight: 700;
  line-height: 1;
  padding: 0;
  touch-action: manipulation;
  user-select: none;
  position: relative;
}
.key.modifier {
  --cap-top: #f4ebff;
  --cap-base: #e6dbf7;
  --cap-border: #cab8e6;
  --cap-front: #987ebd;
  color: #4a336f;
}
.key.accent {
  --cap-top: #e8dbfd;
  --cap-base: #d3bff6;
  --cap-border: #bea6ea;
  --cap-front: #8c70b7;
  color: #432776;
}
.keycap {
  position: absolute;
  inset: 0 1px 1px 0;
  transform: translateY(var(--cap-offset));
  display: grid;
  place-content: center;
  padding: 0 2px;
  border: 1px solid var(--cap-border);
  border-radius: 6px;
  background: linear-gradient(155deg, var(--cap-top), var(--cap-base));
  box-shadow: inset 0 1px 0 #fffd, inset 0 -2px 2px #3d275013,
    0 var(--cap-depth) 0 var(--cap-front);
  transition: transform 95ms ease-out, box-shadow 95ms ease-out;
}
.key.space .keycap {
  font-size: 0;
  background-image: linear-gradient(#9e87bc, #9e87bc), linear-gradient(155deg, var(--cap-top), var(--cap-base));
  background-position: 50% 64%, center;
  background-repeat: no-repeat;
  background-size: 24px 2px, 100% 100%;
}
.key:hover .keycap { border-color: #a488d6; }
.key.pressed, .key:active {
  --cap-depth: 1px;
  --cap-offset: 3px;
  --cap-top: #d9c6fc;
  --cap-base: #bea2ef;
  --cap-front: #8666b8;
  color: #311f51;
}
.key.pressed .keycap, .key:active .keycap { transition-duration: 40ms; }
.key:focus-visible { z-index: 1; outline-offset: 0; }
.key:focus-visible .keycap { outline: 2px solid #704bc0; }
.key-gap { flex: 0 0 calc(var(--units) * var(--unit-size) - var(--unit-gap)); }

@media (prefers-reduced-motion: reduce) {
  .keycap, .key.pressed .keycap, .key:active .keycap { transition: none; }
}

.lab-footer { display: flex; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding-top: 9px; color: var(--muted); font-size: 13px; line-height: 1.5; }
#lab-status { color: #5a38b8; }

@media (max-width: 850px) {
  .header-inner, .page { width: calc(100% - 40px); }
  .hero { gap: 20px; padding: 23px; }
  .switch-card { grid-template-columns: 47px minmax(0, 1fr) 17px; padding: 12px 10px; gap: 8px; }
  .switch-tile { width: 45px; height: 45px; }
  .switch-body { width: 30px; height: 30px; }
  .switch-check { width: 17px; height: 17px; }
}
@media (max-width: 767px) {
  .header-inner { min-height: 61px; padding-block: 6px; }
  .brand-label { display: none; }
  .page { padding-block: 17px 24px; }
  .hero { grid-template-columns: 1fr; padding: 19px 15px 15px; }
  .intro h1 { font-size: clamp(27px, 8vw, 42px); }
  .desktop-break { display: none; }
  .switch-section { margin-top: 21px; }
  .switch-heading { align-items: flex-start; flex-direction: column; }
  .switch-controls { width: 100%; }
  .switch-search { flex: 1; }
  .switch-search input { width: 100%; }
  .switches { grid-auto-columns: min(82%, 278px); }
  .lab { margin-top: 17px; padding: 14px 12px; }
  .lab-header { align-items: flex-start; flex-wrap: wrap; }
  .board-scene { min-height: 302px; padding: 33px 35px 45px; }
}

[hidden] { display: none !important; }
.header-actions, .statistics-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.statistics { display: grid; gap: 16px; }
.statistics-heading, .statistics-chart { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.statistics-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: #f4eeff; }
.statistics-heading h1 { margin: 0 0 5px; font-size: clamp(26px, 5vw, 40px); }
.statistics-heading p, .statistics-status, .statistics-chart p { color: var(--muted); margin: 0; line-height: 1.6; }
.statistics-status { padding-inline: 3px; }
.statistics-toolbar { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); }
.statistics-toolbar select { padding: 6px 10px; font: inherit; border: 1px solid var(--line); border-radius: 8px; color: #342642; background: white; }
.statistics-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.statistics-metrics > div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.statistics-metrics span { display: block; color: var(--muted); font-size: 14px; }
.statistics-metrics strong { font-size: clamp(17px, 3vw, 27px); font-variant-numeric: tabular-nums; }
.statistics-chart h2 { margin: 0 0 14px; }
.statistics-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.statistics-week button { display: grid; gap: 5px; grid-template-rows: auto 90px auto; justify-items: stretch; border: 1px solid transparent; border-radius: 8px; padding: 6px 2px; color: var(--muted); background: transparent; font-size: 13px; }
.statistics-week button[aria-pressed="true"] { border-color: #d9c7fc; background-color: #f8f4ff; color: #563189; }
.statistics-day-track { display: flex; align-items: end; margin-inline: auto; width: 55%; border-bottom: 1px solid #e7e1f0; }
.statistics-day-track i { width: 100%; background: #8057d3; border-radius: 4px 4px 0 0; }
.statistics-chart-scroll { overflow-x: auto; }
.statistics-slots, .statistics-time-axis { min-width: 580px; }
.statistics-slots { display: grid; align-items: end; grid-template-columns: repeat(288, minmax(0, 1fr)); gap: 1px; height: 115px; border-bottom: 1px solid #e7e1f0; background-image: linear-gradient(to top, #f0ecf5 1px, transparent 1px); background-size: 100% 25%; }
.statistics-slots span { height: var(--bar-height); background: #8057d3; min-width: 0; }
.statistics-time-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; padding-block: 4px; }
.statistics-chart summary { cursor: pointer; color: #6341a7; }
.statistics-table { margin-top: 8px; color: var(--muted); overflow: auto; max-height: 420px; }
.statistics-table table { border-collapse: collapse; text-align: left; width: 100%; font-variant-numeric: tabular-nums; }
.statistics-table th, .statistics-table td { border-bottom: 1px solid var(--line); padding: 8px 4px; }
.statistics-table tr > :last-child { text-align: right; }
@media (max-width: 600px) {
  .statistics-heading, .statistics-chart { padding: 14px; }
  .statistics-metrics > div { padding: 8px; }
}

.statistics-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.statistics-metrics small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.4; }
.statistics-metrics .statistics-primary { background: #ede4ff; border-color: #dbcbf8; }
.statistics-primary strong { color: #532ba0; }
.statistics-chart-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.statistics-chart-heading h2 { margin: 0; }
.statistics-heat-legend { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); }
.statistics-heat-legend i { display: block; border-radius: 3px; width: 13px; height: 13px; }
.statistics-heatmap-scroll { overflow-x: auto; padding: 3px; }
.statistics-heatmap { display: grid; gap: 5px; min-width: 610px; background: #f8f6fc; border: 1px solid #ede7f5; border-radius: 12px; padding: 10px; }
.statistics-heat-row { display: flex; gap: 5px; }
.statistics-heat-row > * { flex: var(--heat-units) 0 0; min-width: 0; }
.statistics-heat-row button { min-height: 34px; border: 1px solid #8265ac24; border-radius: 7px; color: #372850; font-size: 12px; font-weight: 650; }
[data-heat="0"] { background: #e9e4f0; }
[data-heat="1"] { background: #ded1fb; }
[data-heat="2"] { background: #c2a6f2; }
[data-heat="3"] { background: #8c63d7; }
[data-heat="4"] { background: #5b2d9e; }
.statistics-heat-row button[data-heat="3"], .statistics-heat-row button[data-heat="4"] { color: #fff; }
.statistics-heat-row button[aria-pressed="true"] { outline: 2px solid #392351; outline-offset: 1px; }
.statistics-slot-metrics { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 6px 0 12px; color: var(--muted); font-size: 13px; }
.statistics-slot-metrics strong { color: #3d285e; }
.statistics-history { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) {
  .statistics-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statistics-history { grid-template-columns: 1fr; }
}

.statistics-heat-selection { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.statistics-slots { grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; }
.statistics-slots span { border-radius: 3px 3px 0 0; }
.statistics-practice textarea { display: block; width: 100%; min-height: 80px; padding: 9px; margin-bottom: 7px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; }
.statistics-practice textarea:disabled { background: #f6f3fa; }
@media (max-width: 575px) {
  .switches { grid-auto-columns: min(78%, 265px); }
  .switch-search input { width: min(44vw, 195px); }
  .carousel-button { min-height: 42px; }
}


.phone-keyboard .board-scene { min-width: 0; min-height: 0; padding: 10px 5px 23px; }
.phone-keyboard .board-scene::before { display: none; }
.phone-keyboard .board { --unit-gap: 3px; --unit-size: calc((100% + var(--unit-gap)) / 10); width: min(100%, 460px); padding: 8px 5px; gap: 6px; }
.phone-keyboard .key-row { justify-content: center; }
.phone-keyboard .key { height: 44px; font-size: clamp(12px, 4vw, 17px); }
.phone-keyboard .key.modifier, .phone-keyboard .key.accent { font-size: 12px; }
.phone-keyboard .key[aria-pressed="true"] .keycap { background: #dfcef8; }
.phone-keyboard .key.space .keycap { font-size: 13px; background: linear-gradient(155deg, var(--cap-top), var(--cap-base)); }
