.type-wrap {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 1rem;
}
.type-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.type-top h1 { font-size: 1.3rem; }
.type-top a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.type-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.mode-select {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.mode-select button {
  min-height: 54px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
.mode-select button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.setup-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.setup-grid select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.6rem;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.setup-grid select:focus { border-color: var(--accent); }
#btn-start {
  width: 100%;
  min-height: 48px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
}
#btn-start:hover { background: var(--accent-hover); }

.type-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.type-toolbar span { font-size: 0.85rem; color: var(--text-muted); }
.toolbar-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}
#btn-typing-speak {
  width: 36px;
  padding-left: 0;
  padding-right: 0;
  text-align: center;
}
.type-toolbar button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
}
.progress-track {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s ease;
}
#target-text {
  font-family: var(--font-mono);
  font-size: clamp(1.35rem, 4vw, 2rem);
  line-height: 1.6;
  min-height: 3.5rem;
  padding: 0.8rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  overflow-wrap: anywhere;
}
#target-text .done { color: var(--success); }
#target-text .current {
  color: var(--accent);
  background: var(--highlight);
  border-radius: 3px;
}
#chinese-text {
  font-size: 1rem;
  color: var(--text);
  padding: 0.6rem 0.75rem;
  background: var(--highlight);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  min-height: 2rem;
}
#typing-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-size: 1.05rem;
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  outline: none;
  margin-bottom: 0.75rem;
}
#typing-input:focus { border-color: var(--accent); }
#next-key {
  min-height: 1.6rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
#next-key b {
  color: var(--accent);
  font-family: var(--font-mono);
}
#keyboard {
  display: grid;
  gap: 0.35rem;
}
.kb-row {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}
.kb-key {
  flex: 0 0 auto;
  min-width: 34px;
  height: 40px;
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font-mono);
  cursor: default;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  line-height: 1.05;
}
.kb-key .kb-main { font-size: 1em; }
.kb-key .kb-sub {
  font-size: 0.62em;
  opacity: 0.6;
  margin-top: 1px;
}
.kb-key.hint .kb-sub { opacity: 0.9; }
.kb-key.wide { min-width: 64px; }
.kb-key.altgr { min-width: 64px; }
.kb-key.space { flex: 1; max-width: 220px; }
.kb-key.hint {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
#special-hint {
  min-height: 1.6rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.keyboard-guide {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: var(--highlight);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--text-muted);
}
.keyboard-guide h2 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--text);
}
.keyboard-guide ol {
  margin: 0;
  padding-left: 1.25rem;
}
.keyboard-guide li { margin-bottom: 0.25rem; }
.records-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.records-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.records-head h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}
.records-head button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
}
.records-list {
  min-height: 2.5rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.records-empty { padding: 0.75rem 0; }
.record-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.record-item:last-child { border-bottom: 0; }
.record-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
}
.record-mode {
  font-weight: 700;
  color: var(--text);
}
.record-category { color: var(--text-muted); }
.record-accuracy {
  font-weight: 700;
  color: var(--success);
}
.record-duration { color: var(--text-muted); }
.record-meta {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.finish-box {
  text-align: center;
  padding: 2rem 0;
}
.finish-box h2 { margin-bottom: 0.75rem; }
.finish-box p { color: var(--text-muted); margin-bottom: 1rem; }
.finish-box button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  cursor: pointer;
}
@media (max-width: 640px) {
  .kb-key {
    flex: 1 1 0;
    min-width: 0;
    height: 34px;
    font-size: 0.62rem;
    padding: 0 0.05rem;
  }
  .kb-key.wide, .kb-key.altgr {
    min-width: 40px;
  }
  .kb-key.space { min-width: 56px; max-width: 140px; }
  .kb-row { gap: 0.25rem; }
  .keyboard-guide {
    font-size: 0.8rem;
    padding: 0.75rem;
  }
  .record-line { gap: 0.3rem 0.6rem; }
  .record-meta { font-size: 0.74rem; }
}
