/* styles.css */
:root{
  --bg0:#070a12;
  --bg1:#0b1220;
  --text:#eef2ff;
  --muted:#b9c3dd;
  --muted2:#94a3c7;
  --line:rgba(255,255,255,.10);
  --shadow: 0 24px 60px rgba(0,0,0,.45);
  --radius: 22px;
  --focus: 0 0 0 4px rgba(142, 197, 252, .35);

  --btnLine: rgba(255,255,255,.14);
  --btnBgA: rgba(255,255,255,.14);
  --btnBgB: rgba(255,255,255,.06);

  /* soft pastels (requested) */
  --pastelBlue: rgba(150, 210, 255, .34);
  --pastelOrange: rgba(255, 196, 140, .30);
  --pastelPink: rgba(255, 170, 210, .30);

  --soundA: rgba(120, 220, 255, .30);
  --soundB: rgba(255, 215, 120, .16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0;
  color:var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1100px 700px at 15% 10%, rgba(100, 210, 255, .20), transparent 60%),
    radial-gradient(900px 700px at 90% 25%, rgba(167, 139, 250, .18), transparent 60%),
    radial-gradient(900px 700px at 40% 90%, rgba(34, 197, 94, .14), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  line-height: 1.45;
}

.wrap{
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px);
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(16px, 2.5vw, 22px);
}

.header{
  padding-top: 6px;
  position: sticky;
  top: 0;
  z-index: 1100;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 14px;

  background: linear-gradient(180deg, rgba(12,18,32,.86), rgba(10,14,26,.72));
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  padding: 10px 12px;
  backdrop-filter: blur(10px);
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}

.brand-link{
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.brand-link:focus-visible{
  outline: none;
  box-shadow: var(--focus);
  border-radius: 16px;
}

.logo{
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
  flex: 0 0 auto;
}

.brand-text{
  display:flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.title{
  font-family: Fraunces, Georgia, serif;
  font-weight: 700;
  letter-spacing: .2px;
  margin: 0;
  font-size: clamp(30px, 4.1vw, 42px);
  line-height: 1.05;
}
.tm{
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-weight: 800;
  font-size: .48em;
  vertical-align: super;
  margin-left: 2px;
  color: rgba(238,242,255,.85);
}

.tagline{
  margin: 0;
  color: var(--muted);
  font-size: clamp(14px, 1.7vw, 16px);
  max-width: 58ch;
}

.main{ display:grid; gap: 14px; }

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-inner{
  padding: clamp(14px, 2.5vw, 18px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

/* Controls (desktop) */
.controls{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status{
  color: var(--muted2);
  font-size: 14px;
  margin: 0;
  min-height: 1.25em;
}

.btn-row{
  display:flex;
  align-items:center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn{
  appearance: none;
  border: 1px solid var(--btnLine);
  background: linear-gradient(180deg, var(--btnBgA), var(--btnBgB));
  color: var(--text);
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 800;
  letter-spacing: .2px;
  cursor: pointer;
  transition: transform .08s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease, opacity .18s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  white-space: nowrap;
}

.btn:hover{ transform: translateY(-1px); border-color: rgba(255,255,255,.24); }
.btn:active{ transform: translateY(0px); }
.btn:focus-visible{ outline: none; box-shadow: var(--focus); }
.btn[disabled]{ opacity: .65; cursor: not-allowed; transform: none; }

.btn-ghost{
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.03));
}

/* Requested pastel buttons */
.btn-my{
  border-color: rgba(255,255,255,.16);
  background:
    radial-gradient(900px 240px at 35% 15%, var(--pastelBlue), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
}

.btn-save{
  border-color: rgba(255,255,255,.14);
  background:
    radial-gradient(900px 240px at 40% 10%, var(--pastelOrange), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.04));
}

.btn-discover{
  border-color: rgba(255,255,255,.18);
  background:
    radial-gradient(900px 240px at 30% 20%, var(--pastelPink), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
}

.btn-danger{
  border-color: rgba(255,255,255,.12);
  background:
    linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.03));
}

.btn-small{
  padding: 10px 12px;
  font-weight: 800;
  font-size: 13px;
}

/* Sound button: brighter but not neon, chip-like */
.btn-sound{
  border-color: rgba(255,255,255,.22);
  background:
    radial-gradient(900px 240px at 30% 20%, var(--soundA), transparent 62%),
    radial-gradient(900px 240px at 80% 0%, var(--soundB), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
}

.dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.35);
}

/* Chip row (sound + fullscreen) */
.chip-row{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Desktop placement: top-left of the video card */
.chip-float{
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 6;
  box-shadow: 0 18px 46px rgba(0,0,0,.35);
  padding: 0;
}

/* Under-player hint */
.under-player-hint{
  margin: 2px 2px 0 2px;
  font-family: "DM Sans", Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-style: italic;
  color: rgba(185, 195, 221, .92);
  font-size: 14px;
  letter-spacing: .1px;
  max-width: 80ch;
}
@media (min-width: 641px){
  .under-player-hint{
    color: rgba(167, 139, 250, .92);
    font-size: 15px;
  }
}

/* Extra hint (mobile only) */
.under-player-subhint{
  display: none;
  margin: 0 2px 0 2px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: rgba(185, 195, 221, .86);
  font-size: 12.5px;
  letter-spacing: .1px;
  max-width: 80ch;
}

.video-shell{
  border-radius: calc(var(--radius) - 8px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  position: relative;
  z-index: 1;
}

.ratio{
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: rgba(0,0,0,.35);
}

iframe{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  border:0;
}

/* YouTube API host */
.yt-host{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
}
.yt-host iframe{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  border:0;
  z-index: 0;
}

/* Library */
.hidden{ display: none !important; }

.card-library .card-inner{
  gap: 14px;
}

.library-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.library-title{
  text-align: center;
  flex: 1 1 auto;
}

.h2{
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  letter-spacing: .2px;
  font-size: clamp(20px, 2.6vw, 28px);
  line-height: 1.1;
}

.library-tagline{
  margin: 6px auto 0 auto;
  color: var(--muted);
  max-width: 70ch;
  font-size: 14px;
}

.library-body{
  display:grid;
  gap: 10px;
}

/* Full-bleed player inside library view */
.library-player-shell{
  border-radius: calc(var(--radius) - 8px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  margin: 0;
}

.library-player-actions{
  display:flex;
  align-items:center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.library-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display:grid;
  gap: 10px;
}

.library-item{
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  padding: 10px;
}

.library-row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.library-link{
  display:flex;
  align-items:center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.library-link:focus-visible{
  outline: none;
  box-shadow: var(--focus);
  border-radius: 14px;
}

.thumb{
  width: 112px;
  height: 63px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
  flex: 0 0 auto;
}

.library-meta{
  display:flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.library-name{
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 44ch;
}

.library-sub{
  color: var(--muted2);
  font-size: 12px;
}

.library-date{
  display: none;
  color: var(--muted2);
  font-size: 12px;
  padding-left: 2px;
}

.library-actions{
  display:flex;
  align-items:center;
  gap: 8px;
  flex: 0 0 auto;
}

.footer{
  color: rgba(255,255,255,.45);
  font-size: 12px;
  padding-bottom: 10px;
}

/* Hamburger menu */
.menu{
  position: relative;
  margin-top: 2px;
  flex: 0 0 auto;
}
.menu-btn{
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 14px;
  cursor: pointer;
  display:grid;
  place-items:center;
  transition: transform .08s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.menu-btn:hover{ transform: translateY(-1px); border-color: rgba(255,255,255,.24); }
.menu-btn:active{ transform: translateY(0px); }
.menu-btn:focus-visible{ outline: none; box-shadow: var(--focus); }

/* simplified three-line icon */
.menu-icon{
  width: 18px;
  height: 2px;
  position: relative;
  display:block;
  background: rgba(255,255,255,.80);
  border-radius: 999px;
}
.menu-icon::before,
.menu-icon::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  height: 2px;
  border-radius: 999px;
  background: rgba(255,255,255,.80);
}
.menu-icon::before{ top: -6px; }
.menu-icon::after{ top: 6px; }

.menu-panel{
  min-width: 220px;
  background: linear-gradient(180deg, rgba(12,18,32,.96), rgba(10,14,26,.92));
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
  padding: 8px;
  z-index: 1200;
}
.menu-item{
  width: 100%;
  text-align: left;
  appearance:none;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  color: var(--text);
  border-radius: 14px;
  padding: 12px 12px;
  font-weight: 800;
  letter-spacing: .15px;
  cursor:pointer;
}
.menu-item:hover{ border-color: rgba(255,255,255,.22); }

/* Modal */
body.modal-open{
  overflow: hidden;
}

.modal{
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
}

.modal-card{
  position: relative;
  width: min(720px, calc(100% - 28px));
  margin: 0 auto;
  top: 10vh;
  background: linear-gradient(180deg, rgba(12,18,32,.98), rgba(10,14,26,.94));
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0,0,0,.65);
  padding: 14px;
  outline: none;
}

.modal-top{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title{
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  letter-spacing: .2px;
  font-size: 22px;
  line-height: 1.1;
}

.modal-close{
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.04));
  color: var(--text);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-weight: 900;
}
.modal-close:focus-visible{ outline: none; box-shadow: var(--focus); }

.modal-desc{
  margin: 10px 0 0 0;
  color: rgba(185,195,221,.94);
  font-size: 14px;
  max-width: 72ch;
}

.install-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.install-step{
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  padding: 12px;
}

.install-step-title{
  font-weight: 900;
  letter-spacing: .15px;
  font-size: 14px;
  margin-bottom: 8px;
}

.install-ol{
  margin: 0;
  padding-left: 18px;
  color: rgba(185,195,221,.92);
  font-size: 13px;
  line-height: 1.5;
}

.modal-actions{
  margin-top: 12px;
  display:flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* MOBILE: full-bleed video, controls under it, chips under Discover */
@media (max-width: 640px){
  .wrap{
    max-width: 100%;
    padding: 18px 0 18px;
    gap: 16px;
  }

  .header{
    margin: 0 16px;
    padding: 10px 12px;
  }

  .brand{
    gap: 10px;
  }

  .logo{
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .title{
    font-size: clamp(28px, 7vw, 36px);
  }

  .tagline{
    max-width: 44ch;
  }

  .main{
    gap: 12px;
  }

  /* remove the “card” feel around the player on mobile */
  #playerView.card{
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
  }

  #playerView .card-inner{
    padding: 0;
    gap: 12px;
  }

  /* put video first, controls under it */
  #playerView .controls{ order: 2; }
  #playerView .video-shell{ order: 1; }
  #playerView .under-player-hint{ order: 3; padding: 0 16px 0 16px; }
  #playerView .under-player-subhint{ order: 4; padding: 0 16px 6px 16px; display:block; }

  /* full-bleed video to edges */
  #playerView .video-shell{
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  /* Controls area gets padding */
  #playerView .controls{
    padding: 0 16px 6px 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
  }

  .status{
    font-size: 13px;
  }

  .btn-row{
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* Discover spans full width on mobile */
  #nextBtn{
    grid-column: 1 / -1;
    justify-content: center;
  }

  #saveBtn,
  #myCalmtentBtn{
    justify-content: center;
  }

  /* Chips become centered row under Discover */
  .chip-float{
    position: static;
    order: 3;
    align-self: center;
    margin: 0 auto;
    box-shadow: none;
  }

  /* Keep hint readable on mobile */
  .under-player-hint{
    font-size: 13px;
    color: rgba(185,195,221,.92);
  }

  /* Library view: let the player go full-bleed like home */
  #libraryView.card{
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    margin: 0;
  }

  #libraryView .card-inner{
    padding: 0;
  }

  .library-head{
    padding: 0 16px;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .library-player-shell{
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .library-player-actions{
    padding: 10px 16px 0 16px;
    justify-content: center;
  }

  .library-body{
    padding: 10px 16px 0 16px;
  }

  .library-item{
    flex-direction: column;
    align-items: stretch;
  }

  .library-row{
    flex-direction: column;
    align-items: stretch;
  }

  .library-actions{
    justify-content: flex-end;
    margin-top: 8px;
  }

  /* move date under buttons on mobile */
  .library-sub{
    display: none;
  }
  .library-date{
    display: block;
    margin-top: 6px;
  }

  .thumb{
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .footer{
    padding: 0 16px 12px 16px;
  }

  .install-grid{
    grid-template-columns: 1fr;
  }

  .modal-card{
    top: 6vh;
  }
}
