:root {
  --bg: #0c0f14;
  --panel: #131720;
  --card: #181d27;
  --border: #262e3d;
  --text: #e2e8f0;
  --muted: #8b9bb4;
  --brand: #3b82f6;
  --brand-hover: #60a5fa;
  --gold: #d4af37;
  --green: #22c55e;
  --radius: 12px;
}

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

html {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(18, 22, 29, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-switch {
  display: inline-flex;
  background: #0f131a;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.lang-link {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  color: var(--muted);
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.lang-link.active {
  background: var(--brand);
  color: #fff;
}

main {
  flex: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 20px;
  width: 100%;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: center;
  margin-bottom: 36px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: var(--brand-hover);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.hero h1 {
  font-size: 34px;
  font-weight: 900;
  line-height: 1.2;
  color: #fff;
  max-width: 820px;
}

.hero-lead {
  font-size: 16px;
  color: var(--muted);
  max-width: 740px;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
}

.btn-primary:hover {
  background: var(--brand-hover);
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
  color: #fff;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.stat-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--gold);
}

.stat-lbl {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.section {
  margin-bottom: 48px;
}

.section-head {
  margin-bottom: 20px;
}

.section-head h2 {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}

.section-head p {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.viewer-frame {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.viewer-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.sheet-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sheet-thumb {
  height: 200px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.sheet-thumb object {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sheet-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.sheet-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.sheet-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 14px;
  flex: 1;
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.spec-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 13.5px;
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.step-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-hover);
  margin-bottom: 6px;
}

.step-desc {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
}

footer {
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 40px;
}

.viewer-container {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#canvas-container {
  width: 100%;
  height: 520px;
  position: relative;
  background: #0e1219;
}

.viewer-controls {
  padding: 14px 18px;
  background: #11151e;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ctrl-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #1a202c;
  color: #cbd5e1;
  cursor: pointer;
  min-height: 32px;
  transition: all 0.15s ease;
}

.btn-sm:hover {
  background: #2d3748;
  color: #fff;
}

.btn-sm.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 700;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-group input[type="range"] {
  width: 90px;
  accent-color: var(--brand);
  cursor: pointer;
}

.slider-group span {
  font-size: 12px;
  color: var(--muted);
  min-width: 34px;
}

/* Responsive Layouts (RULES §2) */
html[data-layout="phone"] .stat-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
html[data-layout="phone"] .hero h1 {
  font-size: 24px;
}
html[data-layout="phone"] #canvas-container {
  height: 360px;
}
html[data-layout="phone"] .viewer-controls {
  padding: 10px;
  gap: 8px;
}
html[data-layout="phone"] .specs-grid {
  grid-template-columns: 1fr;
}
html[data-layout="phone"] .sheet-grid {
  grid-template-columns: 1fr;
}

/* Root redirect & 404 pages (No inline styles - CSP compliant) */
.root-main {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
.root-links {
  list-style: none;
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 24px;
}
.root-link {
  color: var(--brand);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}
.root-link:hover {
  text-decoration: underline;
}
.page-404 {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
.code-404 {
  font-size: 72px;
  font-weight: 900;
  color: var(--brand);
  line-height: 1;
  margin-bottom: 12px;
}
.title-404 {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}
.desc-404 {
  color: var(--muted);
  max-width: 440px;
  font-size: 15px;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* 3D Poster / Lazy Loader */
.viewer-poster {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1a2332 0%, #0c0f14 85%);
  z-index: 5;
  padding: 20px;
}
.poster-card {
  max-width: 420px;
  text-align: center;
  background: rgba(19, 23, 32, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}
.poster-icon {
  font-size: 42px;
  margin-bottom: 10px;
}
.poster-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
}
.poster-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 18px;
}
.webgl-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 14px;
  padding: 20px;
  text-align: center;
}
