:root {
  color-scheme: light;
  --bg: #f6f1e9;
  --bg-accent: #e0d7c7;
  --panel: #ffffff;
  --ink: #1c1b1a;
  --muted: #5e5a55;
  --accent: #e76f51;
  --accent-2: #2a9d8f;
  --stroke: #c9c0b4;
  --shadow: 0 14px 30px rgba(38, 34, 30, 0.12);
  --layout-max: 1200px;
  --layout-pad: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #ffffff 0%, var(--bg) 40%, var(--bg-accent) 100%);
  min-height: 100vh;
}

.hero {
  padding: 36px var(--layout-pad) 10px;
}

.hero-inner {
  max-width: var(--layout-max);
  margin: 0 auto;
  background: linear-gradient(120deg, rgba(231, 111, 81, 0.2), rgba(42, 157, 143, 0.1));
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 18px;
  padding: 26px 28px;
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  margin: 0 0 8px;
  color: var(--muted);
}

h1 {
  font-family: "Impact", "Arial Black", sans-serif;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
  font-size: clamp(26px, 4vw, 44px);
}

.lead {
  margin: 0;
  font-size: clamp(14px, 2.4vw, 18px);
  color: var(--muted);
}

.container {
  max-width: calc(var(--layout-max) + (var(--layout-pad) * 2));
  margin: 0 auto;
  padding: var(--layout-pad);
  display: grid;
  gap: 22px;
}

.controls {
  background: var(--panel);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--stroke);
  display: grid;
  gap: 18px;
}

.control-group {
  display: grid;
  gap: 8px;
}

.control-row {
  display: grid;
  gap: 16px;
}

@media (min-width: 900px) {
  .control-row {
    grid-template-columns: 300px 1fr 280px;
    align-items: start;
  }
}

.label {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 13px;
  text-transform: uppercase;
}

.sub-controls {
  display: grid;
  gap: 6px;
}

.controls label {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
}

.controls .label {
  font-weight: 700;
}

.hidden {
  display: none;
}

.segmented {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.segmented input {
  margin-right: 6px;
}

.split-row {
  display: grid;
  gap: 12px;
}

.split-controls {
  flex: 1;
}

@media (min-width: 720px) {
  .split-row {
    grid-template-columns: minmax(130px, 150px) 1.4fr;
    align-items: center;
  }
}

.checkboxes {
  display: grid;
  gap: 14px;
}

.algo-group {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: #f8f1e8;
  border: 1px solid rgba(201, 192, 180, 0.6);
}

.algo-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.algo-group h4 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.algo-group-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.controls .algo-group-label {
  font-weight: 800;
}

.algo-group-label span {
  display: inline-block;
}

.algo-toggle-checkbox {
  margin: 0;
}

.algo-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, max-content));
  gap: 6px 12px;
  padding-left: 18px;
  justify-items: start;
  justify-content: start;
}

.hint {
  margin: 0;
  font-size: 12px;
  color: var(--accent);
}

.seed-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.speed-row {
  display: grid;
  gap: 10px;
}

@media (min-width: 720px) {
  .speed-row {
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: center;
  }
}

@media (min-width: 720px) {
  .speed-row .button-row {
    flex-wrap: nowrap;
  }
}

button {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 14px rgba(231, 111, 81, 0.3);
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--stroke);
  box-shadow: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

input[type="range"] {
  width: 100%;
}

.panels {
  display: grid;
  --panel-columns: auto-fit;
  grid-template-columns: repeat(var(--panel-columns), minmax(260px, 1fr));
  gap: 18px;
}

.algo-notes {
  background: var(--panel);
  border-radius: 18px;
  padding: 20px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.algo-notes h2 {
  margin: 0;
  font-size: 20px;
}

.algo-category {
  display: grid;
  gap: 10px;
}

.algo-category > h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.algo-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

@media (min-width: 1100px) {
  .algo-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.algo-list article {
  padding: 12px;
  border-radius: 12px;
  background: #f8f1e8;
  border: 1px solid rgba(201, 192, 180, 0.6);
  display: grid;
  align-content: start;
  height: 170px;
  overflow: visible;
}

.algo-list h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.algo-list p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.algo-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(201, 192, 180, 0.6);
  color: var(--ink);
  white-space: nowrap;
}

.badge[data-tip] {
  position: relative;
  cursor: help;
}

.badge[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  background: #1c1b1a;
  color: #fff;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 2;
}

.badge[data-tip]:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.panel {
  background: var(--panel);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  animation: fadeUp 0.5s ease;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h3 {
  margin: 0;
  font-size: 18px;
}

.panel-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: #b9b1a6;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.status-dot.status-idle {
  background: #b9b1a6;
}

.status-dot.status-running {
  background: #e76f51;
  box-shadow: 0 0 0 1px rgba(231, 111, 81, 0.35), 0 0 10px rgba(231, 111, 81, 0.6);
}

.status-dot.status-done {
  background: #2a9d8f;
  box-shadow: 0 0 0 1px rgba(42, 157, 143, 0.35), 0 0 10px rgba(42, 157, 143, 0.6);
}

.panel canvas {
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: #f3ede4;
}

.stats {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  grid-template-columns: 1fr;
}

.stats span {
  font-weight: 700;
  color: var(--ink);
}

@media (min-width: 640px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 12px;
  }
}

.stat-item {
  position: relative;
  display: inline-block;
  width: max-content;
  cursor: help;
}

.stat-item::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  background: #1c1b1a;
  color: #fff;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 2;
}

.stat-item:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.site-footer {
  margin-top: 20px;
  padding: 24px var(--layout-pad);
  border-top: 1px solid var(--stroke);
  color: var(--muted);
}

.footer-inner {
  max-width: var(--layout-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 900px) {
  .container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
