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

body {
  display: flex;
  height: 100vh;
  font-family: 'Inter', system-ui, sans-serif;
  background: #F7F4EF;
  color: #1C1917;
}

/* ── Sidebar ─────────────────────────────────────────── */
#sidebar {
  width: 290px;
  flex-shrink: 0;
  padding: 28px 24px 24px;
  background: #FFFFFF;
  border-right: 1px solid #EAE6DF;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 10;
}

/* ── Brand ───────────────────────────────────────────── */
#brand h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 3.15rem;
  font-weight: 400;
  color: #F5C518;
  line-height: 1;
  letter-spacing: -0.5px;
}
.sun-o {
  filter:
    drop-shadow(0 0 4px  rgba(255, 210, 40, 1))
    drop-shadow(0 0 14px rgba(245, 197, 24, 0.65))
    drop-shadow(0 0 32px rgba(245, 197, 24, 0.3));
}
#brand .subtitle {
  margin-top: 10px;
  font-size: 0.75rem;
  color: #A8A29E;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ── Hero result ─────────────────────────────────────── */
#hero-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid #EAE6DF;
  border-bottom: 1px solid #EAE6DF;
}
#hero-left {
  width: 100%;
  text-align: center;
  min-width: 0;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid #EAE6DF;
}
#annual-hours {
  font-family: 'DM Serif Display', serif;
  font-size: 4.2rem;
  font-weight: 400;
  color: #D97706;
  line-height: 1;
  letter-spacing: -2px;
}
.hero-label {
  margin-top: 7px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #A8A29E;
}
#hero-raw {
  margin-top: 4px;
  font-size: 0.68rem;
  color: #A8A29E;
}
#quality-ring-wrap {
  width: 160px;
  position: relative;
}
#quality-ring-wrap svg {
  display: block;
  width: 160px;
  height: 160px;
}
.quality-ring-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #A8A29E;
  text-align: center;
  margin-top: 4px;
}
.quality-info-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 170px;
  padding: 8px 10px;
  background: rgba(28,25,23,0.92);
  border-radius: 7px;
  font-size: 0.71rem;
  font-style: normal;
  font-weight: 400;
  color: #E7E5E4;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  pointer-events: none;
  z-index: 100;
}
#quality-ring-wrap:hover .quality-info-tip { display: block; }

/* ── Inputs ──────────────────────────────────────────── */
#inputs-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#address-wrap { position: relative; }

#address-input {
  width: 100%;
  padding: 10px 36px 10px 14px;
  border: 1.5px solid #EAE6DF;
  border-radius: 999px;
  background: #FAF8F4;
  color: #1C1917;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
#address-input::placeholder { color: #C4BFBA; }
#address-input:focus {
  border-color: #D97706;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(217,119,6,0.1);
}

#reset-all-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #C4BFBA;
  font-size: 0.8rem;
  padding: 3px 5px;
  border-radius: 50%;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
#reset-all-btn:hover { color: #1C1917; background: #EAE6DF; }

#floor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease;
}
#floor-row.visible {
  max-height: 50px;
  opacity: 1;
}
.floor-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: #78716C;
}
#floor-stepper {
  display: flex;
  align-items: center;
  gap: 14px;
}
.step-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid #EAE6DF;
  background: #FAF8F4;
  color: #1C1917;
  font-size: 1.1rem;
  font-weight: 400;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.step-btn:hover { border-color: #D97706; background: #FEF9EE; }
.step-btn:active { background: #FEF3C7; }
#floor-val {
  font-size: 1rem;
  font-weight: 600;
  color: #1C1917;
  min-width: 18px;
  text-align: center;
}

/* ── Windows ─────────────────────────────────────────── */
#windows-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#windows-guidance {
  font-size: 0.78rem;
  color: #A8A29E;
  line-height: 1.55;
  padding: 10px 13px;
  border: 1px dashed #D6D0C8;
  border-radius: 10px;
  background: #FAF8F4;
}
#windows-list { display: flex; flex-direction: column; gap: 4px; }
.window-row { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; padding: 2px 0; }
.w-label   { color: #D97706; font-weight: 700; width: 28px; flex-shrink: 0; }
.w-facing  { color: #A8A29E; flex: 1; }
.w-hrs     { color: #1C1917; font-weight: 600; font-size: 0.78rem; }
.w-raw     { color: #A8A29E; font-weight: 400; }
.window-row.combined { border-top: 1px solid #EAE6DF; padding-top: 6px; margin-top: 2px; }
.window-row.combined .w-label { color: #78716C; font-weight: 600; }
.window-row.combined .w-hrs   { color: #D97706; }
.w-remove {
  background: none; border: none; cursor: pointer;
  color: #C4BFBA; font-size: 0.8rem; line-height: 1;
  padding: 0 2px; margin-left: auto; flex-shrink: 0;
  transition: color 0.15s;
}
.w-remove:hover { color: #DC2626; }

#reset-windows-btn {
  background: none;
  border: none;
  color: #C4BFBA;
  font-size: 0.74rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  text-align: left;
  transition: color 0.15s;
}
#reset-windows-btn:hover { color: #DC2626; }

/* ── Calculate button ────────────────────────────────── */
#analyze-btn {
  padding: 13px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  background: #D97706;
  color: #FFFFFF;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, opacity 0.15s;
}
#analyze-btn:disabled { opacity: 0.28; cursor: not-allowed; }
#analyze-btn:not(:disabled):hover { background: #B45309; }
#analyze-btn.hint-loading {
  border: 1.5px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    conic-gradient(from -90deg, #D97706 0deg var(--border-sweep), rgba(217,119,6,0.15) var(--border-sweep)) border-box;
  color: #D97706;
  opacity: 1;
  animation: hint-border-sweep 2s ease-out forwards;
}

/* ── Spinner / Error ─────────────────────────────────── */
#spinner {
  height: 38px;
  border-radius: 999px;
  border: 1.5px solid #D97706;
}
#spinner.hint-loading {
  border-color: transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    conic-gradient(from -90deg, #D97706 0deg var(--border-sweep), rgba(217,119,6,0.15) var(--border-sweep)) border-box;
  animation: hint-border-sweep 10s ease-out forwards;
}
#error {
  font-size: 0.8rem;
  color: #DC2626;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  padding: 10px 12px;
}

/* ── Map ─────────────────────────────────────────────── */
#map-container { flex: 1; position: relative; }
#map { width: 100%; height: 100%; z-index: 1; }

#map-block {
  position: absolute; inset: 0;
  z-index: 499; cursor: wait;
}
#map-ripple {
  position: absolute;
  width: 0; height: 0;
  pointer-events: none;
  z-index: 500;
}
#map-ripple::before, #map-ripple::after {
  content: '';
  position: absolute;
  width: 52px; height: 52px;
  border: 2px solid #f5c518;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
  animation: map-ripple 2s ease-out infinite;
}
#map-ripple::after { animation-delay: 0.9s; }
@keyframes map-ripple {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0.75; }
  100% { transform: translate(-50%, -50%) scale(5);   opacity: 0; }
}

#map-hint {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 22px;
  background: rgba(255,255,255,0.92);
  border: 1.5px solid #D97706;
  border-radius: 999px;
  color: #D97706;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.map-hint-icon { font-size: 0.7rem; opacity: 0.7; }
.map-hint-sep { opacity: 0.35; }
#map-hint-change {
  pointer-events: auto;
  background: none; border: none; padding: 0; margin: 0;
  color: #D97706; font: inherit; font-size: 0.82rem; opacity: 0.75;
  text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer;
}
#map-hint-change:hover { opacity: 1; }
@property --border-sweep {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
#map-hint.hint-loading {
  border-color: transparent;
  background:
    linear-gradient(rgba(255,255,255,0.92), rgba(255,255,255,0.92)) padding-box,
    conic-gradient(from -90deg, #D97706 0deg var(--border-sweep), rgba(217,119,6,0.15) var(--border-sweep)) border-box;
  animation: hint-border-sweep 10s ease-out forwards;
}
@keyframes hint-border-sweep {
  from { --border-sweep: 0deg; }
  to   { --border-sweep: 330deg; }
}

/* ── Sun-path panel ──────────────────────────────────── */
#sunpath-panel {
  width: 380px;
  flex-shrink: 0;
  padding: 20px 16px;
  background: #FFFFFF;
  border-left: 1px solid #EAE6DF;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#sunpath-panel h2 { font-size: 0.95rem; font-weight: 600; color: #78716C; }
#compass-ring-wrap { position: relative; width: 100%; aspect-ratio: 1; }
#compass-ring-chart { width: 100%; height: 100%; }
#compass-ring-chart svg { display: block; width: 100%; height: 100%; }
#compass-3d-btn {
  position: absolute; top: 8px; right: 8px;
  padding: 3px 9px;
  background: rgba(255,255,255,0.88); border: 1.5px solid #D97706;
  border-radius: 999px; color: #D97706;
  font-size: 0.72rem; font-weight: 600; font-family: inherit;
  cursor: pointer; backdrop-filter: blur(4px);
  transition: background 0.15s, color 0.15s;
}
#compass-3d-btn:hover { background: #D97706; color: #fff; }

/* ── 3D compass modal ────────────────────────────────── */
#compass-3d-modal {
  position: fixed; inset: 0;
  z-index: 2000;
  background: #0f1117;
  display: flex; align-items: center; justify-content: center;
}
#compass-3d-canvas { display: block; width: 100%; height: 100%; }
#compass-3d-close {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%; width: 36px; height: 36px;
  color: #aeb3c8; font-size: 0.9rem; font-family: inherit;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
#compass-3d-close:hover { background: rgba(255,255,255,0.15); color: #fff; }
#compass-3d-reset {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  padding: 6px 16px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px; color: #aeb3c8;
  font-size: 0.78rem; font-family: inherit; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
#compass-3d-reset:hover { background: rgba(255,255,255,0.12); color: #fff; }
.chart-caption { font-size: 0.68rem; color: #A8A29E; text-align: center; margin-top: 4px; }
.chart-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: #78716C; margin-top: 8px; }
#monthly-chart { width: 100% !important; }
#hourly-chart  { width: 100% !important; }

/* ── Compass rose (building mode, hidden) ────────────── */
#rose-wrap { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
#compass-rose { flex-shrink: 0; cursor: pointer; }
#compass-rose .seg { transition: fill 0.15s, opacity 0.15s; }
#compass-rose .seg.detected   { fill: #2c3047; opacity: 1; }
#compass-rose .seg.selected   { fill: #f5c518; opacity: 1; }
#compass-rose .seg.undetected { fill: #1a1d28; opacity: 0.6; }
#compass-rose text {
  font-size: 13px; font-family: system-ui, sans-serif; font-weight: 600;
  fill: #e8eaf0; pointer-events: none;
  dominant-baseline: middle; text-anchor: middle;
}
#rose-controls { display: flex; flex-direction: column; gap: 6px; }
.rose-btn {
  padding: 4px 10px;
  border: 1px solid #2c3047; border-radius: 5px;
  background: #0f1117; color: #aeb3c8;
  font-size: 0.78rem; cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.rose-btn:hover { border-color: #f5c518; color: #f5c518; }
.hint { font-size: 0.7rem; font-weight: 400; color: #555b75; text-transform: none; letter-spacing: 0; }
.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-group label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: #8a8fa8; }

/* ── Location marker (Leaflet divIcon) ───────────────── */
.location-marker-icon {
  width: 14px; height: 14px;
  background: #D97706;
  border: 2.5px solid #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* ── Window markers (Leaflet divIcon) ────────────────── */
.window-marker-icon {
  width: 22px; height: 22px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #ff3b3b;
  font-size: 10px; font-weight: 700;
  font-family: system-ui, sans-serif;
  text-shadow: 0 0 6px rgba(255,60,60,0.8), 0 1px 2px rgba(0,0,0,0.6);
  box-shadow: 0 1px 6px rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
}

/* ── Address autocomplete ────────────────────────────── */
#address-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #FFFFFF;
  border: 1px solid #EAE6DF;
  border-radius: 12px;
  overflow: hidden;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.addr-suggestion {
  padding: 9px 14px;
  font-size: 0.81rem;
  color: #44403C;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid #F5F0E8;
}
.addr-suggestion:last-child { border-bottom: none; }
.addr-suggestion:hover { background: #FAF8F4; color: #1C1917; }

/* ── Compass tooltip ─────────────────────────────────── */
#compass-tooltip {
  position: fixed;
  display: none;
  padding: 6px 10px;
  background: rgba(15,17,23,0.88);
  border: 1px solid #2c3047;
  border-radius: 6px;
  font-size: 0.76rem;
  color: #aeb3c8;
  pointer-events: none;
  z-index: 9999;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.tip-list { display: flex; flex-direction: column; gap: 3px; }
.tip-row  { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tip-months { font-weight: 500; }
.tip-hrs { color: #f5c518; font-weight: 600; }

/* ── Animation controls ──────────────────────────────── */
#anim-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  padding: 12px 14px;
  background: rgba(15,17,23,0.85);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 230px;
  z-index: 10;
}
#anim-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
#anim-play-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
#anim-play-btn:hover { background: rgba(255,255,255,0.15); border-color: #F5C518; color: #F5C518; }
#anim-slider {
  flex: 1;
  accent-color: #F5C518;
  cursor: pointer;
  min-width: 0;
}
#anim-time {
  font-size: 0.72rem;
  color: #aeb3c8;
  white-space: nowrap;
  min-width: 62px;
  text-align: right;
}
#anim-months {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.anim-month-btn {
  padding: 3px 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: #aeb3c8;
  font-size: 0.67rem;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.anim-month-btn:hover { border-color: rgba(245,197,24,0.5); color: #F5C518; }
.anim-month-btn.active {
  background: #F5C518;
  border-color: #F5C518;
  color: #0f1117;
  font-weight: 600;
}

.hidden { display: none !important; }
