.typing-shell {
  --typing-ink: #132238;
  --typing-subtle: #60708a;
  --typing-line: rgba(148, 163, 184, 0.22);
  --typing-panel: rgba(255, 255, 255, 0.96);
  --typing-blue: #2563eb;
  --typing-blue-deep: #1d4ed8;
  --typing-sky: #0ea5e9;
  --typing-amber: #f59e0b;
  --typing-green: #16a34a;
  --typing-red: #dc2626;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.typing-hero,
.typing-panel,
.typing-card,
.typing-rank-table,
.typing-best-card {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid var(--typing-line);
  background: var(--typing-panel);
  box-shadow: 0 24px 58px rgba(15, 23, 42, 0.08);
}

.typing-hero {
  padding: 34px 36px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.14), transparent 32%),
    radial-gradient(circle at left bottom, rgba(14, 165, 233, 0.12), transparent 28%),
    linear-gradient(135deg, #ffffff 0%, #f7fbff 52%, #f4fbff 100%);
}

.typing-hero::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -90px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.07);
}

.typing-kicker,
.typing-best-label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.10);
  color: var(--typing-blue-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.typing-kicker::before,
.typing-best-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--typing-sky);
  box-shadow: 0 0 0 5px rgba(14, 165, 233, 0.10);
}

.typing-hero h1 {
  position: relative;
  z-index: 1;
  margin: 16px 0 10px;
  font-size: 34px;
  line-height: 1.08;
  font-weight: 800;
  color: var(--typing-ink);
}

.typing-hero p {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 800px;
  color: var(--typing-subtle);
  line-height: 1.9;
  font-size: 15px;
}

.typing-actions,
.typing-grid,
.typing-stats,
.typing-best-grid {
  display: grid;
  gap: 14px;
}

.typing-actions {
  margin-top: 24px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.typing-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.typing-card {
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
}

.typing-card h3,
.typing-panel h2,
.typing-best-card h3 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 800;
  color: var(--typing-ink);
}

.typing-card p,
.typing-panel p {
  margin: 0;
  color: var(--typing-subtle);
  line-height: 1.8;
}

.typing-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 16px;
  border: 1px solid rgba(191, 219, 254, 0.9);
  background: #eff6ff;
  color: var(--typing-blue-deep);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.typing-btn:hover {
  transform: translateY(-1px);
}

.typing-btn.primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.20);
}

.typing-panel {
  padding: 24px;
}

.typing-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.typing-stat,
.typing-best-item {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.92);
}

.typing-stat-label,
.typing-best-key {
  color: var(--typing-subtle);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.typing-stat-value,
.typing-best-value {
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--typing-blue-deep);
}

.typing-best-card {
  padding: 22px 24px;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 32%),
    linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
}

.typing-best-grid {
  margin-top: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.typing-word-board {
  padding: 26px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 30%),
    linear-gradient(135deg, #0f172a 0%, #132238 100%);
  color: #e2e8f0;
}

.typing-word-current {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.typing-word-queue {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.typing-word-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
}

.typing-word-chip.done {
  background: rgba(22, 163, 74, 0.18);
  color: #86efac;
}

.typing-word-chip.error {
  background: rgba(220, 38, 38, 0.18);
  color: #fca5a5;
}

.typing-input {
  width: 100%;
  min-height: 60px;
  padding: 16px 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  outline: none;
  font-size: 18px;
  color: var(--typing-ink);
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.typing-input:focus {
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.typing-hint,
.typing-message {
  margin-top: 12px;
  color: var(--typing-subtle);
  line-height: 1.8;
}

.typing-message.error {
  color: var(--typing-red);
}

.typing-message.success {
  color: var(--typing-green);
}

.typing-passage {
  padding: 24px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, #fffdf6 0%, #fff8e7 100%);
  border: 1px solid #fde68a;
  line-height: 2;
  font-size: 22px;
  letter-spacing: 0.01em;
  word-break: break-word;
  color: #4b5563;
}

.typing-char {
  border-radius: 6px;
  padding: 1px 1px;
}

.typing-char.correct {
  background: rgba(22, 163, 74, 0.18);
  color: #047857;
}

.typing-char.wrong {
  background: rgba(220, 38, 38, 0.18);
  color: #b91c1c;
}

.typing-char.current {
  background: #dbeafe;
  box-shadow: inset 0 -2px 0 #2563eb;
}

.typing-rank-table {
  overflow: hidden;
}

.typing-rank-table table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.typing-rank-table th,
.typing-rank-table td {
  padding: 13px 10px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.35;
}

.typing-rank-table thead th {
  font-size: 12px;
  font-weight: 800;
  color: #475569;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.typing-rank-table tbody tr:last-child td {
  border-bottom: 0;
}

.typing-rank-table th:nth-child(1),
.typing-rank-table td:nth-child(1) {
  width: 72px;
}

.typing-rank-table th:nth-child(2),
.typing-rank-table td:nth-child(2) {
  width: 108px;
}

.typing-rank-table th:nth-child(3),
.typing-rank-table td:nth-child(3),
.typing-rank-table th:nth-child(4),
.typing-rank-table td:nth-child(4),
.typing-rank-table th:nth-child(5),
.typing-rank-table td:nth-child(5) {
  width: 88px;
}

.typing-rank-table th:nth-child(6),
.typing-rank-table td:nth-child(6) {
  width: 156px;
}

.typing-rank-top {
  font-weight: 800;
  color: var(--typing-blue-deep);
}

.typing-self-row {
  background: rgba(37, 99, 235, 0.06);
}

.typing-inline-meta {
  margin-top: 14px;
  color: var(--typing-subtle);
  line-height: 1.8;
}

.typing-inline-actions {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.typing-empty {
  text-align: center;
  color: var(--typing-subtle);
  padding: 28px;
}

@media (max-width: 960px) {
  .typing-actions,
  .typing-grid,
  .typing-stats,
  .typing-best-grid {
    grid-template-columns: 1fr;
  }

  .typing-word-current {
    font-size: 32px;
  }

  .typing-passage {
    font-size: 18px;
  }

  .typing-rank-table table {
    table-layout: auto;
  }
}
