:root {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --border: rgba(148, 163, 184, 0.16);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0284c7;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --cat-work: #38bdf8;
  --cat-health: #34d399;
  --cat-life: #a78bfa;
  --cat-general: #fbbf24;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 4px minimal slim vertical scrollbar (M0-05 v2 requirement) */
::-webkit-scrollbar {
  width: 4px;
  height: 0;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

.app-shell {
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
  overflow-x: hidden;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(11, 17, 32, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.brand-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weather-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.conn-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.conn-badge.demo {
  background: rgba(251, 191, 36, 0.16);
  color: var(--warn);
}
.conn-badge.live {
  background: rgba(52, 211, 153, 0.16);
  color: var(--ok);
}

.main-view {
  flex: 1;
  padding: 14px 14px 96px;
  overflow-x: hidden;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}
.tab-panel.active {
  display: flex;
}

.hero-banner {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: linear-gradient(135deg, #0f2942 0%, #1e1b4b 100%);
}
.hero-banner.weather-rain {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.hero-banner.weather-cloudy {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}
.weather-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
  background: radial-gradient(circle at 85% 20%, rgba(56, 189, 248, 0.6), transparent 55%);
  animation: pulseGlow 5s ease-in-out infinite alternate;
}
@keyframes pulseGlow {
  from { opacity: 0.18; transform: scale(1); }
  to { opacity: 0.35; transform: scale(1.06); }
}

.hero-content {
  position: relative;
  z-index: 1;
}
.hero-kicker {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}
.hero-headline {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.45;
}
.hero-goal {
  margin: 0;
  font-size: 12px;
  color: #cbd5e1;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.card-head h3,
.card-head h4 {
  margin: 0;
  font-size: 14px;
}
.card-hint {
  font-size: 11px;
  color: var(--muted);
}

.pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.pill.ok {
  background: rgba(52, 211, 153, 0.15);
  color: var(--ok);
}

.timetable-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slot-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--cat-general);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.slot-card.cat-work { border-left-color: var(--cat-work); }
.slot-card.cat-health { border-left-color: var(--cat-health); }
.slot-card.cat-life { border-left-color: var(--cat-life); }
.slot-card.focus-glow {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.22);
}

.slot-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.slot-body {
  flex: 1;
}
.slot-title {
  font-size: 14px;
  font-weight: 600;
}
.slot-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 56px;
}

.bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.user {
  align-self: flex-end;
  background: var(--accent-strong);
  color: #fff;
}
.bubble.assistant {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.chat-composer {
  position: fixed;
  bottom: 62px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(11, 17, 32, 0.96);
  border-top: 1px solid var(--border);
  z-index: 25;
}

input[type="text"],
input[type="search"],
input[type="url"],
input[type="password"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.inline-form {
  display: flex;
  gap: 8px;
}

.config-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.config-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.btn {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn.primary {
  background: var(--accent-strong);
  color: #fff;
}
.btn.ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.btn.danger {
  background: rgba(248, 113, 113, 0.16);
  color: var(--danger);
}
.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.recovery-card {
  gap: 12px;
}
.recovery-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.16);
  color: var(--ok);
}
.recovery-title {
  margin: 0;
  font-size: 17px;
}
.recovery-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.tiny-step-box {
  padding: 12px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
}
.tiny-step-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.tiny-step-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}
.reward-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.1);
  font-size: 13px;
}
.reward-box p { margin: 0; }
.timer-display {
  font-size: 36px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.06em;
  color: var(--accent);
  padding: 8px 0;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.status-tile {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.status-tile .label {
  font-size: 11px;
  color: var(--muted);
}
.status-tile .val {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 720px;
  height: 62px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(11, 17, 32, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 30;
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
}
.nav-btn small {
  font-size: 10px;
}
.nav-btn.active {
  color: var(--accent);
  font-weight: 700;
}

.modal {
  border: none;
  background: transparent;
  padding: 12px;
  max-width: 520px;
  width: calc(100% - 24px);
  color: var(--text);
}
.modal::backdrop {
  background: rgba(2, 6, 23, 0.72);
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-sub { margin: 0; font-size: 12px; color: var(--muted); }
.modal-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.modal-section h4 { margin: 0; font-size: 13px; }
.transit-pill {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.12);
  font-size: 12px;
  color: var(--accent);
}
.preview-box {
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-size: 12px;
  z-index: 50;
  max-width: 90%;
  text-align: center;
}

.hidden {
  display: none !important;
}
