:root {
  --bg: #f2efe8;
  --text: #162327;
  --muted: #4c6066;
  --card: #fffdf8;
  --stroke: #d9d0bf;
  --accent: #0c7a68;
  --accent-2: #d98c2f;
  --danger: #b7442e;
  --shadow: 0 18px 45px -28px rgba(13, 33, 39, 0.45);
  --risk-low: #1f9d57;
  --risk-moderate: #d6b300;
  --risk-high: #ef8a23;
  --risk-critical: #d5392a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at -10% -10%, #fde2bf 0%, rgba(253, 226, 191, 0) 65%),
    radial-gradient(900px 700px at 120% 20%, #c8e7de 0%, rgba(200, 231, 222, 0) 60%),
    var(--bg);
  line-height: 1.35;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(24px);
  pointer-events: none;
  opacity: 0.35;
}

.bg-shape-a {
  width: 220px;
  height: 220px;
  top: -60px;
  right: -70px;
  background: #f7b161;
}

.bg-shape-b {
  width: 280px;
  height: 280px;
  left: -100px;
  bottom: -110px;
  background: #6fb6a8;
}

.app-shell {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 1rem 0.9rem 2rem;
}

.hero {
  margin-bottom: 0.9rem;
  position: relative;
  z-index: 20;
  animation: fade-in 340ms ease-out both;
}

.hero-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero h1 {
  margin: 0.15rem 0;
  font-size: clamp(1.45rem, 6vw, 2rem);
  line-height: 1.1;
}

.hero-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.hero-title-row h1 {
  flex: 1;
  min-width: 0;
}

.hero-actions {
  display: none;
}

.hero-actions-panel {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  justify-content: flex-end;
  margin-top: 0.35rem;
}

.hero-actions--open {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(11, 21, 25, 0.32);
  backdrop-filter: blur(1px);
}

.hero-actions--open .hero-actions-panel {
  inline-size: fit-content;
  max-inline-size: calc(100vw - 1.4rem);
  margin: 4.45rem 0.6rem 0 auto;
  padding: 0.5rem;
  border: 1px solid #ccd6d3;
  border-radius: 14px;
  background: #fffdf8;
  box-shadow: 0 18px 42px -24px rgba(17, 33, 39, 0.65);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.42rem;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #b8cdd0;
  background: #f3fbfa;
  border-radius: 999px;
  padding: 0.26rem 0.5rem;
  color: #26484f;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.lang-switch select {
  border: 0;
  background: transparent;
  color: #1d4a52;
  font-size: 0.74rem;
  font-weight: 800;
  padding: 0;
  font-family: inherit;
}

.lang-switch select:focus {
  outline: none;
}

.hero-actions--open .refresh-data-btn,
.hero-actions--open .favorite-toggle-btn,
.hero-actions--open .edit-location-btn {
  width: auto;
  justify-content: flex-start;
  text-align: left;
  min-height: 2.35rem;
  padding: 0.52rem 0.86rem;
  font-size: 0.88rem;
  white-space: nowrap;
}

.hero-actions--open .lang-switch {
  width: 100%;
  justify-content: space-between;
  border-radius: 12px;
  padding: 0.5rem 0.65rem;
}

.mobile-menu-btn {
  border: 1px solid #a7c8c0;
  background: #f0faf7;
  color: #1e4d52;
  border-radius: 10px;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.mobile-menu-btn--open {
  background: #dff3ee;
  border-color: #78b0a4;
}

.refresh-data-btn {
  border: 1px solid #a7c8c0;
  background: #f0faf7;
  color: #1e4d52;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.favorite-toggle-btn {
  border: 1px solid #d2d6af;
  background: #fffbe4;
  color: #8f7f12;
  border-radius: 999px;
  min-width: 2.45rem;
  padding: 0.34rem 0.62rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}

.favorite-toggle-btn--icon {
  min-width: 2.2rem;
  padding: 0.32rem 0.55rem;
  line-height: 1;
}

.favorite-toggle-btn--active {
  border-color: #c5b44f;
  background: #fff2a5;
  color: #6f5f00;
}

.edit-location-btn {
  border: 1px solid #a7c8c0;
  background: #f0faf7;
  color: #1e4d52;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.method-nav {
  margin: 0.5rem 0 0;
}

.method-nav a {
  color: #1d565a;
  font-weight: 700;
}

.card {
  background: color-mix(in oklab, var(--card) 93%, white);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1rem;
  margin: 0.85rem 0;
  animation: fade-in 400ms ease-out both;
}

.card h2 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
}

.location-card {
  margin-top: 0.3rem;
}

.location-help {
  margin: -0.2rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.geo-locate-btn {
  border: 1px solid #a7c8c0;
  background: #f0faf7;
  color: #1e4d52;
  border-radius: 999px;
  padding: 0.38rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  margin: -0.15rem 0 0.65rem;
}

.geo-locate-btn[disabled] {
  opacity: 0.65;
}

.location-search-wrap input {
  width: 100%;
  border: 1px solid #b8c8cc;
  border-radius: 12px;
  padding: 0.68rem 0.8rem;
  font: inherit;
  font-size: 0.95rem;
}

.location-search-wrap input:focus {
  outline: 2px solid rgba(12, 122, 104, 0.35);
  outline-offset: 1px;
}

.favorite-locations-box {
  margin-top: 0.65rem;
}

.location-fav-title {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.favorite-locations-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.favorite-location-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: center;
}

.favorite-select-btn {
  width: 100%;
  text-align: left;
  border: 1px solid #d1d8da;
  background: #ffffff;
  border-radius: 11px;
  padding: 0.54rem 0.66rem;
  font: inherit;
  color: var(--text);
}

.favorite-select-btn strong {
  display: block;
  font-size: 0.9rem;
}

.favorite-select-btn span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.1rem;
}

.favorite-remove-btn {
  border: 1px solid #dbc8c0;
  background: #fff5f2;
  color: #a14530;
  border-radius: 9px;
  padding: 0.45rem 0.52rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.location-results {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.location-result-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: center;
}

.location-results li .location-select-btn {
  width: 100%;
  text-align: left;
  border: 1px solid #d1d8da;
  background: #ffffff;
  border-radius: 11px;
  padding: 0.58rem 0.7rem;
  font: inherit;
  color: var(--text);
}

.location-results li .location-select-btn strong {
  display: block;
  font-size: 0.92rem;
}

.location-results li .location-select-btn span {
  display: block;
  color: var(--muted);
  font-size: 0.77rem;
  margin-top: 0.1rem;
}

.location-fav-btn {
  border: 1px solid #d2d6af;
  background: #fffbe4;
  color: #8f7f12;
  border-radius: 10px;
  padding: 0.48rem 0.52rem;
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 2.15rem;
}

.location-fav-btn--active {
  border-color: #c5b44f;
  background: #fff2a5;
  color: #6f5f00;
}

.gauge-card {
  padding-bottom: 1.15rem;
}

.gauge-wrap {
  position: relative;
  max-width: 280px;
  margin: 0 auto;
}

.gauge-svg {
  width: 100%;
  height: auto;
  display: block;
}

#gaugeTrack,
#gaugeFill {
  fill: none;
  stroke-linecap: round;
  stroke-width: 16;
}

#gaugeTrack {
  stroke: #d8e4df;
}

#gaugeFill {
  stroke: var(--accent);
  stroke-dasharray: 0 1;
  transition: stroke-dashoffset 480ms ease, stroke 240ms ease;
}

.gauge-center {
  position: absolute;
  inset: 53px 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.2rem;
  flex-wrap: wrap;
}

.gauge-center #riskScore {
  font-size: 2.1rem;
  font-weight: 700;
}

.gauge-center strong {
  width: 100%;
  text-align: center;
  font-size: 1rem;
}

.gauge-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
  margin: 0.45rem 0 0;
}

.curve-title {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  color: #27454b;
}

.curve-peak {
  margin: 0.28rem 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1d4047;
}

.curve-drivers {
  margin: 0.08rem 0 0.2rem;
  font-size: 0.76rem;
  color: #476067;
}

.curve-24h {
  width: 100%;
  border-radius: 9px;
  background: #ffffff;
  border: 1px solid #d9e3e0;
  padding: 0.14rem 0.18rem 0.12rem;
  height: 238px;
}

.curve-24h canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.curve-empty {
  margin: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4f6369;
  font-size: 0.82rem;
  font-weight: 700;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
  align-items: end;
  min-height: 150px;
}

.time-col {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  border-radius: 12px;
  padding: 0.2rem;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease;
}

.time-col:focus-visible {
  outline: 2px solid rgba(12, 122, 104, 0.4);
  outline-offset: 1px;
}

.time-weekday {
  font-size: 0.68rem;
  font-weight: 700;
  color: #3f5a61;
  letter-spacing: 0.02em;
  line-height: 1;
}

.time-bar-wrap {
  width: 100%;
  height: 106px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(12, 122, 104, 0.14), rgba(217, 140, 47, 0.12));
  display: flex;
  align-items: flex-end;
  padding: 0.23rem;
}

.time-bar {
  width: 100%;
  border-radius: 10px;
  background: linear-gradient(180deg, #2aa363, #1f9d57);
  transition: height 340ms ease;
}

.time-bar--faible {
  background: linear-gradient(180deg, #2aa363, var(--risk-low));
}

.time-bar--modere {
  background: linear-gradient(180deg, #f0dc59, var(--risk-moderate));
}

.time-bar--eleve {
  background: linear-gradient(180deg, #f0a13b, var(--risk-high));
}

.time-bar--critique {
  background: linear-gradient(180deg, #e34d34, var(--risk-critical));
}

.time-val {
  font-size: 0.75rem;
  font-weight: 700;
}

.time-lbl {
  font-size: 0.71rem;
  color: var(--muted);
}

.time-col--today {
}

.time-col--selected {
  background: rgba(12, 122, 104, 0.12);
  border-color: rgba(12, 122, 104, 0.7);
}

.time-col--today .time-lbl,
.time-col--today .time-val,
.time-col--today .time-weekday {
  font-weight: 800;
}

.drivers-list {
  margin: 0;
  padding-left: 1.1rem;
}

.drivers-list li {
  margin-bottom: 0.42rem;
}

.alert-card {
  border-color: #efc6aa;
  background: #fff6ef;
}

.alert-card h2 {
  color: #8a3e10;
}

.update-card {
  border-color: #b9d8d1;
  background: #f2fcf9;
}

.update-card h2 {
  color: #1e4d52;
}

.update-card p {
  margin: 0.1rem 0 0.65rem;
  color: #35545c;
  font-size: 0.9rem;
}

.update-card button {
  border: 0;
  border-radius: 999px;
  padding: 0.52rem 0.92rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(140deg, #22696d, #3e8c4f);
}

.alert-card button {
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(140deg, #bb4a22, #cf6b1f);
}

.install-hint {
  position: sticky;
  top: 0.5rem;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  width: min(860px, calc(100% - 1.2rem));
  margin: 0.6rem auto 0;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  border: 1px solid #d7cfbe;
  background: rgba(255, 253, 246, 0.96);
  box-shadow: 0 12px 34px -24px rgba(22, 35, 39, 0.65);
  backdrop-filter: blur(4px);
}

.install-hint p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.25;
  color: #22353b;
}

.install-hint button {
  border: 0;
  border-radius: 999px;
  padding: 0.38rem 0.72rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(140deg, #22696d, #3e8c4f);
  white-space: nowrap;
}

.storage-consent {
  position: fixed;
  inset: auto 0 0;
  z-index: 1300;
  padding: 0.6rem;
  display: flex;
  justify-content: center;
}

.storage-consent-panel {
  width: min(860px, 100%);
  border: 1px solid #d4c9b6;
  border-radius: 14px;
  background: rgba(255, 253, 246, 0.98);
  box-shadow: 0 20px 42px -28px rgba(12, 28, 33, 0.72);
  padding: 0.68rem 0.78rem;
}

.storage-consent-panel p {
  margin: 0;
  color: #263a40;
  font-size: 0.8rem;
  line-height: 1.3;
}

.storage-consent-actions {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.storage-consent-actions button {
  border: 1px solid #a7c8c0;
  border-radius: 999px;
  background: #f0faf7;
  color: #1e4d52;
  padding: 0.42rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.storage-consent-actions button:last-child {
  border-color: #c8cfcf;
  background: #f6f8f7;
  color: #41565a;
}

.footer-note {
  margin-top: 1rem;
  padding: 0.75rem 0.2rem;
  color: #3f4e52;
  font-size: 0.8rem;
}

.footer-updated {
  margin: 0.35rem 0 0;
  color: #4b6066;
  font-size: 0.79rem;
}

.footer-link-line {
  margin-top: 0.35rem;
}

.footer-link-line a {
  color: #1d565a;
  font-weight: 700;
}

.hidden {
  display: none;
}

.level-faible #gaugeFill {
  stroke: var(--risk-low);
}

.level-modere #gaugeFill {
  stroke: var(--risk-moderate);
}

.level-eleve #gaugeFill {
  stroke: var(--risk-high);
}

.level-critique #gaugeFill {
  stroke: var(--risk-critical);
}

@media (min-width: 760px) {
  .app-shell {
    padding: 1.3rem 1.2rem 2.4rem;
  }

  .mobile-menu-btn {
    display: none;
  }

  .hero-actions {
    display: block;
  }

  .hero-actions-panel {
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
  }

  .timeline {
    gap: 0.5rem;
  }

  .curve-24h {
    padding: 0.16rem 0.2rem 0.16rem;
    height: 220px;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
