:root {
  color-scheme: light;
  --bg: #f4f7f4;
  --panel: #ffffff;
  --panel-soft: #eef5ef;
  --text: #1d2b24;
  --muted: #607068;
  --line: #d8e2dc;
  --accent: #2f7d57;
  --accent-dark: #236141;
  --accent-soft: #e4f3ea;
  --sun: #f3b23b;
  --rain: #4a86c5;
  --danger: #b43b35;
  --danger-soft: #fff0ee;
  --shadow: 0 18px 48px rgba(31, 50, 41, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 10%, rgba(243, 178, 59, 0.18), transparent 26rem),
    linear-gradient(135deg, #f7faf8 0%, var(--bg) 56%, #edf6f8 100%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.68; }

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

input, select { min-height: 44px; padding: 0 12px; }
textarea { padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(47, 125, 87, 0.16);
  outline: none;
}

label { display: grid; gap: 7px; font-weight: 800; }

.auth-check, .login-page {
  display: grid;
  place-items: center;
  padding: 28px 18px;
}

.status-panel, .auth-card, .tool-panel, .weather-panel, .recommend-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.status-panel { width: min(440px, 100%); padding: 32px; text-align: center; }
.status-panel h1 { margin: 8px 0; font-size: 28px; letter-spacing: 0; }
.status-panel p { margin: 0; color: var(--muted); }

.login-shell {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 420px);
  gap: clamp(24px, 6vw, 72px);
  align-items: center;
  width: min(1040px, 100%);
}

.login-copy h1 {
  margin: 10px 0 16px;
  font-size: clamp(52px, 10vw, 96px);
  line-height: 1;
  letter-spacing: 0;
}
.login-copy p:not(.eyebrow) { max-width: 520px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.85; }

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-card { padding: 24px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border-radius: 8px; background: var(--panel-soft); }
.segment {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}
.segment.is-active { color: var(--text); background: #fff; box-shadow: 0 6px 16px rgba(31, 50, 41, 0.10); }
.auth-form { display: grid; gap: 16px; margin-top: 22px; }
.is-hidden { display: none !important; }

.primary-button, .secondary-button, .ghost-button {
  min-height: 44px;
  padding: 0 15px;
  border-radius: 8px;
  font-weight: 900;
}
.primary-button { border: 0; color: #fff; background: var(--accent); }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { border: 1px solid var(--accent); color: var(--accent); background: var(--accent-soft); }
.ghost-button { border: 1px solid var(--line); color: var(--text); background: #fff; }

.form-message {
  display: none;
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--danger);
  background: var(--danger-soft);
  line-height: 1.6;
}
.form-message.is-visible { display: block; }
.form-message.is-success { color: var(--accent-dark); background: var(--accent-soft); }

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  width: min(1180px, calc(100% - 32px));
  min-height: 70px;
  margin: 0 auto;
}
.brand { color: var(--text); font-size: 22px; font-weight: 1000; text-decoration: none; }
.nav-tabs { display: flex; justify-content: center; gap: 6px; }
.nav-tab {
  min-height: 38px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}
.nav-tab.is-active { color: var(--accent-dark); background: var(--accent-soft); }

.app-main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 64px; }
.view { display: none; }
.view.is-active { display: block; }
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.section-heading h1 { margin: 6px 0 0; font-size: clamp(30px, 5vw, 48px); line-height: 1.1; letter-spacing: 0; }

.dashboard-grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 20px; }
.weather-panel, .recommend-panel, .tool-panel { padding: 22px; }
.weather-main { display: grid; gap: 12px; }
.weather-main span { color: var(--muted); font-size: 24px; font-weight: 900; }
.weather-main strong { font-size: clamp(64px, 10vw, 110px); line-height: 1; letter-spacing: 0; }
.weather-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 28px 0 0; }
.weather-stats div { padding: 14px; border-radius: 8px; background: var(--panel-soft); }
dt { color: var(--muted); font-size: 13px; font-weight: 900; }
dd { margin: 3px 0 0; font-size: 24px; font-weight: 1000; }

.coordinate-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.coordinate-card, .clothes-card, .history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.coordinate-card { padding: 15px; }
.coordinate-card span, .clothes-card span { color: var(--muted); font-size: 12px; font-weight: 900; }
.coordinate-card strong, .clothes-card strong { display: block; margin-top: 4px; font-size: 18px; }
.reason-text { margin: 18px 0; white-space: pre-line; color: var(--muted); line-height: 1.75; }
.save-form { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: end; }

.closet-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.tool-panel { display: grid; gap: 15px; }
.tool-panel h2 { margin: 0; font-size: 22px; }
.flag-row, .button-row, .two-columns { display: flex; gap: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.checkbox-row input { width: 18px; min-height: 18px; }
.item-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.clothes-card { overflow: hidden; }
.clothes-thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--panel-soft); color: var(--muted); font-weight: 900; }
.clothes-thumb img { width: 100%; height: 100%; object-fit: cover; }
.clothes-body { display: grid; gap: 9px; padding: 14px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 4px 8px; border-radius: 999px; color: var(--accent-dark); background: var(--accent-soft); font-size: 12px; font-weight: 900; }
.card-actions { display: flex; gap: 8px; }
.card-actions button { flex: 1; min-height: 36px; }

.history-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.history-card { padding: 18px; }
.history-card h2 { margin: 0 0 8px; font-size: 20px; }
.history-card p { margin: 0; color: var(--muted); line-height: 1.7; }
.settings-panel { max-width: 680px; }

.empty-state { padding: 28px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); background: rgba(255, 255, 255, 0.7); text-align: center; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--text);
  box-shadow: var(--shadow);
  line-height: 1.6;
}
.toast.is-visible { display: block; }

@media (max-width: 900px) {
  .login-shell, .dashboard-grid, .closet-layout { grid-template-columns: 1fr; }
  .header-inner { grid-template-columns: 1fr auto; padding: 12px 0; }
  .nav-tabs { grid-column: 1 / -1; justify-content: start; overflow-x: auto; }
  .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .save-form { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .app-main, .header-inner { width: min(100% - 24px, 1180px); }
  .section-heading { align-items: stretch; flex-direction: column; }
  .coordinate-list, .item-grid, .history-list, .weather-stats { grid-template-columns: 1fr; }
  .flag-row, .button-row, .two-columns { flex-direction: column; }
  .login-copy h1 { font-size: 56px; }
}
