:root {
  --bg: #1a1612;
  --surface: #252019;
  --surface-raised: #2d2620;
  --accent: #d4a574;
  --accent-dim: #8b6f4e;
  --text: #e8e0d5;
  --text-muted: #9a8f80;
  --brew: #c45c3a;
  --steep: #d4a574;
  --cool: #5b8a72;
  --drinkable: #6b9ac4;
  --cold: #7a6f82;
  --radius: 12px;
}

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

body {
  font-family: "Fraunces", Georgia, serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  padding: 1rem;
  padding-bottom: 4rem;
}

.container {
  max-width: 600px;
  margin: 0 auto;
}

header {
  text-align: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--accent-dim);
  margin-bottom: 1.5rem;
}

h1 {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Timer Section */
.timer-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.current-temp-label {
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.timer-display {
  font-family: "JetBrains Mono", monospace;
  font-size: 2.5rem;
  color: var(--accent);
  margin: 0.5rem 0;
}

.timer-display.countdown {
  color: var(--brew);
  font-size: 3rem;
}

.timer-phase {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.75rem;
  min-height: 1.4em;
}

.timer-instruction {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  min-height: 1.2em;
}

.timer-instruction.countdown-instruction {
  color: var(--brew);
  font-weight: 600;
  font-style: normal;
  font-size: 1rem;
}

.timer-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.timer-help-link {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
}

.timer-help-link:hover {
  color: var(--accent);
}

.timer-btn {
  padding: 0.6rem 1.5rem;
  font-family: "Fraunces", serif;
  font-size: 0.85rem;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.timer-btn.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.timer-btn.primary.danger {
  background: var(--brew);
  border-color: var(--brew);
}

.timer-btn.primary.flash {
  background: var(--cool);
  border-color: var(--cool);
}

.timer-btn.secondary {
  background: var(--surface-raised);
  color: var(--text);
}

.timer-btn:hover {
  opacity: 0.85;
}
.timer-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Measurement section */
.measurement-section {
  border: 2px dashed var(--accent-dim);
}

.measurement-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.measurement-buttons .timer-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Sticky toggle */
.sticky-toggle {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1000;
  background: var(--surface-raised);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  color: var(--accent);
  font-family: "Fraunces", serif;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.sticky-toggle:hover {
  background: var(--accent-dim);
}
.sticky-toggle.active {
  background: var(--accent);
  color: var(--bg);
}
.sticky-toggle svg {
  width: 16px;
  height: 16px;
}

/* Overlay chart */
.chart-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--bg);
  border-bottom: 1px solid var(--accent-dim);
  padding: 0.75rem 1rem;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.chart-overlay.visible {
  transform: translateY(0);
}
.chart-overlay .chart-wrapper {
  height: 200px;
  max-width: 600px;
  margin: 0 auto;
}
.chart-overlay .chart-legend {
  max-width: 600px;
  margin: 0.5rem auto 0;
}

body.overlay-active {
  padding-bottom: 320px;
}

/* Chart Container */
.chart-section {
  margin-bottom: 1.5rem;
}

.chart-container {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  position: relative;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 280px;
}

canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.65rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-dot.steep {
  background: var(--steep);
}
.legend-dot.cool {
  background: var(--cool);
}
.legend-dot.drinkable {
  background: var(--drinkable);
}
.legend-dot.cold {
  background: var(--cold);
}
.legend-marker {
  width: 2px;
  height: 10px;
}
.legend-marker.add {
  background: var(--steep);
}
.legend-marker.remove {
  background: var(--brew);
}

/* Markers info */
.markers-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.marker-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.75rem;
  text-align: center;
}

.marker-card-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-card-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.2rem;
  margin-top: 0.25rem;
}

.marker-card-value.add {
  color: var(--steep);
}
.marker-card-value.remove {
  color: var(--brew);
}
.marker-card-value.drinkable {
  color: var(--drinkable);
}
.marker-card-value.done {
  color: var(--cool);
}

/* Time scrubber */
.time-scrubber {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.time-display {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 70px;
}

.time-scrubber input {
  flex: 1;
  -webkit-appearance: none;
  background: var(--surface-raised);
  height: 4px;
  border-radius: 2px;
}

.time-scrubber input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

/* Controls */
.controls-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.control-group {
  margin-bottom: 1rem;
}
.control-group:last-child {
  margin-bottom: 0;
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.control-value {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
  font-size: 0.75rem;
}

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  background: var(--surface-raised);
  height: 6px;
  border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

.select-wrapper {
  position: relative;
}

select {
  width: 100%;
  padding: 0.6rem;
  font-family: "Fraunces", serif;
  font-size: 0.85rem;
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.select-wrapper::after {
  content: "▼";
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-dim);
  font-size: 0.6rem;
  pointer-events: none;
}

/* Equation box inline (in Model tab) */
.equation-box-inline {
  background: var(--surface-raised);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1.5rem;
}

.equation-box-inline .equation-title {
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.equation-box-inline .equation {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: var(--text);
  text-align: center;
  padding: 0.5rem 0;
}

.equation-box-inline .equation span {
  color: var(--accent);
}

.equation-section {
  margin-top: 1rem;
}

.equation-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem 0;
  border-top: 1px solid var(--accent-dim);
}

.equation-section-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.equation-toggle-icon {
  font-size: 0.6rem;
  color: var(--accent-dim);
  transition: transform 0.2s;
}

.equation-toggle-icon.open {
  transform: rotate(180deg);
}

.equation-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.equation-details.open {
  max-height: 300px;
}

.equation-values {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.7;
  padding-top: 0.75rem;
}

.equation-note {
  font-size: 0.7rem;
  color: var(--accent-dim);
  font-style: italic;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--accent-dim);
}

/* Info tabs */
.info-tabs {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}

.tab-buttons {
  display: flex;
  border-bottom: 1px solid var(--accent-dim);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  flex: 1;
  min-width: max-content;
  padding: 0.75rem 0.5rem;
  font-family: "Fraunces", serif;
  font-size: 0.7rem;
  background: none;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  color: var(--accent);
  background: var(--surface-raised);
}

.tab-content {
  display: none;
  padding: 1rem;
}

.tab-content.active {
  display: block;
}

.tab-content h3 {
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.tab-content h4 {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.tab-content p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.tab-content code {
  font-family: "JetBrains Mono", monospace;
  background: var(--surface-raised);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* Steps */
.step {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.step-num {
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-title {
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.step-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Xanthine table */
.xanthine-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  margin: 0.75rem 0;
}

.xanthine-table th,
.xanthine-table td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--accent-dim);
}

.xanthine-table th {
  color: var(--accent);
  font-weight: 600;
}
.xanthine-table td {
  color: var(--text-muted);
}

/* Log section */
.log-section {
  margin-top: 0;
}

.log-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.measurement-log {
  width: 100%;
  min-height: 200px;
  max-height: 400px;
  padding: 1rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  resize: vertical;
}

.measurement-log::placeholder {
  color: var(--accent-dim);
}

.copy-btn {
  margin-top: 0.75rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Signature */
.signature {
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 2rem;
  border-top: 1px solid var(--accent-dim);
}

.signature-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.signature-name {
  font-size: 1.1rem;
  color: var(--accent);
  margin-top: 0.5rem;
  font-style: italic;
}

.logo,
.logo:visited,
.logo:hover,
.logo:active,
.logo:focus,
.logo:focus-visible {
  color: var(--accent);
}

.logo i {
  color: currentColor;
}

/* Dual-handle range slider styles */
.range-slider {
  position: relative;
  height: 6px;
  background: var(--surface-raised);
  border-radius: 3px;
  margin: 10px 0;
}

.range-slider-track {
  position: absolute;
  height: 100%;
  background: var(--drinkable);
  border-radius: 3px;
  opacity: 0.5;
}

.range-slider input[type="range"] {
  position: absolute;
  width: 100%;
  height: 6px;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  margin: 0;
  top: 0;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.range-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
  border: none;
}

.range-values {
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 0.5rem;
}

/* Timer context info */
.timer-context {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

.timer-context-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.timer-context-item i {
  color: var(--accent-dim);
  font-size: 0.7rem;
}

/* Live model params in measurement section */
.live-params {
  background: var(--surface-raised);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-top: 0.75rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.live-params-title {
  font-size: 0.65rem;
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.live-params-row {
  display: flex;
  justify-content: space-between;
}

.live-params-value {
  color: var(--accent);
}

.live-params-insufficient {
  color: var(--accent-dim);
  font-style: italic;
  text-align: center;
  padding: 0.5rem;
}

/* Collapsible log section */
.log-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem 0;
  border-top: 1px solid var(--accent-dim);
  margin-top: 1rem;
}

.log-toggle-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.log-toggle-icon {
  font-size: 0.6rem;
  color: var(--accent-dim);
  transition: transform 0.2s;
}

.log-toggle-icon.open {
  transform: rotate(180deg);
}

.log-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.log-content.open {
  max-height: 500px;
}

.log-inner {
  padding-top: 0.75rem;
}
.signature-name a,
.signature-name a:visited {
  color: var(--accent);
  text-decoration: none;
}

.signature-name a:hover {
  text-decoration: underline;
}

.molecule-block {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.molecule-block p {
  margin: 0;
  flex: 1;
}

.molecule {
  flex-shrink: 0;
  color: var(--text-muted);
}

.molecule {
  width: 160px;
  height: auto;
}
.binomial {
  font-style: italic;
}
