:root {
  --bg: #fbf7ef;
  --surface: #fffdf8;
  --surface-soft: #f5ede2;
  --text: #2f241f;
  --muted: #6f5d52;
  --line: rgba(92, 72, 58, 0.18);
  --accent: #b95d29;
  --accent-strong: #8f421f;
  --green: #2f855a;
  --yellow: #b7791f;
  --red: #b43c42;
  --orange: #c7652d;
  --shadow: 0 18px 48px rgba(63, 43, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Manrope", system-ui, sans-serif;
  background:
    linear-gradient(180deg, #fffdf8 0%, var(--bg) 42%, #efe4d7 100%);
}

button,
input,
textarea {
  font: inherit;
}

.sna-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(calc(100% - 32px), 1120px);
  margin: 16px auto 0;
  padding: 14px 16px;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(63, 43, 31, 0.08);
  backdrop-filter: blur(14px);
}

.sna-brand {
  color: var(--text);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.sna-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
}

.sna-nav a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
}

.sna-nav a:hover,
.sna-nav a[aria-current="page"] {
  color: var(--accent-strong);
}

.sna-app {
  width: min(calc(100% - 32px), 1120px);
  min-height: calc(100vh - 108px);
  margin: 0 auto;
  padding: 38px 0 56px;
}

.sna-screen {
  display: none;
}

.sna-screen.is-active {
  display: block;
}

.sna-intro,
.sna-panel {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sna-intro {
  display: grid;
  align-content: center;
  min-height: 640px;
  padding: clamp(28px, 6vw, 72px);
}

.sna-panel {
  padding: clamp(24px, 4vw, 42px);
}

.sna-panel--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.44fr);
  gap: 24px;
  align-items: start;
}

.sna-eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  line-height: 1;
}

h1 {
  max-width: 860px;
  font-size: clamp(3.2rem, 8vw, 6.4rem);
}

h2 {
  font-size: clamp(2.4rem, 5vw, 4.4rem);
}

h3 {
  font-size: 2rem;
}

.sna-lede {
  max-width: 760px;
  margin: 24px 0 0;
  color: #4d3b31;
  font-size: clamp(1.12rem, 2.2vw, 1.42rem);
  line-height: 1.72;
}

.sna-note,
.sna-panel__head p,
.sna-panel__copy,
.help-panel p {
  color: var(--muted);
  line-height: 1.78;
}

.sna-note {
  max-width: 780px;
  margin: 22px 0 0;
  padding: 18px 20px;
  background: var(--surface-soft);
  border-left: 4px solid var(--accent);
}

.sna-panel__head {
  max-width: 820px;
  margin-bottom: 28px;
}

.sna-panel__head p {
  margin: 16px 0 0;
  font-size: 1.04rem;
}

.sna-panel__copy {
  margin: 18px 0 0;
  font-size: 1.16rem;
}

.sna-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.sna-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.sna-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(63, 43, 31, 0.12);
}

.sna-button--primary {
  color: #fffdf8;
  background: var(--accent);
}

.sna-button--primary:hover {
  background: var(--accent-strong);
}

.sna-button--secondary,
.sna-button--ghost {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.sna-button--ghost {
  color: var(--muted);
  background: transparent;
}

.sna-form {
  display: grid;
  gap: 24px;
}

.sna-field {
  display: grid;
  gap: 10px;
  color: #4d3b31;
  font-weight: 800;
}

.sna-field input,
.sna-field textarea {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.sna-field textarea {
  min-height: 138px;
  resize: vertical;
}

.sna-field input:focus,
.sna-field textarea:focus,
.story-option:focus-within,
.battery-card:focus-visible,
.sna-button:focus-visible {
  border-color: rgba(185, 93, 41, 0.72);
  box-shadow: 0 0 0 4px rgba(185, 93, 41, 0.14);
}

.sna-fieldset {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.sna-fieldset legend {
  margin-bottom: 12px;
  color: #4d3b31;
  font-weight: 800;
}

.story-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.story-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.battery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.battery-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 12px;
  min-height: 190px;
  padding: 20px;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.battery-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(63, 43, 31, 0.1);
}

.battery-dot {
  grid-row: 1 / span 2;
  width: 18px;
  height: 18px;
  margin-top: 4px;
  border-radius: 50%;
  background: currentColor;
}

.battery-card strong {
  font-size: 1.08rem;
}

.battery-card span:not(.battery-dot) {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.battery-card p {
  grid-column: 2;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.68;
}

.battery-card--green {
  color: var(--green);
}

.battery-card--yellow {
  color: var(--yellow);
}

.battery-card--red {
  color: var(--red);
}

.battery-card--orange {
  color: var(--orange);
}

.help-panel {
  padding: 22px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.help-panel[hidden] {
  display: none;
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.history-chart {
  width: 100%;
  aspect-ratio: 1;
  border: 12px solid #fff;
  border-radius: 50%;
  background: #e9dfd3;
  box-shadow: inset 0 0 0 1px var(--line), 0 14px 34px rgba(63, 43, 31, 0.12);
}

.history-legend {
  display: grid;
  gap: 10px;
}

.legend-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: currentColor;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.history-item {
  display: grid;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-item strong {
  color: var(--text);
}

.history-item span,
.history-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.empty-history {
  padding: 18px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 820px) {
  .sna-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .sna-nav {
    justify-content: flex-start;
  }

  .sna-intro {
    min-height: auto;
  }

  .sna-panel--split,
  .battery-grid,
  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-chart {
    max-width: 320px;
  }
}

@media (max-width: 560px) {
  .sna-header,
  .sna-app {
    width: min(calc(100% - 24px), 1120px);
  }

  .sna-app {
    padding-top: 26px;
  }

  h1 {
    font-size: clamp(3rem, 15vw, 4.4rem);
  }

  h2 {
    font-size: clamp(2.2rem, 12vw, 3.2rem);
  }

  .sna-actions,
  .sna-button {
    width: 100%;
  }

  .battery-card {
    min-height: 0;
  }
}
