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

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

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

:root {
  --bg: #0d1117;
  --panel-bg: #161b22;
  --panel-border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #f5c542;
  --accent-glow: rgba(245, 197, 66, 0.18);
  --cyan-datum: #00f0ff;
  --error-coral: #ff5a5f;
  --success-green: #3fb950;
  --fulcrum-brass: #d4a373;
  --beam-metal: #c9d1d9;
  --focus-ring: #58a6ff;
  --font-display: "Syne", system-ui, -apple-system, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

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

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

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  top: -999px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #000;
  padding: 0.5rem 1rem;
  font-weight: 600;
  z-index: 1000;
  text-decoration: none;
}
.skip-link:focus {
  top: 10px;
}

.container {
  width: 100%;
  max-width: 680px;
  padding: 1.25rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header & Top Bar */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--panel-border);
}

.site-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.nav-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.btn-quiet {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-quiet:hover, .btn-quiet:focus-visible {
  color: var(--text);
  border-color: var(--text-muted);
  outline: none;
}

.btn-quiet:focus-visible {
  box-shadow: 0 0 0 2px var(--focus-ring);
}

/* Hero Opening */
.hero {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5.5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  letter-spacing: -0.02em;
}

.hero-deck {
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
  color: var(--text-muted);
  line-height: 1.45;
}

/* Workshop Stage Card */
.workshop-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.round-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  background: #21262d;
  color: var(--accent);
  border: 1px solid rgba(245, 197, 66, 0.3);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.round-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.round-instruction {
  font-size: 0.85rem;
  color: var(--text-muted);
  width: 100%;
}

/* Interactive Stage */
.stage-container {
  position: relative;
  width: 100%;
  height: 200px;
  background: #090d13;
  border: 1px solid #21262d;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.stage-container:active {
  cursor: grabbing;
}

.stage-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.bg-hatch {
  position: absolute;
  width: 140%;
  height: 140%;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 12px,
    rgba(255, 255, 255, 0.05) 12px,
    rgba(255, 255, 255, 0.05) 13px
  );
  pointer-events: none;
  transition: transform 0.3s ease;
}

.datum-line {
  position: absolute;
  width: 90%;
  height: 1px;
  border-top: 1px dashed rgba(0, 240, 255, 0.3);
  pointer-events: none;
}

/* Mechanical Assembly */
.beam-assembly {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.fulcrum {
  position: absolute;
  bottom: 54px;
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 28px solid var(--fulcrum-brass);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  transition: transform 0.2s ease;
  pointer-events: none;
  z-index: 2;
}

.fulcrum::after {
  content: "";
  position: absolute;
  left: -4px;
  top: 24px;
  width: 8px;
  height: 4px;
  background: #8c6239;
  border-radius: 2px;
}

.beam {
  position: absolute;
  top: calc(50% - 9px);
  width: 320px;
  height: 18px;
  background: linear-gradient(180deg, #e6edf3 0%, #8b949e 100%);
  border: 1px solid #f0f6fc;
  border-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  transform-origin: center center;
  transition: transform 0.05s ease-out;
  z-index: 3;
}

/* End Stoppers & Center Detent */
.beam::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 0;
  width: 6px;
  height: 28px;
  background: var(--accent);
  border-radius: 2px;
}

.beam::after {
  content: "";
  position: absolute;
  top: -6px;
  right: 0;
  width: 6px;
  height: 28px;
  background: var(--accent);
  border-radius: 2px;
}

.ball {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #b1bac4 50%, #21262d 100%);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  z-index: 4;
  margin-left: -8px;
  margin-top: -8px;
  pointer-events: none;
}

/* Hidden Bubble Level Indicator */
.bubble-level {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  background: #090d13;
  border: 1px solid var(--panel-border);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s ease;
}

.bubble-level.visible {
  opacity: 1;
  transform: translateY(0);
}

.bubble-capsule {
  position: relative;
  width: 140px;
  height: 18px;
  background: #1f242c;
  border: 1px solid #38414e;
  border-radius: 9px;
  overflow: hidden;
}

.bubble-center-lines {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 10px);
  width: 20px;
  border-left: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
  pointer-events: none;
}

.bubble-indicator {
  position: absolute;
  top: 2px;
  left: calc(50% - 7px);
  width: 14px;
  height: 14px;
  background: rgba(245, 197, 66, 0.85);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent);
  transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.bubble-level.balanced .bubble-indicator {
  background: var(--success-green);
  box-shadow: 0 0 8px var(--success-green);
}

.bubble-level.tilted-left .bubble-indicator,
.bubble-level.tilted-right .bubble-indicator {
  background: var(--error-coral);
  box-shadow: 0 0 8px var(--error-coral);
}

.bubble-readout {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

/* Controls Bar */
.controls-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.nudge-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.btn-nudge {
  background: #21262d;
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-nudge:hover {
  background: #30363d;
  border-color: #8b949e;
}

.btn-nudge:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.slider-container {
  width: 100%;
  display: flex;
  align-items: center;
}

.slider-container input[type="range"] {
  width: 100%;
  height: 6px;
  background: #21262d;
  border-radius: 3px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
  cursor: pointer;
}

.slider-container input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
  cursor: pointer;
}

/* Primary Action Buttons */
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #0d1117;
  border: none;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  padding: 0.85rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(245, 197, 66, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: #ffdf3a;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(245, 197, 66, 0.35);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-next {
  background: #238636;
  color: #fff;
  box-shadow: 0 4px 12px rgba(35, 134, 54, 0.3);
}
.btn-next:hover {
  background: #2ea043;
}

/* Attempt Tape List */
.attempt-tape {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  list-style: none;
}

.attempt {
  display: grid;
  grid-template-columns: 28px 1fr 90px;
  align-items: center;
  gap: 0.75rem;
  background: #161b22;
  border: 1px solid var(--panel-border);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.attempt-number {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

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

.target-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--cyan-datum);
  transform: translateX(-50%);
}

.attempt-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 6px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: left 0.3s ease;
}

.attempt.slot-balanced .attempt-marker {
  background: var(--success-green);
  box-shadow: 0 0 6px var(--success-green);
}

.attempt.slot-left .attempt-marker,
.attempt.slot-right .attempt-marker {
  background: var(--error-coral);
}

.attempt-result {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: right;
  color: var(--text-muted);
}

.attempt.completed .attempt-result {
  color: var(--text);
  font-weight: 600;
}

/* Final Summary Card */
.summary-section {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 480px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

.summary-stat-box {
  background: #0d1117;
  border: 1px solid var(--panel-border);
  padding: 1rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text);
}

.canvas-wrapper {
  width: 100%;
  background: #0d1117;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow: hidden;
  padding: 0.5rem;
}

#overlay-canvas {
  width: 100%;
  height: 220px;
  display: block;
}

.summary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .summary-actions {
    grid-template-columns: 1fr;
  }
}

/* Editorial Explanation Article */
.editorial-article {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
  border-top: 1px solid var(--panel-border);
  padding-top: 1.5rem;
}

.editorial-article h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.editorial-article p {
  color: #c9d1d9;
  font-size: 0.95rem;
  line-height: 1.6;
}

.editorial-article p strong {
  color: #fff;
}

.sources-list {
  font-size: 0.85rem;
  color: var(--text-muted);
  list-style: square;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Footer */
.site-footer {
  width: 100%;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: underline;
}

.site-footer a:hover {
  color: var(--text);
}

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

/* Accessibility & Reduced Motion */
@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;
  }
}
