/* =========================================================
   오늘의 AI 한 장 — Apple-minimal design system
   Light, typographic, restrained. One accent per category.
   ========================================================= */

:root {
  /* Canvas & surfaces */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f4;
  --surface-quote: #f6f6f9;

  /* Ink (Apple neutral grays) */
  --ink: #1d1d1f;
  --ink-2: #565659;
  --ink-3: #86868b;
  --ink-4: #aeaeb2;

  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-2: rgba(0, 0, 0, 0.055);

  /* Category accents — one restrained color each */
  --c-prompt: #8a63d2; /* 프롬프트 — 아듀 브랜드 보라 */
  --c-flow: #0a84ff; /* 워크플로우 — 블루 */
  --c-tool: #16a191; /* 도구 — 틸 */
  --c-mind: #ff8a3d; /* 사고법 — 앰버 */

  /* Active accent, set per-view via [data-accent] */
  --accent: var(--c-prompt);
  --accent-soft: rgba(138, 99, 210, 0.12);

  /* Warning callout */
  --warn-bg: #fff6e6;
  --warn-ink: #8a5b00;
  --warn-line: rgba(199, 128, 0, 0.28);

  /* Shape & depth */
  --r-card: 26px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 14px 34px rgba(0, 0, 0, 0.07);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 18px rgba(0, 0, 0, 0.05);
  --shadow-tab: 0 -0.5px 0 rgba(0, 0, 0, 0.06);

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --spring: cubic-bezier(0.5, 1.5, 0.5, 1);

  --font:
    "SF Pro Text", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Pretendard", system-ui, "Segoe UI", Roboto, sans-serif;

  --tabbar-h: 60px;
  --maxw: 620px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

button {
  font-family: inherit;
}
a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
::selection {
  background: var(--accent-soft);
}

/* ---------- App shell ---------- */
#app {
  min-height: 100dvh;
}

#main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  min-height: 100dvh;
}

/* ---------- View transitions ---------- */
.view {
  animation: viewIn 0.5s var(--ease) both;
}
@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Headers ---------- */
.topbar {
  padding: calc(env(safe-area-inset-top) + 14px) 0 2px;
}
.topbar__eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}
.topbar__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.largetitle {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 6px 0 2px;
  color: var(--ink);
}
.subtitle {
  font-size: 15px;
  color: var(--ink-3);
  margin: 2px 0 14px;
}

/* ---------- Today hero header ---------- */
.today-head {
  padding: calc(env(safe-area-inset-top) + 22px) 2px 16px;
  text-align: center;
}
.today-head__date {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
.today-head__brand {
  margin-top: 5px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.today-head__spark {
  width: 17px;
  height: 17px;
  color: var(--accent);
  display: inline-block;
}

/* ---------- Card ---------- */
.card {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card--hero {
  margin-top: 4px;
}
.card__accentbar {
  height: 4px;
  width: 100%;
  background: var(--accent);
  opacity: 0.9;
}
.card__body {
  padding: 26px 24px 24px;
}

/* Category badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* Hook */
.hook {
  margin: 16px 0 0;
  font-size: clamp(25px, 6.6vw, 34px);
  line-height: 1.24;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  word-break: keep-all;
}
.card--list .hook {
  font-size: 19px;
  line-height: 1.34;
  margin-top: 10px;
}

/* Summary */
.summary {
  margin: 14px 0 0;
  font-size: 17px;
  line-height: 1.62;
  color: var(--ink-2);
  word-break: keep-all;
}

/* Section label */
.seclabel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 26px 0 10px;
}
.seclabel__text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink-3);
}

/* Segmented control (짧은/긴) */
.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border-radius: 9px;
  gap: 2px;
}
.segmented__opt {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}
.segmented__opt[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.12),
    0 1px 1px rgba(0, 0, 0, 0.04);
}

/* Example / prompt block */
.example {
  position: relative;
  background: var(--surface-quote);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
}
.example__text {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.66;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: keep-all;
  font-family: var(--font);
}
.example__copy {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.18s var(--spring),
    filter 0.2s var(--ease);
}
.example__copy:active {
  transform: scale(0.96);
}
.example__copy.is-done {
  background: #34c759;
}
.example__copy svg {
  width: 17px;
  height: 17px;
}

/* Steps */
.steps {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps__item {
  position: relative;
  display: flex;
  gap: 13px;
  padding: 11px 0;
  border-top: 1px solid var(--hairline-2);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  word-break: keep-all;
}
.steps__item:first-child {
  border-top: 0;
}
.steps__num {
  flex: 0 0 auto;
  counter-increment: step;
  width: 25px;
  height: 25px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.steps__num::before {
  content: counter(step);
}

/* Caution callout */
.caution {
  margin-top: 22px;
  display: flex;
  gap: 12px;
  padding: 15px 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--r-md);
}
.caution__ico {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--warn-ink);
  margin-top: 1px;
}
.caution__text {
  font-size: 14.5px;
  line-height: 1.56;
  color: var(--warn-ink);
  word-break: keep-all;
}

/* ---------- Hero action bar ---------- */
.actionbar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 50px;
  border: 1px solid var(--hairline);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition:
    transform 0.18s var(--spring),
    background 0.2s var(--ease),
    color 0.2s var(--ease);
}
.act:active {
  transform: scale(0.96);
}
.act svg {
  width: 19px;
  height: 19px;
}
.act.is-saved {
  color: var(--accent);
}
.act.is-saved .act__bookmark {
  fill: var(--accent);
  stroke: var(--accent);
}
.act__pop {
  animation: pop 0.4s var(--spring);
}
@keyframes pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.22);
  }
  100% {
    transform: scale(1);
  }
}

/* ---------- Archive / list ---------- */
.searchbar {
  position: relative;
  margin: 4px 0 14px;
}
.searchbar__ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  pointer-events: none;
}
.searchbar input {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 11px;
  background: var(--surface-2);
  padding: 0 14px 0 36px;
  font-size: 16px;
  color: var(--ink);
  outline: none;
  font-family: var(--font);
}
.searchbar input::placeholder {
  color: var(--ink-4);
}

/* Filter chips */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 14px;
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar {
  display: none;
}
.chip {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}
.chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.chip[aria-pressed="true"] .chip__dot {
  display: none;
}

/* List */
.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.list-card {
  display: block;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
  padding: 16px 18px;
  cursor: pointer;
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
  animation: listIn 0.5s var(--ease) both;
}
.list-card:active {
  transform: scale(0.985);
}
@keyframes listIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.list-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
}
.list-card__cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--lc);
}
.list-card__cat .chip__dot {
  background: var(--lc);
}
.list-card__hook {
  margin: 8px 0 5px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.34;
  color: var(--ink);
  word-break: keep-all;
}
.list-card__sum {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: keep-all;
}

/* ---------- Empty / error states ---------- */
.state {
  text-align: center;
  padding: 64px 24px;
  animation: viewIn 0.5s var(--ease) both;
}
.state__emoji {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  display: grid;
  place-items: center;
  color: var(--ink-3);
}
.state__emoji svg {
  width: 27px;
  height: 27px;
}
.state__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.state__desc {
  margin-top: 6px;
  font-size: 15px;
  color: var(--ink-3);
  line-height: 1.5;
}
.state__btn {
  margin-top: 18px;
  height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Detail back ---------- */
.backbar {
  display: flex;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 12px) 0 8px;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 6px 6px 0;
  margin-left: -2px;
}
.back svg {
  width: 20px;
  height: 20px;
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(250, 250, 252, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-tab);
  border-top: 0.5px solid var(--hairline);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-4);
  transition: color 0.2s var(--ease);
}
.tab__icon {
  width: 25px;
  height: 25px;
  display: block;
}
.tab__icon svg {
  width: 100%;
  height: 100%;
}
.tab__label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tab[aria-current="page"] {
  color: var(--accent);
}
.tab:active .tab__icon {
  transform: scale(0.9);
  transition: transform 0.15s var(--ease);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  transform: translate(-50%, 20px);
  z-index: 60;
  background: rgba(28, 28, 30, 0.94);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s var(--ease),
    transform 0.4s var(--spring);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 80vw;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast svg {
  width: 17px;
  height: 17px;
  color: #34c759;
}

/* ---------- Action sheet ---------- */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.32);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.sheet-scrim.show {
  opacity: 1;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  margin: 0 auto;
  max-width: var(--maxw);
  background: #fbfbfd;
  border-radius: 22px 22px 0 0;
  padding: 10px 14px calc(env(safe-area-inset-bottom) + 14px);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(102%);
  transition: transform 0.42s var(--ease);
}
.sheet.show {
  transform: translateY(0);
}
.sheet__grabber {
  width: 38px;
  height: 5px;
  border-radius: 3px;
  background: var(--ink-4);
  opacity: 0.5;
  margin: 4px auto 10px;
}
.sheet__title {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 4px 0 12px;
}
.sheet__btn {
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s var(--spring);
}
.sheet__btn:active {
  transform: scale(0.98);
}
.sheet__ico {
  width: 22px;
  height: 22px;
  color: var(--accent);
  display: inline-grid;
  place-items: center;
}
.sheet__ico svg {
  width: 100%;
  height: 100%;
}
.sheet__btn--cancel {
  justify-content: center;
  color: var(--ink-3);
  font-weight: 600;
  margin-top: 4px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Larger screens: center as a phone-ish column ---------- */
@media (min-width: 700px) {
  #main {
    padding-top: 8px;
  }
}
