/* =========================================================
   Next Star — طبقة تصميم المعالج (بتكمّل styles.css)
   ========================================================= */

/* ---------- Banners ---------- */
.banner[hidden] {
  display: none;
}

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: linear-gradient(100deg, rgba(255, 198, 63, 0.09), rgba(255, 198, 63, 0.02));
  border: 1px solid rgba(255, 198, 63, 0.26);
  border-radius: var(--r);
  padding: 13px 15px;
}

.banner .btn {
  padding: 8px 14px;
  font-size: 12.5px;
  min-height: 38px;
}

/* ---------- Stepper ---------- */
.stepper {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.step-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  text-align: right;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--muted);
  cursor: pointer;
  transition: 0.16s ease;
  font-size: 13px;
  font-weight: 700;
  min-height: 46px;
}

.step-btn .n {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.step-btn .n .ic {
  width: 14px;
  height: 14px;
}

.step-btn:hover:not(:disabled) {
  border-color: #3d4c63;
  color: var(--text);
}

.step-btn.done .n {
  background: rgba(53, 214, 138, 0.16);
  color: var(--green);
}

.step-btn.active {
  background: linear-gradient(145deg, rgba(255, 198, 63, 0.16), rgba(240, 165, 29, 0.07));
  border-color: rgba(255, 198, 63, 0.75);
  color: var(--gold-2);
}

.step-btn.active .n {
  background: linear-gradient(145deg, var(--gold-2), var(--gold));
  color: #17110a;
}

.step-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.step-btn,
.step-btn .t {
  min-width: 0;
}

.step-btn .t {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-bottom: 22px;
}

.rail i {
  display: block;
  height: 100%;
  width: 16.6%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--orange));
  box-shadow: 0 0 12px rgba(255, 198, 63, 0.5);
  transition: width 0.35s var(--ease);
}

/* ---------- Layout helpers ---------- */
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.two-col > .card {
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.pill.warn-pill {
  background: rgba(255, 138, 43, 0.12);
  border-color: rgba(255, 138, 43, 0.35);
  color: #ffb072;
}

.pill.blue-pill {
  background: rgba(90, 162, 255, 0.12);
  border-color: rgba(90, 162, 255, 0.3);
  color: #a8c9ff;
}

.body-text {
  margin: 0;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.85;
}

.mini-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 14px;
}

.mini-card strong {
  color: var(--gold-2);
  font-size: 14px;
  font-family: var(--font-display);
}

.mini-card p {
  margin: 4px 0 0;
  font-size: 12.5px;
}

/* ---------- Dashboard (step 1) ---------- */
.dash {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.dash-item {
  background: #080c12;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-item .k {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

.dash-item .v {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.2;
  color: var(--gold-2);
  font-variant-numeric: tabular-nums;
}

.dash-item .v.small {
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
}

/* ---------- Chips (platforms) ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  transition: 0.15s ease;
  min-height: 44px;
}

.chip input {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--gold);
  flex: 0 0 auto;
}

.chip > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.chip .ic {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  opacity: 0.9;
}

.chip:has(input:checked) {
  border-color: rgba(255, 198, 63, 0.7);
  color: var(--gold-2);
  background: rgba(255, 198, 63, 0.07);
}

.chip:has(input:focus-visible) {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- Mission list ---------- */
.mission-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mission-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.mission-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
  font-family: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 14px;
  cursor: pointer;
  color: var(--text);
  transition: 0.15s ease;
  flex: 1;
  min-width: 0;
}

.mission-item:hover {
  border-color: rgba(255, 198, 63, 0.7);
}

.mission-item.active {
  border-color: rgba(255, 198, 63, 0.75);
  background: rgba(255, 198, 63, 0.07);
}

.mi-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mi-meta {
  font-size: 12px;
  color: var(--muted);
}

.mi-del {
  flex: 0 0 auto;
  width: 42px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: 0.15s ease;
}

.mi-del:hover {
  color: #ff9a9a;
  border-color: rgba(255, 98, 98, 0.45);
  background: rgba(255, 98, 98, 0.07);
}

.mi-del .ic {
  width: 16px;
  height: 16px;
}

/* ---------- Requirement lists ---------- */
.req-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.req-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid transparent;
}

.req-list li.inferred {
  border-color: rgba(255, 138, 43, 0.28);
  background: rgba(255, 138, 43, 0.05);
}

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: #d5deec;
  cursor: pointer;
  flex: 1;
  line-height: 1.65;
  min-width: 0;
}

.check-line input[type='checkbox'] {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  margin-top: 3px;
  padding: 0;
  accent-color: var(--gold);
}

.check-line input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(141, 157, 180, 0.5);
}

.src {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(53, 214, 138, 0.12);
  color: var(--green);
  border: 1px solid rgba(53, 214, 138, 0.28);
  margin-top: 3px;
}

.src.inf {
  background: rgba(255, 138, 43, 0.12);
  color: #ffab6b;
  border-color: rgba(255, 138, 43, 0.3);
}

/* ---------- Script ---------- */
.hook-box {
  background: linear-gradient(135deg, rgba(255, 198, 63, 0.1), rgba(255, 138, 43, 0.04));
  border: 1px solid rgba(255, 198, 63, 0.32);
  border-radius: 13px;
  padding: 15px 17px;
  margin-bottom: 16px;
}

.hook-box p {
  margin: 6px 0 0;
  font-size: 16.5px;
  font-weight: 700;
  color: var(--gold-2);
  line-height: 1.7;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scene {
  display: flex;
  gap: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
}

.scene-time {
  flex: 0 0 auto;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold);
  min-width: 78px;
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
  direction: ltr;
  text-align: right;
}

.scene-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 14px;
  min-width: 0;
}

.scene-shot {
  color: var(--text);
  font-weight: 600;
}

.scene-vo {
  color: #c3cfe0;
}

.scene-os {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.angle-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.angle-list li {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 14px;
}

.angle-list li.picked {
  border-color: rgba(255, 198, 63, 0.7);
  background: rgba(255, 198, 63, 0.06);
}

.angle-list .muted {
  margin-top: 3px;
  line-height: 1.6;
}

.tiny-pill {
  font-size: 11px;
  padding: 2px 8px;
}

/* ---------- Nav row ---------- */
.nav-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.nav-row .spacer {
  flex: 1;
}

.btn.ghost.tiny {
  padding: 7px 13px;
  font-size: 12.5px;
}

/* ---------- Errors / empty ---------- */
.error-box {
  background: rgba(255, 98, 98, 0.08);
  border: 1px solid rgba(255, 98, 98, 0.4);
  border-radius: 12px;
  padding: 14px 16px;
  color: #ffb3b3;
  font-size: 14px;
  margin-top: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-box .error-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.empty .big {
  display: grid;
}

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 9, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(28px + var(--sat)) 16px calc(28px + var(--sab));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 640px;
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line-2);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  margin: auto;
}

.modal-card.wide {
  max-width: 780px;
}

.modal-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.modal-actions .btn {
  padding: 10px 20px;
  font-size: 13.5px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

.check-line.inline {
  flex: 0 0 auto;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.check-line.inline input {
  margin-top: 0;
}

.switch-line {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 13px;
}

.sync-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sync-row .btn {
  padding: 10px 16px;
  font-size: 13px;
}

.sync-row .btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.model-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.model-tools .search {
  flex: 1;
  min-width: 0;
}

.model-tools .muted {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.model-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: var(--bg);
  margin-bottom: 10px;
  overscroll-behavior: contain;
}

.model-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: 0.12s ease;
}

.model-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.model-item input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  accent-color: var(--gold);
}

.mname {
  direction: ltr;
  text-align: left;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.mfree {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

.mfree.yes {
  background: rgba(53, 214, 138, 0.12);
  color: var(--green);
  border-color: rgba(53, 214, 138, 0.3);
}

.mfree.no {
  background: rgba(255, 138, 43, 0.1);
  color: #ffab6b;
  border-color: rgba(255, 138, 43, 0.28);
}

.mnote {
  flex: 0 0 auto;
  font-size: 10.5px;
  color: var(--muted);
}

.model-empty {
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.model-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.card-inner {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.card-inner:last-of-type {
  border-bottom: none;
}

.card-inner h3 {
  margin: 0 0 8px;
  font-size: 14.5px;
  color: var(--gold-2);
  font-family: var(--font-display);
}

.modal a {
  color: var(--gold-2);
}

/* ---------- Backup ---------- */
.backup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.backup-actions .btn {
  width: 100%;
  padding: 12px 14px;
  font-size: 13px;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .stepper {
    display: flex;
    overflow-x: auto;
    gap: 7px;
    padding-bottom: 4px;
    margin-inline: calc(var(--pad) * -1);
    padding-inline: var(--pad);
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .stepper::-webkit-scrollbar {
    display: none;
  }

  .step-btn {
    flex: 0 0 auto;
    min-width: 112px;
    scroll-snap-align: start;
    padding: 9px 11px;
  }

  .step-btn .t {
    font-size: 12px;
  }

  .req-list li {
    flex-wrap: wrap;
  }

  .nav-row .btn {
    flex: 1;
    min-width: 46%;
  }

  .scene {
    flex-direction: column;
    gap: 6px;
  }

  .scene-time {
    text-align: right;
  }
}

@media (max-width: 560px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .modal {
    /* شكل الشيت السفلي على الموبايل */
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 18px 16px calc(20px + var(--sab));
    max-height: 94dvh;
    overflow-y: auto;
    margin: 0;
  }

  .model-list {
    max-height: 44dvh;
  }

  .backup-actions {
    grid-template-columns: 1fr;
  }

  .modal-actions .btn {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .step-btn {
    min-width: 104px;
  }

  .step-btn .t .ic-step {
    display: none;
  }

  .hook-box p {
    font-size: 15.5px;
  }

  .mi-del {
    width: 40px;
  }
}

/* زرار "تثبيت" بيظهر بس لما التطبيق قابل للتثبيت */
#installApp[hidden] {
  display: none;
}
