@font-face {
  font-family: "Syne";
  src: url("/fara-echer/assets/Syne.79bc839264c4.woff2") format("woff2");
  font-weight: 700 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/fara-echer/assets/Manrope.ce093b341d9c.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBMPlexMono";
  src: url("/fara-echer/assets/IBMPlexMono.81fc864103e7.woff2") format("woff2");
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0e14;
  --bg-panel: #121824;
  --bg-stage: #0d121c;
  --border: #223046;
  --border-focus: #38bdf8;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #7d8ea6;
  --accent: #fbbf24;
  --accent-gold: #f59e0b;
  --cyan: #38bdf8;
  --rose: #f43f5e;
  --emerald: #10b981;
  --font-heading: "Syne", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBMPlexMono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  top: -999px;
  left: 1rem;
  background: var(--cyan);
  color: #000;
  padding: 0.5rem 1rem;
  font-weight: 700;
  z-index: 100;
  border-radius: 4px;
}
.skip-link:focus {
  top: 1rem;
}

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(8px);
}

.brand {
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.brand:hover, .brand:focus-visible {
  color: var(--cyan);
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.nav-links a:hover, .nav-links a:focus-visible {
  color: var(--text-main);
}
.lang-toggle {
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-panel);
}
.lang-toggle:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.game-hero {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
  letter-spacing: -0.02em;
}

h1 em {
  font-style: normal;
  color: var(--cyan);
}

.deck {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 68ch;
}
.deck strong {
  color: var(--text-main);
}

.trust {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Workshop Stage */
.workshop-stage {
  position: relative;
  background: var(--bg-stage);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(30, 41, 59, 0.4) 0%, transparent 80%),
    linear-gradient(to right, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px, 24px 24px;
}

.round-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 0.6rem;
}

.round-badge {
  color: var(--accent);
  font-weight: 600;
}

.round-title {
  color: var(--text-muted);
}

/* Canvas / SVG Stage */
.stage-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.stage-canvas-wrap:active {
  cursor: grabbing;
}

.machinist-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Real-time Angle Readout Banner */
.readout-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-align: center;
}

.angle-display {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.02em;
}

.reveal-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.reveal-badge[data-type="perfect"] {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  border: 1px solid var(--emerald);
}
.reveal-badge[data-type="obtuse"] {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
  border: 1px solid var(--cyan);
}
.reveal-badge[data-type="acute"] {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose);
  border: 1px solid var(--rose);
}

/* Control Buttons & Nudges */
.stage-controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.nudge-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nudge-btn {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background-color 0.15s;
}
.nudge-btn:hover {
  border-color: var(--cyan);
  background: #1a2334;
}
.nudge-btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.action-btn {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  width: 100%;
  max-width: 320px;
  min-height: 52px;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #0b0e14;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
}
.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
}
.action-btn:active {
  transform: translateY(1px);
}
.action-btn:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.keyboard-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-align: center;
}
.stage-controls:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 6px;
  border-radius: 8px;
}

/* Attempts Slot List */
.attempts-section {
  margin-top: 2rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.section-heading {
  margin-bottom: 1rem;
}
.section-heading h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}
.section-heading p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.attempts-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.attempt-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-stage);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.attempt-idx {
  color: var(--text-dim);
  font-weight: 600;
}

.attempt-bar-track {
  position: relative;
  height: 8px;
  background: #1e293b;
  border-radius: 4px;
  overflow: hidden;
}

.attempt-target-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  z-index: 2;
}

.attempt-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  border-radius: 2px;
  transform: translateX(-50%);
  z-index: 3;
  display: none;
}

.attempt-val {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
}

/* Summary Section */
.summary-section {
  margin-top: 2rem;
  background: linear-gradient(180deg, #161f2e 0%, #0e1520 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.summary-heading h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
}

.summary-card {
  background: var(--bg-stage);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.summary-card dt {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.summary-card dd {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

.summary-sentence {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.5;
}

.summary-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.mastery-callout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-secondary {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  min-height: 44px;
}
.btn-secondary:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.share-status {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--emerald);
}

/* 5-joint Blueprint Overlay */
.blueprint-wrap {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  background: #080c12;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

/* Method Note */
.method-section {
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.method-section h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.method-section p {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.method-section a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.method-section a:visited {
  color: #a5b4fc;
}

footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
footer a {
  color: var(--text-muted);
  text-decoration: none;
}
footer a:hover {
  color: var(--cyan);
}

/* Screen-reader-only live status (CSP-safe: class only, no inline styles) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Attempt markers: state via class + data attributes (CSP style-src 'self' forbids inline styles) */
.attempt-marker.is-visible {
  display: block;
}
.attempt-marker[data-type="perfect"] {
  background: #10b981;
}
.attempt-marker[data-type="obtuse"] {
  background: #06b6d4;
}
.attempt-marker[data-type="acute"] {
  background: #f43f5e;
}
.attempt-marker[data-pos="0"] { left: 0%; }
.attempt-marker[data-pos="1"] { left: 1%; }
.attempt-marker[data-pos="2"] { left: 2%; }
.attempt-marker[data-pos="3"] { left: 3%; }
.attempt-marker[data-pos="4"] { left: 4%; }
.attempt-marker[data-pos="5"] { left: 5%; }
.attempt-marker[data-pos="6"] { left: 6%; }
.attempt-marker[data-pos="7"] { left: 7%; }
.attempt-marker[data-pos="8"] { left: 8%; }
.attempt-marker[data-pos="9"] { left: 9%; }
.attempt-marker[data-pos="10"] { left: 10%; }
.attempt-marker[data-pos="11"] { left: 11%; }
.attempt-marker[data-pos="12"] { left: 12%; }
.attempt-marker[data-pos="13"] { left: 13%; }
.attempt-marker[data-pos="14"] { left: 14%; }
.attempt-marker[data-pos="15"] { left: 15%; }
.attempt-marker[data-pos="16"] { left: 16%; }
.attempt-marker[data-pos="17"] { left: 17%; }
.attempt-marker[data-pos="18"] { left: 18%; }
.attempt-marker[data-pos="19"] { left: 19%; }
.attempt-marker[data-pos="20"] { left: 20%; }
.attempt-marker[data-pos="21"] { left: 21%; }
.attempt-marker[data-pos="22"] { left: 22%; }
.attempt-marker[data-pos="23"] { left: 23%; }
.attempt-marker[data-pos="24"] { left: 24%; }
.attempt-marker[data-pos="25"] { left: 25%; }
.attempt-marker[data-pos="26"] { left: 26%; }
.attempt-marker[data-pos="27"] { left: 27%; }
.attempt-marker[data-pos="28"] { left: 28%; }
.attempt-marker[data-pos="29"] { left: 29%; }
.attempt-marker[data-pos="30"] { left: 30%; }
.attempt-marker[data-pos="31"] { left: 31%; }
.attempt-marker[data-pos="32"] { left: 32%; }
.attempt-marker[data-pos="33"] { left: 33%; }
.attempt-marker[data-pos="34"] { left: 34%; }
.attempt-marker[data-pos="35"] { left: 35%; }
.attempt-marker[data-pos="36"] { left: 36%; }
.attempt-marker[data-pos="37"] { left: 37%; }
.attempt-marker[data-pos="38"] { left: 38%; }
.attempt-marker[data-pos="39"] { left: 39%; }
.attempt-marker[data-pos="40"] { left: 40%; }
.attempt-marker[data-pos="41"] { left: 41%; }
.attempt-marker[data-pos="42"] { left: 42%; }
.attempt-marker[data-pos="43"] { left: 43%; }
.attempt-marker[data-pos="44"] { left: 44%; }
.attempt-marker[data-pos="45"] { left: 45%; }
.attempt-marker[data-pos="46"] { left: 46%; }
.attempt-marker[data-pos="47"] { left: 47%; }
.attempt-marker[data-pos="48"] { left: 48%; }
.attempt-marker[data-pos="49"] { left: 49%; }
.attempt-marker[data-pos="50"] { left: 50%; }
.attempt-marker[data-pos="51"] { left: 51%; }
.attempt-marker[data-pos="52"] { left: 52%; }
.attempt-marker[data-pos="53"] { left: 53%; }
.attempt-marker[data-pos="54"] { left: 54%; }
.attempt-marker[data-pos="55"] { left: 55%; }
.attempt-marker[data-pos="56"] { left: 56%; }
.attempt-marker[data-pos="57"] { left: 57%; }
.attempt-marker[data-pos="58"] { left: 58%; }
.attempt-marker[data-pos="59"] { left: 59%; }
.attempt-marker[data-pos="60"] { left: 60%; }
.attempt-marker[data-pos="61"] { left: 61%; }
.attempt-marker[data-pos="62"] { left: 62%; }
.attempt-marker[data-pos="63"] { left: 63%; }
.attempt-marker[data-pos="64"] { left: 64%; }
.attempt-marker[data-pos="65"] { left: 65%; }
.attempt-marker[data-pos="66"] { left: 66%; }
.attempt-marker[data-pos="67"] { left: 67%; }
.attempt-marker[data-pos="68"] { left: 68%; }
.attempt-marker[data-pos="69"] { left: 69%; }
.attempt-marker[data-pos="70"] { left: 70%; }
.attempt-marker[data-pos="71"] { left: 71%; }
.attempt-marker[data-pos="72"] { left: 72%; }
.attempt-marker[data-pos="73"] { left: 73%; }
.attempt-marker[data-pos="74"] { left: 74%; }
.attempt-marker[data-pos="75"] { left: 75%; }
.attempt-marker[data-pos="76"] { left: 76%; }
.attempt-marker[data-pos="77"] { left: 77%; }
.attempt-marker[data-pos="78"] { left: 78%; }
.attempt-marker[data-pos="79"] { left: 79%; }
.attempt-marker[data-pos="80"] { left: 80%; }
.attempt-marker[data-pos="81"] { left: 81%; }
.attempt-marker[data-pos="82"] { left: 82%; }
.attempt-marker[data-pos="83"] { left: 83%; }
.attempt-marker[data-pos="84"] { left: 84%; }
.attempt-marker[data-pos="85"] { left: 85%; }
.attempt-marker[data-pos="86"] { left: 86%; }
.attempt-marker[data-pos="87"] { left: 87%; }
.attempt-marker[data-pos="88"] { left: 88%; }
.attempt-marker[data-pos="89"] { left: 89%; }
.attempt-marker[data-pos="90"] { left: 90%; }
.attempt-marker[data-pos="91"] { left: 91%; }
.attempt-marker[data-pos="92"] { left: 92%; }
.attempt-marker[data-pos="93"] { left: 93%; }
.attempt-marker[data-pos="94"] { left: 94%; }
.attempt-marker[data-pos="95"] { left: 95%; }
.attempt-marker[data-pos="96"] { left: 96%; }
.attempt-marker[data-pos="97"] { left: 97%; }
.attempt-marker[data-pos="98"] { left: 98%; }
.attempt-marker[data-pos="99"] { left: 99%; }
.attempt-marker[data-pos="100"] { left: 100%; }

/* Blueprint overlay sizing (class + wrap fallback, no inline styles) */
.blueprint-wrap svg,
.blueprint-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Localized 404 pages (replaces blocked style attributes) */
.not-found {
  text-align: center;
  padding: 4rem 1rem;
}
.not-found .deck {
  margin: 1rem auto;
}
.not-found .action-btn {
  margin-top: 1.5rem;
  text-decoration: none;
}

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