:root {
  --ink: #102033;
  --muted: #52667a;
  --line: #d9e1e8;
  --panel: #ffffff;
  --page: #f5f8fb;
  --blue: #0072b2;
  --teal: #009e73;
  --orange: #d55e00;
  --gold: #e69f00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app {
  width: min(1464px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
}

button {
  border: 1px solid #0b6fae;
  background: #0b7fc4;
  color: white;
  border-radius: 6px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

button.secondary,
button.icon-button {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

.workspace {
  display: grid;
  grid-template-columns: 540px minmax(0, 1fr);
  gap: 24px;
}

.controls,
.results {
  min-width: 0;
}

.control-section,
.results {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.control-section + .control-section {
  margin-top: 16px;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #c7d2dc;
  border-radius: 6px;
  padding: 6px 8px;
  background: white;
  color: var(--ink);
}

input[type="range"] {
  padding: 0;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr 82px;
  align-items: center;
  gap: 12px;
}

.range-row output {
  text-align: right;
  color: var(--ink);
  font-weight: 700;
}

.grind-language {
  color: var(--ink);
  font-weight: 700;
}

.section-heading,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-row {
  margin-bottom: 12px;
}

#status {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

#status[data-state="error"] {
  color: #b00020;
}

.pour-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 38px;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}

.pour-row label {
  margin: 0;
  font-size: 13px;
}

.icon-button {
  min-width: 38px;
  padding: 0;
}

.schedule-total {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 76px;
  background: #fbfdff;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 22px;
}

.cup-summary {
  display: grid;
  justify-items: center;
  margin: 14px 0 10px;
  padding: 0;
}

.beaker-readout {
  display: grid;
  grid-template-columns: 190px 240px;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: 470px;
  padding: 0 14px 4px;
  background: #ffffff;
}

.beaker-cup {
  display: block;
  width: 180px;
  height: 250px;
  flex: 0 0 auto;
}

.v60-paper {
  fill: rgba(255, 255, 255, 0.8);
  stroke: #718393;
  stroke-width: 3;
  stroke-linejoin: round;
}

.v60-rim {
  fill: rgba(255, 255, 255, 0.82);
  stroke: #718393;
  stroke-width: 3;
}

.v60-bed {
  fill: #7a4b26;
}

.v60-ribs {
  fill: none;
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 1.3;
}

.v60-tip {
  fill: rgba(255, 255, 255, 0.75);
  stroke: #718393;
  stroke-width: 2;
  stroke-linejoin: round;
}

.coffee-stream {
  fill: none;
  stroke: #7a4b26;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 18 10;
  transition: opacity 120ms linear;
  animation: coffee-flow 0.65s linear infinite;
}

.beaker-fill {
  fill: url("#beakerCoffee");
  transform: scaleY(0);
  transform-box: fill-box;
  transform-origin: bottom;
  transition: transform 140ms linear;
}

.beaker-glass {
  fill: url("#beakerGlass");
  stroke: #718393;
  stroke-width: 4;
  stroke-linejoin: round;
}

.beaker-handle,
.beaker-graduations {
  fill: none;
  stroke: #718393;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.beaker-graduations {
  stroke-width: 3;
  opacity: 0.75;
}

.beaker-text span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  font-size: 22px;
}

.beaker-text strong {
  display: block;
  margin-top: 8px;
  font-size: 36px;
  line-height: 1;
}

@keyframes coffee-flow {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -28;
  }
}

.diagnostics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.diagnostics span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: white;
  font-size: 13px;
}

.diagnostics span[data-state="ok"] {
  color: #176f43;
  border-color: #a7d8bd;
}

.diagnostics span[data-state="warn"] {
  color: #9a4d00;
  border-color: #e6bd82;
}

.chart-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

canvas {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .beaker-readout {
    grid-template-columns: 1fr;
    justify-items: center;
    width: 100%;
  }

  .beaker-text {
    text-align: center;
  }
}
