:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #1a1d24;
  --ink-soft: #5b6270;
  --line: #e6e8ef;
  --primary: #2d5bff;
  --primary-soft: #e8eeff;
  --warn: #ff7849;
  --ok: #2ecc71;
  --shadow: 0 6px 20px rgba(20, 30, 60, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Pretendard", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* 상단바 */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px;
  background: var(--primary-soft);
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 22px;
}
.brand h1 { margin: 0; font-size: 20px; }
.subtitle { margin: 2px 0 0; color: var(--ink-soft); font-size: 13px; }

.tabs { display: flex; gap: 4px; background: #fff; padding: 4px; border-radius: 12px; box-shadow: var(--shadow); }
.tab {
  border: none; background: transparent;
  padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--ink-soft);
  font-weight: 500;
}
.tab.active { background: var(--primary); color: white; }

/* 탭 패널 */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 날씨 스트립 */
.weather-strip {
  background: linear-gradient(135deg, #4a7dff 0%, #6c5ce7 100%);
  border-radius: var(--radius);
  padding: 22px;
  color: white;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.weather-today {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; margin-bottom: 16px;
}
.weather-today .left { font-size: 13px; opacity: 0.9; }
.weather-today .city { font-size: 14px; opacity: 0.85; margin-bottom: 4px; }
.weather-today .temp { font-size: 56px; font-weight: 300; line-height: 1; }
.weather-today .cond { font-size: 18px; margin-top: 8px; }
.weather-today .icon { font-size: 64px; }
.weather-today .meta { display: flex; gap: 16px; font-size: 13px; opacity: 0.9; margin-top: 6px; }

.weather-week {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.18);
  padding-top: 14px;
}
.day-cell {
  text-align: center;
  font-size: 12px;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 4px;
}
.day-cell .d { opacity: 0.85; margin-bottom: 4px; }
.day-cell .ic { font-size: 22px; margin: 2px 0; }
.day-cell .t { font-weight: 600; }

/* 추천 카드 */
.recommend-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.rec-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.rec-header h2 { margin: 0; font-size: 18px; }

.rec-summary {
  background: var(--primary-soft);
  color: #1d3fb0;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.rec-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.rec-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
  background: #fafbff;
}
.rec-item .emo { font-size: 36px; }
.rec-item .nm { font-weight: 600; margin-top: 6px; font-size: 14px; }
.rec-item .cat { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.rec-item .why { font-size: 11px; color: var(--ink-soft); margin-top: 8px; line-height: 1.4; }

.rec-tips {
  background: #fff7ed;
  border: 1px solid #ffd9b8;
  color: #b04300;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

.rec-empty {
  text-align: center; padding: 32px; color: var(--ink-soft);
}

/* 옷장 */
.closet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.closet-header h2 { margin: 0; font-size: 18px; }

.closet-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
}
.chip.active { background: var(--ink); color: white; border-color: var(--ink); }

.closet-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.closet-card {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
  position: relative;
}
.closet-card .emo { font-size: 38px; }
.closet-card .nm { font-weight: 600; margin-top: 6px; font-size: 14px; }
.closet-card .meta { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.closet-card .warmth-bar {
  display: flex; gap: 2px; margin-top: 8px;
}
.closet-card .warmth-bar span {
  flex: 1; height: 4px; background: var(--line); border-radius: 2px;
}
.closet-card .warmth-bar span.on { background: var(--warn); }
.closet-card .del {
  position: absolute; top: 8px; right: 8px;
  background: none; border: none; cursor: pointer;
  color: var(--ink-soft); font-size: 16px;
  width: 26px; height: 26px; border-radius: 6px;
}
.closet-card .del:hover { background: #ffe6e6; color: #d63; }

/* 개인 설정 */
.tab-panel h2 { margin: 0 0 6px; font-size: 18px; }
.hint { color: var(--ink-soft); font-size: 13px; margin: 0 0 18px; }

.form-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  background: var(--card); padding: 18px; border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.form-grid label span { font-weight: 600; color: var(--ink); }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input[type="text"],
.form-grid select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.form-grid input[type="range"] { padding: 8px 0; }
.range-hint { font-size: 11px; }

.actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; }
.save-toast {
  display: inline-block; opacity: 0; padding: 6px 12px;
  background: var(--ok); color: white; border-radius: 8px;
  font-size: 13px; transition: opacity 0.3s;
}
.save-toast.show { opacity: 1; }

/* 버튼 공통 */
.btn-primary, .btn-ghost {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #1f47d6; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { background: #fff; color: var(--ink); }

/* 모달 */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 25, 40, 0.4);
  display: grid; place-items: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: white;
  border-radius: var(--radius);
  padding: 22px;
  width: 100%; max-width: 540px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.2);
}
.modal h3 { margin: 0 0 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* 푸터 */
.foot { text-align: center; margin-top: 30px; color: var(--ink-soft); }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .weather-week { grid-template-columns: repeat(7, 1fr); font-size: 11px; }
  .weather-today .temp { font-size: 44px; }
  .weather-today .icon { font-size: 48px; }
}
