:root {
  --bp-sky: #CFE5FF;
  --bp-sky-deep: #8CBDF7;
  --bp-sky-soft: #EEF6FF;
  --cedar: #F7D1BA;
  --cedar-deep: #E5A57E;
  --cedar-soft: #FFF3EB;
  --cream: #FFFBF0;
  --cream-card: #FFFFFF;
  --mint: #C7F0DB;
  --mint-deep: #6AC89D;
  --mint-soft: #EEFAF4;
  --navy: #1F2D45;
  --navy-muted: #4A5D7A;
  --grid-line: rgba(107, 164, 232, 0.16);
  --grid-major: rgba(107, 164, 232, 0.28);
  --border-soft: rgba(31, 45, 69, 0.13);
  --shadow-card: 0 14px 34px rgba(31, 45, 69, 0.08);
  --shadow-hover: 0 18px 42px rgba(31, 45, 69, 0.12);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --font-display: "Bitter", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--navy);
  background-color: var(--cream);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Subtle Pastel Drafting-Grid Background */
.blueprint-grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--cream);
  background-image:
    linear-gradient(to right, var(--grid-major) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-major) 1px, transparent 1px),
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px),
    radial-gradient(circle at 12% 10%, rgba(207, 229, 255, 0.42), transparent 44%),
    radial-gradient(circle at 88% 18%, rgba(247, 209, 186, 0.34), transparent 42%),
    radial-gradient(circle at 50% 90%, rgba(199, 240, 219, 0.36), transparent 48%);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px, 100% 100%, 100% 100%, 100% 100%;
}

/* Top Dossier Header */
.dossier-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 251, 240, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--bp-sky);
  box-shadow: 0 6px 20px rgba(31, 45, 69, 0.06);
}

.dossier-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.72rem 1.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.dossier-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.back-hub-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.44rem 0.9rem;
  border-radius: 999px;
  background: var(--bp-sky);
  color: var(--navy);
  font-weight: 700;
  font-size: 0.84rem;
  text-decoration: none;
  border: 1.5px solid rgba(31, 45, 69, 0.14);
  transition: transform 0.18s ease, background 0.18s ease;
}

.back-hub-link:hover {
  transform: translateY(-1px);
  background: #B9D9FF;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.dossier-code {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--navy-muted);
}

.dossier-title {
  font-family: var(--font-display);
  font-size: 1.04rem;
  color: var(--navy);
}

.dossier-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  background: var(--bp-sky-soft);
  padding: 0.28rem;
  border-radius: 999px;
  border: 1.5px solid var(--bp-sky);
}

.d-tab {
  text-decoration: none;
  color: var(--navy-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.38rem 0.78rem;
  border-radius: 999px;
  transition: background 0.18s ease, color 0.18s ease;
}

.d-tab:hover,
.d-tab.is-active {
  background: var(--cream-card);
  color: var(--navy);
  box-shadow: 0 2px 8px rgba(31, 45, 69, 0.08);
}

.dossier-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Main Container */
.studio-main {
  position: relative;
  z-index: 3;
  max-width: 1220px;
  margin: 0 auto;
  padding: 1.6rem 1.2rem 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Architectural Studio Cards */
.studio-card {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--bp-sky);
  border-radius: var(--radius-xl);
  padding: 1.85rem;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(6px);
}

/* Blueprint drafting corner marks */
.sheet-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2.5px solid var(--bp-sky-deep);
  pointer-events: none;
}
.sheet-corner.tl { top: 12px; left: 12px; border-right: 0; border-bottom: 0; border-radius: 4px 0 0 0; }
.sheet-corner.tr { top: 12px; right: 12px; border-left: 0; border-bottom: 0; border-radius: 0 4px 0 0; }
.sheet-corner.bl { bottom: 12px; left: 12px; border-right: 0; border-top: 0; border-radius: 0 0 0 4px; }
.sheet-corner.br { bottom: 12px; right: 12px; border-left: 0; border-top: 0; border-radius: 0 0 4px 0; }

/* Entrance + Scroll Reveal */
.hero-enter {
  animation: sheetSlideIn 0.72s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes sheetSlideIn {
  from { opacity: 0; transform: translateY(22px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1), transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Typography & Pills */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--navy);
  margin: 0;
  line-height: 1.22;
}

h1 { font-size: clamp(1.75rem, 3.2vw, 2.55rem); margin-top: 0.55rem; }
h2 { font-size: clamp(1.38rem, 2.3vw, 1.95rem); margin-top: 0.35rem; }
h3 { font-size: 1.18rem; }
h4 { font-size: 1.02rem; }

.draft-pill {
  display: inline-block;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--bp-sky);
  color: var(--navy);
  border: 1.5px solid rgba(31, 45, 69, 0.12);
}

.pill-cedar { background: var(--cedar); }
.pill-mint { background: var(--mint); }
.pill-sky { background: var(--bp-sky); }

/* Buttons */
.bp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.68rem 1.18rem;
  border-radius: 14px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.bp-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(31, 45, 69, 0.12);
}

.bp-btn:active {
  transform: translateY(0);
}

.bp-btn-ink {
  background: var(--navy);
  color: var(--cream);
}
.bp-btn-ink:hover { background: #2B3E5E; }

.bp-btn-sky {
  background: var(--bp-sky);
  color: var(--navy);
  border-color: var(--bp-sky-deep);
}
.bp-btn-sky:hover { background: #BCD9FF; }

.bp-btn-cedar {
  background: var(--cedar);
  color: var(--navy);
  border-color: var(--cedar-deep);
}
.bp-btn-cedar:hover { background: #F2C2A5; }

.bp-btn-mint {
  background: var(--mint);
  color: var(--navy);
  border-color: var(--mint-deep);
}
.bp-btn-mint:hover { background: #B1E8CC; }

.bp-btn-ghost {
  background: var(--cream);
  color: var(--navy);
  border-color: var(--border-soft);
}
.bp-btn-ghost:hover { background: var(--bp-sky-soft); }

/* Hero Layout */
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.8rem;
  align-items: center;
}

.hero-lead {
  font-size: 1.02rem;
  color: var(--navy-muted);
  margin: 0.9rem 0 1.25rem;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.kpi-tile {
  padding: 0.78rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.kpi-mint { background: var(--mint-soft); border-color: var(--mint-deep); }
.kpi-cedar { background: var(--cedar-soft); border-color: var(--cedar-deep); }
.kpi-sky { background: var(--bp-sky-soft); border-color: var(--bp-sky-deep); }

.kpi-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--navy-muted);
}

.kpi-tile strong {
  font-size: 0.95rem;
  color: var(--navy);
}

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

.blueprint-plate {
  margin: 0;
  background: linear-gradient(160deg, var(--bp-sky-soft) 0%, #FFFFFF 100%);
  border: 2px dashed var(--bp-sky-deep);
  border-radius: var(--radius-lg);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.plate-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--navy-muted);
}

.blueprint-plate img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  background: #102A43;
}

.blueprint-plate figcaption {
  font-size: 0.82rem;
  color: var(--navy-muted);
  text-align: center;
  font-style: italic;
}

/* Theory Dossier */
.sec-head {
  margin-bottom: 1.2rem;
}

.theory-callout {
  background: linear-gradient(135deg, var(--cream) 0%, var(--cedar-soft) 100%);
  border-left: 5px solid var(--cedar-deep);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.35rem;
}

.theory-question {
  font-size: 1.15rem;
  margin-bottom: 0.45rem;
}

.theory-exact {
  margin: 0;
  font-size: 0.98rem;
  color: var(--navy);
}

.arch-two-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.35rem;
}

.spec-panel {
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.3rem;
  border: 2px solid var(--border-soft);
}

.panel-sky {
  background: var(--bp-sky-soft);
  border-color: var(--bp-sky);
}

.panel-mint {
  background: var(--mint-soft);
  border-color: var(--mint);
}

.spec-panel-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.spec-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--navy);
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.spec-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.93rem;
  color: var(--navy);
}

.approval-stamp-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  background: var(--cream);
  border: 2px dashed var(--mint-deep);
}

.approval-msg {
  font-weight: 600;
  color: var(--navy);
  font-size: 0.92rem;
}

/* 4 Games Multi-Panel Architectural Grid */
.phases-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.arch-games-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem;
}

.game-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.45rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-panel:hover {
  box-shadow: var(--shadow-hover);
}

.game-head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.phase-tag {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.22rem 0.65rem;
  border-radius: 8px;
}

.tag-sky { background: var(--bp-sky); color: var(--navy); }
.tag-cedar { background: var(--cedar); color: var(--navy); }
.tag-mint { background: var(--mint); color: var(--navy); }

.game-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--navy-muted);
}

.sim-stage {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--bp-sky);
  background: var(--cream);
  box-shadow: inset 0 2px 10px rgba(31, 45, 69, 0.05);
}

.sim-stage canvas {
  display: block;
  width: 100%;
  height: auto;
}

.status-ribbon {
  padding: 0.62rem 0.9rem;
  border-radius: 12px;
  background: var(--bp-sky-soft);
  border: 1.5px solid var(--bp-sky);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--navy);
}

.status-ribbon.is-win {
  background: var(--mint);
  border-color: var(--mint-deep);
}

.status-ribbon.is-err {
  background: #FFE5E5;
  border-color: #F2A2A2;
}

/* Game 1 Gantt Buttons */
.gantt-stack {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
}

.gantt-btn {
  width: 100%;
  text-align: left;
  padding: 0.64rem 0.9rem;
  border-radius: 12px;
  border: 1.5px solid var(--border-soft);
  background: var(--cream);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.gantt-btn:hover:not(.done) {
  background: var(--bp-sky-soft);
  border-color: var(--bp-sky-deep);
  transform: translateX(3px);
}

.gantt-btn.done {
  background: var(--mint-soft);
  border-color: var(--mint-deep);
  color: var(--navy);
}

/* Game 2 Dock Controls */
.dock-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.dock-controls .bp-btn-ink {
  grid-column: 1 / -1;
}

/* Game 3 Budget Visualizer */
.budget-visualizer {
  background: var(--cream);
  border: 2px solid var(--bp-sky);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.meter-row {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
}

.meter-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: var(--bp-sky-soft);
  overflow: hidden;
  border: 1px solid var(--border-soft);
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease;
}

.meter-fill.is-ok {
  background: linear-gradient(90deg, var(--mint-deep), #8BE0B7);
}

.meter-fill.is-over {
  background: linear-gradient(90deg, #F29C89, #E86D6D);
}

.meter-limit-pin {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--navy);
  opacity: 0.65;
}

.breakdown-bar {
  display: flex;
  height: 24px;
  border-radius: 999px;
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--navy);
  border: 1px solid var(--border-soft);
}

.breakdown-bar span {
  display: grid;
  place-items: center;
  transition: width 0.35s ease;
  white-space: nowrap;
  overflow: hidden;
}

.seg-carp { background: var(--cedar); }
.seg-iron { background: var(--bp-sky); }
.seg-uph { background: var(--mint); }

.provider-selects,
.slider-controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.provider-selects label,
.slider-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--navy);
}

.provider-selects select {
  padding: 0.56rem 0.75rem;
  border-radius: 10px;
  border: 1.5px solid var(--bp-sky-deep);
  background: var(--cream-card);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 500;
}

.slider-controls input[type="range"] {
  accent-color: var(--navy);
  width: 100%;
  cursor: pointer;
}

.panel-foot {
  margin-top: auto;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* Wide Flight Simulator Camera */
.flight-sim-card {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.96) 0%, rgba(238, 246, 255, 0.94) 100%);
  border: 2.5px solid var(--bp-sky-deep);
}

.flight-lead {
  margin: 0 0 1.1rem;
  font-size: 0.97rem;
  color: var(--navy-muted);
}

.flight-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.flight-kpis {
  margin-bottom: 1rem;
}

.sleigh-cam-wrap {
  position: relative;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 3px solid var(--navy);
  background: #172338;
  box-shadow: 0 18px 40px rgba(31, 45, 69, 0.2);
  aspect-ratio: 16 / 9;
}

.sleigh-cam-wrap.portrait-cam {
  max-width: 440px;
  aspect-ratio: 3 / 4;
}

.sleigh-cam-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Master Shipwright Certificate */
.certificate-card {
  background: linear-gradient(145deg, var(--cream) 0%, var(--cedar-soft) 55%, var(--mint-soft) 100%);
  border: 2.5px solid var(--cedar-deep);
  padding: 1.2rem;
}

.cert-border {
  border: 2px dashed rgba(31, 45, 69, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.7rem 1.5rem;
  text-align: center;
  position: relative;
}

.cert-seal {
  width: 58px;
  height: 58px;
  margin: 0 auto 0.65rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background: var(--bp-sky);
  border: 2.5px solid var(--navy);
  box-shadow: 0 6px 14px rgba(31, 45, 69, 0.12);
}

.cert-desc {
  max-width: 680px;
  margin: 0.6rem auto 1.2rem;
  color: var(--navy-muted);
}

.cert-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 1.4rem;
}

.cert-chip {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.82);
  color: var(--navy-muted);
  border: 1.5px solid var(--border-soft);
  transition: transform 0.2s ease, background 0.2s ease;
}

.cert-chip.done {
  background: var(--mint);
  color: var(--navy);
  border-color: var(--mint-deep);
  transform: scale(1.04);
}

.cert-signature-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1.5px solid rgba(31, 45, 69, 0.12);
}

.sig-line {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.sig-script {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--navy);
}

.sig-line small {
  font-size: 0.76rem;
  color: var(--navy-muted);
}

.cert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* Footer */
.studio-footer {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 1.2rem 1rem 2rem;
  color: var(--navy-muted);
  font-size: 0.86rem;
}

/* Help Dialog */
.studio-dialog {
  width: min(560px, 92vw);
  border: 2.5px solid var(--bp-sky-deep);
  border-radius: var(--radius-xl);
  padding: 1.6rem;
  background: var(--cream);
  color: var(--navy);
  box-shadow: 0 24px 60px rgba(31, 45, 69, 0.25);
}

.studio-dialog::backdrop {
  background: rgba(31, 45, 69, 0.45);
  backdrop-filter: blur(5px);
}

.dialog-head {
  margin-bottom: 1rem;
}

.studio-dialog .spec-list {
  margin-bottom: 1.25rem;
}

/* Responsive */
@media (max-width: 980px) {
  .hero-grid,
  .arch-two-cols,
  .arch-games-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .dossier-inner {
    padding: 0.65rem 0.85rem;
  }
  .dossier-tabs {
    width: 100%;
    justify-content: center;
  }
  .studio-main {
    padding: 1.1rem 0.8rem 2.5rem;
  }
  .studio-card {
    padding: 1.2rem;
  }
  .kpi-strip {
    grid-template-columns: 1fr;
  }
  .dock-controls {
    grid-template-columns: 1fr;
  }
  .cert-signature-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .sig-line {
    text-align: center;
  }
}

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