/* BABI's Tutorials — soft, floral, unhurried. */

:root {
  --blush:      #FFF6F9;
  --blush-deep: #FDE9F1;
  --petal:      #FFE3EE;
  --rose:       #E5709A;
  --rose-deep:  #C4467C;
  --lilac:      #B98FC9;
  --lilac-soft: #EADCF1;
  --plum:       #47293A;
  --plum-soft:  #8B6579;
  --card:       #FFFFFF;
  --gold:       #E0B475;
  --leaf:       #9BBF9E;
  --danger:     #C4547A;

  --radius:     20px;
  --radius-sm:  12px;
  --shadow:     0 2px 8px rgba(196, 70, 124, .06), 0 12px 32px rgba(196, 70, 124, .08);
  --shadow-lg:  0 4px 14px rgba(196, 70, 124, .10), 0 20px 48px rgba(196, 70, 124, .14);
  --serif:      "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans:       "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

/* The header lilies are rotated, so their bounding box is ~10px wider than the
   artwork on each side and can just clear the viewport edge at mid widths.
   Needed on html as well as body — otherwise the page still scrolls 2px. */
html { overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--sans);
  color: var(--plum);
  background:
    radial-gradient(1100px 620px at 88% -10%, var(--lilac-soft) 0%, transparent 58%),
    radial-gradient(900px 520px at 4% 4%, var(--petal) 0%, transparent 52%),
    linear-gradient(180deg, var(--blush) 0%, var(--blush-deep) 100%);
  background-attachment: fixed;
}

/* ---------------------------------------------------------------- layout */

.wrap { max-width: 940px; margin: 0 auto; padding: 0 22px 80px; }

header.site {
  position: relative;
  text-align: center;
  padding: 54px 0 34px;
}

header.site .lily-left,
header.site .lily-right {
  position: absolute;
  top: 26px;
  width: 92px;
  opacity: .5;
  pointer-events: none;
}
header.site .lily-left  { left: -14px;  transform: rotate(-14deg); }
header.site .lily-right { right: -14px; transform: rotate(14deg) scaleX(-1); }

h1.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.5rem, 7vw, 3.9rem);
  line-height: 1.04;
  margin: 0;
  letter-spacing: .01em;
  background: linear-gradient(120deg, var(--rose-deep), var(--rose) 45%, var(--lilac));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h1.brand em { font-style: italic; }

.tagline {
  margin: 12px 0 0;
  font-size: 1.02rem;
  color: var(--plum-soft);
  letter-spacing: .02em;
}

.divider {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin: 26px auto 0; max-width: 320px;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--rose) 50%, transparent);
  opacity: .45;
}
.divider svg { width: 22px; height: 22px; color: var(--rose); opacity: .75; }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}

.add-card { margin-bottom: 30px; }

.add-row { display: flex; gap: 12px; flex-wrap: wrap; }

label.field-label {
  display: block;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--plum-soft);
  margin-bottom: 10px;
  font-weight: 700;
}

input[type="url"], input[type="text"], input[type="password"] {
  flex: 1 1 280px;
  min-width: 0;
  padding: 15px 18px;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--plum);
  background: var(--blush);
  border: 1.5px solid var(--petal);
  border-radius: var(--radius-sm);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input::placeholder { color: #C9A9B8; }
input:focus {
  outline: none;
  background: #fff;
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(229, 112, 154, .16);
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 26px;
  font-family: var(--sans);
  font-size: .97rem; font-weight: 700;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none;
  transition: transform .15s, box-shadow .18s, filter .18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-deep) 100%);
  box-shadow: 0 4px 14px rgba(196, 70, 124, .3);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 6px 20px rgba(196, 70, 124, .38); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; filter: none; }

.btn-soft {
  color: var(--rose-deep);
  background: var(--petal);
}
.btn-soft:hover { background: #FFD6E6; }

.btn-ghost {
  color: var(--plum-soft);
  background: transparent;
  padding: 10px 14px;
}
.btn-ghost:hover { color: var(--danger); background: rgba(196, 84, 122, .08); }

.btn-sm { padding: 10px 18px; font-size: .88rem; }

/* ---------------------------------------------------------------- flashes */

.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; margin-bottom: 20px;
  border-radius: var(--radius-sm);
  font-size: .94rem; font-weight: 600;
}
.flash-ok  { background: #EAF6EC; color: #3F6B47; }
.flash-err { background: #FDE7EE; color: var(--rose-deep); }

/* ---------------------------------------------------------------- list */

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 0 16px; padding: 0 4px;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: 1.85rem; font-weight: 600; margin: 0;
  color: var(--plum);
}
.count { font-size: .86rem; color: var(--plum-soft); font-weight: 600; }

.videos { display: flex; flex-direction: column; gap: 16px; }

.video {
  display: flex; gap: 18px; align-items: center;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  transition: transform .18s, box-shadow .18s;
}
.video:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* reorder controls */

.order {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  flex: 0 0 30px;
}
.order-btn {
  width: 28px; height: 22px;
  display: grid; place-items: center;
  font-size: .6rem; line-height: 1;
  color: var(--rose-deep);
  background: var(--petal);
  border: none; border-radius: 7px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.order-btn:hover:not(:disabled) { background: #FFD0E2; }
.order-btn:disabled { opacity: .28; cursor: default; }
.order-num {
  font-size: .72rem; font-weight: 800;
  color: var(--plum-soft); opacity: .7;
  line-height: 1; padding: 1px 0;
}

.thumb {
  position: relative; flex: 0 0 150px;
  width: 150px; height: 88px;
  border-radius: var(--radius-sm); overflow: hidden;
  background: linear-gradient(135deg, var(--petal), var(--lilac-soft));
  display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .dur {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(71, 41, 58, .82); color: #fff;
  font-size: .72rem; font-weight: 700;
  padding: 2px 7px; border-radius: 6px;
}

.meta { flex: 1; min-width: 0; }
.meta h3 {
  margin: 0 0 5px;
  font-size: 1.06rem; font-weight: 700; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.meta .sub { font-size: .84rem; color: var(--plum-soft); }

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

/* progress */

.bar {
  height: 8px; border-radius: 99px;
  background: var(--petal); overflow: hidden;
  margin-top: 9px;
}
.bar > i {
  display: block; height: 100%; width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--lilac), var(--rose));
  transition: width .5s ease;
}

.pill {
  display: inline-block;
  font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .07em;
  padding: 4px 10px; border-radius: 99px;
}
.pill-queued      { background: var(--lilac-soft); color: #6F4B80; }
.pill-downloading { background: #FFF0D9;          color: #96702C; }
.pill-done        { background: #E6F4E9;          color: #3F6B47; }
.pill-error       { background: #FDE0E8;          color: var(--rose-deep); }

/* ---------------------------------------------------------------- empty */

.empty { text-align: center; padding: 62px 24px; }
.empty svg { width: 92px; opacity: .55; margin-bottom: 8px; }
.empty p {
  font-family: var(--serif); font-size: 1.5rem;
  color: var(--plum-soft); margin: 0 0 6px;
}
.empty span { font-size: .92rem; color: var(--plum-soft); opacity: .85; }

/* ---------------------------------------------------------------- login */

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 400px;
  background: var(--card);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  padding: 46px 38px 40px;
  text-align: center;
}
.login-card .lily { width: 78px; margin-bottom: 6px; opacity: .85; }
.login-card h1 {
  font-family: var(--serif); font-size: 2.15rem; font-weight: 600;
  margin: 0 0 6px;
  background: linear-gradient(120deg, var(--rose-deep), var(--lilac));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-card p.hint { color: var(--plum-soft); font-size: .92rem; margin: 0 0 26px; }
.login-card input { width: 100%; text-align: center; margin-bottom: 14px; flex: none; }
.login-card .btn { width: 100%; }

/* ---------------------------------------------------------------- watch */

.player-wrap {
  background: #2B1A24;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.player-wrap video { width: 100%; display: block; max-height: 72vh; background: #2B1A24; }

.watch-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.watch-head h2 {
  font-family: var(--serif); font-size: 1.7rem; font-weight: 600;
  margin: 0; flex: 1; line-height: 1.25;
}

/* ------------------------------------------------------- settings drawer */

.settings {
  margin-top: 34px;
  background: rgba(255, 255, 255, .6);
  border: 1px solid var(--petal);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.settings > summary {
  cursor: pointer;
  padding: 13px 18px;
  font-size: .85rem; font-weight: 700;
  color: var(--plum-soft);
  letter-spacing: .03em;
  list-style: none;
  user-select: none;
  transition: background .15s;
}
.settings > summary::-webkit-details-marker { display: none; }
.settings > summary::after {
  content: "›"; float: right;
  transition: transform .2s; display: inline-block;
  font-size: 1.1rem; line-height: 1;
}
.settings[open] > summary::after { transform: rotate(90deg); }
.settings > summary:hover { background: rgba(255, 227, 238, .5); }

.settings-body { padding: 4px 18px 20px; }
.settings-note {
  font-size: .86rem; line-height: 1.6;
  color: var(--plum-soft); margin: 0 0 14px;
}
.settings-note code {
  background: var(--petal); color: var(--rose-deep);
  padding: 1px 6px; border-radius: 5px;
  font-size: .84em;
}
.settings-status {
  font-size: .8rem; color: var(--plum-soft);
  margin: 0 0 12px; opacity: .85;
}
/* cookie facts */

.cookie-facts {
  background: var(--blush);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.fact {
  display: flex; gap: 12px; align-items: baseline;
  padding: 5px 0; font-size: .84rem;
}
.fact + .fact { border-top: 1px solid rgba(229, 112, 154, .12); }
.fact-label {
  flex: 0 0 118px;
  color: var(--plum-soft); font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; font-size: .68rem;
}
.fact-value { flex: 1; min-width: 0; color: var(--plum); }
.fact-value .good { color: #3F6B47; }
.fact-value .bad  { color: var(--rose-deep); }
.muted { color: var(--plum-soft); opacity: .8; }

.cookie-list { margin-bottom: 16px; }
.cookie-list > summary {
  cursor: pointer; font-size: .8rem; font-weight: 700;
  color: var(--rose-deep); padding: 5px 0;
  list-style: none; user-select: none;
}
.cookie-list > summary::-webkit-details-marker { display: none; }
.cookie-list > summary::before { content: "▸ "; }
.cookie-list[open] > summary::before { content: "▾ "; }

.cookie-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--petal); }
.cookie-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.cookie-table th {
  text-align: left; padding: 8px 12px;
  background: var(--petal); color: var(--rose-deep);
  font-weight: 800; text-transform: uppercase; letter-spacing: .05em; font-size: .66rem;
  white-space: nowrap;
}
.cookie-table td { padding: 7px 12px; border-top: 1px solid var(--blush-deep); white-space: nowrap; }
.cookie-table code { font-size: .95em; color: var(--plum); }
.cookie-table tr:nth-child(even) td { background: rgba(255, 246, 249, .6); }

.cookie-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; }

.cookie-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cookie-form input[type="file"] {
  flex: 1 1 220px; min-width: 0;
  font-size: .84rem; color: var(--plum-soft);
}
.cookie-form input[type="file"]::file-selector-button {
  font-family: var(--sans); font-size: .84rem; font-weight: 700;
  color: var(--rose-deep); background: var(--petal);
  border: none; border-radius: 8px;
  padding: 9px 14px; margin-right: 10px;
  cursor: pointer;
}
.cookie-form input[type="file"]::file-selector-button:hover { background: #FFD6E6; }

footer.site {
  text-align: center; padding: 40px 0 0;
  color: var(--plum-soft); font-size: .84rem; opacity: .8;
}
footer.site .heart { color: var(--rose); }

/* ---------------------------------------------------------------- mobile */

@media (max-width: 640px) {
  header.site { padding: 34px 0 24px; }
  /* Pulled inside the padding: rotation adds ~7px to each side of the box. */
  header.site .lily-left, header.site .lily-right { width: 58px; opacity: .35; top: 18px; }
  header.site .lily-left { left: 0; }
  header.site .lily-right { right: 0; }

  .card { padding: 20px; }
  .video { flex-wrap: wrap; gap: 12px; }
  .thumb { flex: 0 0 100px; width: 100px; height: 60px; }
  .meta { flex: 1 1 130px; }
  /* Bigger tap targets on a phone. */
  .order { flex: 0 0 34px; }
  .order-btn { width: 34px; height: 36px; font-size: .68rem; }
  .actions { width: 100%; justify-content: flex-end; }
  .btn { padding: 13px 20px; }

  /* Back + title + Save won't fit on one line at 375px, and the Save button
     was being pushed off-screen. Title on its own row, buttons split below. */
  .watch-head { flex-wrap: wrap; gap: 10px; }
  .watch-head h2 { flex: 1 1 100%; order: -1; font-size: 1.35rem; }
  .watch-head .btn { flex: 1 1 0; }

  .fact { flex-direction: column; gap: 2px; }
  .fact-label { flex: none; }
}
