/* Final design alignment layer. Kept separate from historical audit patches. */
:where(button, a, .btn, .icon-btn, .tab, .filter-chip, .select-button, .toggle) { -webkit-tap-highlight-color: transparent; }

.btn, .icon-btn, .filter-chip, .select-button, .quick-prompts button, .composer-tools button, .tab {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
}
.btn { min-height: 44px; height: auto; line-height: 1.25; text-align: center; text-wrap: balance; }
.btn svg, .icon-btn svg, .quick-prompts button svg, .composer-tools button svg { flex: 0 0 auto; align-self: center; }
.btn-wide { width: 100%; }

.section-head, .page-header, .detail-head, .composer-footer, .toolbar, .level-actions, .modal-actions { align-items: center; }
.section-head > :first-child, .page-title, .route-copy, .dossier-copy, .dashboard-empty-copy { min-width: 0; }
.section-head .card-title, .section-head h2, .page-title h1 { text-wrap: balance; line-height: 1.2; }
.card-subtitle, .page-title p, .form-hint, .secondary, .level-row-title, .artifact-name strong, .setting-value, .select-row strong { overflow-wrap: anywhere; }

.link-button, .profile-button, .nav-item, .level-row, .artifact-table-row, .setting-row, .select-row, .step, .status-pill, .chip { align-items: center; }
.link-button { min-height: 38px; line-height: 1.3; }
.nav-label, .level-row-title, .row-status, .row-time, .row-artifact, .setting-label, .setting-value, .level-main { min-width: 0; }
.nav-label, .row-status, .row-time, .row-artifact { overflow-wrap: anywhere; }

.search-input, .select-control, .select-button, .field-control input, .field-control textarea, .form-grid input, .form-grid select, .form-grid textarea, .composer textarea { line-height: 1.35; }
.field-control textarea, .form-grid textarea, .composer textarea { padding-block: 12px; }
.level-actions .btn, .modal-actions .btn, .header-actions .btn { min-width: 170px; }
.level-actions .btn:first-child { min-width: min(390px, 100%); }
.header-actions, .level-actions, .modal-actions { flex-wrap: wrap; }

@media (max-width: 980px) {
  .header-actions, .level-actions, .modal-actions { align-items: stretch; }
  .header-actions .btn, .level-actions .btn, .modal-actions .btn { min-width: 0; }
}
@media (max-width: 680px) {
  .btn, .icon-btn, .filter-chip, .select-button, .quick-prompts button, .composer-tools button { min-height: 44px; }
  .page-header, .section-head, .toolbar, .composer-footer { align-items: stretch; }
  .section-head .btn, .header-actions .btn, .level-actions .btn, .modal-actions .btn { width: 100%; }
  .link-button { justify-content: flex-start; text-align: left; }
  .step { line-height: 1.25; text-align: center; }
}
/* Final asset-path correction: this file loads after all feature layers. */
.dashboard-dossier-card::before {
  background-image: url('../../assets/vectors/orbital-grid.svg');
}

.prologue-level-layout .prologue-hero::before {
  background-image: url('../../assets/levels/prologue-investigation-still.webp') !important;
}

.route-hero::before { background-image: url('../../assets/illustrations/chess-king-hero.webp') !important; }
.route-hero::after,
.book-preview::before { background-image: url('../../assets/vectors/orbital-grid.svg') !important; }
.dashboard-dossier-card::before { background-image: url('../../assets/vectors/orbital-grid.svg') !important; }
.sidebar::after { background-image: url('../../assets/illustrations/staircase-sidebar.webp') !important; }

/* Dashboard composition: give long Russian headings enough breathing room. */
.dashboard-bottom {
  grid-template-columns: minmax(0, 1.52fr) minmax(270px, .92fr) minmax(300px, 1.06fr);
}

.dashboard-empty-report {
  grid-template-columns: minmax(165px, .8fr) minmax(0, 1.2fr);
  gap: 18px;
}

.dashboard-empty-copy h2,
.dashboard-bottom .card-title {
  max-width: 100%;
  overflow-wrap: normal;
}

.dashboard-empty-copy p { max-width: 31ch; }

.dashboard-bottom .card-title {
  letter-spacing: -.018em;
}

@media (min-width: 1281px) and (max-width: 1600px) {
  .dashboard-bottom { grid-template-columns: minmax(0, 1.42fr) minmax(250px, .86fr) minmax(270px, 1fr); }
  .dashboard-empty-copy h2 { font-size: clamp(27px, 2vw, 31px); }
  .dashboard-empty-copy p { font-size: 14px; }
}

/* At 100% browser zoom the CSS viewport is compact even on a large monitor. */
@media (max-width: 1400px) and (min-width: 1081px) {
  .dashboard-bottom {
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, .85fr) !important;
    gap: 16px !important;
  }

  .dashboard-bottom > .dashboard-dossier-card {
    grid-column: 1 / -1 !important;
    min-height: 330px !important;
    display: grid;
    grid-template-columns: minmax(0, .82fr) minmax(300px, 1.18fr);
    grid-template-rows: 1fr auto;
    column-gap: 24px;
  }

  .dashboard-dossier-card .dashboard-dossier-visual {
    grid-column: 2;
    grid-row: 1 / 3;
    min-height: 280px;
    margin: 0;
  }

  .dashboard-dossier-card .dashboard-dossier-action {
    grid-column: 1;
    grid-row: 2;
    margin: 18px 0 0 !important;
  }
}

@media (max-width: 980px) {
  .dashboard-empty-report { grid-template-columns: minmax(140px, .78fr) minmax(0, 1.22fr); }
}

/* Match the compact, editorial density of the reference at desktop zoom. */
@media (min-width: 981px) {
  body {
    zoom: .8;
    width: 125%;
  }

  .artifact-dashboard-head {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 16px !important;
  }

  .artifact-dashboard-head .card-title {
    max-width: none !important;
    overflow-wrap: normal;
  }

  .artifact-all-link {
    align-self: center;
    white-space: nowrap;
  }

  .dashboard-bottom .btn,
  .dashboard-bottom .link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* One consistent action row for the three lower dashboard cards. */
@media (min-width: 761px) {
  .dashboard-bottom > .card {
    position: relative;
    height: clamp(425px, 29.5vw, 495px) !important;
  }

  .dashboard-bottom .dashboard-primary-action,
  .dashboard-bottom .artifact-footer-link,
  .dashboard-bottom .dashboard-dossier-action {
    box-sizing: border-box;
    height: 54px !important;
    min-height: 54px !important;
    width: min(100%, 300px) !important;
    margin: 0 !important;
    padding: 0 18px !important;
    border: 1px solid rgba(213,155,56,.9) !important;
    border-radius: 9px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #f6bd48 !important;
    background: linear-gradient(180deg, rgba(173,122,39,.055), rgba(0,0,0,.08));
    font-size: 15px !important;
    line-height: 1.2;
    font-weight: 650;
    white-space: nowrap;
  }

  .dashboard-bottom .dashboard-primary-action {
    position: static !important;
    transform: none !important;
    margin-top: auto !important;
  }

  .dashboard-empty-copy {
    align-self: stretch;
    height: 100%;
    padding-bottom: 0;
  }

  .dashboard-bottom .artifact-footer-link {
    position: static !important;
    transform: none !important;
    margin-top: auto !important;
  }

  .dashboard-bottom .dashboard-dossier-action {
    position: static !important;
    transform: none !important;
    margin-top: auto !important;
  }

  .dashboard-bottom .artifact-dashboard-card {
    display: flex;
    flex-direction: column;
  }

  .dashboard-bottom .artifact-dashboard-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .dashboard-bottom .artifact-dashboard-actions {
    flex: 0 0 54px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-top: 16px;
  }

  .dashboard-bottom .dashboard-empty-copy {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) 54px;
    align-content: stretch;
    gap: 0;
  }

  .dashboard-bottom .dashboard-empty-copy .dashboard-empty-divider {
    margin-block: 22px;
  }

  .dashboard-bottom .dashboard-empty-copy .dashboard-primary-action {
    align-self: end;
    justify-self: center;
  }

  .dashboard-bottom .dashboard-dossier-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) 54px;
  }

  .dashboard-bottom .dashboard-dossier-card .dashboard-dossier-visual {
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    padding-bottom: 14px;
  }

  .dashboard-bottom .dashboard-dossier-card .dashboard-dossier-action {
    align-self: end;
    justify-self: center;
  }

  .dashboard-bottom .dashboard-dossier-card .dashboard-dossier-visual img {
    max-height: 218px;
  }

  .dashboard-bottom .artifact-dashboard-card .artifact-empty-content,
  .dashboard-bottom .artifact-dashboard-card .artifact-list {
    min-height: 0;
  }

  .dashboard-bottom .artifact-dashboard-card .artifact-empty-content {
    flex: 1 1 auto;
    padding-bottom: 0 !important;
    gap: 10px !important;
  }

  .dashboard-bottom .artifact-dashboard-card .artifact-empty-visual {
    flex: 0 0 104px;
    min-height: 104px !important;
  }

  .dashboard-bottom .artifact-dashboard-card .artifact-empty-visual img {
    max-height: 112px !important;
  }

  .dashboard-bottom .artifact-dashboard-card .artifact-footer-link,
  .dashboard-bottom .dashboard-dossier-action {
    align-self: center;
  }
}
/* Calm interaction for gold actions: light, responsive, never flashy. */
.btn-outline-gold,
.btn-gold,
.mini-action,
.btn,
.icon-btn,
.filter-chip,
.select-button,
.quick-prompts button,
.composer-tools button,
.dashboard-bottom .artifact-footer-link {
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease, color .2s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .btn-outline-gold:hover:not(:disabled),
  .btn-gold:hover:not(:disabled),
  .mini-action:hover:not(:disabled),
  .btn:hover:not(:disabled),
  .icon-btn:hover:not(:disabled),
  .filter-chip:hover:not(:disabled),
  .select-button:hover:not(:disabled),
  .quick-prompts button:hover:not(:disabled),
  .composer-tools button:hover:not(:disabled),
  .dashboard-bottom .artifact-footer-link:hover:not(:disabled),
  .btn-outline-gold:focus-visible,
  .btn-gold:focus-visible,
  .mini-action:focus-visible,
  .dashboard-bottom .artifact-footer-link:focus-visible {
    transform: translateY(-2px) !important;
    border-color: #f0bd55 !important;
    color: #ffe0a0 !important;
    background-color: rgba(216, 163, 67, .12);
    box-shadow: 0 0 0 1px rgba(240, 189, 85, .18) inset, 0 0 20px rgba(216, 163, 67, .2), 0 8px 18px rgba(0, 0, 0, .2);
  }
}

.btn-outline-gold:active:not(:disabled),
.btn-gold:active:not(:disabled),
.mini-action:active:not(:disabled),
.btn:active:not(:disabled),
.icon-btn:active:not(:disabled),
.filter-chip:active:not(:disabled),
.select-button:active:not(:disabled),
.quick-prompts button:active:not(:disabled),
.composer-tools button:active:not(:disabled),
.dashboard-bottom .artifact-footer-link:active:not(:disabled) {
  transform: translateY(0) !important;
  box-shadow: 0 0 0 1px rgba(240, 189, 85, .16) inset;
}

/* Shared sticky page header with the profile at the left edge. */
.page-header {
  position: relative;
  z-index: 25;
  box-sizing: border-box;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(180px, 230px);
  align-items: center;
  gap: 22px;
  margin: 0 -12px 20px;
  padding: 10px 12px 12px;
  background: linear-gradient(180deg, rgba(4, 7, 10, .98) 72%, rgba(4, 7, 10, .84));
  border-bottom: 1px solid rgba(216, 163, 67, .12);
  backdrop-filter: blur(14px);
}

.profile-header-card {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 8px 10px;
  border-color: rgba(216, 163, 67, .2);
  background: rgba(10, 16, 21, .72);
}

.page-header .page-title h1 {
  font-size: clamp(30px, 2.45vw, 36px);
  line-height: 1;
}

.page-header .page-title p {
  margin-top: 4px;
  line-height: 1.25;
}

.page-header .profile-header-card { grid-column: 3; grid-row: 1; }
.page-header .header-actions { grid-column: 2; grid-row: 1; }

.profile-header-card:hover { border-color: rgba(216, 163, 67, .5); }
.page-header .page-title { min-width: 0; }
.page-header .page-title h1,
.page-header .page-title p { overflow-wrap: anywhere; }

  @media (max-width: 980px) {
  .page-header {
    position: relative;
    min-height: 0;
    grid-template-columns: 1fr auto;
    gap: 12px;
    margin: 0 -4px 12px;
    padding-inline: 4px;
  }

  .profile-header-card { display: none; }
  .page-header .page-title { grid-column: 1 / -1; grid-row: 1; }
  .page-header .header-actions { grid-column: 1 / -1; grid-row: 2; }
}
