:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --border: #2d3f56;
  --border-on-surface: #2d3f56;
  --border-on-surface-2: #334155;
  --text: #e8edf4;
  --text-muted: #8fa3bc;
  --text-on-surface: #e8edf4;
  --text-muted-on-surface: #8fa3bc;
  --text-on-surface-2: #e8edf4;
  --text-muted-on-surface-2: #94a3b8;
  --text-on-accent: #ffffff;
  --accent: #e63946;
  --accent-light: #ff6b6b;
  --accent-dark: #b91c2c;
  --accent-on-surface-2: #ff6b6b;
  --success: #2dd4a8;
  --success-on-surface-2: #2dd4a8;
  --danger-on-surface: #f87171;
  --note-on-surface-2: #4ade80;
  --gold: #f4c430;
  --gold-on-surface: #f4c430;
  --tube-bg: #1e2d42;
  --note-bg: #1e3a2f;
  --note-bg-hover: #234535;
  --note-border: #3d6b52;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  transition: background 0.3s ease, color 0.3s ease;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.nav-link {
  color: var(--text-muted-on-surface);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border-on-surface);
  background: var(--surface);
  transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover {
  color: var(--text-on-surface);
  border-color: var(--accent);
}

.nav-settings {
  margin-left: auto;
}

.btn-save-top {
  flex-shrink: 0;
  padding: 0.5rem 1.15rem;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  min-width: 5.5rem;
  transition: background 0.25s ease, opacity 0.15s, transform 0.15s;
}

.btn-save-top.is-saving {
  pointer-events: none;
  opacity: 0.9;
}

.btn-save-top.is-saving::before {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.45em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
  vertical-align: -0.1em;
}

.btn-save-top.is-saved {
  background: var(--success);
  color: var(--text-on-accent);
  pointer-events: none;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.app-footer {
  margin-top: 2.5rem;
  padding: 1rem 0 0.25rem;
  text-align: center;
}

.company-mark {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.55;
  margin: 0;
  letter-spacing: 0.03em;
}

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: stretch;
  min-height: 0;
}

@media (max-width: 860px) {
  main {
    grid-template-columns: 1fr;
  }
}

.thermometer-panel,
.controls-panel {
  background: var(--surface);
  border: 1px solid var(--border-on-surface);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  color: var(--text-on-surface);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.thermometer-panel,
.controls-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}


.thermometer-panel {
  align-items: center;
  gap: 1.5rem;
}

.thermometer {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 360px;
}

.thermometer-chart {
  display: flex;
  justify-content: center;
  width: 100%;
  padding-right: 92px;
  box-sizing: content-box;
}

.thermometer-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-height: 580px;
}

.thermometer-visual-stack {
  position: relative;
  display: inline-block;
  line-height: 0;
  overflow: visible;
}

.thermometer-visual-stack > svg {
  display: block;
}

.scale-labels {
  position: absolute;
  left: calc(100% + 0.35rem);
  top: 0;
  width: 88px;
  pointer-events: none;
  box-sizing: border-box;
}

.scale-label {
  position: absolute;
  right: 0;
  transform: translateY(50%);
  font-size: 0.7rem;
  line-height: 1.15;
  color: var(--text-muted-on-surface);
  white-space: nowrap;
}

.scale-label[hidden] {
  display: none;
}

.scale-label.anchor {
  font-weight: 600;
  color: var(--text-on-surface);
}

.scale-label.major {
  font-weight: 600;
  color: var(--text-on-surface);
  font-size: 0.8rem;
}

.scale-label.current {
  color: var(--accent-light);
  font-weight: 700;
  font-size: 0.82rem;
}

.scale-label::before {
  content: "";
  position: absolute;
  right: calc(100% + 0.35rem);
  top: 50%;
  width: 6px;
  height: 1px;
  background: var(--border);
  transform: translateY(-50%);
}

.scale-label.major::before {
  width: 11px;
  background: var(--text-muted-on-surface);
}

.thermometer--figure .scale-label::before {
  width: calc(0.35rem + 7px);
}

.thermometer--figure .scale-label.major::before {
  width: calc(0.35rem + 15px);
}

.scale-label.current::before {
  width: calc(0.35rem + 18px);
  height: 2px;
  background: var(--accent-light);
  box-shadow: 0 0 6px color-mix(in srgb, var(--accent-light) 65%, transparent);
}

.classic-svg {
  width: 148px;
  height: 520px;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.2));
}

.figure-svg {
  display: block;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.18));
}

.thermometer--classic .thermometer-visual {
  min-height: 520px;
}

.thermometer--figure .thermometer-visual {
  min-height: 460px;
}

.thermometer--figure .figure-svg {
  width: auto;
  height: 460px;
  max-width: min(280px, 58vw);
}

.classic-tube-outline,
.classic-bulb-outline {
  fill: var(--tube-bg);
  stroke: var(--border-on-surface);
  stroke-width: 2.5;
}

.thermometer-fill-rect,
.classic-fill-rect {
  transition: y 0.6s cubic-bezier(0.34, 1.2, 0.64, 1), height 0.6s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.fill-level-marker {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--accent-light);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 10px color-mix(in srgb, var(--accent-light) 75%, transparent);
  pointer-events: none;
  z-index: 2;
  transform: translateY(50%);
  transition: bottom 0.6s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.thermometer-panel.donation-pulse .thermometer-fill-rect,
.thermometer-panel.donation-pulse .classic-fill-rect {
  filter: brightness(1.2);
}

.thermometer-panel.donation-pulse .fill-level-marker {
  animation: fill-marker-pulse 0.7s ease;
}

@keyframes fill-marker-pulse {
  0%,
  100% {
    transform: translateY(50%) scaleX(1);
    opacity: 1;
  }

  40% {
    transform: translateY(50%) scaleX(1.08);
    opacity: 1;
  }
}

.classic-fill-stop-dark {
  stop-color: var(--accent-dark);
}

.classic-fill-stop-mid {
  stop-color: var(--accent);
}

.classic-fill-stop-light {
  stop-color: var(--accent-light);
}

.thermometer-panel.goal-reached .classic-fill-stop-dark {
  stop-color: var(--accent-goal-dark);
}

.thermometer-panel.goal-reached .classic-fill-stop-mid {
  stop-color: var(--gold);
}

.thermometer-panel.goal-reached .classic-fill-stop-light {
  stop-color: var(--accent-goal-light);
}

.figure-head-outline,
.figure-part-outline {
  fill: var(--tube-bg);
  stroke: var(--border-on-surface);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.shape-mode-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.shape-mode-option {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem;
  border: 2px solid var(--border-on-surface-2);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-on-surface-2);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
}

.shape-mode-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  background: var(--surface);
  color: var(--text-on-surface);
}

.shape-mode-option input {
  accent-color: var(--accent);
}

.shape-mode-preview {
  width: 22px;
  height: 44px;
  flex-shrink: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.shape-mode-preview-classic {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 400'%3E%3Crect x='21' y='18' width='38' height='318' rx='19' fill='%23cbd5e1' stroke='%23475569' stroke-width='3'/%3E%3Ccircle cx='40' cy='346' r='36' fill='%23cbd5e1' stroke='%23475569' stroke-width='3'/%3E%3C/svg%3E");
}

.shape-mode-preview-figure {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 0 88 400'%3E%3Ccircle cx='40' cy='32' r='28' fill='%23cbd5e1' stroke='%23475569' stroke-width='3'/%3E%3Cpath d='M24 80 A10 10 0 0 1 34 70 L46 70 A10 10 0 0 1 56 80 L56 200 L24 200 Z' fill='%23cbd5e1' stroke='%23475569' stroke-width='3'/%3E%3Crect x='1' y='74' width='18' height='98' rx='9' fill='%23cbd5e1' stroke='%23475569' stroke-width='3'/%3E%3Crect x='61' y='74' width='18' height='98' rx='9' fill='%23cbd5e1' stroke='%23475569' stroke-width='3'/%3E%3Crect x='20' y='200' width='16' height='108' rx='8' fill='%23cbd5e1' stroke='%23475569' stroke-width='3'/%3E%3Crect x='44' y='200' width='16' height='108' rx='8' fill='%23cbd5e1' stroke='%23475569' stroke-width='3'/%3E%3C/svg%3E");
}

.figure-shape-panel {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-on-surface-2);
  border-radius: 12px;
  background: var(--surface-2);
}

.figure-shape-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.figure-settings-preview-wrap {
  display: flex;
  justify-content: center;
  padding: 0.75rem;
  margin: 0.85rem 0 1rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-on-surface-2);
}

.figure-settings-preview {
  width: 120px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.figure-settings-preview .figure-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
}

.figure-sliders {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.figure-slider-group {
  display: grid;
  gap: 0.7rem;
}

.figure-slider-group-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted-on-surface-2);
}

.figure-slider {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.figure-slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  color: var(--text-on-surface-2);
}

.figure-slider-value {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted-on-surface-2);
  font-size: 0.8rem;
}

.figure-slider input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.field-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted-on-surface);
  margin-bottom: 0.4rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
}

.stat-card {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 0.85rem;
  text-align: center;
  border: 1px solid var(--border-on-surface-2);
  color: var(--text-on-surface-2);
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted-on-surface-2);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-on-surface-2);
}

.stat-card.raised .stat-value {
  color: var(--accent-on-surface-2);
}

.stat-card.progress .stat-value {
  color: var(--success-on-surface-2);
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-on-surface-2);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent-light));
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.controls-panel h2,
.controls-panel > .hint,
.controls-panel > .denomination-group,
.controls-panel > .custom-amount,
.controls-panel > .donor-fields,
.controls-panel > .actions {
  flex-shrink: 0;
}

.controls-panel h2 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.hint {
  color: var(--text-muted-on-surface);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.denomination-group {
  margin-bottom: 1.25rem;
}

.denomination-group h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-on-surface);
  margin-bottom: 0.6rem;
}

.denominations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.denom-btn {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 2px solid var(--border-on-surface-2);
  background: var(--surface-2);
  color: var(--text-on-surface-2);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s, color 0.15s;
  font-variant-numeric: tabular-nums;
}

.denom-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: rgba(230, 57, 70, 0.12);
}

.denom-btn:active {
  transform: translateY(0);
}

.denom-btn.coin {
  border-color: var(--border-on-surface-2);
}

.denom-btn.note {
  background: var(--note-bg);
  border-color: var(--note-border);
  color: var(--note-on-surface-2);
}

.denom-btn.note:hover {
  border-color: var(--success-on-surface-2);
  background: var(--note-bg-hover);
}

.donor-fields {
  margin-bottom: 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-on-surface-2);
  background: var(--surface-2);
}

.donor-fields[hidden] {
  display: none;
}

.donor-fields .field-label {
  display: block;
  margin-bottom: 0.75rem;
}

.donor-field {
  margin-bottom: 0.75rem;
}

.donor-field:last-child {
  margin-bottom: 0;
}

.donor-field label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted-on-surface-2);
  margin-bottom: 0.35rem;
}

.donor-field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 2px solid var(--border-on-surface);
  background: var(--surface);
  color: var(--text-on-surface);
  font-size: 0.95rem;
  font-family: inherit;
}

.donor-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.custom-amount {
  margin-bottom: 1.25rem;
}

.custom-amount label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted-on-surface);
  margin-bottom: 0.4rem;
}

.custom-row {
  display: flex;
  gap: 0.5rem;
}

.custom-row input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 2px solid var(--border-on-surface-2);
  background: var(--surface-2);
  color: var(--text-on-surface-2);
  font-size: 1rem;
  font-family: inherit;
}

.custom-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-add {
  background: var(--accent);
  color: var(--text-on-accent);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-on-surface-2);
  border: 2px solid var(--border-on-surface-2);
}

.btn-danger {
  background: transparent;
  color: var(--danger-on-surface);
  border: 2px solid var(--danger-on-surface);
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.controls-panel .history {
  flex-shrink: 0;
  margin-top: 0.25rem;
}

.history h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-on-surface);
  margin-bottom: 0.6rem;
}

#historyList {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-right: 0.2rem;
}

#historyList.is-scrollable {
  max-height: 16.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 0.35rem;
}

#historyList.is-scrollable::-webkit-scrollbar {
  width: 8px;
}

#historyList.is-scrollable::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--border-on-surface) 70%, var(--text-muted-on-surface));
  border-radius: 4px;
}

#historyList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 0.88rem;
  border: 1px solid transparent;
  color: var(--text-on-surface-2);
  flex-shrink: 0;
}

.history-entry-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.history-amount {
  font-weight: 600;
}

.history-donor {
  font-size: 0.78rem;
  color: var(--text-muted-on-surface-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#historyList li.empty {
  background: transparent;
  color: var(--text-muted-on-surface);
  font-style: italic;
  justify-content: center;
}

#historyList .time {
  color: var(--text-muted-on-surface-2);
  font-size: 0.75rem;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 2.5rem));
  opacity: 0;
  visibility: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border-on-surface-2);
  color: var(--text-on-surface-2);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  transition:
    transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1),
    opacity 0.25s ease,
    visibility 0.25s ease;
  z-index: 100;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

.toast.success {
  border-color: var(--success);
}

.toast.warning {
  border-color: var(--gold);
}

.thermometer-panel.goal-reached .progress-bar-fill {
  background: linear-gradient(180deg, var(--accent-goal-light), var(--gold), var(--accent-goal-dark));
}

.thermometer-panel.celebration-active {
  animation: celebration-panel-glow 1.2s ease-in-out infinite alternate;
}

@keyframes celebration-panel-glow {
  from {
    box-shadow: var(--shadow), 0 0 0 0 color-mix(in srgb, var(--gold) 0%, transparent);
  }

  to {
    box-shadow: var(--shadow), 0 0 28px 4px color-mix(in srgb, var(--gold) 45%, transparent);
  }
}

.celebration-layer {
  position: fixed;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  overflow: hidden;
}

.celebration-banner {
  position: fixed;
  top: 18%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.1rem 1.6rem;
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 2px solid var(--gold);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%) scale(0.88);
  animation: celebration-banner-in 0.65s cubic-bezier(0.34, 1.35, 0.64, 1) forwards;
}

.celebration-banner-emoji {
  font-size: 2rem;
  line-height: 1;
}

.celebration-banner-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-on-surface);
}

.celebration-banner-amount {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold-on-surface, var(--gold));
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  opacity: 0.95;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes celebration-banner-in {
  to {
    transform: translateX(-50%) scale(1);
  }
}

@keyframes confetti-fall {
  to {
    transform: translate3d(var(--confetti-drift, 0px), 110vh, 0) rotate(var(--confetti-spin, 360deg));
    opacity: 0.2;
  }
}

.form-field-toggle {
  margin-top: 0.25rem;
}

.toggle-field-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.toggle-field-text {
  flex: 1;
  min-width: 0;
}

.toggle-field-title {
  display: block;
  font-weight: 600;
  color: var(--text-on-surface-2);
  margin-bottom: 0.25rem;
}

.form-field-toggle .toggle-field-text .field-hint {
  margin-top: 0;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
  margin-top: 0.1rem;
}

.toggle-switch input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  color: var(--text-on-surface-2);
  cursor: pointer;
}

.toggle-label input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .thermometer-panel.celebration-active {
    animation: none;
  }

  .celebration-banner {
    animation: none;
    transform: translateX(-50%) scale(1);
  }
}



.settings-info {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.settings-info > h2,
.settings-info .info-grid,
.settings-info .settings-note {
  flex-shrink: 0;
}

.settings-reports-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-on-surface);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.settings-reports-section h2,
.settings-reports-section .hint,
.report-actions {
  flex-shrink: 0;
}

.settings-reports-section h2 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.report-actions {
  margin-bottom: 1rem;
}

.event-reports-list-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.event-reports-list-wrap.has-entries {
  flex: 1 1 0;
}

.event-reports-title {
  font-size: 0.95rem;
  margin-bottom: 0.65rem;
  color: var(--text-on-surface);
  flex-shrink: 0;
}

.event-reports-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 0 0 auto;
  min-height: 0;
  padding-right: 0.2rem;
}

.event-reports-list.is-scrollable {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 0.35rem;
}

@media (max-width: 1280px) {
  .event-reports-list.is-scrollable {
    flex: 0 0 auto;
    max-height: 20rem;
  }
}

.event-reports-list.is-scrollable::-webkit-scrollbar {
  width: 8px;
}

.event-reports-list.is-scrollable::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--border-on-surface) 70%, var(--text-muted-on-surface));
  border-radius: 4px;
}

.event-reports-list .empty {
  color: var(--text-muted-on-surface);
  font-size: 0.9rem;
}

.event-report-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border-on-surface);
  border-radius: 10px;
  background: var(--surface-2);
}

.event-report-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.event-report-title {
  font-weight: 600;
  color: var(--text-on-surface);
  line-height: 1.3;
}

.event-report-detail {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.82rem;
  color: var(--text-muted-on-surface);
  line-height: 1.4;
}

.event-report-line {
  display: block;
  word-break: break-word;
}

.event-report-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  flex-shrink: 0;
}

body:has(.settings-main) .app {
  max-width: 1920px;
}

.settings-main {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.72fr) minmax(0, 1.65fr);
  gap: 1.5rem;
  width: 100%;
  align-items: stretch;
}

.settings-panel {
  background: var(--surface);
  border: 1px solid var(--border-on-surface);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  color: var(--text-on-surface);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.settings-colors .color-scheme-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.settings-colors .color-scheme-layout {
  flex: 1;
}

.settings-colors .color-actions {
  flex-shrink: 0;
  margin-top: 1.25rem;
}

.settings-panel-general .settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1.5rem;
  row-gap: 1.25rem;
}

.settings-panel-general .preset-goals,
.settings-panel-general .settings-form-toggles,
.settings-panel-general .shape-field,
.settings-panel-general .figure-shape-panel {
  grid-column: 1 / -1;
}

.settings-panel-general .settings-form-toggles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.settings-panel-general .figure-shape-panel {
  display: grid;
  grid-template-columns: minmax(130px, 160px) minmax(0, 1fr);
  gap: 0.75rem 1.25rem;
  align-items: start;
  margin-top: 0;
}

.settings-panel-general .figure-shape-title,
.settings-panel-general .figure-shape-panel > .field-hint,
.settings-panel-general #resetFigureShapeBtn {
  grid-column: 1 / -1;
}

.settings-panel-general .figure-settings-preview-wrap {
  margin: 0;
  align-self: stretch;
}

.settings-panel-general .figure-sliders {
  margin-bottom: 0;
}

.settings-panel-general .figure-slider-group {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-colors .color-scheme-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}

.settings-colors .color-scheme-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 1.25rem;
  align-items: start;
  min-width: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-on-surface);
}

.settings-colors .current-colors-card,
.settings-colors .theme-preview {
  width: 100%;
  min-width: 0;
}

.settings-colors .theme-preview {
  justify-self: end;
}

.settings-colors .preview-backdrop {
  width: 100%;
  max-width: 280px;
  box-sizing: border-box;
}

.settings-colors .color-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

@media (max-width: 1280px) {
  .settings-main {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  }

  .settings-colors {
    grid-column: 1 / -1;
  }

  .settings-panel-general .settings-form-toggles {
    grid-template-columns: 1fr;
  }

  .settings-panel-general .figure-slider-group {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body:has(.settings-main) .app {
    max-width: 1100px;
  }

  .settings-main {
    grid-template-columns: 1fr;
  }

  .settings-colors {
    grid-column: auto;
  }

  .settings-panel-general .settings-form {
    grid-template-columns: 1fr;
  }

  .settings-panel-general .figure-shape-panel {
    grid-template-columns: 1fr;
  }

  .settings-colors .color-scheme-side {
    grid-template-columns: 1fr;
  }

  .settings-colors .theme-preview {
    justify-self: stretch;
  }

  .settings-colors .color-targets {
    grid-template-columns: 1fr;
  }
}

.settings-panel h2 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.form-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted-on-surface);
  margin-bottom: 0.4rem;
}

.form-field input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 2px solid var(--border-on-surface-2);
  background: var(--surface-2);
  color: var(--text-on-surface-2);
  font-size: 1.1rem;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.form-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted-on-surface);
}

.preset-goals {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preset-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-on-surface);
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-btn {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
}


.info-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.info-card {
  background: var(--surface-2);
  border: 1px solid var(--border-on-surface-2);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-on-surface-2);
}

.info-label {
  font-size: 0.85rem;
  color: var(--text-muted-on-surface-2);
}

.info-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-on-surface-2);
}

.info-value.raised {
  color: var(--accent-on-surface-2);
}

.settings-note {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--gold-on-surface, var(--gold));
  padding: 0.65rem 0.85rem;
  background: rgba(244, 196, 48, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(244, 196, 48, 0.25);
}

.color-scheme-form {
  margin-top: 0.75rem;
}

.color-scheme-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 860px) {
  .color-scheme-layout {
    grid-template-columns: 1fr;
  }
}

.picker-step-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted-on-surface-2);
  margin-bottom: 0.5rem;
}

.slides-picker {
  --picker-bg: #ffffff;
  --picker-border: #dadce0;
  --picker-text: #3c4043;
  --picker-muted: #5f6368;
  --picker-accent: #fbbc04;
  background: var(--picker-bg);
  color: var(--picker-text);
  border: 1px solid var(--picker-border);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
  box-shadow: 0 4px 16px rgba(60, 64, 67, 0.15);
}

.picker-tabs {
  display: flex;
  gap: 1.25rem;
  border-bottom: 1px solid var(--picker-border);
  margin: -0.15rem -0.25rem 0.85rem;
  padding: 0 0.25rem;
}

.picker-tab {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--picker-muted);
  padding: 0.45rem 0.15rem 0.55rem;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.picker-tab.active {
  color: var(--picker-text);
  font-weight: 700;
  border-bottom-color: var(--picker-accent);
}

.picker-section {
  margin-bottom: 0.65rem;
}

.picker-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.picker-section-header span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--picker-muted);
}

.picker-tools {
  display: flex;
  gap: 0.25rem;
}

.picker-tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--picker-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.picker-tool-btn:hover:not(:disabled) {
  background: #f1f3f4;
  color: var(--picker-text);
}

.picker-tool-btn.active {
  background: #fef7e0;
  color: #e37400;
}

.picker-tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.color-targets {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.color-target {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 2px solid var(--picker-border);
  border-radius: 10px;
  background: #f8f9fa;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.color-target:hover {
  border-color: #bdc1c6;
  background: #fff;
}

.color-target.active {
  border-color: var(--picker-accent);
  background: #fff;
  box-shadow: 0 0 0 1px var(--picker-accent);
}

.color-target-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.color-target-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.color-target-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--picker-text);
}

.color-target-hex {
  font-size: 0.72rem;
  font-family: ui-monospace, "SF Mono", monospace;
  color: var(--picker-muted);
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.theme-preset-row {
  margin-bottom: 0.35rem;
}

.swatch-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  flex-shrink: 0;
}

.theme-preset-swatch {
  width: 26px;
  height: 26px;
}

.swatch-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.swatch-btn.selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--picker-accent);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(10, 22px);
  gap: 6px;
  justify-content: start;
  padding-top: 0.25rem;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 0.15rem;
}

.fine-tune-panel {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--picker-border);
}

.fine-tune-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--picker-muted);
  margin-bottom: 0.6rem;
}

.fine-tune-preview {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.fine-tune-preview input[type="color"] {
  width: 64px;
  height: 64px;
  padding: 2px;
  border: 2px solid var(--picker-border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.fine-tune-preview input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}

.fine-tune-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.fine-tune-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fine-tune-field span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--picker-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fine-tune-field input[type="text"] {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--picker-border);
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.88rem;
  color: var(--picker-text);
}

.fine-tune-field input[type="text"]:focus {
  outline: none;
  border-color: var(--picker-accent);
  box-shadow: 0 0 0 2px rgba(251, 188, 4, 0.25);
}

.fine-tune-field input[type="range"] {
  width: 100%;
  accent-color: var(--picker-accent);
}

.color-scheme-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.current-colors-card {
  background: var(--surface-2);
  border: 1px solid var(--border-on-surface-2);
  border-radius: 12px;
  padding: 1rem;
  color: var(--text-on-surface-2);
}

.current-color-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.current-color-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 2px solid var(--border-on-surface);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s;
  color: var(--text-on-surface);
}

.current-color-item:hover,
.current-color-item.active {
  border-color: var(--accent);
}

.current-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.current-color-meta {
  display: flex;
  flex-direction: column;
}

.current-color-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-on-surface);
}

.current-color-hex {
  font-size: 0.72rem;
  font-family: ui-monospace, "SF Mono", monospace;
  color: var(--text-muted-on-surface);
}

.theme-preview {
  --preview-bg: #0f1419;
  --preview-surface: #1a2332;
  --preview-surface-2: #243044;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.preview-backdrop {
  width: 100%;
  max-width: 320px;
  padding: 1rem;
  border-radius: 12px;
  background: var(--preview-bg);
  border: 1px solid var(--border);
}

.preview-panel {
  background: var(--preview-surface);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  justify-content: center;
  min-height: 100px;
}

.preview-stat {
  width: 36px;
  height: 28px;
  border-radius: 6px;
  background: var(--preview-surface-2);
}

.preview-tube {
  width: 22px;
  height: 72px;
  border-radius: 11px;
  background: var(--preview-surface-2);
  position: relative;
  overflow: hidden;
  border: 2px solid var(--border);
}

.preview-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: linear-gradient(
    180deg,
    var(--preview-thermometer-light, var(--accent-light)),
    var(--preview-thermometer-dark, var(--accent-dark))
  );
  border-radius: 0 0 8px 8px;
}

.preview-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-on-surface);
}

.color-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
