:root {
  font-family: Xmind, Arial, Helvetica, sans-serif;
  color: #111;
  background: #f9f7f5;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-width: 320px; }
button, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: clamp(16px, 2.3vw, 32px);
  background: radial-gradient(ellipse at center, #fff 20%, #f9f7f5 80%);
}
.toolbar { display: flex; align-items: flex-start; justify-content: space-between; min-height: 48px; gap: 16px; }
.toolbar-right { display: flex; align-items: center; gap: 12px; }
.import-button, .icon-button, #year-select {
  display: inline-flex; align-items: center; justify-content: center;
  height: 46px; background: rgba(255,255,255,.55); border: 1.5px solid #cbb9a8;
  border-radius: 999px; color: #151515; box-shadow: 0 2px 4px #4e2b170d;
}
.import-button { gap: 11px; padding: 0 20px; font-size: 15px; white-space: nowrap; cursor: pointer; }
.import-button svg, .icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-button { width: 46px; }
#year-select { padding: 0 15px; font-size: 15px; appearance: auto; }
#year-select[hidden] { display: none; }
#csv-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.import-button:hover, .icon-button:hover, #year-select:hover, .nav-button:hover { border-color: #a97952; background: #fff; }
.import-button:focus-within, .icon-button:focus-visible, #year-select:focus-visible, .nav-button:focus-visible, .dots button:focus-visible { outline: 3px solid #fa6d22; outline-offset: 3px; }

.carousel { display: grid; grid-template-columns: minmax(50px, 1fr) minmax(0, 920px) minmax(50px, 1fr); align-items: center; gap: clamp(8px, 2.2vw, 32px); min-height: 0; }
.display-frame {
  width: min(100%, calc((100svh - 168px) * 1.06));
  aspect-ratio: 1.06;
  justify-self: center;
  border-radius: clamp(38px, 7vw, 94px);
  padding: clamp(27px, 4.5vw, 69px) clamp(27px, 4.5vw, 68px) clamp(17px, 2.2vw, 32px);
  display: flex; flex-direction: column; gap: clamp(14px, 2.6vw, 34px);
  background: linear-gradient(135deg, #d2ac8b 0%, #c39570 50%, #aa7751 100%);
  box-shadow: inset 0 4px 5px #ffffff54, 0 24px 42px #6f48222a;
  touch-action: pan-y;
  cursor: pointer;
}
.display-frame.page-changing .display-inner { animation: page-appear .28s ease-out both; }
@keyframes page-appear {
  from { opacity: .2; transform: translateX(var(--slide-direction, 22px)); }
  to { opacity: 1; transform: translateX(0); }
}
.display-inner {
  min-height: 0; flex: 1; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; isolation: isolate; overflow: hidden;
  padding: clamp(27px, 3.5vw, 42px) clamp(24px, 4vw, 51px) clamp(25px, 2.5vw, 32px);
  border-radius: clamp(26px, 3.7vw, 43px);
  background: #e9e9e8;
  box-shadow: inset 0 11px 20px #42312436, inset 0 0 25px #fff9, 0 1px 1px #fff5;
}
.display-inner[hidden] { display: none; }
.display-inner::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url('./assets/everest-background.png') center 53% / cover no-repeat;
  opacity: .46;
}
.display-inner > * { position: relative; z-index: 1; }
.totals-page { justify-content: flex-start; gap: clamp(14px, 2vw, 24px); cursor: default; }
.totals-header { text-align: center; }
.totals-kicker { color: #e85d16; font-size: clamp(11px, 1.1vw, 15px); font-weight: 800; letter-spacing: .2em; }
.totals-header h1 { margin-top: 6px; font-size: clamp(15px, 2vw, 27px); }
.totals-period { margin-top: 7px; color: #584c41; font-size: clamp(12px, 1.2vw, 16px); }
.totals-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 12px 0; border-top: 1px solid #a99582; border-bottom: 1px solid #a99582; }
.total-stat { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.total-stat-label { color: #69594a; font-size: clamp(9px, .9vw, 12px); font-weight: 700; letter-spacing: .07em; }
.total-stat strong { font-size: clamp(15px, 1.75vw, 24px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals-overview .total-stat strong { color: #e85d16; }
.totals-list { min-height: 0; overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.totals-row { display: grid; grid-template-columns: minmax(120px, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 8px; align-items: center; padding: 13px 2px; border-bottom: 1px solid #b8aa9b; }
.totals-row:last-child { border-bottom: 0; }
.totals-row h2 { min-width: 0; font-size: clamp(12px, 1.25vw, 17px); letter-spacing: .02em; white-space: normal; overflow-wrap: anywhere; }
.totals-row .total-stat strong { font-size: clamp(13px, 1.3vw, 18px); }
.totals-demo { color: #554a41; font-size: 11px; text-align: center; }
.totals-demo[hidden] { display: none; }
.headline, .monthly-total { text-align: center; }
h1, h2, p { margin: 0; }
h1, .wide-label { font-weight: 400; letter-spacing: .24em; }
h1 { font-size: clamp(15px, 2.2vw, 30px); white-space: nowrap; }
.annual-total { display: flex; align-items: baseline; justify-content: center; gap: clamp(7px, 1vw, 14px); margin-top: clamp(8px, 1.8vw, 25px); line-height: .96; white-space: nowrap; }
#annual-value { font-size: clamp(68px, 11.3vw, 153px); font-weight: 800; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.unit { font-size: .43em; font-weight: 400; letter-spacing: -.035em; }
.annual-total .unit { font-size: clamp(29px, 4.5vw, 65px); }
.wide-label { font-size: clamp(15px, 2vw, 29px); white-space: nowrap; }
.wide-label.elevation-label { font-size: clamp(13px, 1.55vw, 22px); letter-spacing: .13em; }
.elevation-page #annual-value { font-size: clamp(62px, 9vw, 125px); }
.headline .wide-label { margin-top: clamp(6px, 1vw, 14px); }
.everest-stat {
  align-self: center; display: flex; align-items: center; gap: 10px;
  padding: 6px 15px; border: 1px solid #bca58b; border-radius: 999px;
  background: #faf8f0dd; box-shadow: 0 4px 12px #6d513522;
  white-space: nowrap;
}
.everest-stat svg { width: 25px; height: 25px; fill: none; stroke: #aa7851; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.everest-copy { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.everest-main { display: flex; align-items: baseline; gap: 5px; }
.everest-main strong { color: #ed5c16; font-size: clamp(17px, 1.65vw, 23px); font-weight: 800; font-variant-numeric: tabular-nums; }
.everest-main span { font-size: clamp(10px, .85vw, 12px); font-weight: 700; letter-spacing: .09em; }
.everest-caption { margin-top: 2px; color: #695b4b; font-size: clamp(8px, .67vw, 10px); letter-spacing: .1em; }
.chart-section { width: 100%; margin-top: 4px; }
.chart-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
h2 { font-size: clamp(12px, 1.35vw, 20px); font-weight: 700; letter-spacing: .13em; white-space: nowrap; }
h2 span { font-weight: 500; letter-spacing: .04em; }
.demo-label { color: #555; font-size: clamp(10px, 1.1vw, 15px); font-style: italic; white-space: nowrap; }
.demo-label[hidden] { display: none; }
.chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(2px, .7vw, 11px); height: clamp(66px, 9vw, 127px); border-bottom: 2px solid #989898; }
.bar-column { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; position: relative; }
.month-button { border: 0; padding: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.month-button:focus-visible { outline: 2px solid #fa5b0a; outline-offset: 3px; }
.month-button:hover .bar:not(.current) { background: #b58864; }
.bar-value { position: absolute; bottom: calc(var(--bar-height, 0%) + 4px); font-size: clamp(7px, .9vw, 12px); line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; color: #514234; pointer-events: none; }
.month-button.selected .bar-value { color: #e85d16; font-weight: 700; }
.bar { width: 78%; min-height: 0; background: #cda888; border-radius: 2px 2px 0 0; transition: height .3s ease; }
.bar.current { background: #fc600b; }
.bar-label { position: absolute; top: calc(100% + 5px); font-size: clamp(9px, 1.35vw, 18px); white-space: nowrap; }
.monthly-total { border-top: 2px solid #a4a4a4; padding-top: clamp(16px, 2vw, 24px); margin-top: clamp(28px, 2.5vw, 35px); }
.month-value { display: flex; justify-content: center; align-items: baseline; gap: clamp(7px, 1vw, 14px); margin-top: clamp(7px, 1.2vw, 16px); line-height: 1; white-space: nowrap; }
#month-value { font-size: clamp(46px, 6.4vw, 88px); font-weight: 800; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.month-value .unit { font-size: clamp(26px, 3.2vw, 47px); }
.brand { align-self: center; color: #fa5b0a; font-weight: 800; font-size: clamp(20px, 3vw, 41px); letter-spacing: .02em; line-height: 1; padding-bottom: clamp(2px, .8vw, 10px); }
.nav-button { width: clamp(46px, 5.3vw, 75px); height: clamp(46px, 5.3vw, 75px); display: grid; place-items: center; justify-self: center; border: 1.5px solid #cbb9a8; border-radius: 50%; background: #faf8f6; color: #111; box-shadow: 0 4px 7px #543a2215; }
.nav-button svg { width: 34%; height: 34%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.footer { min-height: 48px; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.dots { display: flex; gap: 12px; align-items: center; justify-content: center; min-height: 13px; }
.dots button { width: 11px; height: 11px; padding: 0; border: 0; border-radius: 50%; background: #d2c4b7; }
.dots button.active { background: #fa5b0a; }
.status { min-height: 17px; font-size: 12px; color: #655b53; text-align: center; }
.status.error { color: #ad3320; }

@media (max-width: 700px) {
  .app-shell { padding: 14px 12px; }
  .toolbar { min-height: 42px; }
  .import-button, .icon-button, #year-select { height: 40px; }
  .import-button { padding: 0 12px; font-size: 13px; gap: 6px; }
  .import-button svg { width: 17px; height: 17px; }
  .icon-button { width: 40px; }
  .toolbar-right { gap: 5px; }
  #year-select { padding: 0 7px; font-size: 13px; }
  .carousel { grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 2px; }
  .display-frame { width: 100%; aspect-ratio: auto; height: min(66svh, 570px); border-radius: 36px; padding: 24px 17px 14px; gap: 16px; }
  .display-inner { border-radius: 23px; padding: 26px 12px 31px; }
  .totals-page { gap: 13px; padding: 20px 12px; }
  .totals-header h1 { font-size: clamp(13px, 3.4vw, 20px); letter-spacing: .08em; }
  .totals-overview { gap: 4px; padding: 9px 0; }
  .total-stat-label { font-size: 8px; letter-spacing: 0; }
  .total-stat strong, .totals-row .total-stat strong { font-size: clamp(11px, 2.8vw, 15px); }
  .totals-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 3px; padding: 10px 0; }
  .totals-row h2 { grid-column: 1 / -1; font-size: 13px; }
  .nav-button { width: 32px; height: 45px; border: 0; box-shadow: none; background: transparent; }
  h1 { font-size: clamp(12px, 3.7vw, 20px); letter-spacing: .15em; }
  #annual-value { font-size: clamp(49px, 15vw, 100px); }
  .annual-total .unit { font-size: clamp(21px, 6vw, 40px); }
  .wide-label { font-size: clamp(12px, 3.7vw, 19px); letter-spacing: .17em; }
  .wide-label.elevation-label { font-size: clamp(10px, 2.8vw, 14px); letter-spacing: .06em; }
  .elevation-page #annual-value { font-size: clamp(43px, 13vw, 80px); }
  .everest-stat { gap: 6px; padding: 4px 9px; }
  .everest-stat svg { width: 18px; height: 18px; }
  .everest-main strong { font-size: 15px; }
  .everest-main span { font-size: 9px; }
  .everest-caption { font-size: 7px; }
  h2 { font-size: clamp(9px, 2.5vw, 14px); letter-spacing: .05em; }
  .demo-label { display: none; }
  .chart { height: clamp(62px, 18vw, 115px); gap: 1px; }
  .bar-label { font-size: clamp(7px, 2.15vw, 12px); }
  .bar-value { font-size: clamp(6px, 1.6vw, 8px); }
  .monthly-total { padding-top: 18px; margin-top: 23px; }
  #month-value { font-size: clamp(40px, 12vw, 70px); }
  .month-value .unit { font-size: clamp(21px, 6vw, 36px); }
  .brand { font-size: 19px; }
}

@media (max-height: 900px) and (min-width: 701px) {
  .display-frame { padding: 38px 42px 20px; gap: 16px; border-radius: 64px; }
  .display-inner { padding: 26px 31px 24px; border-radius: 35px; }
  h1 { font-size: 21px; }
  #annual-value { font-size: min(10vw, 12vh); }
  .elevation-page #annual-value { font-size: min(8.5vw, 10vh); }
  .annual-total .unit { font-size: 38px; }
  .wide-label { font-size: 20px; }
  .annual-total { margin-top: 10px; }
  .headline .wide-label { margin-top: 5px; }
  .everest-stat { padding: 4px 12px; }
  .everest-stat svg { width: 20px; height: 20px; }
  .everest-main strong { font-size: 18px; }
  h2 { font-size: 14px; }
  .demo-label { font-size: 11px; }
  .chart { height: 81px; }
  .bar-label { font-size: 12px; }
  .monthly-total { margin-top: 25px; padding-top: 16px; }
  #month-value { font-size: 55px; }
  .month-value .unit { font-size: 30px; }
  .brand { font-size: 28px; padding-bottom: 0; }
}

html:fullscreen .app-shell {
  height: 100dvh;
  min-height: 100dvh;
  grid-template-rows: minmax(0, 1fr);
  padding: clamp(12px, 2vw, 24px);
}
html:fullscreen .toolbar,
html:fullscreen .footer { display: none; }
html:fullscreen .display-frame { width: min(100%, calc((100dvh - 48px) * 1.06)); }
@media (max-width: 700px) {
  html:fullscreen .display-frame { height: min(92dvh, 720px); }
}

@media (prefers-reduced-motion: reduce) {
  .bar { transition: none; }
  .display-frame.page-changing .display-inner { animation: none; }
}
