:root {
  color-scheme: dark;
  --bg: #070b12;
  --panel: rgba(9, 14, 22, 0.72);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f6f8fb;
  --muted: #8390a3;
  --accent: #03A9F4;
  --green: #67e8a1;
  --red: #ff6b78;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.055), transparent 32%),
    linear-gradient(180deg, #0b0f16 0%, var(--bg) 62%, #05070a 100%);
}

button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(243, 198, 78, 0.6);
  background: rgba(243, 198, 78, 0.12);
}

.minimal-shell {
  height: 100vh;
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  opacity: 0.82;
}

.menu-button {
  min-width: 74px;
}

.theme-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 0;
  color: var(--muted);
  font-size: 13px;
}

.top-bar .theme-picker:last-of-type {
  margin-right: auto;
}

.theme-picker select {
  min-width: 116px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 9px 34px 9px 13px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font: inherit;
  outline: none;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.theme-picker select:focus {
  border-color: rgba(243, 198, 78, 0.64);
}

.theme-picker option {
  background: #101722;
  color: var(--text);
}

.mini-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.mini-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.035);
}

.mini-stats strong {
  color: var(--text);
  font-size: 15px;
}

.practice-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}

.task-board {
  text-align: center;
  padding: 4px 18px 0;
}

.task-name {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.12em;
}

.task-board h1 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 0 auto;
  max-width: 1180px;
  max-height: 22vh;
  min-height: 40px;
  /* overflow: hidden; */
  color: var(--text);
  font-size: clamp(42px, 6.4vw, 92px);
  line-height: 1.08;
  letter-spacing: 0.035em;
}

.task-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0.8em;
  padding: 0.02em 0.06em;
  border-radius: 0.18em;
  color: rgba(246, 248, 251, 0.54);
  transition: color 0.12s ease, background 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.task-char.correct {
  color: var(--green);
  background: rgba(103, 232, 161, 0.12);
  box-shadow: 0 0 18px rgba(103, 232, 161, 0.18);
}

.task-char.wrong {
  color: var(--red);
  background: rgba(255, 107, 120, 0.16);
  box-shadow: 0 0 20px rgba(255, 107, 120, 0.22);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.1em;
}

.task-char.current {
  color: var(--accent);
  background: rgba(243, 198, 78, 0.13);
  box-shadow: 0 0 20px rgba(243, 198, 78, 0.2);
  transform: translateY(-2px);
}

.task-char.pending {
  color: rgba(246, 248, 251, 0.35);
}

.typed-text {
  min-height: 28px;
  margin: 10px 0 0;
  color: rgba(198, 208, 222, 0.96);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.task-tip {
  margin: 10px 0 0;
  color: rgba(198, 208, 222, 0.92);
  font-size: 18px;
  font-weight: 600;
}

.scene-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.018);
}

.scene-wrap::before {
  content: "教学键盘";
  position: absolute;
  left: 24px;
  bottom: 20px;
  z-index: 1;
  color: rgba(255, 255, 255, 0.18);
  font-size: 13px;
  letter-spacing: 0.16em;
  animation: fadeHint 2s ease forwards;
  pointer-events: none;
}

@keyframes fadeHint {
  0%, 65% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

#keyboardCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.finger-card {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(243, 198, 78, 0.18);
  border-radius: 999px;
  padding: 8px 13px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--muted);
  backdrop-filter: blur(10px);
}

.finger-card span {
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
}

.finger-card strong {
  color: var(--text);
  font-size: 13px;
}

.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
}

.bottom-bar p {
  margin: 0;
}

.button-row {
  display: flex;
  gap: 8px;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow-y: auto;
  padding: 24px;
}

.menu-overlay[hidden] {
  display: none;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.menu-header h2 {
  margin: 0;
  font-size: 28px;
  color: var(--text);
}

.close-menu-button {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.lesson-section {
  margin-bottom: 24px;
}

.lesson-section-title {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.lesson-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.lesson-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-radius: 18px;
  padding: 16px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.lesson-card:hover {
  transform: translateY(-2px);
  border-color: rgba(243, 198, 78, 0.5);
  background: rgba(243, 198, 78, 0.08);
}

.lesson-card.active {
  border-color: rgba(243, 198, 78, 0.8);
  background: rgba(243, 198, 78, 0.14);
}

.card-keys {
  display: flex;
  gap: 3px;
  justify-content: center;
  flex-wrap: wrap;
}

.card-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 34px;
  padding: 0 6px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.card-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.lesson-card.active .card-label {
  color: var(--accent);
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .minimal-shell {
    min-height: 100vh;
    height: auto;
  }

  .top-bar,
  .bottom-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .mini-stats,
  .button-row,
  .theme-picker {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .mini-stats {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .theme-picker select {
    width: 100%;
  }

  .scene-wrap {
    min-height: 420px;
  }
}
