:root {
  --bg: radial-gradient(circle at top left, #1f2933 0, #020617 42%, #000000 100%);
  --panel: rgba(15, 23, 42, 0.96);
  --panel-soft: rgba(15, 23, 42, 0.85);
  --surface: rgba(2, 6, 23, 0.9);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --accent-strong: #16a34a;
  --orange: #f97316;
  --orange-soft: rgba(249, 115, 22, 0.16);
  --blue: #38bdf8;
  --border: rgba(148, 163, 184, 0.45);
  --shadow-soft: 0 30px 80px rgba(15, 23, 42, 0.9);
  --shadow-subtle: 0 18px 40px rgba(15, 23, 42, 0.65);
}

#gms-typing-root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background-image: var(--bg);
  margin: 0;
  padding: 32px 24px;
  box-sizing: border-box;
}

.gms-tt-container {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.gms-tt-left-panel {
  background: var(--panel);
  border-radius: 22px;
  padding: 20px 18px 18px 18px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.4);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gms-tt-right-panel {
  background: var(--surface);
  border-radius: 22px;
  padding: 18px 18px 20px 18px;
  box-shadow: var(--shadow-subtle);
  border: 1px solid rgba(30, 64, 175, 0.45);
  position: relative;
  overflow: hidden;
}

.gms-tt-right-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.42), transparent 60%);
  opacity: 0.7;
  pointer-events: none;
}

.gms-tt-right-panel > * {
  position: relative;
  z-index: 1;
}

.gms-tt-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 8px 4px 8px;
}

.gms-tt-header {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: #f9fafb;
}

.gms-tt-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.gms-tt-card {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.85));
  padding: 10px 10px 12px 10px;
}

.gms-tt-card-levels {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.96));
}

.gms-tt-card-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 8px;
}

.gms-tt-card-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: radial-gradient(circle, var(--accent) 0, transparent 70%);
}

.gms-tt-level-buttons {
  display: flex;
  gap: 8px;
}

.gms-tt-level-button {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.86);
  color: var(--muted);
  font-size: 13px;
  padding: 7px 0;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.08s ease-out, box-shadow 0.12s ease-out;
}

.gms-tt-level-button:hover {
  background: rgba(15, 23, 42, 0.98);
  color: #e5e7eb;
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(22, 163, 74, 0.38);
}

.gms-tt-level-button.active {
  background: linear-gradient(135deg, var(--accent-strong), #4ade80);
  border-color: transparent;
  color: #022c22;
  box-shadow: 0 12px 30px rgba(22, 163, 74, 0.65);
}

.gms-tt-lesson-select select {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: rgba(15, 23, 42, 0.98);
  color: var(--text);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  position: relative;
}

.gms-tt-lesson-select {
  position: relative;
}

.gms-tt-lesson-select::after {
  content: "▾";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}

/* Gauges - compact, card-like */
.gms-tt-gauges {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 2px;
}

#gms-gauge-accuracy {
  grid-column: span 2;
}

.gms-tt-gauge {
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.96));
  border-radius: 16px;
  border: 1px solid rgba(30, 64, 175, 0.55);
  padding: 6px 6px 10px 6px;
  text-align: center;
}

.gms-tt-gauge-svg {
  width: 100%;
  height: auto;
}

.gms-tt-gauge-track {
  fill: none;
  stroke: rgba(30, 64, 175, 0.45);
  stroke-width: 12;
  stroke-linecap: round;
}

.gms-tt-gauge-fill {
  fill: none;
  stroke: var(--blue);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 0 300;
}

.gms-tt-gauge-needle {
  stroke: var(--orange);
  stroke-width: 3.6;
  stroke-linecap: round;
}

.gms-tt-gauge-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: -4px;
}

.gms-tt-gauge-value {
  font-size: 18px;
  font-weight: 700;
  color: #e5e7eb;
}

.gms-tt-actions {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gms-tt-start-btn,
.gms-tt-reset-btn {
  width: 100%;
  border-radius: 999px;
  border: none;
  font-size: 15px;
  padding: 10px 0;
  cursor: pointer;
  transition: transform 0.08s ease-out, box-shadow 0.12s ease-out, filter 0.1s ease-out;
}

.gms-tt-start-btn {
  background: linear-gradient(135deg, var(--accent-strong), #4ade80);
  color: #022c22;
  box-shadow: 0 16px 35px rgba(22, 163, 74, 0.65);
}

.gms-tt-reset-btn {
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #2b1003;
  box-shadow: 0 12px 30px rgba(249, 115, 22, 0.7);
}

.gms-tt-start-btn:hover,
.gms-tt-reset-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.gms-tt-start-btn:active,
.gms-tt-reset-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.gms-tt-right-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.gms-tt-intro {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.gms-tt-reading-surface {
  border-radius: 18px;
  background-image: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(2, 6, 23, 0.96));
  border: 1px solid rgba(30, 64, 175, 0.6);
  padding: 18px 18px 16px 18px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.95);
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.gms-tt-target {
  font-family: Consolas, "Courier New", monospace;
  font-size: 16px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  text-align: justify;
  margin-bottom: 14px;
  padding: 10px 10px 12px 10px;
  border-radius: 12px;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0.92),
    rgba(15, 23, 42, 0.92) 26px,
    rgba(31, 41, 55, 0.96) 27px
  );
  box-shadow: inset 0 0 0 1px rgba(30, 64, 175, 0.35);
}

.gms-tt-input {
  /* visually hidden but still focusable to capture typing */
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  border: 0;
  padding: 0;
  margin: 0;
}

.gms-tt-target span.ok {
  color: var(--accent);
}

.gms-tt-target span.bad {
  color: #f97373;
  text-decoration: underline;
}

.gms-tt-target span.todo {
  color: #6b7280;
}

.gms-tt-keyboard {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(30, 64, 175, 0.5);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gms-tt-key-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.gms-tt-key {
  min-width: 28px;
  padding: 6px 6px;
  border-radius: 7px;
  border: 1px solid rgba(30, 64, 175, 0.6);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.98));
  color: #e5e7eb;
  font-size: 11px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.8);
  transition: background 0.1s ease-out, box-shadow 0.1s ease-out, transform 0.06s ease-out, border-color 0.12s ease-out;
}

.gms-tt-key-space {
  min-width: 40%;
  text-align: center;
}

.gms-tt-key.is-next {
  border-color: var(--accent);
  background: radial-gradient(circle at top, rgba(22, 163, 74, 0.18), rgba(15, 23, 42, 0.96));
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.5), 0 8px 20px rgba(22, 163, 74, 0.8);
}

.gms-tt-key.is-pressed {
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.9);
}

@media (max-width: 900px) {
  #gms-typing-root {
    padding: 16px 14px 22px 14px;
  }

  .gms-tt-container {
    grid-template-columns: minmax(0, 1fr);
  }
}

