:root {
  --bg: #120f1f;
  --bg-2: #1b1630;
  --paper: #f6f1e8;
  --ink: #16131f;
  --muted: #6d6878;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #8b7cff;
  --good: #34d399;
  --warn: #fbbf24;
  --radius: 22px;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1200px 600px at 10% -10%, #3b2f73 0%, var(--bg) 45%);
  color: var(--paper);
  font-family: "SF Pro Display", "PingFang SC", "Noto Sans SC", sans-serif;
}
body { padding: 0; }

.app {
  width: min(430px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(18px + var(--safe-top)) 16px calc(28px + var(--safe-bottom));
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.kicker {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  color: #c4b8ff;
}
h1 {
  margin: 6px 0 0;
  font-size: 32px;
  letter-spacing: -0.04em;
}
.ics-btn, .ghost {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ics-btn {
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  white-space: nowrap;
}
.ics-btn.solid { width: 100%; padding: 13px 16px; }
.ghost {
  background: transparent;
  color: var(--paper);
  padding: 10px;
}

.hero {
  margin-top: 18px;
  background: linear-gradient(180deg, #2a2348, #211c39);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 18px;
  min-height: 132px;
}
.hero .label {
  font-size: 12px;
  color: #c4b8ff;
  margin: 0 0 8px;
}
.hero h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.03em;
}
.hero .meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #ddd6fe;
  font-size: 14px;
}
.chip {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 4px 10px;
}
.countdown {
  margin-top: 14px;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  color: var(--good);
}

.tabs {
  margin: 16px 0 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,0.06);
  padding: 4px;
  border-radius: 16px;
}
.tab {
  border: 0;
  background: transparent;
  color: #cfc9e6;
  font: inherit;
  font-size: 14px;
  padding: 10px 2px;
  border-radius: 12px;
}
.tab.is-on {
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
}

.day-nav {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 4px 0 12px;
}
.day-pill {
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--paper);
  border-radius: 16px;
  padding: 8px 2px;
  text-align: center;
}
.day-pill small { display: block; color: #a89fc4; }
.day-pill.is-on { background: var(--paper); color: var(--ink); }
.day-pill.is-on small { color: #6d6878; }
.day-pill.has-class::after {
  content: "";
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin: 6px auto 0;
}

.card {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 14px 14px 14px 16px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--course);
}
.card.is-done { opacity: 0.58; }
.time {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.card h3 {
  margin: 4px 0 6px;
  font-size: 18px;
  letter-spacing: -0.03em;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: #4b4458;
}
.tag {
  background: #efeaf6;
  border-radius: 999px;
  padding: 3px 8px;
}
.warn {
  color: #9a3412;
  background: #ffedd5;
}
.empty {
  padding: 28px 8px;
  text-align: center;
  color: #cfc9e6;
}

.week-grid {
  display: grid;
  grid-template-columns: 42px repeat(7, 1fr);
  gap: 4px;
  font-size: 10px;
}
.slot {
  min-height: 72px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 4px;
  color: var(--paper);
}
.slot b { display: block; font-size: 11px; }
.slot span { color: #cfc9e6; }
.head {
  text-align: center;
  color: #c4b8ff;
  padding-bottom: 6px;
}
.mini {
  background: var(--course, #7c5cff);
  color: white;
  border-radius: 8px;
  padding: 4px;
  min-height: 68px;
  line-height: 1.25;
}

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(8,6,16,0.62);
  display: grid;
  place-items: end center;
  padding: 16px;
}
.sheet[hidden] { display: none; }
.sheet-card {
  width: min(430px, 100%);
  background: #241e3d;
  border: 1px solid var(--line);
  border-radius: 24px 24px 18px 18px;
  padding: 20px 18px calc(16px + var(--safe-bottom));
}
.sheet-card h2 { margin: 0 0 10px; font-size: 22px; }
.sheet-card ol { padding-left: 18px; color: #ddd6fe; }
.sheet-note { color: #fbbf24; font-size: 13px; }
.sheet-actions { display: grid; gap: 8px; }

.note-banner {
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
  border-radius: 16px;
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 10px;
}

.feed-lead, .feed-meta {
  color: #ddd6fe;
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 12px;
}
.feed-meta a { color: #c4b8ff; }
.pref-list { list-style: none; margin: 0; padding: 0; }
.choice-grid { display: grid; gap: 8px; margin: 4px 0 16px; }
.choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--paper);
  border-radius: 18px;
  padding: 16px;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.choice em { font-style: normal; color: #c4b8ff; font-size: 13px; white-space: nowrap; }
.choice.is-on { background: var(--paper); color: var(--ink); font-weight: 700; }
.choice.is-on em { color: #6d28d9; }
.feed-card.is-other { opacity: 0.72; }
.pref-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  background: var(--paper);
  color: var(--ink);
  border-radius: 16px;
  padding: 10px;
  margin-bottom: 8px;
}
.pref-item.is-off { opacity: 0.55; }
.pref-item button, .text-btn {
  font: inherit;
  border: 0;
  border-radius: 999px;
  padding: 6px 8px;
  background: #efeaf6;
  color: var(--ink);
}
.pref-label b {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 4px;
  border-radius: 50%;
  background: #16131f;
  color: var(--paper);
  font-size: 12px;
}
.keyword-label {
  display: grid;
  gap: 6px;
  color: #ddd6fe;
  margin: 12px 0;
}
.keyword-label input, .course-add input {
  font: inherit;
  border: 0;
  border-radius: 14px;
  padding: 12px;
  color: var(--ink);
}
.course-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.chip-btn, .import-btn {
  font: inherit;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.import-btn { margin: 4px 0 14px; background: transparent; color: #c4b8ff; padding-left: 0; }
.pref-error { color: #fbbf24; min-height: 1.2em; margin: 0 0 8px; }
.reason, .summary-text {
  margin: 8px 0 0;
  color: #4b4458;
  font-size: 13px;
  line-height: 1.5;
}
.feed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.feed-actions button, .feed-actions a {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.feed-go { background: #16131f; color: #f6f1e8; }
.feed-quiet { background: #efeaf6; color: #4b4458; }
.hero .feed-reason {
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.45;
  color: #d1fae5;
}
.dock[hidden] { display: none; }
.dock {
  position: sticky;
  bottom: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 18px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(18, 15, 31, 0.92);
  border: 1px solid var(--line);
}
.dock button {
  border: 0;
  border-radius: 999px;
  padding: 12px 8px;
  background: transparent;
  color: #d9d3ea;
  font: inherit;
  font-weight: 700;
}
.dock button.is-on { background: var(--paper); color: var(--ink); }
.photo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
  padding: 22px 14px;
  border-radius: 22px;
  border: 1px dashed #8b7cff;
  color: #efeaff;
  font-weight: 700;
  cursor: pointer;
}
.photo-btn input { display: none; }
.keyword-label textarea {
  width: 100%;
  min-height: 74px;
  margin-top: 6px;
  border: 0;
  border-radius: 16px;
  padding: 12px;
  font: inherit;
  resize: vertical;
  background: #fff;
  color: var(--ink);
}
.plan-heading { margin: 18px 0 8px; font-size: 16px; }
.plan-card { margin: 12px 0; }
.plan-list { margin: 8px 0 12px; padding-left: 18px; }
.plan-list li { margin: 8px 0; }
.plan-list span { display: block; color: var(--muted); font-size: 13px; }

body.product {
  background: #e6e1d6;
  color: #1c1917;
}
body.product .app {
  background: #f7f4ef;
  box-shadow: 0 0 0 1px rgba(40, 32, 20, 0.06);
  padding-bottom: calc(108px + var(--safe-bottom));
}
body.product .kicker {
  letter-spacing: 0;
  text-transform: none;
  font-size: 13px;
  color: #8a8478;
}
body.product h1 {
  color: #1c1917;
  font-size: 34px;
  font-weight: 650;
}
body.product .ics-btn {
  background: transparent;
  color: #1c1917;
  padding: 8px 2px;
  font-size: 15px;
}
body.product .ics-btn.solid {
  background: #1c1917;
  color: #f7f3ea;
  border-radius: 14px;
  padding: 14px 16px;
}
body.product .hero {
  background: #1c1917;
  color: #f7f3ea;
  border: 0;
  border-radius: 28px;
  padding: 22px 22px 20px;
  min-height: 0;
}
body.product .hero .label {
  margin: 0 0 10px;
  color: #d8c7aa;
  letter-spacing: 0.08em;
}
body.product .hero h2 {
  color: #f7f3ea;
  font-size: 32px;
  line-height: 1.15;
}
body.product .hero .feed-reason,
body.product .countdown { color: #ebe4d8; }
body.product .feed-lead,
body.product .feed-meta,
body.product .empty,
body.product .keyword-label,
body.product .plan-heading {
  color: #6f6a60;
}
body.product .plan-heading {
  margin: 22px 2px 10px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
}
body.product .card {
  background: #fff;
  border: 1px solid #ebe6dc;
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(40, 32, 20, 0.05);
  padding: 16px 16px 14px;
}
body.product .card::before { display: none; }
body.product .feed-card.is-other { opacity: 1; background: #fff; }
body.product .choice {
  background: #fff;
  color: #1c1917;
  border: 1px solid #ebe6dc;
  box-shadow: none;
}
body.product .choice em { color: #8a8478; }
body.product .choice.is-on {
  background: #1c1917;
  color: #f7f3ea;
  border-color: #1c1917;
}
body.product .choice.is-on em { color: #e7d7be; }
body.product .type-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
body.product .type-row .choice {
  width: auto;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 14px;
}
body.product .keyword-label input,
body.product .keyword-label textarea,
body.product .course-add input {
  background: #fff;
  border: 1px solid #ebe6dc;
  border-radius: 16px;
  color: #1c1917;
}
body.product .photo-btn {
  display: grid;
  gap: 4px;
  justify-items: start;
  margin: 4px 0 14px;
  padding: 18px 18px;
  background: #fff;
  color: #1c1917;
  border: 1px solid #ebe6dc;
  border-radius: 22px;
  box-shadow: 0 10px 28px rgba(40, 32, 20, 0.05);
}
body.product .photo-btn strong { font-size: 17px; }
body.product .photo-btn small { color: #8a8478; font-weight: 500; line-height: 1.4; }
body.product .feed-go { background: #1c1917; color: #f7f3ea; }
body.product .feed-quiet { background: #f3efe8; color: #3f3a34; }
body.product .note-banner {
  background: #fff;
  color: #3f3a34;
  border: 1px solid #ebe6dc;
}
body.product .text-btn { background: #1c1917; color: #f7f3ea; }
body.product .dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(430px, 100%);
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 8px 8px calc(10px + var(--safe-bottom));
  border: 0;
  border-top: 1px solid #e6e0d4;
  border-radius: 0;
  background: rgba(247, 244, 239, 0.94);
  backdrop-filter: blur(16px);
}
body.product .dock button {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 4px 0 2px;
  background: transparent;
  color: #8a8478;
  font-size: 11px;
  font-weight: 650;
}
body.product .dock button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.product .dock button.is-on {
  background: transparent;
  color: #1c1917;
}
body.product .import-btn {
  background: #1c1917;
  color: #f7f3ea;
  margin: 0 0 8px;
  padding: 12px 16px;
}
body.product .empty {
  background: #fff;
  border: 1px dashed #ddd6c8;
  border-radius: 18px;
  color: #8a8478;
}
body.product .lesson {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 14px 16px;
}
body.product .lesson h3 { margin: 0; font-size: 17px; }
body.product .lesson .reason { margin: 4px 0 0; }
body.product .lesson-time b {
  display: block;
  font-size: 16px;
  letter-spacing: -0.03em;
}
body.product .lesson-time span {
  color: #8a8478;
  font-size: 12px;
}
