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

@font-face {
  font-family: 'Manrope';
  src: url('/patratul-perfect/assets/Manrope.ce093b341d9c.woff2') format('woff2');
  font-weight: 400 500 600 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-workbench: #e2e8f0;
  --text-primary: #090d16;
  --text-secondary: #1e293b;
  --text-muted: #475569;
  --border-subtle: #cbd5e1;
  --border-strong: #94a3b8;
  --border-focus: #2563eb;
  --focus-ring: rgba(37, 99, 235, 0.4);
  --accent-gold: #b45309;
  --accent-crimson: #be123c;
  --accent-cyan: #0369a1;
  --accent-emerald: #047857;
  --shape-fill: #e2e8f0;
  --shape-stroke: #090d16;
  --handle-fill: #b45309;
  --handle-glow: rgba(180, 83, 9, 0.25);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --bg-primary: #0b0f17;
  --bg-surface: #131b2e;
  --bg-elevated: #1e293b;
  --bg-workbench: #0f172a;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-subtle: #334155;
  --border-strong: #475569;
  --border-focus: #60a5fa;
  --focus-ring: rgba(96, 165, 250, 0.4);
  --accent-gold: #fbbf24;
  --accent-crimson: #f43f5e;
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --shape-fill: #1e293b;
  --shape-stroke: #f8fafc;
  --handle-fill: #fbbf24;
  --handle-glow: rgba(251, 191, 36, 0.35);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0b0f17;
    --bg-surface: #131b2e;
    --bg-elevated: #1e293b;
    --bg-workbench: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-subtle: #334155;
    --border-strong: #475569;
    --border-focus: #60a5fa;
    --focus-ring: rgba(96, 165, 250, 0.4);
    --accent-gold: #fbbf24;
    --accent-crimson: #f43f5e;
    --accent-cyan: #38bdf8;
    --accent-emerald: #10b981;
    --shape-fill: #1e293b;
    --shape-stroke: #f8fafc;
    --handle-fill: #fbbf24;
    --handle-glow: rgba(251, 191, 36, 0.35);
  }
}

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

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-gold);
}

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--text-primary);
  color: var(--bg-surface);
  padding: 0.5rem 1rem;
  font-weight: 700;
  z-index: 100;
  border-radius: 4px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* Container */
.page-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 4rem;
  flex: 1 0 auto;
}

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-link {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text-primary);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.8125rem;
  font-weight: 600;
}

.lang-link {
  padding: 0.35rem 0.65rem;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--bg-surface);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.lang-link.is-active {
  color: var(--text-primary);
  background: var(--bg-elevated);
  font-weight: 700;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

/* Title area */
.intro-block {
  margin-bottom: 2rem;
}

h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.deck {
  font-size: clamp(1.0625rem, 2.5vw, 1.1875rem);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.trust-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-gold);
}

/* Workshop Workbench */
.workbench-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2.5rem;
}

.round-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.round-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.round-counter {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.round-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  min-height: 1.5em;
}

/* Shape Drafting Board */
.drafting-board {
  position: relative;
  width: 100%;
  height: 320px;
  background: var(--bg-workbench);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  margin-bottom: 1.25rem;
  user-select: none;
  touch-action: none;
}

.drafting-svg {
  width: 100%;
  height: 100%;
  max-width: 320px;
}

/* Shapes & styles */
.guide-line {
  stroke: var(--accent-gold);
  stroke-width: 2;
  stroke-dasharray: 4 4;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.guide-line.is-visible {
  opacity: 1;
}

.master-caliper {
  stroke: var(--accent-gold);
  stroke-width: 2.5;
  stroke-dasharray: 6 3;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.master-caliper.is-visible {
  opacity: 1;
}

.master-diagonal {
  stroke: var(--accent-gold);
  stroke-width: 1.5;
  stroke-opacity: 0.5;
  stroke-dasharray: 2 4;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.master-diagonal.is-visible {
  opacity: 1;
}

.target-shape {
  fill: var(--shape-fill);
  stroke: var(--shape-stroke);
  stroke-width: 2;
  transition: height 0.05s ease, y 0.05s ease;
}

/* Round variations */
[data-round-type="outline"] .target-shape {
  fill: none;
  stroke-width: 2.5;
}

[data-round-type="solid"] .target-shape {
  fill: var(--text-primary);
  fill-opacity: 0.85;
  stroke: var(--text-primary);
}

[data-round-type="stripes"] .target-shape {
  fill: url(#stripe-pattern);
  stroke-width: 2.5;
}

[data-round-type="diamond"] .drafting-svg {
  transform: rotate(45deg);
  transition: transform 0.3s ease;
}

[data-round-type="flanked"] .flanking-pillar {
  display: block;
}

.flanking-pillar {
  display: none;
  fill: var(--border-strong);
  opacity: 0.4;
}

/* Drag Handle */
.drag-handle-bar {
  cursor: ns-resize;
  fill: var(--handle-fill);
  transition: fill 0.15s ease, transform 0.1s ease;
}

.drag-handle-bar:hover, .drag-handle-bar.is-dragging {
  fill: var(--accent-crimson);
  filter: drop-shadow(0 0 6px var(--handle-glow));
}

.is-verified .drag-handle-bar {
  display: none;
}

/* Control slider and tactile buttons */
.workbench-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nudge-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.nudge-btn:hover:not(:disabled) {
  background: var(--border-subtle);
}

.nudge-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.nudge-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.height-slider {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--border-subtle);
  outline: none;
  cursor: pointer;
  accent-color: var(--accent-gold);
}

.height-slider:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.readout-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.readout-val {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Primary Action Button */
.action-btn-row {
  margin-top: 0.5rem;
}

.btn-primary {
  width: 100%;
  min-height: 52px;
  padding: 0.85rem 1.5rem;
  font-family: 'Syne', sans-serif;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
  background: var(--text-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

[data-theme="dark"] .btn-primary {
  color: #0b0f17;
  background: #f8fafc;
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary.btn-next {
  background: var(--accent-gold);
  color: #ffffff;
}

[data-theme="dark"] .btn-primary.btn-next {
  color: #0b0f17;
}

.btn-primary.btn-summary {
  background: var(--accent-cyan);
  color: #ffffff;
}

/* Feedback panel */
.feedback-panel {
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: fadeIn 0.25s ease-out;
}

.verdict {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.0625rem;
}

.verdict.is-perfect {
  color: var(--accent-emerald);
}

.verdict.is-short {
  color: var(--accent-gold);
}

.verdict.is-tall {
  color: var(--accent-crimson);
}

.feedback-details {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Summary / Blueprint Section */
.summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2.5rem;
  animation: fadeIn 0.3s ease-out;
}

.summary-card h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.summary-prose {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.blueprint-container {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 1.5rem;
  background: var(--bg-workbench);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.blueprint-svg {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
}

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

.btn-secondary {
  flex: 1;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
  background: var(--border-subtle);
}

/* Explanatory Article / Method */
.method-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 2.5rem;
  margin-bottom: 2.5rem;
}

.method-section h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.method-section p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

.method-section cite {
  font-style: normal;
  font-weight: 600;
  color: var(--text-primary);
}

.limits-box {
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent-gold);
  padding: 1rem 1.25rem;
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 2rem;
  margin-top: auto;
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-nav a:hover {
  text-decoration: underline;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@media (max-width: 480px) {
  .page-container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .drafting-board {
    height: 280px;
  }

  .summary-actions {
    flex-direction: column;
  }
}
