/* ==========================================================================
   YSY AKROBAT — 3D İnteraktif Kurulum Kılavuzu
   Google/Microsoft/Mozilla Modern Web Guidance (Baseline) Uyumlu CSS
   Varsayılan: Beyaz Zemin (Light) | İsteğe Bağlı: Koyu Zemin (Dark)
   ========================================================================== */

:root {
  color-scheme: light;

  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
  }

  /* Official Brand Tokens (ysy-akrobat.com + Logo PDF) */
  --ak-red: #c52027;
  --ak-orange: #f58220;
  --ak-orange-hover: #e27112;
  --ak-green: #16a34a;
  --ak-blue-fold: #1d70b8;
  --ak-red-fold: #d92d20;

  /* Adaptive Light / Dark Surface Tokens using Baseline light-dark() */
  --bg-page: light-dark(#eef2f6, #0d1b24);
  --bg-stage-top: light-dark(#f7f9fc, #1c3a4c);
  --bg-stage-bot: light-dark(#e6edf4, #0d1b24);
  --bg-header: light-dark(#ffffff, #0e1d27);
  --bg-card: light-dark(rgba(255, 255, 255, 0.95), rgba(15, 29, 39, 0.92));
  --bg-card-solid: light-dark(#ffffff, #132531);
  --bg-subtle: light-dark(#f3f5f8, rgba(255, 255, 255, 0.08));
  --bg-subtle-hover: light-dark(#e7ecf2, rgba(255, 255, 255, 0.15));
  --bg-warn-soft: light-dark(#fef2f2, rgba(217, 45, 32, 0.16));

  --text-primary: light-dark(#121212, #f8fafc);
  --text-secondary: light-dark(#4b5563, #cbd5e1);
  --text-muted: light-dark(#6b7280, #94a3b8);

  --border-subtle: light-dark(#e2e8f0, rgba(255, 255, 255, 0.14));
  --border-strong: light-dark(#cbd5e1, rgba(255, 255, 255, 0.24));
  --shadow-card: light-dark(
    0 8px 26px rgba(15, 23, 42, 0.08),
    0 12px 34px rgba(0, 0, 0, 0.45)
  );

  --font-heading: "Figtree", system-ui, -apple-system, sans-serif;
  --font-body: "Assistant", system-ui, -apple-system, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  inline-size: 100%;
  block-size: 100%;
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

img,
svg,
canvas {
  display: block;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2.5px solid var(--ak-orange);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  overflow: clip;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ==========================================================================
   Theme-Sensitive Media & Toggle Labels (Default: Light)
   ========================================================================== */

.brand-logo-dark,
.theme-label-to-light {
  display: none;
}

.brand-logo-light,
.theme-label-to-dark {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  & .brand-logo-light,
  & .theme-label-to-dark {
    display: none;
  }
  & .brand-logo-dark,
  & .theme-label-to-light {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
  }
}

/* ==========================================================================
   App Shell & Header
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  inline-size: 100%;
  block-size: 100dvb;
  overflow: clip;
}

/* Shopify iframe icinde cift logo olmamasi icin ?embed=1 duzeni */
.app-shell.is-embed .brand-link,
.app-shell.is-embed .header-divider {
  display: none;
}

.app-shell.is-embed .site-header {
  padding-block: 0.45rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding-block: 0.55rem;
  padding-inline: clamp(0.65rem, 2vw, 1.4rem);
  background: var(--bg-header);
  border-block-end: 1px solid var(--border-subtle);
  z-index: 10;
}

.header-start {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-inline-size: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-logo {
  inline-size: auto;
  block-size: clamp(18px, 2.2vw, 24px);
  object-fit: contain;
}

.header-divider {
  inline-size: 1px;
  block-size: 22px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

.model-heading {
  min-inline-size: 0;
}

.model-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(0.9rem, 1.4vw, 1.1rem);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: clip;
  text-overflow: ellipsis;
}

.model-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: clip;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.icon-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding-block: 0.42rem;
  padding-inline: 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.icon-pill:hover {
  background: var(--bg-subtle-hover);
  border-color: var(--border-strong);
}

.icon-pill-warn {
  color: var(--ak-red);
  border-color: color-mix(in srgb, var(--ak-red) 35%, var(--border-subtle));
  background: var(--bg-warn-soft);
}

/* ==========================================================================
   3D Studio Workspace (Container-Query Driven)
   ========================================================================== */

.studio-main {
  container: studio / inline-size;
  position: relative;
  inline-size: 100%;
  block-size: 100%;
  min-block-size: 0;
  background: radial-gradient(circle at 50% 42%, var(--bg-stage-top) 0%, var(--bg-stage-bot) 85%);
  overflow: clip;
  user-select: none;
  -webkit-user-select: none;
}

.viewport-stage {
  position: absolute;
  inset: 0;
}

#viewer-canvas {
  inline-size: 100%;
  block-size: 100%;
  touch-action: none;
  cursor: grab;
}

#viewer-canvas:active {
  cursor: grabbing;
}

.callout-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: clip;
}

.seam-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  padding-block: 0.2rem;
  padding-inline: 0.5rem;
  border-radius: 999px;
  background: #ffffff;
  color: #121212;
  border: 1.5px solid var(--ak-orange);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  transition: opacity 0.15s ease;
}

.seam-pin::after {
  content: "";
  position: absolute;
  inset-inline-start: 50%;
  inset-block-start: 100%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-block-start-color: var(--ak-orange);
}

.loading-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.75rem;
  background: color-mix(in srgb, var(--bg-stage-bot) 82%, transparent);
  backdrop-filter: blur(4px);
  font-weight: 600;
  z-index: 6;
}

.spinner {
  inline-size: 36px;
  block-size: 36px;
  border-radius: 50%;
  border: 3px solid var(--border-strong);
  border-block-start-color: var(--ak-orange);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Floating Top Bar: Chapters & 3D Tools
   ========================================================================== */

.studio-top-bar {
  position: absolute;
  inset-block-start: 0.75rem;
  inset-inline: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
  z-index: 4;
}

.chapter-bar,
.tool-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.28rem;
  min-inline-size: 0;
  pointer-events: auto;
  padding: 0.24rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
}

.chapter-bar {
  overflow-x: auto;
  scrollbar-width: none;
}

.chapter-bar::-webkit-scrollbar {
  display: none;
}

.tool-bar {
  flex-shrink: 0;
}

.desktop-tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.mobile-tools-trigger {
  display: none;
}

.chapter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding-block: 0.36rem;
  padding-inline: 0.72rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.chapter-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.chapter-btn.is-done {
  color: var(--ak-green);
}

.chapter-btn.is-active {
  background: var(--ak-orange);
  color: #ffffff;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  padding-block: 0.36rem;
  padding-inline: 0.65rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tool-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.tool-btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--ak-orange) 16%, transparent);
  color: var(--ak-orange);
}

/* Mobile View Options Dropdown */
.mobile-view-menu {
  position: absolute;
  inset-block-start: 3.6rem;
  inset-inline-end: 0.6rem;
  inline-size: min(250px, calc(100% - 1.2rem));
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.45rem;
  border-radius: var(--radius-md);
  background: var(--bg-card-solid);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  z-index: 5;
}

.menu-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 0.84rem;
  font-weight: 600;
  text-align: start;
}

.menu-toggle-row:hover {
  background: var(--bg-subtle);
}

.toggle-pill {
  position: relative;
  inline-size: 34px;
  block-size: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.toggle-pill::after {
  content: "";
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  inline-size: 16px;
  block-size: 16px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.15s ease;
}

.menu-toggle-row[aria-pressed="true"] .toggle-pill {
  background: var(--ak-orange);
}

.menu-toggle-row[aria-pressed="true"] .toggle-pill::after {
  transform: translateX(14px);
}

.menu-action-row {
  border-block-start: 1px solid var(--border-subtle);
  border-radius: 0 0 8px 8px;
  padding-block-start: 0.65rem;
  color: var(--ak-orange);
}

/* ==========================================================================
   Floating Active Part & Assembly Note Card
   ========================================================================== */

.note-card {
  position: absolute;
  inset-inline-start: 0.75rem;
  inset-block-start: 4.1rem;
  inline-size: min(305px, calc(100% - 1.5rem));
  max-block-size: calc(100% - 10rem);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-inline-start: 4px solid var(--ak-orange);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
  overflow: clip;
  z-index: 4;
}

.note-card-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  inline-size: 100%;
  padding: 0.8rem 0.9rem 0.45rem;
  border: 0;
  background: transparent;
  text-align: start;
}

.part-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding-block: 0.16rem;
  padding-inline: 0.55rem;
  border-radius: 999px;
  background: var(--ak-orange);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.76rem;
  font-weight: 700;
}

.note-summary-title {
  flex: 1 1 auto;
  min-inline-size: 0;
  font-family: var(--font-heading);
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: clip;
  text-overflow: ellipsis;
}

.note-chevron {
  display: none;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.note-card-details {
  padding: 0 0.9rem 0.85rem;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.chapter-tag {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
}

.note-part-body {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
  line-height: 1.46;
  color: var(--text-secondary);
  user-select: text;
  -webkit-user-select: text;
}

.note-part-tip {
  margin: 0 0 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--ak-orange) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ak-orange) 28%, transparent);
  font-size: 0.82rem;
  line-height: 1.4;
}

.neighbor-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-block-end: 0.65rem;
}

.neighbor-label {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.neighbor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.neighbor-chip {
  padding-block: 0.14rem;
  padding-inline: 0.48rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
}

.neighbor-chip:hover {
  border-color: var(--ak-orange);
  color: var(--ak-orange);
}

.fold-legend {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
  padding-block: 0.5rem;
  border-block: 1px solid var(--border-subtle);
  margin-block-end: 0.55rem;
}

.fold-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  line-height: 1.25;
}

.fold-item strong {
  display: block;
  font-size: 0.76rem;
}

.fold-item span {
  color: var(--text-muted);
}

.flap-reminder {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.77rem;
  color: var(--ak-red);
}

/* ==========================================================================
   Floating Bottom Step Dock
   ========================================================================== */

.step-dock {
  position: absolute;
  inset-block-end: max(0.75rem, env(safe-area-inset-bottom));
  inset-inline-start: 50%;
  transform: translateX(-50%);
  inline-size: min(720px, calc(100% - 1.5rem));
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
  z-index: 4;
}

.dock-center {
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.step-pills {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: 0.1rem;
}

.step-pills::-webkit-scrollbar {
  display: none;
}

.step-pill {
  flex: 0 0 auto;
  min-inline-size: 32px;
  block-size: 30px;
  padding-inline: 0.42rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  transition: transform 0.12s ease, background-color 0.15s ease, color 0.15s ease;
}

.step-pill:hover {
  border-color: var(--ak-orange);
}

.step-pill.is-done {
  background: color-mix(in srgb, var(--ak-green) 16%, var(--bg-subtle));
  border-color: color-mix(in srgb, var(--ak-green) 42%, transparent);
  color: var(--ak-green);
}

.step-pill.is-active {
  background: var(--ak-orange);
  border-color: var(--ak-orange);
  color: #ffffff;
  transform: scale(1.05);
}

.progress-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-progress {
  flex: 1 1 auto;
  block-size: 6px;
  accent-color: var(--ak-orange);
  border-radius: 999px;
}

.progress-text {
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding-block: 0.52rem;
  padding-inline: 0.92rem;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.nav-btn-primary {
  border: 0;
  background: var(--ak-orange);
  color: #ffffff;
}

.nav-btn-primary:hover:not(:disabled) {
  background: var(--ak-orange-hover);
}

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

.nav-btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle-hover);
}

.subtitle-toast {
  display: none;
}

@keyframes ak-subtitle-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ak-caret-blink {
  50% {
    opacity: 0;
  }
}

@keyframes ak-note-receive {
  0% {
    border-color: var(--ak-orange);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ak-orange) 42%, transparent);
  }
  45% {
    border-color: var(--ak-orange);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--ak-orange) 20%, transparent),
      0 8px 24px color-mix(in srgb, var(--ak-orange) 24%, transparent);
  }
  100% {
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-card);
  }
}

@keyframes ak-sheen-sweep {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(120%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .subtitle-toast,
  .note-card.is-receiving,
  .note-card.is-receiving::after,
  .subtitle-caret {
    animation: none;
    transition: none;
  }
}

/* ==========================================================================
   Container Query: Clean, Uncluttered Mobile QR Layout
   ========================================================================== */

@container studio (inline-size < 780px) {
  .studio-top-bar {
    inset-block-start: 0.55rem;
    inset-inline: 0.55rem;
    gap: 0.4rem;
  }

  .desktop-tools,
  .tool-label {
    display: none;
  }

  .mobile-tools-trigger {
    display: inline-flex;
  }

  .chapter-btn {
    padding-block: 0.32rem;
    padding-inline: 0.58rem;
    font-size: 0.74rem;
  }

  /* Collapsible bottom note sheet leaves ~70%+ of phone screen for 3D model */
  .note-card {
    inset-inline: 0.55rem;
    inset-block-start: auto;
    inset-block-end: calc(max(0.55rem, env(safe-area-inset-bottom)) + 4.95rem);
    inline-size: auto;
    max-block-size: 42dvb;
  }

  .note-card-toggle {
    padding: 0.55rem 0.75rem;
  }

  .note-chevron {
    display: inline-block;
  }

  .note-card.is-collapsed .note-card-details {
    display: none;
  }

  .note-card:not(.is-collapsed) .note-chevron {
    transform: rotate(180deg);
  }

  .note-card-details {
    padding: 0 0.75rem 0.7rem;
  }

  /* Mobile Typewriter Subtitle Caption & Tuck Animation */
  .subtitle-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    position: absolute;
    inset-inline: 0.7rem;
    inset-block-end: calc(max(0.55rem, env(safe-area-inset-bottom)) + 8.35rem);
    padding: 0.68rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid color-mix(in srgb, var(--ak-orange) 42%, var(--border-subtle));
    background: light-dark(rgba(255, 255, 255, 0.94), rgba(14, 28, 38, 0.92));
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
    text-align: start;
    z-index: 5;
    transform-origin: center bottom;
    animation: ak-subtitle-in 0.26s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.34s ease;
  }

  .subtitle-toast.is-tucking {
    transform: translateY(34px) scale(0.84);
    opacity: 0;
    pointer-events: none;
  }

  .subtitle-badge {
    flex-shrink: 0;
    padding: 0.14rem 0.48rem;
    border-radius: 999px;
    background: var(--ak-orange);
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    margin-block-start: 0.08rem;
  }

  .subtitle-text-wrap {
    font-size: 0.85rem;
    line-height: 1.42;
    color: var(--text-primary);
  }

  .subtitle-caret {
    display: inline-block;
    inline-size: 2px;
    block-size: 0.95em;
    margin-inline-start: 2px;
    vertical-align: -0.14em;
    background: var(--ak-orange);
    animation: ak-caret-blink 0.7s steps(2, start) infinite;
  }

  .subtitle-toast.is-typed .subtitle-caret {
    opacity: 0;
    animation: none;
  }

  /* Refined soft light-sheen glow when note tucks into collapsed card */
  .note-card.is-receiving {
    animation: ak-note-receive 0.75s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .note-card.is-receiving::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
      105deg,
      transparent 15%,
      color-mix(in srgb, var(--ak-orange) 26%, rgba(255, 255, 255, 0.5)) 48%,
      transparent 82%
    );
    transform: translateX(-120%);
    animation: ak-sheen-sweep 0.65s ease-out forwards;
  }

  .step-dock {
    inset-inline: 0.55rem;
    inset-block-end: max(0.55rem, env(safe-area-inset-bottom));
    transform: none;
    inline-size: auto;
    padding: 0.42rem 0.48rem;
    gap: 0.38rem;
  }

  .step-pill {
    min-inline-size: 29px;
    block-size: 28px;
    font-size: 0.78rem;
  }

  .step-dock .nav-btn {
    padding-block: 0.48rem;
    padding-inline: 0.62rem;
  }

  .step-dock .nav-btn-text {
    display: none;
  }
}

@media (max-width: 680px) {
  .header-divider,
  .model-subtitle,
  .pill-text {
    display: none;
  }

  .icon-pill {
    padding: 0.44rem 0.55rem;
  }
}

/* ==========================================================================
   Native <dialog> Modals (Modern Web Guidance Mandatory Rules)
   ========================================================================== */

dialog.ak-dialog {
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card-solid);
  color: var(--text-primary);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
  inline-size: min(760px, calc(100dvw - 1.25rem));
  max-block-size: calc(100dvb - 1.25rem);
}

dialog.ak-dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(8, 17, 24, 0.72);
  backdrop-filter: blur(6px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-shell {
  display: flex;
  flex-direction: column;
  max-block-size: calc(100dvb - 1.25rem);
  overflow: clip;
}

.dialog-head {
  padding: 1rem 1.2rem 0.85rem;
  border-block-end: 1px solid var(--border-subtle);
}

.dialog-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.warn-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-block-end: 0.6rem;
}

.warn-pill {
  padding-block: 0.2rem;
  padding-inline: 0.6rem;
  border-radius: 999px;
  background: var(--bg-warn-soft);
  color: var(--ak-red);
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
}

.dialog-title {
  margin: 0 0 0.22rem;
  font-family: var(--font-heading);
  font-size: clamp(1.05rem, 2.2vw, 1.32rem);
  font-weight: 800;
  line-height: 1.25;
}

.dialog-lead {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.close-x-btn {
  display: grid;
  place-items: center;
  inline-size: 34px;
  block-size: 34px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  flex-shrink: 0;
  font-weight: 700;
}

.close-x-btn:hover {
  background: var(--bg-subtle-hover);
}

.warn-steps-indicator {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-block-start: 0.8rem;
}

.warn-tab {
  padding-block: 0.45rem;
  padding-inline: 0.4rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
}

.warn-tab.is-active {
  background: var(--ak-orange);
  border-color: var(--ak-orange);
  color: #ffffff;
}

.warn-tab.is-visited:not(.is-active) {
  border-color: color-mix(in srgb, var(--ak-green) 45%, transparent);
  color: var(--ak-green);
}

.dialog-body {
  padding: 1rem 1.2rem;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.8rem 1.2rem;
  border-block-start: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}

.warn-status-msg {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ak-red);
}

.dialog-foot-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-inline-start: auto;
}

/* Warning Panels */
.warn-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.9rem;
  align-items: start;
}

.warn-figure {
  margin: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  overflow: clip;
}

.warn-figure img {
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.warn-figure figcaption {
  padding: 0.65rem 0.8rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.warn-figure-bad {
  border-color: color-mix(in srgb, var(--ak-red) 55%, transparent);
}

.warn-figure-good {
  border-color: color-mix(in srgb, var(--ak-green) 55%, transparent);
}

.warn-text-stack {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.critical-callout {
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius-md);
  background: var(--bg-warn-soft);
  border: 1px solid color-mix(in srgb, var(--ak-red) 35%, transparent);
  margin-block-end: 0.8rem;
}

.warn-text-stack .critical-callout {
  margin-block-end: 0;
}

.critical-callout h2 {
  margin: 0 0 0.28rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--ak-red);
}

.critical-callout p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.46;
}

.line-legend-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.line-legend-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.85rem;
}

.line-sample {
  inline-size: 44px;
  block-size: 0;
  flex-shrink: 0;
}

.line-valley {
  border-block-start: 3px dashed var(--ak-red-fold);
}

.line-mountain {
  border-block-start: 3px dotted var(--ak-blue-fold);
}

.line-cut {
  border-block-start: 2.5px solid var(--text-primary);
}

.glue-tip {
  margin: 0.8rem 0 0;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  line-height: 1.45;
}

.confirm-box {
  padding: 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}

.confirm-box h2 {
  margin: 0 0 0.45rem;
  font-family: var(--font-heading);
  font-size: 0.98rem;
}

.check-summary {
  margin: 0 0 0.85rem;
  padding-inline-start: 1.15rem;
  font-size: 0.86rem;
  line-height: 1.52;
  color: var(--text-secondary);
}

.ack-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--ak-orange);
  background: color-mix(in srgb, var(--ak-orange) 10%, var(--bg-card-solid));
  cursor: pointer;
  font-size: 0.86rem;
  line-height: 1.4;
}

.ack-checkbox input {
  inline-size: 18px;
  block-size: 18px;
  margin-block-start: 2px;
  accent-color: var(--ak-orange);
  flex-shrink: 0;
}

/* Part Picker Dialog */
.picker-dialog {
  inline-size: min(520px, calc(100dvw - 1.25rem));
}

.part-search-box input {
  inline-size: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  margin-block-end: 0.9rem;
}

.picker-group {
  margin-block-end: 0.85rem;
}

.picker-group h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 0.42rem;
}

.picker-btn {
  padding-block: 0.56rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
}

.picker-btn:hover {
  border-color: var(--ak-orange);
}

.picker-btn.is-done {
  color: var(--ak-green);
  border-color: color-mix(in srgb, var(--ak-green) 45%, transparent);
}

.picker-btn.is-active {
  background: var(--ak-orange);
  border-color: var(--ak-orange);
  color: #ffffff;
}

/* Completion Dialog */
.complete-dialog {
  inline-size: min(440px, calc(100dvw - 1.25rem));
}

.complete-shell {
  padding: 1.6rem 1.35rem;
  align-items: center;
  text-align: center;
  gap: 0.7rem;
}

.complete-badge {
  display: grid;
  place-items: center;
  inline-size: 54px;
  block-size: 54px;
  border-radius: 50%;
  background: var(--ak-green);
  color: #ffffff;
  font-size: 1.7rem;
  font-weight: 800;
}

.complete-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-block-start: 0.4rem;
}
