:root {
  color-scheme: light;
  --bg: #f2f0e8;
  --paper: #fffef7;
  --ink: #203a33;
  --muted: #70786f;
  --line: #c9c8bd;
  --accent: #c4613d;
  --accent-light: #dfa182;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
}

[hidden] {
  display: none !important;
}

.app {
  width: min(920px, calc(100% - 36px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 11px;
  border-bottom: 2px solid var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.brand-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: var(--ink);
}

.brand-icon svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cooldown-badge {
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 11px;
}

main {
  display: grid;
  grid-template-columns: minmax(250px, 0.72fr) minmax(0, 1.5fr);
  gap: 26px;
}

.report-panel {
  display: flex;
  min-height: 430px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 34px 26px;
  border: 2px solid var(--ink);
  color: #fff;
  background: var(--ink);
  text-align: center;
}

.report-panel h1,
.chart-header h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.report-panel h1 {
  margin: 0 0 30px;
  font-size: 42px;
  letter-spacing: -0.04em;
}

.report-button {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px solid #10241f;
  border-radius: 0;
  color: #17241f;
  background: #e18a61;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}

.report-button svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.report-button:hover:not(:disabled) {
  background: #ee9b72;
}

.report-button:active:not(:disabled) {
  transform: translate(1px, 1px);
}

.report-button:disabled {
  border-color: #53685f;
  color: #aabbb1;
  background: #304a41;
  cursor: not-allowed;
}

.report-button.is-loading svg {
  animation: spin 900ms linear infinite;
}

.status {
  display: flex;
  min-height: 20px;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  color: #c2d0c8;
  font-size: 12px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #90a69a;
}

.status.is-ready .status-dot {
  background: #8bd5a9;
}

.status.is-waiting .status-dot {
  background: #f5ad86;
}

.status.is-error .status-dot {
  background: #ff8e84;
}

.last-report {
  margin: 24px 0 0;
  color: #91a69b;
  font-family: "Courier New", monospace;
  font-size: 11px;
}

.chart-panel {
  min-width: 0;
  padding-left: 26px;
  border-left: 1px solid var(--line);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chart-header h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.range-tabs {
  display: inline-flex;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
}

.range-tabs button {
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.range-tabs button:hover {
  color: var(--ink);
  text-decoration: underline;
}

.range-tabs button.active {
  color: #fff;
  background: var(--ink);
  text-decoration: none;
}

.stats {
  display: flex;
  gap: 48px;
  margin: 30px 0 25px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.stats div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stats span {
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 10px;
  text-transform: uppercase;
}

.stats strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
  line-height: 1;
}

.stats div:last-child strong {
  color: var(--accent);
}

.hour-chart {
  display: grid;
  height: 225px;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
  border-bottom: 1px solid var(--ink);
  background-image: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent calc(25% - 1px),
    rgba(112, 120, 111, 0.16) calc(25% - 1px),
    rgba(112, 120, 111, 0.16) 25%
  );
}

.chart-column {
  display: flex;
  height: 100%;
  min-width: 0;
  flex-direction: column;
  justify-content: flex-end;
}

.bar-value {
  height: 18px;
  color: #8d5b43;
  font-family: "Courier New", monospace;
  font-size: 9px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  opacity: 0;
}

.chart-column.has-reports .bar-value {
  opacity: 1;
}

.bar-track {
  display: flex;
  height: 178px;
  align-items: flex-end;
  justify-content: center;
}

.bar-fill {
  width: 100%;
  min-height: 3px;
  border-radius: 0;
  background: var(--accent-light);
  transition: height 250ms ease, background 150ms ease;
}

.chart-column.is-peak .bar-fill,
.chart-column.has-reports:hover .bar-fill,
.chart-column.has-reports:focus-visible .bar-fill {
  background: var(--accent);
}

.bar-label {
  height: 27px;
  padding-top: 10px;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 9px;
  text-align: center;
}

.chart-empty {
  display: grid;
  height: 100%;
  grid-column: 1 / -1;
  place-items: center;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 11px;
}

.chart-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: calc(100vw - 36px);
  padding: 12px 15px;
  border: 1px solid #10241f;
  border-radius: 0;
  color: #fff;
  background: var(--ink);
  font-size: 12px;
  font-weight: 700;
  animation: toast-in 160ms ease-out;
}

.toast.is-error {
  background: #7d392e;
}

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

@keyframes toast-in {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 720px) {
  .app {
    width: min(100% - 28px, 520px);
    padding-top: 18px;
  }

  main {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .report-panel {
    min-height: 300px;
  }

  .report-panel h1 {
    margin-bottom: 24px;
  }

  .report-button {
    max-width: 340px;
  }

  .chart-panel {
    padding: 22px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .chart-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .range-tabs {
    width: 100%;
  }

  .range-tabs button {
    flex: 1;
  }

  .hour-chart {
    height: 195px;
    gap: 2px;
  }

  .bar-track {
    height: 148px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
