@font-face {
  font-family: "Bricolage Grotesque";
  src: url("assets/fonts/bricolage-grotesque-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg-primary: #000000;
  --bg-secondary: #0b0e0d;
  --bg-card: #101513;
  --surface-focus: #18201d;
  --text-primary: #f2f5ee;
  --text-secondary: #b6c0ba;
  --text-faint: #717c76;
  --accent-primary: #8dffd6;
  --accent-soft: rgba(141, 255, 214, 0.18);
  --paper: #f4f0e7;
  --danger: #ff7d77;
  --success: #8dffd6;
  --ease-on: cubic-bezier(0.6, 0, 0.4, 1);
  --ease-color: cubic-bezier(0.4, 0.04, 0.5, 1);
  --display-font: "Bricolage Grotesque", "Avenir Next", sans-serif;
  --body-font: "Bricolage Grotesque", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html,
body {
  position: fixed;
  inset: 0;
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--body-font);
  font-synthesis: weight;
}

button { font: inherit; }

#app,
.screen { width: 600px; height: 600px; }

#app {
  position: fixed;
  inset: 0;
  padding: 8px;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
}

.hidden { display: none !important; }

.header {
  min-height: 72px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.home-header {
  min-height: 126px;
  align-items: flex-start;
  justify-content: space-between;
  padding-top: 20px;
}

.brand-lockup h1 {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
  color: var(--paper);
  font-family: var(--display-font);
  font-size: 39px;
  font-weight: 800;
  line-height: 0.77;
  letter-spacing: -2.8px;
}

.brand-lockup h1 span:last-child {
  color: transparent;
  -webkit-text-stroke: 1.2px var(--accent-primary);
  text-stroke: 1.2px var(--accent-primary);
  transform: translateX(22px);
}

.header h1 {
  font-family: var(--display-font);
  font-size: 27px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.9px;
}

.eyebrow {
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.2px;
  text-transform: uppercase;
}

.paper-mark {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 7px 6px 0 0;
  transform: rotate(45deg);
  background: linear-gradient(135deg, rgba(141,255,214,.15) 0 49%, transparent 50%);
  border: 1px solid rgba(141, 255, 214, 0.7);
}

.paper-mark::before,
.paper-mark::after,
.paper-mark i {
  content: "";
  position: absolute;
  background: rgba(141, 255, 214, 0.62);
}

.paper-mark::before { width: 1px; height: 105px; left: 37px; top: -15px; transform: rotate(-45deg); }
.paper-mark::after { height: 1px; width: 52px; right: 0; bottom: 25px; transform: rotate(-45deg); transform-origin: right; }
.paper-mark i { width: 6px; height: 6px; right: -3px; top: -3px; border-radius: 50%; }

.content { flex: 1; min-height: 0; }
.home-content { padding: 0 16px; }

.intro {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.25;
  margin-bottom: 13px;
}

.intro span {
  flex: 0 0 auto;
  color: var(--paper);
  font-weight: 700;
}

.model-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 342px;
  overflow-y: auto;
  padding: 2px 8px 34px 2px;
  scrollbar-width: none;
  scroll-padding: 4px 0 32px;
}

.model-list::-webkit-scrollbar { display: none; }

.model-card {
  position: relative;
  flex: 0 0 104px;
  min-height: 104px;
  width: 100%;
  padding: 12px 18px 12px 12px;
  border: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,.025) 0 49.6%, rgba(141,255,214,.08) 50%, transparent 50.4%),
    var(--bg-card);
  color: var(--text-primary);
  clip-path: polygon(0 0, calc(100% - 25px) 0, 100% 25px, 100% 100%, 0 100%);
  display: grid;
  grid-template-columns: 30px 58px 1fr 28px;
  align-items: center;
  gap: 12px;
  text-align: left;
  opacity: 0.82;
  transition: transform 475ms var(--ease-on), background-color 300ms var(--ease-color), opacity 300ms var(--ease-color);
}

.model-card::after {
  content: "";
  position: absolute;
  width: 36px;
  height: 1px;
  right: -6px;
  top: 24px;
  transform: rotate(45deg);
  background: rgba(141, 255, 214, 0.48);
}

.model-card:focus {
  outline: none;
  background-color: var(--surface-focus);
  box-shadow: 0 0 24px var(--accent-soft);
  opacity: 1;
  transform: scale(0.975);
}

.model-index {
  align-self: start;
  padding-top: 4px;
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

.model-icon { width: 58px; height: 66px; color: var(--text-primary); overflow: hidden; }
.model-icon .nps-panel-crop,
.model-icon .source-panel-crop { transform: scale(0.18); transform-origin: top left; }
.model-icon .source-photo { width: 58px; height: 58px; margin-top: 4px; }

.model-copy { display: flex; min-width: 0; flex-direction: column; }
.model-name {
  display: block;
  font-family: var(--display-font);
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.6px;
  margin-bottom: 9px;
}
.model-meta {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.65px;
  text-transform: uppercase;
}
.model-arrow { color: var(--accent-primary); font-size: 25px; }

.hint-bar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  color: var(--text-faint);
  font-size: 12px;
  letter-spacing: 0.5px;
}
.hint-bar b { color: var(--accent-primary); font-size: 15px; margin-right: 5px; }

.focusable {
  min-height: 48px;
  border: 2px solid transparent;
  cursor: pointer;
}
.focusable:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-soft);
}
.focusable:active { transform: scale(0.94); }

.icon-button {
  width: 64px;
  height: 56px;
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 25px;
}
.icon-button.text-button { font-size: 11px; font-weight: 800; letter-spacing: 1.4px; }

.guide-header { min-height: 68px; padding-top: 8px; padding-bottom: 8px; }
.guide-heading { flex: 1; min-width: 0; }
.guide-heading h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-counter {
  min-width: 56px;
  color: var(--paper);
  font-family: var(--display-font);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.4px;
  text-align: right;
}
.progress-track { height: 3px; margin: 0 16px; background: rgba(242, 245, 238, 0.1); }
.progress-fill { height: 100%; width: 0; background: var(--accent-primary); transition: width 250ms var(--ease-color); }

.guide-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 16px 5px;
}

.diagram {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.diagram svg { width: 100%; height: 100%; max-height: 345px; }
.nps-panel-crop,
.source-panel-crop { position: relative; flex: 0 0 auto; overflow: hidden; }
.nps-panel-crop img,
.source-panel-crop img {
  position: absolute;
  max-width: none;
  user-select: none;
  pointer-events: none;
  filter: invert(1) grayscale(1) contrast(1.45) brightness(1.08);
}
.source-photo {
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 325px;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  filter: invert(1) grayscale(1) contrast(1.28) brightness(1.06);
}

.instruction-panel {
  position: relative;
  flex: 0 0 84px;
  width: 100%;
  padding: 7px 10px 0 18px;
}
.instruction-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 2px;
  background: var(--accent-primary);
}
.step-kicker { color: var(--accent-primary); font-size: 11px; font-weight: 700; letter-spacing: 1.8px; margin-bottom: 3px; }
.instruction-panel h2 {
  font-family: var(--display-font);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.45px;
  margin-bottom: 4px;
}
.instruction-panel > p:last-child { color: var(--text-secondary); font-size: 14px; line-height: 1.24; }

.step-controls { display: flex; gap: 9px; padding: 0 16px 10px; }
.step-button,
.finish-button {
  position: relative;
  height: 64px;
  border-radius: 0;
  clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 0 100%);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  flex: 1;
}
.step-button span { color: var(--accent-primary); font-size: 20px; margin: 0 5px; }
.step-button.primary,
.finish-button { background: #121b18; color: var(--accent-primary); }
.step-button:disabled { opacity: 0.3; cursor: default; }

.completion-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 54px 34px;
}
.final-diagram { width: 250px; height: 220px; color: var(--accent-primary); margin-bottom: 6px; }
.final-diagram svg { width: 100%; height: 100%; }
.final-diagram .nps-panel-crop,
.final-diagram .source-panel-crop { transform: scale(0.68); transform-origin: top left; }
.final-diagram .source-photo { width: 100%; height: 100%; }
.completion-content h1 {
  font-family: var(--display-font);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1.3px;
  margin-bottom: 8px;
}
.completion-content p { color: var(--text-secondary); font-size: 16px; margin-bottom: 24px; }
.finish-button { width: 100%; flex: 0 0 76px; }

.paper { fill: rgba(242, 245, 238, 0.04); stroke: var(--text-primary); stroke-width: 3; stroke-linejoin: round; }
.paper-back { fill: rgba(141, 255, 214, 0.08); stroke: var(--text-secondary); stroke-width: 2.5; stroke-linejoin: round; }
.crease { fill: none; stroke: var(--text-faint); stroke-width: 2; stroke-dasharray: 9 8; }
.paper-detail { fill: none; stroke: var(--text-primary); stroke-width: 2; opacity: 0.72; }
.fold-arrow { fill: none; stroke: var(--accent-primary); stroke-width: 3; stroke-linecap: round; marker-end: url(#arrowhead); }
.arrow-tip { fill: var(--accent-primary); stroke: none; }
.motion { fill: none; stroke: var(--accent-primary); stroke-width: 2.5; stroke-dasharray: 5 6; }
.diagram-label { fill: var(--text-secondary); font-size: 13px; font-family: var(--body-font); letter-spacing: 1px; }

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