@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: #64748b;
  --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;
}

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;
}

/* 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;
}

.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);
}

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);
}

@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;
  }
}
