:root {
  color-scheme: dark;
  --graphite: #17232a;
  --graphite-deep: #0d171c;
  --platen: #253840;
  --platen-light: #36505a;
  --paper: #e7ece8;
  --paper-warm: #f4f1e8;
  --ink: #172025;
  --ink-soft: #425158;
  --line: #829097;
  --line-dark: #0b1216;
  --orange: #c95a30;
  --orange-surface: #b94722;
  --orange-dark: #8f3519;
  --correct: #215d52;
  --correction: #ad3038;
  --correction-dark: #741c22;
  --focus: #f5c84b;
  --white: #ffffff;
  --shadow: #091115;
  --display: "Arial Narrow", "Bahnschrift SemiCondensed", "Noto Sans",
    "Microsoft JhengHei", sans-serif;
  --body: "Segoe UI", "Noto Sans", "Microsoft JhengHei", sans-serif;
  --mono: "Cascadia Mono", "Consolas", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--graphite);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--graphite);
  color: var(--white);
  font-family: var(--body);
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
}

button,
summary,
select {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 10000;
  top: 8px;
  left: 8px;
  min-height: 44px;
  padding: 11px 16px;
  border: 3px solid var(--ink);
  background: var(--focus);
  color: var(--ink);
  font-weight: 800;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(100%, 1440px);
  min-height: 100vh;
  margin: 0 auto;
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(144px, 1fr) auto minmax(144px, 1fr);
  align-items: center;
  min-height: 76px;
  padding: 10px clamp(16px, 3vw, 42px);
  border-bottom: 1px solid var(--platen-light);
  background: var(--graphite-deep);
}

.back-link,
.settings > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--platen-light);
  border-radius: 4px;
  background: transparent;
  color: var(--paper);
  font-family: var(--display);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.back-link {
  justify-self: start;
  padding: 0 14px 0 11px;
}

.back-link:hover,
.settings > summary:hover {
  border-color: var(--paper);
  background: var(--platen);
  color: var(--white);
}

.back-link:active,
.settings > summary:active {
  transform: translateY(1px);
}

.control-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.8;
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 11px;
  min-width: 0;
}

.press-mark {
  position: relative;
  display: grid;
  width: 42px;
  height: 46px;
  place-items: center;
  border: 2px solid var(--paper);
  background: var(--orange);
  color: var(--paper-warm);
  font-family: var(--mono);
  line-height: 1;
  transform: rotate(-2deg);
}

.press-mark::before,
.press-mark::after {
  position: absolute;
  right: 4px;
  left: 4px;
  height: 1px;
  background: currentColor;
  content: "";
  opacity: 0.65;
}

.press-mark::before {
  top: 5px;
}

.press-mark::after {
  bottom: 5px;
}

.press-mark b {
  margin-top: -2px;
  font-size: 1.45rem;
  font-weight: 900;
}

.press-mark i {
  position: absolute;
  right: 3px;
  bottom: 6px;
  padding-left: 2px;
  background: var(--orange);
  font-size: 0.52rem;
  font-style: normal;
  font-weight: 900;
}

.brand-lockup > div {
  min-width: 0;
}

.desk-label {
  display: block;
  margin-bottom: 2px;
  color: #aebdc2;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.19em;
  line-height: 1;
}

.brand-lockup h1 {
  margin: 0;
  color: var(--paper);
  font-family: var(--display);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-stretch: condensed;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.settings {
  position: relative;
  justify-self: end;
}

.settings > summary {
  padding: 0 12px;
  list-style: none;
  cursor: pointer;
}

.settings > summary::-webkit-details-marker {
  display: none;
}

.settings[open] > summary {
  border-color: var(--focus);
  color: var(--focus);
}

.settings-panel {
  position: absolute;
  z-index: 50;
  top: calc(100% + 10px);
  right: 0;
  width: min(280px, calc(100vw - 24px));
  padding: 17px;
  border: 2px solid var(--paper);
  border-radius: 6px;
  background: var(--graphite-deep);
  box-shadow: 7px 7px 0 var(--shadow);
}

.settings-panel label {
  display: block;
  margin-bottom: 7px;
  color: #bbc8cc;
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.settings-panel select {
  width: 100%;
  min-height: 44px;
  padding: 0 36px 0 11px;
  border: 2px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
}

.version-row {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--platen-light);
  color: #bbc8cc;
  font-family: var(--mono);
  font-size: 0.73rem;
}

.version-row strong {
  color: var(--focus);
}

.typing-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(238px, 24vw, 292px);
  gap: clamp(12px, 2.1vw, 28px);
  align-items: stretch;
  width: min(100%, 1280px);
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: clamp(14px, 2.3vw, 30px);
}

.instrument-rail {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(18px, 2.5vw, 28px);
  border: 1px solid var(--platen-light);
  border-radius: 6px;
  background: var(--platen);
  box-shadow: 8px 8px 0 var(--shadow);
}

.deadline {
  padding-bottom: 20px;
  border-bottom: 1px solid #53666e;
}

.deadline-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.deadline-copy span {
  color: #b9c5c9;
  font-family: var(--mono);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.deadline-copy strong {
  color: var(--paper);
  font-family: var(--display);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}

.deadline-track {
  position: relative;
  height: 8px;
  margin-top: 13px;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  background: var(--graphite-deep);
}

.deadline-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--focus);
  transform-origin: left center;
  transition: width 180ms linear;
}

.deadline-track.is-urgent span {
  background: #e4544f;
}

.stats-strip {
  display: grid;
  gap: 0;
  margin: 18px 0 0;
}

.stats-strip > div {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  min-height: 118px;
  padding: 18px 0;
  border-bottom: 1px solid #53666e;
}

.stats-strip > div:last-child {
  border-bottom: 0;
}

.stats-strip dt {
  padding-bottom: 8px;
  color: #b9c5c9;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.stats-strip dd {
  display: flex;
  align-items: baseline;
  margin: 0;
  color: var(--paper);
  font-family: var(--display);
  font-size: clamp(2.65rem, 6vw, 4.7rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.85;
}

.stats-strip small {
  margin-left: 4px;
  color: var(--focus);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
}

.time-stat dd {
  color: var(--focus);
}

.workbench {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: clamp(18px, 3vw, 34px);
  border: 2px solid var(--line-dark);
  border-radius: 7px;
  background: var(--paper-warm);
  color: var(--ink);
  box-shadow: 10px 10px 0 var(--shadow);
}

.copy-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}

.copy-identity {
  min-width: 0;
}

.copy-identity > span {
  display: inline-block;
  padding: 4px 7px 3px;
  border: 1px solid var(--orange-dark);
  background: var(--orange-surface);
  color: var(--paper-warm);
  font-family: var(--mono);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1;
  text-transform: uppercase;
}

.copy-identity h2 {
  margin: 7px 0 0;
  font-family: var(--display);
  font-size: clamp(1.15rem, 2.6vw, 1.75rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1;
}

.difficulty-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  gap: 4px;
}

.difficulty-control button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.difficulty-control button:hover {
  background: #d9ded9;
}

.difficulty-control button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper-warm);
}

.difficulty-control button:active {
  transform: translateY(1px);
}

.copy-sheet {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding: clamp(18px, 4vh, 42px) clamp(2px, 1vw, 12px);
}

.job-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: clamp(12px, 2.2vh, 20px);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.text-display {
  min-height: 4.2em;
  margin: 0;
  overflow-wrap: anywhere;
  color: #69777d;
  font-family: var(--mono);
  font-size: clamp(1.15rem, 2.35vw, 1.76rem);
  font-variant-ligatures: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.72;
  white-space: pre-wrap;
}

.text-display span {
  position: relative;
  display: inline;
  border-radius: 1px;
  transition:
    background-color 120ms ease,
    color 120ms ease;
}

.text-display .pending {
  color: #59666b;
}

.text-display .correct {
  color: var(--correct);
}

.text-display .incorrect {
  background: #efd5d5;
  color: var(--correction-dark);
  font-weight: 900;
  text-decoration: underline;
  text-decoration-color: var(--correction);
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

.text-display .incorrect::after {
  position: absolute;
  bottom: -7px;
  left: 50%;
  width: 0;
  height: 0;
  border-right: 3px solid transparent;
  border-bottom: 0;
  border-left: 3px solid transparent;
  border-top: 4px solid var(--correction);
  content: "";
  transform: translateX(-50%);
}

.text-display .current {
  background: var(--orange-surface);
  color: var(--paper-warm);
  font-weight: 900;
  box-shadow:
    0 0 0 2px var(--orange-surface),
    0 3px 0 var(--orange-dark);
}

.carriage-track {
  position: relative;
  height: 14px;
  margin: clamp(17px, 2.6vh, 25px) 0 clamp(18px, 3.5vh, 34px);
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--line);
  background: #d4d9d5;
}

.carriage-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--orange);
  transition: width 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.carriage-head {
  position: absolute;
  top: 50%;
  left: 0;
  width: 8px;
  height: 26px;
  border: 2px solid var(--ink);
  background: var(--focus);
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(-50%, -50%);
  transition: left 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.input-label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 54px;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 4px 4px 0 #c0c6c2;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.input-row:focus-within {
  border-color: var(--orange-dark);
  box-shadow:
    0 0 0 4px var(--focus),
    5px 5px 0 var(--ink);
}

.input-row[data-state="complete"] {
  border-color: var(--correct);
}

.input-row[data-state="timeup"] {
  border-color: var(--correction);
}

.input-row.is-error {
  border-color: var(--correction);
  animation: correction-jolt 180ms ease-out;
}

#typing-input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  caret-color: var(--orange-dark);
  font-family: var(--mono);
  font-size: max(1rem, 16px);
  font-weight: 700;
}

#typing-input::placeholder {
  color: #59666b;
  font-weight: 500;
  opacity: 1;
}

#typing-input:disabled {
  color: var(--ink-soft);
  opacity: 1;
}

.restart-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 136px;
  min-height: 50px;
  padding: 0 16px;
  border: 0;
  border-left: 2px solid var(--ink);
  border-radius: 0;
  background: var(--orange-surface);
  color: var(--paper-warm);
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  transition:
    background-color 160ms ease,
    transform 160ms ease;
}

.restart-button:hover {
  background: var(--orange-dark);
}

.restart-button:active {
  transform: translateY(1px);
}

.restart-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-width: 2;
}

.typing-instructions {
  margin: 11px 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.5;
}

.feedback-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding-top: 13px;
  border-top: 1px solid #aab3ad;
}

.feedback-bar p {
  margin: 0;
}

#input-feedback {
  max-width: 62%;
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 750;
  line-height: 1.4;
}

.copy-language-note {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.64rem;
  line-height: 1.45;
  text-align: right;
}

.result-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 16px 18px;
  border: 2px solid var(--ink);
  background: var(--focus);
  color: var(--ink);
  animation: result-in 220ms ease-out;
}

.result-panel span {
  display: block;
  margin-bottom: 3px;
  font-family: var(--mono);
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.result-panel h2,
.result-panel p {
  margin: 0;
}

.result-panel h2 {
  font-family: var(--display);
  font-size: 1.2rem;
}

.result-panel p {
  font-family: var(--mono);
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  font-weight: 900;
}

:where(
    .back-link,
    .settings > summary,
    .settings-panel select,
    .difficulty-control button,
    #typing-input,
    .restart-button,
    .copy-sheet
  ):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.workbench :where(button, input):focus-visible {
  outline-color: var(--orange-dark);
}

#typing-input:focus-visible {
  outline: 0;
}

#fa-help-btn,
.fa-help-btn,
.fa-help-button {
  width: 48px !important;
  min-width: 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  border: 2px solid var(--paper) !important;
  border-radius: 4px !important;
  background: var(--orange-surface) !important;
  color: var(--paper-warm) !important;
  box-shadow: 4px 4px 0 var(--shadow) !important;
}

#fa-help-btn:focus-visible,
.fa-help-btn:focus-visible,
.fa-help-button:focus-visible {
  outline: 3px solid var(--focus) !important;
  outline-offset: 3px !important;
}

@keyframes correction-jolt {
  33% {
    transform: translateX(-4px);
  }
  66% {
    transform: translateX(3px);
  }
}

@keyframes result-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 52px 1fr 52px;
    min-height: 68px;
    padding: 8px 12px;
  }

  .back-link,
  .settings > summary {
    width: 44px;
    padding: 0;
  }

  .back-link span,
  .settings > summary span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .typing-main {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 68px);
    padding: 12px;
  }

  .instrument-rail,
  .workbench {
    grid-column: 1;
  }

  .instrument-rail {
    grid-row: 1;
    padding: 14px;
    box-shadow: 5px 5px 0 var(--shadow);
  }

  .workbench {
    grid-row: 2;
    padding: 18px;
    box-shadow: 6px 6px 0 var(--shadow);
  }

  .deadline {
    padding-bottom: 12px;
  }

  .stats-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 10px;
  }

  .stats-strip > div {
    display: block;
    min-height: 0;
    padding: 10px 12px;
    border-right: 1px solid #53666e;
    border-bottom: 0;
  }

  .stats-strip > div:first-child {
    padding-left: 0;
  }

  .stats-strip > div:last-child {
    padding-right: 0;
    border-right: 0;
  }

  .stats-strip dt {
    padding-bottom: 6px;
  }

  .stats-strip dd {
    font-size: clamp(2rem, 12vw, 3.3rem);
  }

  .copy-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  .difficulty-control {
    width: 100%;
  }

  .copy-sheet {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .text-display {
    min-height: 5.1em;
    font-size: clamp(1.04rem, 4.8vw, 1.35rem);
  }
}

@media (max-width: 480px) {
  .brand-lockup {
    gap: 8px;
  }

  .press-mark {
    width: 36px;
    height: 40px;
  }

  .press-mark b {
    font-size: 1.18rem;
  }

  .desk-label {
    font-size: 0.55rem;
  }

  .brand-lockup h1 {
    overflow: hidden;
    font-size: 0.98rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .settings-panel {
    position: fixed;
    top: 62px;
    right: 12px;
  }

  .typing-main {
    gap: 10px;
    padding: 10px;
  }

  .workbench {
    padding: 15px;
  }

  .deadline-copy span,
  .deadline-copy strong {
    font-size: 0.63rem;
  }

  .stats-strip > div {
    padding-right: 8px;
    padding-left: 8px;
  }

  .stats-strip dt {
    min-height: 2.7em;
    font-size: 0.58rem;
    line-height: 1.35;
  }

  .stats-strip dd {
    font-size: clamp(1.8rem, 12vw, 2.65rem);
  }

  .copy-toolbar {
    padding-bottom: 14px;
  }

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

  .difficulty-control button {
    padding: 0 7px;
  }

  .job-line {
    letter-spacing: 0.04em;
  }

  .input-row {
    grid-template-columns: minmax(0, 1fr) 52px;
  }

  #typing-input {
    padding: 0 11px;
  }

  .restart-button {
    min-width: 52px;
    padding: 0;
  }

  .restart-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .feedback-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  #input-feedback {
    max-width: none;
  }

  .copy-language-note {
    text-align: left;
  }

  .result-panel {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  #fa-help-btn,
  .fa-help-btn,
  .fa-help-button {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }
}

@media (min-width: 521px) and (max-height: 540px) {
  .topbar {
    grid-template-columns: minmax(106px, 1fr) auto minmax(106px, 1fr);
    min-height: 48px;
    padding: 2px 10px;
  }

  .back-link,
  .settings > summary {
    min-height: 44px;
    padding: 0 10px;
    font-size: 0.7rem;
  }

  .press-mark {
    width: 30px;
    height: 34px;
    border-width: 1px;
  }

  .press-mark b {
    font-size: 1rem;
  }

  .press-mark i {
    bottom: 4px;
    font-size: 0.43rem;
  }

  .desk-label {
    font-size: 0.5rem;
  }

  .brand-lockup h1 {
    font-size: 0.88rem;
  }

  .settings-panel {
    top: calc(100% + 4px);
  }

  .typing-main {
    grid-template-columns: minmax(0, 1fr) clamp(170px, 31vw, 226px);
    gap: 8px;
    min-height: calc(100vh - 49px);
    padding: 6px;
  }

  .instrument-rail {
    grid-column: 2;
    grid-row: 1;
    padding: 10px;
    box-shadow: 4px 4px 0 var(--shadow);
  }

  .workbench {
    grid-column: 1;
    grid-row: 1;
    padding: 10px 12px;
    box-shadow: 4px 4px 0 var(--shadow);
  }

  .deadline {
    padding-bottom: 8px;
  }

  .deadline-copy {
    gap: 5px;
  }

  .deadline-copy span,
  .deadline-copy strong {
    font-size: 0.54rem;
  }

  .deadline-track {
    height: 6px;
    margin-top: 6px;
  }

  .stats-strip {
    grid-template-columns: 1fr;
    margin-top: 4px;
  }

  .stats-strip > div {
    display: grid;
    grid-template-columns: 1fr auto;
    min-height: 0;
    padding: 5px 0;
    border-right: 0;
    border-bottom: 1px solid #53666e;
  }

  .stats-strip > div:last-child {
    border-bottom: 0;
  }

  .stats-strip dt {
    min-height: 0;
    padding: 0;
    font-size: 0.54rem;
  }

  .stats-strip dd {
    font-size: clamp(1.35rem, 7vh, 2rem);
  }

  .stats-strip small {
    font-size: 0.55rem;
  }

  .copy-toolbar {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    padding-bottom: 7px;
    border-bottom-width: 1px;
  }

  .copy-identity > span {
    padding: 2px 4px;
    font-size: 0.45rem;
  }

  .copy-identity h2 {
    margin-top: 3px;
    font-size: 0.82rem;
  }

  .difficulty-control {
    width: auto;
    grid-template-columns: repeat(3, minmax(48px, 1fr));
    gap: 2px;
  }

  .difficulty-control button {
    min-height: 44px;
    padding: 0 6px;
    font-size: 0.74rem;
  }

  .copy-sheet {
    justify-content: flex-start;
    padding: 7px 0 5px;
  }

  .job-line {
    margin-bottom: 5px;
    font-size: 0.48rem;
  }

  .text-display {
    min-height: 3.2em;
    height: 3.2em;
    overflow-y: auto;
    font-size: clamp(0.875rem, 3.4vh, 1rem);
    line-height: 1.42;
    scrollbar-width: thin;
  }

  .carriage-track {
    height: 8px;
    margin: 6px 0 7px;
    border-top-width: 2px;
  }

  .carriage-head {
    width: 6px;
    height: 16px;
    border-width: 1px;
    box-shadow: 1px 1px 0 var(--ink);
  }

  .input-label {
    margin-bottom: 3px;
    font-size: 0.5rem;
  }

  .input-row {
    grid-template-columns: minmax(0, 1fr) 48px;
    min-height: 44px;
    border-width: 1px;
    box-shadow: 2px 2px 0 #c0c6c2;
  }

  #typing-input {
    min-height: 44px;
    padding: 0 8px;
    font-size: 16px;
  }

  .restart-button {
    min-width: 48px;
    min-height: 44px;
    padding: 0;
    border-left-width: 1px;
  }

  .restart-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .typing-instructions {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .copy-language-note {
    display: none;
  }

  .feedback-bar {
    min-height: 22px;
    padding-top: 5px;
  }

  #input-feedback {
    max-width: 100%;
    font-size: 0.74rem;
  }

  .result-panel {
    margin-top: 0;
    padding: 3px 6px;
    border-width: 1px;
  }

  .result-panel span {
    display: none;
  }

  .result-panel h2,
  .result-panel p {
    font-size: 0.75rem;
    line-height: 1.1;
  }

  .workbench:has(.result-panel:not([hidden])) .feedback-bar {
    display: none;
  }

  #fa-help-btn,
  .fa-help-btn,
  .fa-help-button {
    top: 2px !important;
    right: clamp(92px, 17vw, 150px) !important;
    bottom: auto !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }
}

@media (pointer: coarse) {
  .difficulty-control button,
  .restart-button,
  .back-link,
  .settings > summary,
  .settings-panel select {
    min-height: 44px;
  }
}

@media (prefers-contrast: more) {
  :root {
    --paper: #ffffff;
    --paper-warm: #ffffff;
    --ink-soft: #26373f;
    --line: #4b5c64;
  }

  .back-link,
  .settings > summary,
  .difficulty-control button,
  .input-row {
    border-width: 3px;
  }

  .text-display .pending {
    color: #44545b;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .press-mark {
    transform: none;
  }
}

@media (forced-colors: active) {
  :root {
    color-scheme: light dark;
  }

  .back-link,
  .settings > summary,
  .difficulty-control button,
  .input-row,
  .settings-panel select {
    border-color: ButtonText;
  }

  .text-display .incorrect {
    text-decoration-color: LinkText;
  }
}
