:root {
  --ink: #f4f2ed;
  --muted: #8d929d;
  --line: rgba(255, 255, 255, 0.1);
  --panel: rgba(22, 24, 29, 0.82);
  --lime: #c9ff59;
  --violet: #8c6eff;
  --danger: #ff6b7a;
  --background: #090a0c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-height: 100%;
  background: var(--background);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 88% 5%, rgba(140, 110, 255, 0.15), transparent 28rem),
    radial-gradient(circle at 0% 28%, rgba(201, 255, 89, 0.07), transparent 24rem),
    var(--background);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 860px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(36px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand h1, h2, p { margin: 0; }
.brand h1 { font-size: 1.45rem; letter-spacing: -0.04em; }

.brand-mark {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(201, 255, 89, 0.48);
  border-radius: 14px;
  background: rgba(201, 255, 89, 0.08);
  box-shadow: inset 0 0 18px rgba(201, 255, 89, 0.06);
}

.brand-mark::before {
  width: 16px;
  height: 12px;
  border: 2px solid var(--lime);
  border-radius: 4px;
  content: "";
}

.brand-mark span {
  position: absolute;
  width: 5px;
  height: 5px;
  border: 1px solid var(--lime);
  border-radius: 50%;
}

.eyebrow {
  margin-bottom: 3px;
  color: #747983;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
}

.import-button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--lime);
  color: #11150b;
  font-weight: 760;
  box-shadow: 0 10px 34px rgba(201, 255, 89, 0.13);
  cursor: pointer;
}

.import-button:active { transform: translateY(1px); }
.import-button:disabled { cursor: wait; opacity: 0.65; }
.import-button.compact { min-height: 42px; padding: 0 15px; font-size: 0.88rem; }

.player-panel, .mode-panel, .library-panel, .storage-panel {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(20px);
}

.video-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 23px 23px 0 0;
  background:
    linear-gradient(135deg, rgba(140, 110, 255, 0.1), transparent 45%),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(255, 255, 255, 0.018) 40px),
    #050506;
}

.video-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }

.empty-stage {
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.empty-stage h2 { margin-top: 14px; font-size: clamp(1.15rem, 5vw, 1.6rem); letter-spacing: -0.035em; }
.empty-stage p { margin: 7px 0 18px; color: var(--muted); font-size: 0.86rem; }

.empty-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid rgba(201, 255, 89, 0.34);
  border-radius: 18px;
  transform: rotate(6deg);
}

.empty-symbol span {
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid var(--lime);
}

.now-playing {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.now-copy { display: flex; min-width: 0; align-items: center; gap: 11px; }
.now-copy div { min-width: 0; }
.now-copy p { color: var(--lime); font-size: 0.67rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.now-copy h2 { overflow: hidden; margin: 3px 0; font-size: 0.92rem; text-overflow: ellipsis; white-space: nowrap; }
.now-copy span { color: var(--muted); font-size: 0.73rem; }
.playing-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px var(--lime); }

.transport { display: flex; gap: 7px; }
.transport button, .delete-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 1.5rem;
  cursor: pointer;
}

.mode-panel, .library-panel, .storage-panel { padding: 20px; }
.section-heading, .storage-topline { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading h2, .storage-topline h2 { font-size: 1.05rem; letter-spacing: -0.025em; }
.mode-readout, .count-badge { color: var(--muted); font-size: 0.75rem; }

.mode-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mode-card {
  display: flex;
  min-width: 0;
  min-height: 78px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 0.74rem;
  cursor: pointer;
}

.mode-card.active {
  border-color: rgba(201, 255, 89, 0.6);
  background: linear-gradient(145deg, rgba(201, 255, 89, 0.13), rgba(201, 255, 89, 0.035));
  color: var(--ink);
}

.mode-icon { color: inherit; font-family: ui-monospace, monospace; font-size: 1.24rem; font-weight: 700; }
.mode-card.active .mode-icon { color: var(--lime); }

.status {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid;
  border-radius: 13px;
  font-size: 0.78rem;
  line-height: 1.45;
}

.status span { font-weight: 900; }
.status.success { border-color: rgba(201, 255, 89, 0.22); background: rgba(201, 255, 89, 0.06); color: #dfff9d; }
.status.error { border-color: rgba(255, 107, 122, 0.22); background: rgba(255, 107, 122, 0.06); color: #ff9aa5; }

.video-list { display: grid; gap: 7px; }
.video-row {
  display: flex;
  min-width: 0;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}
.video-row.active { border-color: rgba(140, 110, 255, 0.34); background: rgba(140, 110, 255, 0.08); }
.video-main { display: flex; min-width: 0; flex: 1; align-items: center; gap: 11px; padding: 9px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.video-index { width: 22px; flex: 0 0 auto; color: #5e626b; font-family: ui-monospace, monospace; font-size: 0.66rem; text-align: center; }
.video-thumb { display: grid; width: 56px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: linear-gradient(135deg, #292637, #13151a); color: rgba(255, 255, 255, 0.75); font-size: 0.65rem; }
.video-copy { display: block; min-width: 0; flex: 1; }
.video-copy strong { display: block; overflow: hidden; margin-bottom: 4px; font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.video-copy small { display: block; color: var(--muted); font-size: 0.68rem; }
.delete-button { width: 34px; height: 34px; margin-right: 8px; color: #777c86; font-size: 1.15rem; }
.delete-button:active { color: var(--danger); }

.empty-library { padding: 26px 12px; border: 1px dashed var(--line); border-radius: 16px; text-align: center; }
.empty-library p { margin-bottom: 5px; font-size: 0.88rem; font-weight: 650; }
.empty-library span { color: var(--muted); font-size: 0.75rem; }

.storage-topline strong { color: var(--ink); font-family: ui-monospace, monospace; font-size: 0.74rem; font-weight: 600; }
.storage-topline strong span { color: #686d76; }
.storage-track { overflow: hidden; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); }
.storage-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--lime)); transition: width 0.35s ease; }
.storage-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; }
.storage-foot p { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 0.72rem; }
.storage-foot button { border: 0; background: transparent; color: var(--lime); font-size: 0.72rem; font-weight: 700; cursor: pointer; }
.shield { color: #686d76; font-size: 0.62rem; }
.shield.on { color: var(--lime); }

.install-card {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 22px 0;
  padding: 16px 17px;
  border: 1px solid rgba(140, 110, 255, 0.24);
  border-radius: 18px;
  background: rgba(140, 110, 255, 0.07);
}
.share-symbol { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 12px; background: rgba(140, 110, 255, 0.16); color: #bbaaFF; font-size: 1.3rem; }
.install-card strong { font-size: 0.82rem; }
.install-card p { margin-top: 4px; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }

footer { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 0 2px; color: #656a73; font-size: 0.68rem; text-align: center; }
.privacy-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--lime); }
.visually-hidden { position: fixed; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

@media (min-width: 700px) {
  .app-shell { padding-top: max(34px, env(safe-area-inset-top)); }
  .player-panel { display: grid; grid-template-columns: minmax(0, 1fr) 235px; }
  .video-stage { border-radius: 23px 0 0 23px; }
  .now-playing { align-items: flex-start; flex-direction: column; justify-content: space-between; padding: 22px; }
  .now-copy { align-items: flex-start; }
  .transport { align-self: flex-end; }
}

@media (max-width: 420px) {
  .app-shell { padding-right: 13px; padding-left: 13px; }
  .topbar { margin-bottom: 20px; }
  .brand .eyebrow { display: none; }
  .import-button.compact { padding: 0 12px; }
  .mode-panel, .library-panel, .storage-panel { padding: 16px; border-radius: 20px; }
  .mode-card { min-height: 70px; }
  .video-index { display: none; }
}

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