:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --surface-soft: #edf2ee;
  --ink: #1e2523;
  --muted: #65716d;
  --line: #dce2dd;
  --green: #28635b;
  --green-dark: #1d4b45;
  --rust: #b85c38;
  --gold: #d7a843;
  --shadow: 0 12px 34px rgba(30, 37, 35, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(40, 99, 91, 0.08), transparent 260px),
    var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100%, 780px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.topbar,
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  padding: 8px 2px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--rust);
  font-size: 0.78rem;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.18rem;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.top-pills {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.inventory-pill,
.pwa-pill {
  flex: 0 0 auto;
  min-width: 78px;
  padding: 9px 12px;
  border: 1px solid rgba(40, 99, 91, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
}

.pwa-pill {
  border-color: rgba(184, 92, 56, 0.28);
  background: rgba(255, 249, 231, 0.9);
  color: #75391f;
  font-size: 0.78rem;
}

.pwa-pill[data-ready="true"] {
  border-color: rgba(40, 99, 91, 0.24);
  background: rgba(237, 242, 238, 0.92);
  color: var(--green-dark);
}

.pwa-pill[data-offline="true"] {
  border-color: rgba(40, 99, 91, 0.24);
  background: rgba(40, 99, 91, 0.1);
  color: var(--green-dark);
}

.control-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.field-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.temp-inputs {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 58px 24px;
  align-items: center;
  gap: 8px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

input[type="number"],
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

input[type="number"] {
  padding: 8px 6px;
  text-align: center;
}

select {
  padding: 8px 34px 8px 12px;
}

.unit {
  color: var(--muted);
  font-weight: 700;
}

.weather-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.weather-toggle,
.ghost-action,
.primary-action,
.chip-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.weather-toggle[aria-pressed="true"] {
  border-color: rgba(184, 92, 56, 0.35);
  background: rgba(184, 92, 56, 0.12);
  color: #75391f;
}

.primary-action {
  width: 100%;
  border: 0;
  background: var(--green);
  color: white;
  box-shadow: 0 10px 20px rgba(40, 99, 91, 0.22);
}

.ghost-action {
  flex: 0 0 64px;
  color: var(--green-dark);
}

.result-head {
  padding: 22px 2px 10px;
}

.notes-strip {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: #fff9e7;
  color: #5c4a1e;
  font-size: 0.92rem;
  line-height: 1.45;
}

.outfit-list {
  display: grid;
  gap: 14px;
}

.outfit-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.outfit-visuals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  min-height: 82px;
  background: var(--surface-soft);
}

.visual-tile {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: linear-gradient(135deg, #eff3ef, #dfe9e3);
  color: var(--green-dark);
  font-weight: 800;
}

.visual-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.visual-tile span {
  padding: 6px;
  text-align: center;
  font-size: 0.76rem;
}

.outfit-body {
  padding: 14px;
}

.outfit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.meta-pill {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.outfit-desc {
  margin-bottom: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.piece-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.piece-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.piece-thumb {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--green-dark);
  font-size: 0.7rem;
  font-weight: 800;
}

.piece-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.piece-main {
  min-width: 0;
}

.piece-name {
  overflow-wrap: anywhere;
  font-weight: 700;
  line-height: 1.35;
}

.piece-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.feedback-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.feedback-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.chip-button[data-selected="true"] {
  border-color: rgba(40, 99, 91, 0.35);
  background: rgba(40, 99, 91, 0.1);
  color: var(--green-dark);
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 520px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  h1 {
    font-size: 1.75rem;
  }

  .weather-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .topbar {
    align-items: flex-start;
  }

  .top-pills {
    max-width: 126px;
  }

  .outfit-visuals {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
