:root {
  --bg: #0a1020;
  --bg-soft: #111936;
  --card: rgba(20, 31, 62, 0.72);
  --card-strong: rgba(25, 38, 75, 0.9);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f7fb;
  --muted: #a9b4ce;
  --muted-2: #7784a3;
  --primary: #7c5cff;
  --primary-2: #00d4ff;
  --success: #39d98a;
  --warning: #ffbf47;
  --danger: #ff5c7a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="light"] {
  --bg: #eef3ff;
  --bg-soft: #ffffff;
  --card: rgba(255, 255, 255, 0.8);
  --card-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(18, 30, 60, 0.12);
  --text: #111827;
  --muted: #52607a;
  --muted-2: #6b7280;
  --shadow: 0 24px 70px rgba(68, 86, 140, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(124, 92, 255, 0.28), transparent 35%),
    radial-gradient(circle at 90% 10%, rgba(0, 212, 255, 0.22), transparent 32%),
    linear-gradient(135deg, var(--bg), #060913 80%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 104px;
}

.topbar,
.brand-block,
.action-row,
.url-input-row,
.section-heading,
.dialog-header,
.progress-meta,
.dialog-actions,
.status-pill,
.quick-action,
.source-summary,
.media-meta,
.video-actions,
.link-row,
.bottom-nav {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.brand-block {
  gap: 14px;
}

.brand-mark {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 20px 46px rgba(124, 92, 255, 0.3);
}

.brand-mark__play {
  position: absolute;
  left: 21px;
  top: 17px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 16px solid white;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary-2);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.3rem, 2vw, 1.85rem);
  letter-spacing: -0.04em;
}

h1 span,
h2 span {
  color: var(--primary-2);
}

h2 {
  max-width: 720px;
  margin-bottom: 18px;
  font-size: clamp(2.2rem, 5vw, 4.7rem);
  line-height: 0.95;
  letter-spacing: -0.07em;
}

h3 {
  margin-bottom: 0;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.glass-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.55fr);
  gap: 20px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.52fr);
  gap: 28px;
  padding: clamp(24px, 4vw, 44px);
  min-height: 520px;
}

.hero-copy {
  align-self: center;
}

.status-pill,
.small-badge {
  width: fit-content;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  padding: 9px 13px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(57, 217, 138, 0.12);
}

.input-panel {
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card-strong);
  padding: 22px;
}

.input-panel label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.url-input-row {
  gap: 10px;
  margin-bottom: 12px;
}

input[type="url"] {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  outline: none;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  padding: 16px 15px;
}

[data-theme="light"] input[type="url"] {
  background: rgba(245, 247, 255, 0.88);
}

input:focus {
  border-color: rgba(0, 212, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.1);
}

.action-row,
.dialog-actions {
  gap: 12px;
}

.primary-button,
.soft-button,
.ghost-button,
.icon-button,
.quick-action {
  border: 0;
  border-radius: 18px;
  min-height: 48px;
  font-weight: 850;
  transition: transform 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

.primary-button {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  padding: 0 22px;
  box-shadow: 0 18px 38px rgba(124, 92, 255, 0.24);
}

.soft-button,
.ghost-button,
.icon-button,
.quick-action {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0 16px;
}

.ghost-button {
  background: transparent;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 48px;
  padding: 0;
  font-size: 1.25rem;
}

.primary-button:hover,
.soft-button:hover,
.ghost-button:hover,
.icon-button:hover,
.quick-action:hover {
  transform: translateY(-1px);
}

.button-loader {
  display: none;
  position: absolute;
  left: 16px;
  top: calc(50% - 8px);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.36);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.primary-button.loading .button-loader {
  display: inline-block;
}

.legal-note {
  margin: 14px 0 0;
  color: var(--muted-2);
  font-size: 0.84rem;
}

.device-card {
  display: grid;
  place-items: center;
  padding: 26px;
  min-height: 520px;
}

.phone-frame {
  position: relative;
  width: 238px;
  height: 464px;
  border: 10px solid rgba(255, 255, 255, 0.13);
  border-radius: 42px;
  background: #050814;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 30px 80px rgba(0, 0, 0, 0.42);
  padding: 16px;
}

.phone-speaker {
  position: absolute;
  top: 12px;
  left: 50%;
  width: 76px;
  height: 7px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.16);
}

.phone-screen {
  height: 100%;
  border-radius: 30px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(124, 92, 255, 0.2), rgba(0, 212, 255, 0.04)), #101936;
  padding: 32px 14px 14px;
}

.mini-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 18px;
}

.mini-toolbar span,
.preview-lines span,
.preview-grid span {
  display: block;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.mini-toolbar span {
  height: 8px;
}

.preview-thumbnail {
  display: grid;
  place-items: center;
  height: 170px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.8), rgba(0, 212, 255, 0.55));
}

.preview-play {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  clip-path: polygon(35% 25%, 35% 75%, 75% 50%);
}

.preview-lines {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.preview-lines span {
  height: 10px;
}

.preview-lines span:nth-child(2) {
  width: 74%;
}

.preview-lines span:nth-child(3) {
  width: 52%;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.preview-grid span {
  height: 58px;
  border-radius: 16px;
}

.quick-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
}

.quick-action {
  justify-content: center;
  gap: 10px;
  min-height: 62px;
}

.quick-action span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 11px;
  background: rgba(124, 92, 255, 0.18);
}

.panel {
  padding: 22px;
  min-height: 315px;
}

.wide-panel {
  grid-column: 1 / -1;
}

.section-heading {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.scanner-box {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
  padding: 16px;
}

.scanner-visual {
  position: relative;
  overflow: hidden;
  height: 86px;
  border-radius: 20px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    rgba(0, 0, 0, 0.18);
  background-size: 20px 20px;
}

.scanner-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-2), transparent);
  animation: scan 2.4s ease-in-out infinite;
}

.scanner-copy strong {
  display: block;
  margin-bottom: 4px;
}

.scanner-copy p {
  margin-bottom: 0;
  font-size: 0.94rem;
}

.log-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
  max-height: 188px;
  overflow: auto;
  padding-right: 4px;
}

.log-item {
  display: flex;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.87rem;
}

.log-item::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--primary-2);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 205px;
  border: 1px dashed var(--line);
  border-radius: 24px;
  text-align: center;
  padding: 26px;
}

.empty-state p {
  max-width: 360px;
  margin-bottom: 0;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 12px;
  border-radius: 19px;
  background: rgba(124, 92, 255, 0.18);
  color: var(--primary-2);
  font-size: 1.4rem;
}

.video-list,
.media-options,
.settings-grid,
.link-table {
  display: grid;
  gap: 12px;
}

.video-card,
.media-option,
.link-row,
.setting-row {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
}

.video-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
}

.video-thumb {
  position: relative;
  border-radius: 16px;
  min-height: 86px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.9), rgba(0, 212, 255, 0.55));
}

.video-thumb::after {
  content: "";
  position: absolute;
  left: 38px;
  top: 31px;
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 18px solid rgba(255, 255, 255, 0.9);
}

.video-body strong,
.media-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-body p {
  margin: 4px 0 12px;
  font-size: 0.87rem;
}

.video-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.chip-button,
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 8px 11px;
  font-size: 0.78rem;
  font-weight: 800;
}

.chip.success {
  color: var(--success);
}

.chip.warning {
  color: var(--warning);
}

.link-row {
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.link-main {
  min-width: 0;
}

.link-main strong,
.link-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-main span {
  color: var(--muted);
  font-size: 0.86rem;
}

.link-status {
  flex: 0 0 auto;
}

dialog {
  width: min(720px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--card-strong);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  padding: 0;
}

dialog::backdrop {
  background: rgba(2, 6, 18, 0.72);
  backdrop-filter: blur(6px);
}

.dialog-header {
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 22px;
}

.source-summary {
  justify-content: space-between;
  gap: 12px;
  margin: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.14);
}

.source-summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.media-options {
  max-height: 380px;
  overflow: auto;
  padding: 0 22px 18px;
}

.media-option {
  display: grid;
  grid-template-columns: auto 82px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
}

.media-option input {
  width: 20px;
  height: 20px;
}

.media-thumb {
  height: 68px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.78), rgba(0, 212, 255, 0.46));
}

.media-meta {
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.download-preview {
  margin: 0 22px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.progress-meta {
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.progress-track {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width 0.24s ease;
}

.dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding: 18px 22px 22px;
}

.settings-dialog {
  width: min(680px, calc(100% - 28px));
}

.settings-grid {
  padding: 22px;
}

.setting-row {
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
}

.setting-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
}

.setting-row input[type="checkbox"] {
  width: 44px;
  height: 24px;
  accent-color: var(--primary);
}

.capacitor-note {
  margin: 0 22px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(124, 92, 255, 0.1);
  padding: 16px;
}

.capacitor-note p {
  margin-bottom: 0;
}

code {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 5px;
  color: var(--primary-2);
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 90px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100% - 36px));
}

.toast {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card-strong);
  box-shadow: var(--shadow);
  padding: 13px 15px;
  color: var(--text);
  animation: slideIn 0.22s ease;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 40;
  transform: translateX(-50%);
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 16, 32, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 7px;
}

.nav-item {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 11px 16px;
  font-size: 0.84rem;
  font-weight: 850;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
}

[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.86);
}

.sun-icon {
  display: none;
}

.moon-icon {
  display: inline;
}

[data-theme="light"] .sun-icon {
  display: inline;
}

[data-theme="light"] .moon-icon {
  display: none;
}

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

@keyframes scan {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(64px); }
}

@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 980px) {
  .content-grid,
  .hero-card {
    grid-template-columns: 1fr;
  }

  .device-card {
    min-height: 360px;
  }

  .phone-frame {
    width: 205px;
    height: 380px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 22px, 1220px);
    padding-top: 18px;
  }

  .topbar {
    align-items: flex-start;
  }

  .hero-card,
  .panel,
  .device-card {
    border-radius: 24px;
  }

  .hero-card {
    min-height: auto;
    padding: 22px;
  }

  .url-input-row,
  .action-row,
  .dialog-actions,
  .quick-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .quick-actions {
    display: grid;
  }

  .quick-action {
    width: 100%;
  }

  .scanner-box,
  .video-card,
  .media-option {
    grid-template-columns: 1fr;
  }

  .media-option input {
    order: -1;
  }

  .link-row,
  .source-summary,
  .setting-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .bottom-nav {
    width: calc(100% - 22px);
    justify-content: space-between;
  }

  .nav-item {
    flex: 1;
    padding: 10px 8px;
  }
}
