/* ---------- Tokens (from Figma) ---------- */
:root {
  --purple: #5200d4;
  --purple-100: #eee6fb;
  --purple-tab: #ede9fe;
  --violet: #7c3aed;
  --blue-100: #ebf0ff;
  --blue-accent: #2563eb;
  --ink: #140d26;
  --text: #171717;
  --text-2: #525252;
  --border: #e5e5e5;
  --line: #d4d4d4;
  --surface: #fafafa;
  --teal: #14b8a6;
  --shadow-xs: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  -webkit-font-smoothing: antialiased;
  background: #fafafa;
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
}
button { cursor: pointer; color: inherit; background: none; border: none; font: inherit; text-align: inherit; }
img { display: block; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* ---------- Prototype shell ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 260px; flex: none; background: #fff;
  border-right: 1px solid #ececf0;
  display: flex; flex-direction: column;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 20px; border-bottom: 1px solid #f0f0f3; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--purple);
  color: #fff; font-weight: 800; font-size: 14px; display: grid; place-items: center;
}
.brand-title { font-size: 13px; font-weight: 700; color: #1c1c1e; }
.brand-sub { font-size: 11px; color: #8e8e93; margin-top: 1px; }

.nav { flex: 1; overflow-y: auto; padding: 8px 0 16px; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 20px;
  font-size: 13px; color: #3c3c43; position: relative;
}
.nav-item:hover { background: #f6f5fa; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: #d1d1d6; flex: none; }
.nav-item.active { background: #ede9ff; color: var(--purple); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--purple); }
.nav-item.active .dot { background: var(--purple); }
.sidebar-foot { padding: 12px 20px; font-size: 11px; color: #8e8e93; border-top: 1px solid #f0f0f3; }

.stage {
  flex: 1; position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: #f0eff5; overflow: hidden;
}
.stage-caption {
  position: absolute; top: 20px; left: 24px; right: 24px;
  font-size: 12px; color: #6e6e76; line-height: 1.5; max-width: 260px;
}
.stage-caption strong { display: block; color: #1c1c1e; font-size: 13px; margin-bottom: 2px; }
.phone-wrap { transform-origin: center center; }
.phone {
  width: 413px; height: 872px; padding: 10px; border-radius: 64px; background: #1c1c1e;
  box-shadow: 0 20px 60px rgba(20, 13, 38, 0.18), 0 4px 12px rgba(20, 13, 38, 0.08);
}
.screen {
  width: 393px; height: 852px; border-radius: 54px; overflow: hidden; position: relative;
  background: var(--surface); display: flex; flex-direction: column;
}

/* ---------- Phone chrome ---------- */
.statusbar {
  height: 56px; flex: none; background: #fff; display: flex; align-items: center;
  justify-content: space-between; padding: 6px 30px 0 46px;
  font-weight: 600; font-size: 16px; color: #000;
}
.sb-icons { display: flex; gap: 6px; align-items: center; }
.sb-icons svg { fill: currentColor; }

.site-header {
  height: 72px; flex: none; background: #fff; border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.05);
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  position: relative; z-index: 2;
}
.logo { width: 33.26px; height: 32px; }
.profile { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--purple); color: #fff;
  font-weight: 600; font-size: 16px; display: grid; place-items: center;
}

.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }

.bottom { flex: none; }
.tabnav {
  height: 64px; background: #fff; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; padding: 8px;
}
.tab {
  width: 93.5px; height: 100%; border-radius: 8px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-weight: 600; font-size: 14px; line-height: 22px; color: var(--ink);
}
.tab img { width: 24px; height: 24px; padding: 2px; }
.tab.active { background: var(--purple-tab); color: var(--purple); }

.safari {
  background: rgba(255, 255, 255, 0.98); border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 10px; height: 133px;
}
.url {
  margin: 0 26px; height: 40px; background: #fff; border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); position: relative;
  display: flex; align-items: center; justify-content: center;
}
.url-host { display: flex; align-items: center; gap: 6px; font-size: 17px; letter-spacing: -0.4px; color: #000; }
.url-host img { width: 7.8px; height: 11.4px; }
.url-size { position: absolute; left: 12px; width: 19px; height: 12px; }
.url-reload { position: absolute; right: 12px; width: 15px; height: 18px; }
.safari-tabs { height: 49px; display: grid; grid-template-columns: repeat(5, 1fr); justify-items: center; }
.safari-tabs img { width: 75px; height: 49px; }
.home-indicator { width: 134px; height: 5px; border-radius: 100px; background: #000; margin: 21px auto 0; }

.toast {
  position: absolute; left: 16px; right: 16px; bottom: 213px; z-index: 10;
  background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px;
  font-size: 14px; line-height: 20px; font-weight: 500;
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- Today's Plan ---------- */
.hero {
  background: var(--blue-100); border-radius: 16px 16px 0 0; padding: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.cal { position: relative; width: 40px; height: 43.56px; margin-bottom: 4px; }
.cal-box {
  position: absolute; top: 3.56px; left: 0; width: 40px; height: 40px; background: #fff;
  border: 2px solid var(--text); font-weight: 600; text-align: center;
}
.cal-m { font-size: 12px; line-height: 16px; letter-spacing: 0.25px; text-transform: uppercase; margin-top: 2px; }
.cal-d { font-size: 14px; line-height: 16px; }
.cal-ring { position: absolute; top: -1px; width: 2px; height: 9px; background: var(--text); border-radius: 2px; }
.cal-ring.l { left: 9px; } .cal-ring.r { right: 9px; }
.hero h1 { font-size: 24px; line-height: 32px; font-weight: 600; }
.hero p { font-size: 16px; line-height: 24px; }

.plan { position: relative; padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; }
.rail {
  position: absolute; left: 35px; width: 2px; z-index: 0;
  background-image: linear-gradient(var(--line) 50%, transparent 50%);
  background-size: 2px 8px;
}
.task { display: flex; flex-direction: column; gap: 16px; position: relative; z-index: 1; }

.step { display: flex; gap: 16px; align-items: center; }
.step.top { align-items: flex-start; }
.stepper { width: 40px; height: 40px; flex: none; position: relative; }
.stepper img { width: 100%; height: 100%; }
.stepper.active {
  border-radius: 50%; background: var(--surface); border: 2px solid var(--purple);
  box-shadow: 0 0 5px rgba(124, 58, 237, 0.55); display: grid; place-items: center;
}
.stepper.active span { width: 8px; height: 8px; border-radius: 50%; background: var(--violet); margin-top: 1px; }
.step-label { font-size: 14px; line-height: 22px; }
.step-title { font-size: 16px; line-height: 24px; font-weight: 600; }

.card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.card.pad { padding: 16px; display: flex; flex-direction: column; gap: 16px; }

.tag {
  align-self: flex-start; display: inline-flex; gap: 4px; align-items: center;
  background: var(--blue-100); color: var(--blue-accent); border-radius: 4px; padding: 4px 8px;
  font-size: 12px; line-height: 16px; font-weight: 600;
}
.tag img { width: 16px; height: 16px; }
.q { font-size: 18px; line-height: 25px; font-weight: 600; color: var(--ink); }

/* V1: 0–10 scale */
.key { display: flex; gap: 4px; align-items: center; font-size: 16px; line-height: 24px; color: var(--text-2); }
.key.end { justify-content: flex-end; }
.key img { width: 24px; height: 24px; }
.scale { display: flex; flex-direction: column; gap: 4px; }
.scale-row { display: flex; gap: 4px; justify-content: center; }
.num {
  height: 64px; flex: 1 0 0; min-width: 0; border-radius: 12px; background: #fff;
  border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  font-weight: 600; font-size: 16px; line-height: 24px; color: var(--ink); text-align: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.08s;
}
.scale-row.second .num { flex: 0 0 56.83px; }
.num:hover { border-color: #c9b8f0; }
.num:active { transform: scale(0.96); }
.num.sel { background: var(--purple-100); border-color: var(--purple); color: var(--purple); }

.btn-primary {
  width: 100%; height: 48px; border-radius: 12px; background: var(--purple); color: #fff;
  font-weight: 600; font-size: 16px; line-height: 24px; text-align: center;
  transition: opacity 0.15s, filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; filter: none; }

/* V2: emoji */
.emoji-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 0; }
.emoji {
  background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  filter: drop-shadow(0 1px 1px rgba(16, 24, 40, 0.05));
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.emoji .e { font-size: 52px; line-height: normal; letter-spacing: -0.5px; }
.emoji .l { font-size: 12px; line-height: 16px; color: var(--text-2); }
.emoji:hover { border-color: #c9b8f0; }
.emoji:active { transform: scale(0.97); }
.emoji.sel { background: var(--purple-100); border-color: var(--purple); }
.emoji.sel .l { color: var(--purple); font-weight: 600; }

/* V3 + selected response pill */
.pill {
  width: 100%; height: 36px; display: flex; align-items: center; gap: 2px;
  padding: 8px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--border);
  box-shadow: var(--shadow-xs); font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink);
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
}
.pill .lead { width: 16px; height: 16px; flex: none; display: grid; place-items: center; font-size: 14px; }
.pill .txt { padding: 0 4px; flex: 1; }
.pill .tail { width: 16px; height: 16px; flex: none; }
.pill:hover { border-color: #c9b8f0; }
.pill:active { transform: scale(0.99); }
.pill.sel { background: var(--purple-100); border-color: var(--purple); }
.pill.done { cursor: pointer; }
.pill.done:hover { filter: brightness(0.98); }
.reply { font-size: 14px; line-height: 22px; color: var(--ink); }

.pause {
  background: var(--blue-100); padding: 16px 10px; display: flex; gap: 2px; align-items: flex-start;
  font-size: 16px; line-height: 24px; font-weight: 600;
}
.pause img { width: 24px; height: 24px; flex: none; }
.pause p { padding: 0 4px; color: var(--text-2); }
.pause .link { color: var(--purple); }
.pause .link:hover { text-decoration: underline; }

/* Class card */
.thumb { height: 182px; position: relative; overflow: hidden; border-radius: 8px 8px 0 0; }
.thumb > img { width: 100%; height: 100%; object-fit: cover; }
.save {
  position: absolute; top: 11px; right: 11px; height: 48px; display: flex; align-items: center;
  padding: 8px 8px 8px 0; background: #fff; border: 1px solid var(--border); border-radius: 12px;
  opacity: 0.7; box-shadow: var(--shadow-xs); font-weight: 600; font-size: 16px; line-height: 24px; color: #070101;
}
.save img { width: 31px; height: 100%; }
.save.on { opacity: 0.95; }
.meta { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.class-title { display: flex; flex-direction: column; gap: 8px; }
.class-name { font-size: 18px; line-height: 25px; font-weight: 600; color: var(--ink); }
.trainer { font-size: 16px; line-height: 24px; color: var(--ink); margin-top: 2px; }
.why { background: var(--blue-100); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.why-head { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 16px; line-height: 24px; }
.why-head img { width: 24px; height: 24px; border-radius: 50%; }
.why p { font-size: 16px; line-height: 24px; }
.actions { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.switch { display: flex; gap: 10px; align-items: center; height: 40px; font-weight: 600; font-size: 16px; line-height: 24px; color: var(--text-2); }
.switch img { width: 24px; height: 24px; padding: 4px 3px 3px; }
.switch .link { color: var(--purple); }
.switch .link:hover { text-decoration: underline; }

/* Skeleton */
.skel { background: linear-gradient(90deg, #eee 0%, #f6f6f6 40%, #eee 80%); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Motion */
.fade-in { animation: fadeIn 0.35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) { .stage-caption { display: none; } }
@media (max-width: 640px) {
  .sidebar { display: none; }
  .stage-caption { display: none; }
}
