:root {
  --paper: #f6f1e4;
  --ink: #14120f;
  --ink-soft: #4a4740;
  --rule: #d9d1bc;
  --surface: #fbf7eb;
  --surface-hover: #f1ecdc;
  --shadow-rgb: 20, 18, 15;

  --accent-moss: #5a7a4b;
  --accent-brick: #a84a3a;
  --accent-indigo: #2e3b6b;
  --accent-wheat: #d4a24a;
  --accent-slate: #4b6b7a;

  --accent: var(--accent-moss);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  padding: env(safe-area-inset-top) 1rem calc(7rem + env(safe-area-inset-bottom));
  position: relative;
  overflow-x: hidden;
}

body[data-accent="brick"]  { --accent: var(--accent-brick); }
body[data-accent="indigo"] { --accent: var(--accent-indigo); }
body[data-accent="wheat"]  { --accent: var(--accent-wheat); }
body[data-accent="slate"]  { --accent: var(--accent-slate); }

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.028;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  z-index: 0;
}

main.journal {
  max-width: 560px;
  margin: 0 auto;
  padding-top: 1.5rem;
  position: relative;
  z-index: 1;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: .75rem;
  margin-bottom: 2rem;
}

.stamp {
  font-family: "IBM Plex Mono", monospace;
  font-size: .78rem;
  letter-spacing: .12em;
  color: var(--ink-soft);
  transform: rotate(-2deg);
  display: inline-block;
  background: var(--accent);
  color: var(--paper);
  padding: .15rem .55rem;
  border-radius: 2px;
}

.location-button {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .55rem;
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 999px;
  color: var(--ink);
  font-family: "Inter", sans-serif;
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s ease;
}
.location-button:hover { background: var(--surface-hover); }
.location-pin {
  font-size: .85rem;
  line-height: 1;
}
.location {
  font-weight: 500;
  color: var(--ink-soft);
}

.time-strip {
  display: flex;
  gap: .35rem;
  overflow-x: auto;
  margin: 0 0 1.25rem;
  padding-bottom: .35rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.time-strip::-webkit-scrollbar { display: none; }
.time-chip {
  flex: 0 0 auto;
  padding: .35rem .85rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-family: "IBM Plex Mono", monospace;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.time-chip:hover { color: var(--ink); }
.time-chip.selected {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 2.25rem;
}

.feels-like {
  font-family: "Fraunces", serif;
  font-weight: 500;
  font-variation-settings: "SOFT" 50;
  font-size: clamp(6rem, 22vw, 9.5rem);
  line-height: .95;
  color: var(--accent);
  letter-spacing: -.03em;
  display: flex;
  align-items: flex-start;
}

.feels-number { display: inline-block; }

.degree {
  font-family: "Fraunces", serif;
  font-size: .4em;
  padding-top: .25em;
  margin-left: .05em;
  color: var(--ink-soft);
}

.feels-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: .7rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: .25rem 0 .6rem;
}

.meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: .8rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 34ch;
}

.section-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: .7rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 .75rem;
  font-weight: 500;
}

.figure {
  display: flex;
  justify-content: center;
  margin: 0 auto 1.5rem;
  max-width: 200px;
}
.paperdoll {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(var(--shadow-rgb), 0.08));
}
.figure-body {
  fill: var(--surface);
  stroke: var(--ink-soft);
  stroke-width: 1;
  opacity: 0.55;
}
.layer-fill {
  fill: var(--accent);
  opacity: 0;
  transition: opacity .35s ease, fill .35s ease;
}
.layer-fill.base.show { opacity: 0.85; }
.layer-fill.mid.show  { opacity: 0.55; }
.layer-fill.outer.show { opacity: 0.4; mix-blend-mode: multiply; }
.figure-bottoms { fill: var(--ink-soft); opacity: 0; transition: opacity .35s ease; }
.figure-bottoms.show { opacity: 0.85; }
.figure-shoes { fill: var(--ink); opacity: 0; transition: opacity .35s ease; }
.figure-shoes.show { opacity: 0.9; }
.figure-beanie, .figure-scarf {
  fill: var(--accent);
  opacity: 0;
  transition: opacity .3s ease;
}
.figure-beanie.show, .figure-scarf.show { opacity: 0.9; }
.figure-glasses {
  stroke: var(--ink);
  stroke-width: 1.5;
  opacity: 0;
  transition: opacity .3s ease;
}
.figure-glasses.show { opacity: 0.85; }
.figure-umbrella {
  fill: var(--accent);
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0;
  transition: opacity .3s ease;
}
.figure-umbrella.show { opacity: 0.85; }
.figure-sun {
  stroke: var(--accent-wheat);
  stroke-width: 2;
  stroke-dasharray: 3 5;
  opacity: 0;
  transition: opacity .3s ease;
  transform-origin: 100px 34px;
  animation: sun-spin 60s linear infinite;
}
.figure-sun.show { opacity: 0.55; }
@keyframes sun-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .figure-sun { animation: none; }
}

.layer-stack {
  display: flex;
  flex-direction: column;
  margin-bottom: 2.25rem;
}

.layer-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: .9rem 1rem;
  box-shadow: 0 1px 0 rgba(20, 18, 15, 0.05);
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-top: -10px;
  transform: translateX(0);
  transition: transform .2s ease, box-shadow .2s ease;
}

.layer-card:first-of-type { margin-top: 0; }
.layer-card:nth-of-type(2) { transform: translateX(4px); }
.layer-card:nth-of-type(3) { transform: translateX(8px); }
.layer-card:hover { box-shadow: 0 2px 6px rgba(20,18,15,0.08); }

.layer-card .tier {
  font-family: "IBM Plex Mono", monospace;
  font-size: .65rem;
  letter-spacing: .22em;
  color: var(--ink-soft);
  min-width: 54px;
}

.layer-card .layer-body {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.layer-card .garment {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--ink);
}

.material {
  font-family: "IBM Plex Mono", monospace;
  font-size: .68rem;
  letter-spacing: .08em;
  color: var(--ink-soft);
  margin: 0;
  text-transform: lowercase;
}
.material:empty { display: none; }

.bottoms {
  margin-bottom: 1.5rem;
}
.bottoms .garment {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-size: 1.4rem;
  margin: 0;
}

.feet {
  margin-bottom: 1.5rem;
}
.feet-row {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-size: 1.25rem;
  margin: 0;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: .55rem;
  flex-wrap: wrap;
}
.feet-separator {
  font-family: "IBM Plex Mono", monospace;
  font-style: normal;
  color: var(--ink-soft);
  font-size: .9rem;
}
.feet-socks {
  font-size: 1rem;
  color: var(--ink-soft);
}

.fabric {
  margin-bottom: 2rem;
}
.fabric-badge {
  display: inline-block;
  padding: .3rem .7rem;
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--accent);
}

.accessories { margin-bottom: 2rem; }

.chip-row {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.chip {
  padding: .35rem .75rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  font-family: "Inter", sans-serif;
  font-size: .85rem;
  color: var(--ink);
}

.chip .icon { margin-right: .35rem; }

.sun { margin-bottom: 2rem; }

.sun-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.uv-ring {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 3px solid var(--rule);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  position: relative;
  background: conic-gradient(var(--accent) calc(var(--uv-pct, 0%) * 1), var(--rule) 0);
  padding: 3px;
}

.uv-ring::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--paper);
}

.uv-num, .uv-label { position: relative; }

.uv-num {
  font-family: "Fraunces", serif;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ink);
}
.uv-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: .6rem;
  letter-spacing: .18em;
  color: var(--ink-soft);
}

.sun-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: "Inter", sans-serif;
  font-size: .95rem;
  color: var(--ink);
}
.sun-list li { margin-bottom: .25rem; }

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 0 .5rem;
  border-top: 1px solid var(--rule);
  margin-top: 1.5rem;
}

.control {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.control select {
  font-family: "Inter", sans-serif;
  font-size: .9rem;
  text-transform: none;
  padding: .35rem .5rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}

.profile-button {
  font-family: "Inter", sans-serif;
  font-size: .85rem;
  padding: .4rem .9rem;
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
}
.profile-button:hover { background: var(--surface-hover); }

.status {
  font-family: "IBM Plex Mono", monospace;
  font-size: .75rem;
  color: var(--ink-soft);
  min-height: 1.2em;
  margin: 1rem 0 0;
}

.fab {
  position: fixed;
  right: calc(1.25rem + env(safe-area-inset-right));
  bottom: calc(1.5rem + env(safe-area-inset-bottom));
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);
  border: none;
  box-shadow: 0 8px 24px rgba(20,18,15,0.18);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: fab-breathe 4s ease-in-out infinite;
  z-index: 20;
}

.fab:active { transform: scale(0.96); }
.fab.speaking { animation: fab-speaking 1.4s ease-in-out infinite; }

@keyframes fab-breathe {
  0%, 100% { box-shadow: 0 8px 24px rgba(20,18,15,0.18); transform: scale(1); }
  50%      { box-shadow: 0 10px 28px rgba(20,18,15,0.24); transform: scale(1.03); }
}
@keyframes fab-speaking {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

.sheet {
  border: none;
  border-radius: 18px 18px 0 0;
  padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  background: var(--paper);
  color: var(--ink);
  max-width: 560px;
  width: 100%;
  position: fixed;
  inset: auto 0 0 0;
  margin: 0 auto;
  box-shadow: 0 -8px 32px rgba(20,18,15,0.18);
  animation: sheet-slide-up .22s ease-out;
}
.sheet::backdrop {
  background: rgba(20,18,15,0.45);
  animation: sheet-fade-in .22s ease-out;
}

@keyframes sheet-slide-up {
  from { transform: translateY(20px); opacity: 0.6; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes sheet-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sheet-form h3 {
  font-family: "Fraunces", serif;
  font-weight: 500;
  margin: 0 0 .75rem;
}
.sheet fieldset {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: .55rem .75rem .85rem;
  margin: 0 0 1rem;
}
.sheet legend {
  padding: 0 .35rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: .7rem;
  letter-spacing: .18em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.seg-group {
  display: inline-flex;
  padding: 3px;
  background: rgba(20, 18, 15, 0.06);
  border-radius: 999px;
  width: 100%;
  gap: 2px;
}
.seg-option {
  flex: 1;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .45rem .8rem;
  font-family: "Inter", sans-serif;
  font-size: .9rem;
  color: var(--ink-soft);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease, transform .1s ease;
}
.seg-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.seg-option span { pointer-events: none; }
.seg-option:has(input:checked) {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(20,18,15,0.12), 0 1px 1px rgba(20,18,15,0.06);
  font-weight: 500;
}
.seg-option:hover:not(:has(input:checked)) {
  color: var(--ink);
}
.seg-option:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nudge {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}
.nudge button {
  padding: .4rem .9rem;
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 999px;
  cursor: pointer;
  font-family: "Inter", sans-serif;
}
.nudge-readout {
  font-family: "IBM Plex Mono", monospace;
  font-size: .8rem;
  color: var(--ink-soft);
  margin: 0 0 1rem;
}
.sheet-actions {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: flex-end;
}
.sheet-actions button {
  padding: .55rem 1.25rem;
  border: none;
  background: var(--accent);
  color: var(--paper);
  border-radius: 999px;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-size: .95rem;
}

.gps-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .9rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  margin-bottom: 1rem;
  transition: background .15s ease, transform .08s ease;
}
.gps-button:active { transform: scale(0.99); }
.gps-button:hover { background: var(--surface-hover); }
.gps-icon {
  font-size: 1.4rem;
  color: var(--accent);
  line-height: 1;
}
.gps-label { display: flex; flex-direction: column; }
.gps-label strong {
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 1rem;
}
.gps-label small {
  font-family: "IBM Plex Mono", monospace;
  font-size: .72rem;
  color: var(--ink-soft);
  letter-spacing: .04em;
}

.search { margin-bottom: .5rem; }
.search-label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: .4rem;
}
.search input[type="search"] {
  width: 100%;
  padding: .65rem .85rem;
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 10px;
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  color: var(--ink);
}
.search input[type="search"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.search input[type="search"]::placeholder {
  color: var(--ink-soft);
  opacity: 0.7;
}
.search-results {
  list-style: none;
  padding: 0;
  margin: .5rem 0 0;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--surface);
}
.search-results:empty { display: none; }
.search-result {
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background .12s ease;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--surface-hover); }
.search-result .name {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink);
}
.search-result .region {
  font-family: "IBM Plex Mono", monospace;
  font-size: .7rem;
  color: var(--ink-soft);
  margin-left: .5rem;
  letter-spacing: .06em;
}
.search-hint {
  font-family: "IBM Plex Mono", monospace;
  font-size: .72rem;
  color: var(--ink-soft);
  margin: .4rem 0 0;
}

.map-picker { margin-top: 1rem; }
.map-toggle {
  width: 100%;
  padding: .6rem 1rem;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  border-radius: 10px;
  font-family: "Inter", sans-serif;
  font-size: .95rem;
  cursor: pointer;
  transition: background .15s ease;
}
.map-toggle:hover { background: var(--surface-hover); }
.map-wrap { margin-top: .6rem; }
.map {
  width: 100%;
  height: 260px;
  border-radius: 10px;
  border: 1px solid var(--rule);
  overflow: hidden;
}
.map-coords {
  font-family: "IBM Plex Mono", monospace;
  font-size: .75rem;
  color: var(--ink-soft);
  margin: .5rem 0;
  letter-spacing: .04em;
}
.map-confirm {
  width: 100%;
  padding: .6rem 1rem;
  background: var(--accent);
  color: var(--paper);
  border: none;
  border-radius: 999px;
  font-family: "Inter", sans-serif;
  font-size: .95rem;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .fab, .fab.speaking { animation: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15130f;
    --ink: #f6f1e4;
    --ink-soft: #c5bfad;
    --rule: #2e2a22;
    --surface: #1d1b16;
    --surface-hover: #25221c;
    --shadow-rgb: 0, 0, 0;
  }
  .sheet { background: var(--paper); }
  .control select, .nudge button { background: var(--surface); color: var(--ink); }
  .seg-group { background: rgba(246, 241, 228, 0.08); }
  .seg-option:has(input:checked) {
    background: var(--surface-hover);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}
