:root {
  color-scheme: light;
  --ink: #191917;
  --muted: #77766f;
  --line: #e7e5df;
  --paper: #f7f5f2;
  --white: #fffefa;
  --lime: #d2f36b;
  --lime-dark: #a8cd38;
  --red: #eb4d56;
  font-family: 'Segoe UI', sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 78% 15%, rgba(210, 243, 107, .18), transparent 29rem),
    var(--paper);
}

button, input { font: inherit; }
button { color: inherit; }

.shell {
  width: min(100% - 48px, 780px);
  margin: 0 auto;
}

.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: 'Segoe UI', sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -1.1px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 9px;
  background: var(--lime);
  font-size: 20px;
  line-height: 1;
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #83b844;
}

.intro { padding: 72px 0 40px; }

.eyebrow {
  margin: 0 0 11px;
  color: var(--muted);
  font: 500 10px/1.4 Consolas, monospace;
  letter-spacing: 1.2px;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 19px;
  font: 800 clamp(48px, 9vw, 76px)/.99 'Segoe UI', sans-serif;
  letter-spacing: -5px;
}

h1 span {
  color: #818d61;
  font-family: Georgia, serif;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -4px;
}

.lede {
  max-width: 460px;
  margin-bottom: 0;
  color: #65645d;
  font-size: 15px;
  line-height: 1.65;
}

.add-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--white);
  box-shadow: 0 8px 24px rgba(32, 30, 24, .035);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.section-heading .eyebrow { margin-bottom: 5px; }

h2 {
  margin-bottom: 0;
  font: 700 21px/1.25 'Manrope', sans-serif;
  letter-spacing: -.6px;
}

.step-mark {
  color: #aaa89f;
  font: 400 11px Consolas, monospace;
}

#add-form {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

input {
  min-width: 0;
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #e4e2dc;
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  transition: border-color .16s, box-shadow .16s;
}

input::placeholder { color: #a5a39b; }
input:focus { border-color: #9ab54d; box-shadow: 0 0 0 3px rgba(184, 215, 100, .2); }

.primary-button {
  flex: 0 0 auto;
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .16s, transform .16s;
}

.primary-button:hover { background: #34342e; }
.primary-button:active { transform: translateY(1px); }
.primary-button span { margin-right: 5px; font-size: 17px; vertical-align: -1px; }

.form-message {
  min-height: 16px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.form-message.error { color: #bf343c; }
.form-message.success { color: #527a22; }

.queue-section { padding: 42px 0 0; }
.planner-section { padding: 42px 0 0; }
.queue-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.queue-heading .section-heading { align-items: end; }

.count {
  display: inline-grid;
  place-items: center;
  min-width: 23px;
  height: 23px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 12px;
  background: #ebe9e2;
  color: #67665f;
  font: 500 11px Consolas, monospace;
  vertical-align: 2px;
}

.text-button {
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: #727168;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.text-button:hover { color: var(--ink); }
.text-button:disabled { color: #98968d; text-decoration: none; cursor: default; }

.planner-note {
  margin: -5px 0 15px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.schedule-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(190px, .8fr) auto;
  gap: 9px;
}

.schedule-form input { height: 44px; font-size: 12px; }
.schedule-form .primary-button { height: 44px; padding: 0 13px; font-size: 12px; }
.schedule-form .primary-button span { margin-right: 3px; }
.schedule-form + .form-message { margin: 9px 0 12px; }

.schedule-list { display: grid; gap: 8px; }

.schedule-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 254, 250, .82);
}

.schedule-card.is-due { border-color: #e7c978; background: #fffbed; }
.schedule-card.is-posted { background: #f0eee8; }
.schedule-details { min-width: 0; }
.schedule-idea { overflow-wrap: anywhere; margin: 0 0 5px; font-size: 13px; font-weight: 600; }
.schedule-date { margin: 0; color: var(--muted); font-size: 11px; }
.is-due .schedule-date { color: #946b13; }
.schedule-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 9px; }
.posted-button {
  padding: 7px 9px;
  border: 1px solid #dddacf;
  border-radius: 7px;
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}
.posted-button:hover { border-color: #9ab54d; background: #f6f9eb; }
.schedule-empty { margin-top: 10px; }

.simulator-section { padding: 42px 0 0; }
.offline-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid #dce4ca;
  border-radius: 20px;
  background: #f4f8eb;
  color: #657547;
  font-size: 10px;
  white-space: nowrap;
}
.offline-badge .status-dot { width: 6px; height: 6px; }
.simulator-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}
.simulator-field label { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 600; }
.simulator-field input, .simulator-field select {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: 1px solid #e4e2dc;
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}
.simulator-field input:focus, .simulator-field select:focus { border-color: #9ab54d; box-shadow: 0 0 0 3px rgba(184, 215, 100, .2); }
.simulator-submit { grid-column: 1 / -1; width: 100%; height: 44px; }
.simulation-results {
  margin-top: 17px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--white);
}
.simulation-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.simulation-metric { display: grid; gap: 6px; padding: 12px; border-radius: 8px; background: #f4f2ec; }
.simulation-metric span { color: var(--muted); font-size: 10px; }
.simulation-metric strong { font: 700 20px 'Segoe UI', sans-serif; letter-spacing: -.4px; }
.distribution-title { margin: 20px 0 13px; font: 700 13px 'Segoe UI', sans-serif; }
.retention-chart { display: grid; gap: 10px; }
.retention-row { display: grid; grid-template-columns: 48px minmax(40px, 1fr) 104px; align-items: center; gap: 9px; }
.retention-label, .retention-count { color: var(--muted); font: 10px Consolas, monospace; }
.retention-count { text-align: right; }
.retention-track { display: block; height: 10px; overflow: hidden; border-radius: 8px; background: #eeece5; }
.retention-bar { display: block; height: 100%; min-width: 0; border-radius: inherit; background: #b3d35d; }
.simulation-caveat { margin: 14px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.video-list { display: grid; gap: 9px; }

.video-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 254, 250, .82);
  transition: opacity .18s, background .18s;
}

.video-card.is-watched { background: #f0eee8; }
.video-card.is-watched .video-url { color: #95938a; text-decoration: line-through; }

.video-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #f0eee7;
  color: #57574e;
  font-size: 16px;
}

.video-details { min-width: 0; }
.video-label { margin: 0 0 4px; font-size: 13px; font-weight: 600; }
.video-url {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-url:hover { color: var(--ink); text-decoration: underline; }

.video-actions { display: flex; align-items: center; gap: 14px; }

.open-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--lime);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.open-link:hover { background: var(--lime-dark); }

.watched-button, .remove-button {
  border: 0;
  background: transparent;
  color: #818077;
  cursor: pointer;
}
.watched-button { width: 22px; height: 22px; padding: 0; font-size: 17px; }
.watched-button:hover { color: #5d8526; }
.is-watched .watched-button { color: #699336; }
.remove-button { padding: 4px; font-size: 18px; }
.remove-button:hover { color: var(--red); }

.empty-state {
  padding: 39px 20px 44px;
  border: 1px dashed #d9d7d0;
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}
.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 13px;
  border-radius: 50%;
  background: #eeece5;
  color: #76766c;
  font-size: 20px;
}
.empty-state h3 { margin-bottom: 6px; color: var(--ink); font: 700 15px 'Segoe UI', sans-serif; }
.empty-state p { max-width: 275px; margin: 0 auto; font-size: 12px; line-height: 1.55; }

.credentials {
  margin-top: 38px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.credentials summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 73px;
  cursor: pointer;
  list-style: none;
}
.credentials summary::-webkit-details-marker { display: none; }
.credentials summary .eyebrow { display: block; margin-bottom: 4px; }
.credentials-title { font: 600 13px 'Segoe UI', sans-serif; }
.disclosure-icon { color: var(--muted); font-size: 20px; transition: transform .2s; }
.credentials[open] .disclosure-icon { transform: rotate(45deg); }

.credentials-body {
  max-width: 490px;
  padding: 0 0 20px;
}
.credentials-body p { margin-bottom: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.credentials-body label { display: block; margin: 12px 0 6px; font-size: 11px; font-weight: 600; }
.credentials-body input { height: 42px; font-size: 12px; }
.clear-credentials { margin-top: 8px; }

footer {
  display: flex;
  justify-content: space-between;
  padding: 22px 0 28px;
  color: #98968d;
  font-size: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

[hidden] { display: none !important; }

@media (max-width: 540px) {
  .shell { width: min(100% - 32px, 780px); }
  .topbar { height: 68px; }
  .intro { padding: 55px 0 32px; }
  h1 { letter-spacing: -3.5px; }
  h1 span { letter-spacing: -2.5px; }
  .add-card { padding: 19px 16px; }
  #add-form { flex-direction: column; }
  .primary-button { width: 100%; }
  .schedule-form { grid-template-columns: 1fr; }
  .schedule-form .primary-button { width: 100%; }
  .simulator-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .offline-badge { font-size: 9px; }
  .simulation-results { padding: 12px 10px; }
  .simulation-metrics { gap: 6px; }
  .simulation-metric { padding: 9px 7px; }
  .simulation-metric span { font-size: 9px; }
  .simulation-metric strong { font-size: 16px; }
  .retention-row { grid-template-columns: 42px minmax(30px, 1fr) 86px; gap: 6px; }
  .retention-label, .retention-count { font-size: 9px; }
  .schedule-card { align-items: flex-start; padding: 12px 10px; }
  .schedule-actions { gap: 5px; }
  .posted-button { padding: 7px; font-size: 10px; }
  .video-card { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; padding: 11px; }
  .video-icon { width: 36px; height: 36px; }
  .video-actions { gap: 8px; }
  .open-link { padding: 8px; }
  .open-link .open-label { display: none; }
  footer { gap: 16px; line-height: 1.5; }
}
