:root {
  color-scheme: light;
  --bg: #fff8f5;
  --surface: #fff1e7;
  --surface-strong: #ffffff;
  --ink: #221a13;
  --muted: #534436;
  --line: #d9c3b0;
  --gold: #f9a13d;
  --gold-deep: #8a5000;
  --green: #3c6a00;
  --rose: #d88383;
  --blue: #00687b;
  --shadow: 0 18px 45px rgba(138, 80, 0, 0.12);
  --glass: rgba(255, 255, 255, 0.6);
  --font-head: "Plus Jakarta Sans", Pretendard, "Apple SD Gothic Neo",
    "Noto Sans KR", system-ui, sans-serif;
  font-family:
    "Be Vietnam Pro", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR",
    system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 30% 0%, #fffaf4 0%, transparent 55%),
    radial-gradient(circle at 80% 100%, #fff1e7 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
}

h1,
h2,
h3,
.eyebrow,
.tab {
  font-family: var(--font-head);
}

/* ── 온보딩 웰컴 화면 ─────────────────────────────── */
@keyframes breathing {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 10px 20px rgba(138, 80, 0, 0.05));
  }
  50% {
    transform: scale(1.03);
    filter: drop-shadow(0 15px 30px rgba(138, 80, 0, 0.1));
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 0.85;
  }
  50% {
    opacity: 1;
  }
}

@keyframes welcomeFloat {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    radial-gradient(circle at center, #fff9f2 0%, #fff8f5 100%);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.welcome-screen.is-dismissed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.welcome-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}

.welcome-glow--one {
  top: -60px;
  left: -60px;
  width: 280px;
  height: 280px;
  background: rgba(249, 161, 61, 0.12);
}

.welcome-glow--two {
  right: -60px;
  bottom: -80px;
  width: 320px;
  height: 320px;
  background: rgba(184, 244, 122, 0.16);
}

.welcome-cat {
  position: relative;
  z-index: 1;
  margin-bottom: 12px;
  animation: welcomeFloat 0.8s ease both;
}

.welcome-cat img {
  width: clamp(200px, 56vw, 300px);
  height: auto;
  object-fit: contain;
}

.cat-breathing {
  animation: breathing 6s ease-in-out infinite;
}

.welcome-greeting {
  position: relative;
  z-index: 1;
  min-height: 92px;
  max-width: 420px;
  padding: 0 8px;
  text-align: center;
}

.welcome-greeting h1 {
  display: inline;
  margin: 0;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: clamp(1.4rem, 5.5vw, 1.75rem);
  font-weight: 600;
  line-height: 1.5;
}

.cursor-blink {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  background: var(--gold-deep);
  vertical-align: middle;
  animation: blink 1s infinite;
}

.welcome-input {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  width: min(440px, 100%);
  margin-top: 36px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: var(--glass);
  box-shadow: 0 8px 30px rgba(138, 80, 0, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: welcomeFloat 0.8s ease 0.2s both;
}

.welcome-input input {
  flex: 1;
  min-width: 0;
  padding: 14px 20px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
}

.welcome-input input:focus {
  outline: none;
}

.welcome-input button {
  display: grid;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--gold-deep);
  color: #fff;
  transition: transform 0.2s ease;
}

.welcome-input button:active {
  transform: scale(0.9);
}

.welcome-divider {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(440px, 100%);
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.82rem;
  opacity: 0.55;
  animation: welcomeFloat 0.8s ease 0.28s both;
}

.welcome-divider::before,
.welcome-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.welcome-google {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(440px, 100%);
  margin-top: 14px;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-family: var(--font-head);
  font-size: 0.96rem;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(138, 80, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: welcomeFloat 0.8s ease 0.32s both;
}

.welcome-google:hover {
  box-shadow: 0 10px 26px rgba(138, 80, 0, 0.12);
}

.welcome-google:active {
  transform: scale(0.98);
}

.welcome-google:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.welcome-google svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.welcome-skip {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.7;
  animation: welcomeFloat 0.8s ease 0.4s both;
}

.welcome-skip:hover {
  opacity: 1;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-size: 22px;
  line-height: 1;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  min-height: 100vh;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: rgba(255, 253, 248, 0.78);
  backdrop-filter: blur(16px);
}

.brand,
.section-title,
.chat-header,
.routine-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  justify-content: flex-start;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-strong);
  box-shadow: 0 10px 26px rgba(61, 45, 25, 0.1);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold-deep);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

h2 {
  margin-bottom: 0;
  font-size: 1.12rem;
}

.auth-panel,
.summary-panel,
.insight-panel {
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
}

.auth-panel h2 {
  margin-bottom: 5px;
}

.auth-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

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

.is-hidden {
  display: none !important;
}

.cat-stage {
  position: relative;
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 22px;
  background: transparent;
}

.cat-stage::before {
  content: none;
}

.status-orbit {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(188, 115, 34, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--gold-deep);
  font-size: 0.82rem;
  font-weight: 800;
}

.status-divider {
  width: 1px;
  height: 14px;
  background: rgba(188, 115, 34, 0.22);
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(109, 143, 114, 0.16);
}

#catMood {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.nabi-walker {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  width: clamp(112px, 12vw, 172px);
  pointer-events: none;
  transform: translate3d(var(--nabi-x, 170px), var(--nabi-y, 230px), 0);
  transition:
    transform 1.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.2s ease;
}

.nabi-walker img {
  display: block;
  width: 100%;
  height: auto;
}

.nabi-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 8px);
  min-width: 126px;
  max-width: 190px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 10px 30px rgba(61, 45, 25, 0.12);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  text-align: center;
  transform: translateX(-50%);
  transition: opacity 0.18s ease;
}

.nabi-walker.has-bubble .nabi-bubble {
  opacity: 1;
}

.summary-panel,
.insight-panel {
  padding: 18px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}

.metric-grid div {
  min-height: 78px;
  padding: 12px;
  border-radius: 8px;
  background: #fbf7ed;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

dd {
  margin: 8px 0 0;
  font-size: 1rem;
  font-weight: 850;
}

.insight-panel ul {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.insight-panel li {
  padding: 11px 12px;
  border-radius: 6px;
  background: #f4f7ef;
  color: #354639;
  line-height: 1.48;
}

.main-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px;
}

.top-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 6px;
  padding: 5px;
  border-radius: 8px;
  background: var(--surface);
}

.tab {
  min-width: 86px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab.is-active {
  background: var(--ink);
  color: #fff6df;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
  margin-top: 18px;
}

.view.is-active {
  display: flex;
  flex-direction: column;
}

.chat-header,
.form-header,
.routine-header {
  padding: 22px;
  border-radius: 8px;
  background: var(--surface);
}

.privacy-chip {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(78, 127, 152, 0.12);
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.quick-actions button,
.secondary-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 750;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.quick-actions button {
  padding: 8px 11px;
}

.chat-log {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-height: 360px;
  margin: 0;
  overflow-y: auto;
  padding: 18px;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.68);
  list-style: none;
}

.message {
  max-width: min(680px, 86%);
  padding: 13px 15px;
  border-radius: 8px;
  background: var(--surface-strong);
  line-height: 1.55;
}

.message.user {
  align-self: flex-end;
  background: #fff1d0;
}

.message.cat {
  align-self: flex-start;
}

.message strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px;
  gap: 10px;
  margin-top: 14px;
}

.footprint-draft {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 18px;
  border-radius: 8px;
  background: #f5f8f0;
}

.footprint-draft h3 {
  margin: 0;
  font-size: 1rem;
}

.footprint-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.footprint-grid div {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.nabi-note {
  margin: 0;
  color: #354639;
  line-height: 1.55;
}

.note-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.note-field input {
  padding: 12px;
}

.privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.draft-actions .secondary-button {
  padding: 8px 12px;
}

.footprint-list {
  display: grid;
  gap: 12px;
  max-width: 760px;
  margin-top: 16px;
}

.footprint-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface);
}

.footprint-item h3 {
  margin: 0;
  font-size: 1rem;
}

.footprint-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.footprint-tags span {
  padding: 6px 8px;
  border-radius: 999px;
  background: #f4f0e6;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
}

textarea {
  min-height: 62px;
  max-height: 160px;
  padding: 13px 14px;
  resize: vertical;
}

.chat-form button,
.profile-form button {
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  color: #2d210d;
  font-weight: 900;
}

.profile-form {
  display: grid;
  gap: 16px;
  max-width: 680px;
  margin-top: 16px;
  padding: 22px;
  border-radius: 8px;
  background: var(--surface);
}

.profile-form label,
.profile-form fieldset,
.routine-list label {
  color: var(--muted);
  font-weight: 800;
}

.profile-form input,
.profile-form select {
  margin-top: 8px;
  padding: 12px;
}

.profile-form fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border-radius: 8px;
}

.profile-form fieldset label,
.routine-list label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-form fieldset input,
.routine-list input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--gold-deep);
}

.profile-form button {
  min-height: 46px;
}

.secondary-button {
  padding: 8px 12px;
}

.routine-list {
  display: grid;
  gap: 12px;
  max-width: 720px;
  margin-top: 16px;
}

.routine-list label {
  min-height: 58px;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    border-bottom: 0;
  }

  .cat-stage {
    min-height: 150px;
  }

  .chat-log {
    min-height: 340px;
  }
}

@media (max-width: 620px) {
  .side-panel,
  .main-panel {
    padding: 14px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .chat-header,
  .routine-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    min-width: 0;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .footprint-grid {
    grid-template-columns: 1fr 1fr;
  }

  .chat-form button {
    min-height: 46px;
  }

  .message {
    max-width: 94%;
  }
}
