:root {
  color-scheme: light;
  font-family: Inter, Arial, sans-serif;
  background: #f7f9ff;
  color: #16213d;
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  padding: clamp(18px, 4vw, 42px);
  background:
    linear-gradient(#dfe6f7 1px, transparent 1px),
    linear-gradient(90deg, #dfe6f7 1px, transparent 1px),
    #f7f9ff;
  background-size: 28px 28px;
}

.typing-stage {
  width: min(100%, 820px);
  margin: 0 auto;
}

.typing-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.typing-heading span {
  color: #5672b9;
  font: 700 11px/1.2 "Courier New", monospace;
}

.typing-heading h1 {
  margin: 0;
  color: #2f6fed;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 0.95;
}

.typing-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}

.typing-input {
  min-width: 0;
  height: 48px;
  padding: 0 15px;
  border: 1px solid #aebcdd;
  border-radius: 6px;
  outline: 0;
  background: rgba(255, 255, 255, 0.94);
  color: #16213d;
  font: 600 17px/1 Inter, Arial, sans-serif;
}

.typing-input:focus {
  border-color: #2f6fed;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}

.typing-submit {
  min-width: 112px;
  height: 48px;
  border: 0;
  border-radius: 6px;
  background: #2f6fed;
  color: #fff;
  cursor: pointer;
  font: 700 14px/1 Inter, Arial, sans-serif;
}

.typing-submit:hover { background: #245bc6; }
.typing-submit:active { transform: translateY(1px); }

.sketch-shell {
  overflow: hidden;
  width: 100%;
  aspect-ratio: 13 / 8;
  border: 1px solid #aebcdd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 38px rgba(38, 65, 125, 0.1);
}

.sketch-shell canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.typing-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  padding-top: 12px;
  color: #647092;
  font: 600 11px/1.2 "Courier New", monospace;
}

.typing-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.typing-legend i {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
}

.legend-correct { background: #16213d; }
.legend-readable { background: #2f6fed; }
.legend-noise { border: 1px solid #8d96ad; }

@media (max-width: 520px) {
  body { padding: 16px; }
  .typing-heading { align-items: start; flex-direction: column-reverse; gap: 8px; }
  .typing-controls { grid-template-columns: 1fr; }
  .typing-submit { width: 100%; }
}
