.co {
  --co-bg: #f5f0eb;
  --co-bg-dark: #0a0a0c;
  --co-surface: #fff;
  --co-surface-dark: #121214;
  --co-ink: #1c1917;
  --co-ink-dark: #e4e4e7;
  --co-muted: #8a8078;
  --co-muted-dark: #6b7280;
  --co-border: #e5ddd4;
  --co-border-dark: #2a2a35;
  --co-red: #dc2626;
  --co-red-dark: #ef4444;
  --co-orange: #f97316;
  --co-orange-dark: #fb923c;
  --co-black: #000;

  width: 100%;
  box-sizing: border-box;
}

.co-card {
  max-width: 880px;
  margin: 0 auto;
  background: var(--co-surface);
  border: 1px solid var(--co-border);
  border-radius: 1.5rem;
  overflow: hidden;
}

.theme-dark .co-card {
  background: var(--co-surface-dark);
  border-color: var(--co-border-dark);
}

/* ===== Timeline Section ===== */
.co-timeline-section {
  padding: 1.25rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--co-border);
  background: linear-gradient(135deg, var(--co-surface) 0%, color-mix(in srgb, var(--co-orange) 4%, var(--co-surface)) 100%);
}

.theme-dark .co-timeline-section {
  border-bottom-color: var(--co-border-dark);
  background: linear-gradient(135deg, var(--co-surface-dark) 0%, color-mix(in srgb, var(--co-orange-dark) 5%, var(--co-surface-dark)) 100%);
}

.co-timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.co-timeline-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--co-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.theme-dark .co-timeline-title {
  color: var(--co-muted-dark);
}

.co-timeline-phase {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--co-muted);
  background: var(--co-bg);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
}

.theme-dark .co-timeline-phase {
  color: var(--co-muted-dark);
  background: var(--co-surface-dark);
}

.co-timeline-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ===== Body: controls + result side by side ===== */
.co-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

@media (max-width: 700px) {
  .co-body {
    grid-template-columns: 1fr;
  }
}

/* ===== Controls (left) ===== */
.co-controls {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-right: 1px solid var(--co-border);
}

.theme-dark .co-controls {
  border-right-color: var(--co-border-dark);
}

@media (max-width: 700px) {
  .co-controls {
    border-right: none;
    border-bottom: 1px solid var(--co-border);
  }
  .theme-dark .co-controls {
    border-bottom-color: var(--co-border-dark);
  }
}

.co-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.co-control-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--co-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.theme-dark .co-control-label {
  color: var(--co-muted-dark);
}

.co-select {
  background: var(--co-bg);
  border: 1px solid var(--co-border);
  border-radius: 10px;
  color: var(--co-ink);
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a8078' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.2rem;
  transition: border-color 0.2s ease;
}

.theme-dark .co-select {
  background: var(--co-surface-dark);
  border-color: var(--co-border-dark);
  color: var(--co-ink-dark);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.5'/%3E%3C/svg%3E");
}

.co-select:focus {
  border-color: var(--co-orange);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--co-orange) 25%, transparent);
}

.co-slider-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.co-range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 4px;
  background: var(--co-border);
  outline: none;
  cursor: pointer;
  min-width: 0;
}

.theme-dark .co-range {
  background: var(--co-border-dark);
}

.co-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--co-orange), #ea580c);
  border: 3px solid var(--co-surface);
  box-shadow: 0 2px 6px rgba(249,115,22,0.35);
  transition: transform 0.15s ease;
  cursor: pointer;
}

.theme-dark .co-range::-webkit-slider-thumb {
  border-color: var(--co-surface-dark);
}

.co-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.co-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--co-orange), #ea580c);
  border: 3px solid var(--co-surface);
  box-shadow: 0 2px 6px rgba(249,115,22,0.35);
  cursor: pointer;
}

.theme-dark .co-range::-moz-range-thumb {
  border-color: var(--co-surface-dark);
}

.co-range-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--co-ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 4.5rem;
  text-align: right;
}

.theme-dark .co-range-value {
  color: var(--co-ink-dark);
}

.co-range-unit {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--co-muted);
}

/* ===== Unit Toggle ===== */
.co-unit-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--co-border);
  border-radius: 8px;
  overflow: hidden;
}

.theme-dark .co-unit-toggle {
  border-color: var(--co-border-dark);
}

.co-unit-btn {
  flex: 1;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--co-muted);
  transition: all 0.2s ease;
  letter-spacing: 0.04em;
}

.theme-dark .co-unit-btn {
  color: var(--co-muted-dark);
}

.co-unit-btn.active {
  background: var(--co-orange);
  color: var(--co-surface);
}

.theme-dark .co-unit-btn.active {
  background: var(--co-orange-dark);
  color: var(--co-black);
}

.co-unit-btn:first-child {
  border-right: 1px solid var(--co-border);
}

.theme-dark .co-unit-btn:first-child {
  border-right-color: var(--co-border-dark);
}

/* ===== Result Panel (right) ===== */
.co-result {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  background: radial-gradient(ellipse at 50% 25%, color-mix(in srgb, var(--co-orange) 6%, transparent) 0%, transparent 70%);
}

/* ===== Gauge ===== */
.co-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.co-gauge-svg {
  width: 170px;
  height: 150px;
}

.co-gauge-track {
  fill: none;
  stroke: var(--co-border);
  stroke-width: 8;
}

.theme-dark .co-gauge-track {
  stroke: var(--co-border-dark);
}

.co-gauge-arc {
  fill: none;
  stroke: var(--co-orange);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
}

.theme-dark .co-gauge-arc {
  stroke: var(--co-orange-dark);
}

.co-gauge-center {
  font-size: 2rem;
  font-weight: 900;
  fill: var(--co-ink);
  font-variant-numeric: tabular-nums;
}

.theme-dark .co-gauge-center {
  fill: var(--co-ink-dark);
}

.co-gauge-unit {
  font-size: 0.85rem;
  font-weight: 600;
  fill: var(--co-orange);
}

.theme-dark .co-gauge-unit {
  fill: var(--co-orange-dark);
}

.co-gauge-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--co-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.theme-dark .co-gauge-label {
  color: var(--co-muted-dark);
}

.co-gauge-target-line {
  stroke: var(--co-ink);
  stroke-width: 2;
  stroke-dasharray: 3 3;
  transition: transform 0.3s ease;
  opacity: 0.5;
}

.theme-dark .co-gauge-target-line {
  stroke: var(--co-ink-dark);
}

/* ===== Stats Row ===== */
.co-stats-row {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  justify-content: center;
}

.co-stat-card {
  flex: 1;
  max-width: 130px;
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-radius: 1rem;
  background: var(--co-bg);
  border: 1px solid var(--co-border);
}

.theme-dark .co-stat-card {
  background: var(--co-surface-dark);
  border-color: var(--co-border-dark);
}

.co-stat-label {
  display: block;
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--co-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}

.theme-dark .co-stat-label {
  color: var(--co-muted-dark);
}

.co-stat-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--co-ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.theme-dark .co-stat-number {
  color: var(--co-ink-dark);
}

.co-stat-unit {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--co-muted);
}

.theme-dark .co-stat-unit {
  color: var(--co-muted-dark);
}

.co-stat-badge {
  display: inline-block;
  background: color-mix(in srgb, var(--co-orange) 15%, transparent);
  padding: 0.1rem 0.5rem 0.1rem 0.4rem;
  border-radius: 100px;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--co-orange);
  line-height: 1.3;
}

.theme-dark .co-stat-badge {
  background: color-mix(in srgb, var(--co-orange-dark) 15%, transparent);
  color: var(--co-orange-dark);
}

.co-stat-badge .co-stat-unit {
  font-size: 0.65rem;
  color: inherit;
  opacity: 0.7;
}

/* ===== Error ===== */
.co-error {
  padding: 0.75rem 1.5rem;
}

.co-error-text {
  font-size: 0.8rem;
  color: var(--co-red);
  line-height: 1.5;
  margin: 0;
  padding: 0.75rem 1rem;
  background: rgba(220,38,38,0.06);
  border: 1px solid rgba(220,38,38,0.12);
  border-radius: 0.75rem;
}

.theme-dark .co-error-text {
  color: var(--co-red-dark);
  background: rgba(239,68,68,0.06);
  border-color: rgba(239,68,68,0.12);
}

/* ===== Footer ===== */
.co-footer {
  padding: 0 1.5rem 1.25rem;
}

.co-footer-text {
  font-size: 0.75rem;
  color: var(--co-muted);
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--co-bg);
  border: 1px solid var(--co-border);
  border-radius: 0.75rem;
  line-height: 1.6;
}

.theme-dark .co-footer-text {
  color: var(--co-muted-dark);
  background: var(--co-surface-dark);
  border-color: var(--co-border-dark);
}
