/* ─────────────────────────────────────────────────────────────
   Keystroke — vintage typing manual
   Palette: warm cream paper · sepia ink · oxblood ribbon
   ───────────────────────────────────────────────────────────── */

:root {
  --paper:        #efe5ce;
  --paper-2:      #e6d9b8;
  --paper-deep:   #d8c89e;
  --paper-shade:  #c9b888;
  --ink:          #1c1410;
  --ink-2:        #3a2a1e;
  --ink-3:        #6b5640;
  --ink-4:        #998267;
  --ribbon:       #b6311a;
  --ribbon-deep:  #8a2412;
  --ribbon-soft:  #d96147;
  --moss:         #4f5d35;
  --brass:        #b08a3a;
  --shadow:       rgba(28, 20, 16, 0.18);
  --shadow-deep:  rgba(28, 20, 16, 0.45);

  --serif:    "Fraunces", "Frank Ruhl Libre", Georgia, serif;
  --serif-he: "Frank Ruhl Libre", "Fraunces", Georgia, serif;
  --sans-he:  "Heebo", "Frank Ruhl Libre", system-ui, sans-serif;
  --mono:     "JetBrains Mono", ui-monospace, "Frank Ruhl Libre", monospace;

  --max-w: 78rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-feature-settings: "ss01", "ss02";
  font-variation-settings: "SOFT" 60, "opsz" 14;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-lang="he"] body { font-family: var(--serif-he); }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 15% -10%, #f6ecd4 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 20%, #e6d6ab 0%, transparent 55%),
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 31px,
      rgba(70, 50, 30, 0.045) 32px
    ),
    var(--paper);
  overflow-x: hidden;
}

/* paper grain overlay */
.grain {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  opacity: 0.7;
  mix-blend-mode: multiply;
}

/* ─── Canvas ─────────────────────────────────────────────────── */

.canvas {
  position: relative;
  z-index: 2;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

/* ─── Masthead ───────────────────────────────────────────────── */

.masthead { margin-bottom: 2.25rem; }

.masthead__rule {
  height: 2px;
  background: var(--ink);
}
.masthead__rule--double {
  position: relative;
  margin-top: 0.75rem;
}
.masthead__rule--double::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 4px;
  height: 1px;
  background: var(--ink);
}

.masthead__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: end;
  padding: 1.75rem 0 1.5rem;
}

.masthead__brand { min-width: 0; }

.kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--ink-3);
  background: var(--paper);
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--ink);
  margin-bottom: 0.85rem;
  text-transform: uppercase;
}

html[data-lang="he"] .kicker { font-family: var(--sans-he); letter-spacing: 0.12em; }

.title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 900;
  font-variation-settings: "SOFT" 30, "opsz" 144;
  font-size: clamp(3.5rem, 8vw, 7rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--ink);
}
html[data-lang="he"] .title {
  font-family: var(--serif-he);
  font-weight: 800;
  letter-spacing: 0;
  font-size: clamp(3rem, 7.5vw, 6rem);
  line-height: 1;
}

.subtitle {
  margin: 0.85rem 0 0;
  font-family: var(--serif);
  font-weight: 300;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink-2);
  max-width: 32ch;
}
html[data-lang="he"] .subtitle {
  font-family: var(--serif-he);
  font-style: normal;
  font-weight: 400;
}
.subtitle em { font-style: normal; color: var(--ribbon); font-weight: 400; }

.masthead__meta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  min-width: 18rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-2);
}
html[data-lang="he"] .masthead__meta { font-family: var(--sans-he); }

.meta-line {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.meta-line__dots {
  flex: 1;
  border-bottom: 1px dotted var(--ink-3);
  transform: translateY(-3px);
}

/* Language toggle */
.lang-toggle {
  margin-top: 0.4rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.6rem;
  width: 8.5rem;
  height: 2.4rem;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  cursor: pointer;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--ink);
  user-select: none;
  transition: background 0.2s ease;
}
.lang-toggle:hover { background: var(--paper-2); }
.lang-toggle__option {
  position: relative;
  z-index: 2;
  padding: 0 0.4rem;
  transition: color 0.3s ease;
}
.lang-toggle__option[data-opt="he"] { font-family: var(--sans-he); font-size: 0.95rem; }
.lang-toggle__thumb {
  position: absolute;
  z-index: 1;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  background: var(--ink);
  border-radius: 999px;
  transition: transform 0.32s cubic-bezier(0.7, 0, 0.2, 1);
}
html[data-lang="en"] .lang-toggle__option[data-opt="en"] { color: var(--paper); }
html[data-lang="he"] .lang-toggle__option[data-opt="he"] { color: var(--paper); }
html[data-lang="he"] .lang-toggle__thumb { transform: translateX(100%); }

/* ─── Lesson rail ────────────────────────────────────────────── */

.lesson-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.25rem;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem 0.55rem 0.85rem;
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.18s ease;
  border-radius: 0;
}
html[data-lang="he"] .chip { font-family: var(--sans-he); font-size: 0.95rem; letter-spacing: 0; }

.chip__num {
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
  color: var(--ink-3);
  border-right: 1px solid var(--ink-3);
  padding-right: 0.45rem;
}
html[data-lang="he"] .chip__num { border-right: none; border-left: 1px solid var(--ink-3); padding-right: 0; padding-left: 0.45rem; }

.chip:hover { background: var(--paper-2); }
.chip:hover .chip__num { color: var(--ink-2); }

.chip--active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 4px 4px 0 var(--ribbon);
}
.chip--active .chip__num { color: var(--paper-2); border-color: var(--paper-2); }

/* ─── Page (typing area) ─────────────────────────────────────── */

.page {
  position: relative;
  background: linear-gradient(180deg, #f7eed7 0%, #ece1c1 100%);
  border: 1.5px solid var(--ink);
  padding: 3.5rem 3rem 2.5rem;
  margin-bottom: 2rem;
  box-shadow:
    8px 8px 0 var(--ink),
    8px 8px 0 1px var(--ink),
    20px 22px 30px -10px var(--shadow-deep);
  min-height: 14rem;
}

.page__rules {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 35px,
      rgba(70, 50, 30, 0.07) 36px
    );
  opacity: 0.6;
}

.page__corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--ink);
}
.page__corner--tl { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.page__corner--tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.page__corner--bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }
.page__corner--br { bottom: 10px; right: 10px; border-left: none; border-top: none; }

.passage {
  position: relative;
  font-family: var(--mono);
  font-size: clamp(1.5rem, 2.6vw, 2.05rem);
  line-height: 1.85;
  letter-spacing: 0.005em;
  color: var(--ink-4);
  outline: none;
  word-wrap: break-word;
  white-space: pre-wrap;
  user-select: none;
  cursor: text;
}

html[data-lang="he"] .passage {
  font-family: var(--serif-he);
  font-size: clamp(1.7rem, 2.9vw, 2.3rem);
  line-height: 1.9;
  font-weight: 500;
}

.ch {
  position: relative;
  display: inline-block;
  transition: color 0.08s ease;
}

.ch--ok  { color: var(--ink); }
.ch--err {
  color: var(--ribbon);
  background: rgba(182, 49, 26, 0.12);
  text-decoration: underline wavy var(--ribbon-deep);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

.ch--cur {
  color: var(--ink);
}
.ch--cur::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 3px;
  background: var(--ribbon);
  animation: cursorPulse 1s infinite;
}
html[data-lang="he"] .ch--cur::after { bottom: -4px; }

@keyframes cursorPulse {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.25; }
}

.passage--done .ch { color: var(--ink); opacity: 0.55; }

.hint {
  margin: 1.6rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  position: relative;
  padding-left: 1.4rem;
}
.hint::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--ribbon);
}
html[data-lang="he"] .hint {
  font-family: var(--sans-he);
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 0.95rem;
  padding-left: 0;
  padding-right: 1.4rem;
}
html[data-lang="he"] .hint::before { left: auto; right: 0; }

/* ─── Instruments (stats) ────────────────────────────────────── */

.instruments {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--paper-2);
  border: 1.5px solid var(--ink);
  position: relative;
}

.instruments::before {
  content: "INSTRUMENTS";
  position: absolute;
  top: -0.7rem;
  left: 1.2rem;
  background: var(--paper-2);
  padding: 0 0.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--ink-3);
}
html[data-lang="he"] .instruments::before { content: "מדדים"; left: auto; right: 1.2rem; font-family: var(--sans-he); letter-spacing: 0.1em; }

.meter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  border-left: 1px dashed var(--ink-3);
  padding-left: 1rem;
}
.meter:first-child { border-left: none; padding-left: 0; }
html[data-lang="he"] .meter { border-left: none; border-right: 1px dashed var(--ink-3); padding-left: 0; padding-right: 1rem; }
html[data-lang="he"] .meter:first-child { border-right: none; padding-right: 0; }

.meter__label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
html[data-lang="he"] .meter__label { font-family: var(--sans-he); letter-spacing: 0.05em; text-transform: none; }

.meter__value {
  display: flex;
  align-items: baseline;
  gap: 0.1rem;
  font-family: var(--serif);
  font-weight: 800;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.meter__value--small { font-size: 1.9rem; }
.meter__pct, .meter__sep { font-size: 0.55em; font-weight: 500; color: var(--ink-3); font-style: italic; }
.meter__sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-3);
}
html[data-lang="he"] .meter__sub { font-family: var(--serif-he); font-style: normal; }

.reset {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  align-self: center;
  padding: 0.65rem 1.1rem;
  background: var(--ink);
  color: var(--paper);
  border: none;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.2s ease;
}
.reset:hover { background: var(--ribbon); transform: translateY(-1px); }
html[data-lang="he"] .reset { font-family: var(--sans-he); letter-spacing: 0.04em; text-transform: none; }

/* ─── Keyboard ───────────────────────────────────────────────── */

.keyboard-frame {
  margin-bottom: 2.5rem;
  perspective: 1400px;
}

.keyboard-frame__plate {
  position: relative;
  background:
    linear-gradient(180deg, #2a201a 0%, #1a1410 100%);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
  padding: 1.6rem 1.6rem 1.4rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 180, 0.08),
    inset 0 -2px 8px rgba(0, 0, 0, 0.6),
    0 14px 30px -8px var(--shadow-deep),
    0 30px 60px -20px rgba(0,0,0,0.4);
  transform: rotateX(2deg);
  transform-style: preserve-3d;
}

.keyboard-frame__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0 0.4rem;
  color: #c9b888;
}
.keyboard-frame__brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  background: var(--brass);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 900;
  font-size: 1.05rem;
  border-radius: 50%;
  font-variation-settings: "opsz" 144, "SOFT" 30;
}
.keyboard-frame__brand-name {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.75;
}

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.kb-row {
  display: flex;
  gap: 0.5rem;
}
.kb-row--2 { padding-left: 1.4rem; }
.kb-row--3 { padding-left: 2.6rem; }

.key {
  position: relative;
  width: 3.1rem;
  height: 3.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f3e8cc 0%, #d8c293 100%);
  color: var(--ink);
  border: 1px solid #1a1410;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 230, 0.6),
    inset 0 -1px 1px rgba(0, 0, 0, 0.15),
    0 1px 0 #2a1f17,
    0 4px 0 #18120e,
    0 6px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
}
.key__alt {
  font-family: var(--sans-he);
  font-size: 0.65rem;
  color: var(--ink-3);
  font-weight: 500;
  margin-top: -2px;
  height: 0.85rem;
  line-height: 0.85rem;
}
html[data-lang="he"] .key {
  font-family: var(--sans-he);
  font-size: 1.25rem;
  font-weight: 700;
}
html[data-lang="he"] .key__alt {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
}

.key--wide  { width: 4.6rem; }
.key--xwide { width: 5.6rem; }
.key--space { width: 16rem; height: 2.6rem; font-size: 0.65rem; letter-spacing: 0.2em; color: var(--ink-3); }
.key--space .key__alt { display: none; }

.key--home::before {
  content: "";
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  opacity: 0.7;
}

.key--next {
  background: linear-gradient(180deg, #d96147 0%, #a8261a 100%);
  color: #fbe9d8;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 200, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.3),
    0 1px 0 #4a0f08,
    0 4px 0 #380a06,
    0 6px 14px rgba(217, 97, 71, 0.55);
  animation: keyPulse 1.4s ease-in-out infinite;
}
.key--next .key__alt { color: rgba(251, 233, 216, 0.7); }

@keyframes keyPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.key--press {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 230, 0.4),
    inset 0 -1px 1px rgba(0, 0, 0, 0.15),
    0 1px 0 #2a1f17,
    0 1px 0 #18120e,
    0 2px 4px rgba(0, 0, 0, 0.45);
}

.key--err {
  background: linear-gradient(180deg, #e8a59a 0%, #b6311a 100%) !important;
  color: #fbe9d8 !important;
}

.keyboard-frame__feet {
  position: absolute;
  inset: auto 0 -8px;
  display: flex;
  justify-content: space-between;
  padding: 0 1.5rem;
  pointer-events: none;
}
.screw {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #c9b888, #5a4a30 80%);
  box-shadow: 0 1px 1px rgba(0,0,0,0.4);
  position: relative;
}
.screw::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: linear-gradient(45deg, transparent 45%, var(--ink) 45%, var(--ink) 55%, transparent 55%);
  opacity: 0.6;
}

/* ─── Colophon ───────────────────────────────────────────────── */

.colophon {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-3);
}
html[data-lang="he"] .colophon { font-family: var(--serif-he); font-style: normal; }
.colophon .dot { color: var(--ribbon); font-style: normal; }

/* ─── Finished overlay ───────────────────────────────────────── */

.finished {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(28, 20, 16, 0.55);
  backdrop-filter: blur(6px);
  z-index: 50;
  animation: fadeIn 0.3s ease;
}
.finished[data-show="1"] { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.finished__card {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 2.5rem 3rem 2rem;
  text-align: center;
  box-shadow: 10px 10px 0 var(--ribbon), 10px 10px 0 1px var(--ink);
  max-width: 24rem;
  position: relative;
  animation: pop 0.4s cubic-bezier(0.2, 0.8, 0.3, 1.2);
}
@keyframes pop { from { transform: translateY(20px) scale(0.95); opacity: 0; } to { transform: none; opacity: 1; } }

.finished__kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--ribbon);
  margin-bottom: 0.6rem;
  border-bottom: 2px solid var(--ribbon);
  padding-bottom: 0.3rem;
}
html[data-lang="he"] .finished__kicker { font-family: var(--sans-he); letter-spacing: 0.1em; }

.finished__title {
  margin: 0 0 1.6rem;
  font-family: var(--serif);
  font-weight: 900;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: 3rem;
  line-height: 1;
  letter-spacing: -0.03em;
}
html[data-lang="he"] .finished__title { font-family: var(--serif-he); }

.finished__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.finished__stats > div { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.finished__stats b {
  font-family: var(--serif);
  font-weight: 800;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.finished__stats small {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
}
html[data-lang="he"] .finished__stats small { font-family: var(--sans-he); letter-spacing: 0.04em; text-transform: none; }

.finished__again {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 0.85rem 1.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.2s ease;
}
.finished__again:hover { background: var(--ribbon); }
html[data-lang="he"] .finished__again { font-family: var(--sans-he); letter-spacing: 0.04em; text-transform: none; }

/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 880px) {
  .canvas { padding: 1.5rem 1rem 3rem; }
  .masthead__row { grid-template-columns: 1fr; align-items: start; }
  .masthead__meta { min-width: auto; }
  .page { padding: 2.5rem 1.5rem 1.75rem; box-shadow: 5px 5px 0 var(--ink); }
  .instruments { grid-template-columns: repeat(2, 1fr); gap: 1.5rem 1rem; }
  .instruments .reset { grid-column: 1 / -1; justify-self: center; }
  .meter { border-left: none !important; border-right: none !important; padding: 0 !important; }
  .key { width: 2.3rem; height: 2.3rem; font-size: 0.85rem; }
  .key__alt { font-size: 0.55rem; }
  .key--space { width: 9rem; }
  .kb-row { gap: 0.3rem; }
  .kb-row--2 { padding-left: 0.8rem; }
  .kb-row--3 { padding-left: 1.4rem; }
}

@media (max-width: 540px) {
  .key { width: 1.85rem; height: 1.85rem; font-size: 0.7rem; border-radius: 4px; }
  .key__alt { display: none; }
  .key--space { width: 7rem; }
  .keyboard-frame__plate { padding: 1rem 0.6rem; }
}

/* ─── Shake ──────────────────────────────────────────────────── */

@keyframes shake-1 {
  0%, 100% { transform: translate(0,0); }
  20% { transform: translate(-3px,1px); }
  40% { transform: translate(3px,-2px); }
  60% { transform: translate(-2px,2px); }
  80% { transform: translate(3px,-1px); }
}
@keyframes shake-2 {
  0%, 100% { transform: translate(0,0); }
  20% { transform: translate(-6px,3px); }
  40% { transform: translate(5px,-4px); }
  60% { transform: translate(-4px,5px); }
  80% { transform: translate(6px,-3px); }
}
@keyframes shake-3 {
  0%, 100% { transform: translate(0,0); }
  20% { transform: translate(-10px,5px); }
  40% { transform: translate(8px,-7px); }
  60% { transform: translate(-6px,8px); }
  80% { transform: translate(10px,-5px); }
}

.canvas--shake-1 { animation: shake-1 0.2s ease; }
.canvas--shake-2 { animation: shake-2 0.25s ease; }
.canvas--shake-3 { animation: shake-3 0.3s ease; }

/* ─── Corruption ─────────────────────────────────────────────── */

.canvas {
  filter: saturate(var(--csat,1)) contrast(var(--ccon,1));
}

.masthead,
.lesson-rail,
.page,
.instruments,
.keyboard-frame,
.colophon,
.finished {
  transition: transform 0.4s cubic-bezier(.34,1.56,.64,1);
}

.keyboard-frame__plate {
  transition: transform 0.4s cubic-bezier(.34,1.56,.64,1);
}

.masthead {
  transform: translate(var(--cmh-x,0px),var(--cmh-y,0px)) rotate(var(--cmh-r,0deg));
}
.lesson-rail {
  transform: translate(var(--clr-x,0px),var(--clr-y,0px)) rotate(var(--clr-r,0deg));
}
.page {
  transform: translate(var(--cpg-x,0px),var(--cpg-y,0px)) rotate(var(--cpg-r,0deg));
}
.instruments {
  transform: translate(var(--cin-x,0px),var(--cin-y,0px)) rotate(var(--cin-r,0deg));
}
.keyboard-frame {
  transform: translate(var(--ckb-x,0px),var(--ckb-y,0px)) rotate(var(--ckb-r,0deg));
}
.keyboard-frame__plate {
  transform: rotateX(2deg) translate(var(--ckp-x,0px),var(--ckp-y,0px)) rotate(var(--ckp-r,0deg));
}
.colophon {
  transform: translate(var(--ccl-x,0px),var(--ccl-y,0px)) rotate(var(--ccl-r,0deg));
}
.finished {
  transform: translate(var(--cfin-x,0px),var(--cfin-y,0px)) rotate(var(--cfin-r,0deg));
}
