:root {
  --bg: #0a0e13;
  --panel: #0f151d;
  --panel-2: #131b25;
  --panel-3: #18222e;
  --border: #1f2b3a;
  --border-bright: #2c3d52;
  --text: #d8e3f0;
  --muted: #7f92a8;
  --faint: #4d5f73;
  --green: #00cc66;
  --green-bright: #3dff9e;
  --green-soft: rgba(0, 204, 102, 0.1);
  --red: #ff6b6b;
  --amber: #ffb454;
  --blue: #6cb6ff;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 12% -12%, rgba(0, 204, 102, 0.09), transparent 62%),
    radial-gradient(760px 460px at 92% -8%, rgba(108, 182, 255, 0.07), transparent 62%);
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

::selection {
  background: rgba(0, 204, 102, 0.28);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #223041;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #2e4258;
  background-clip: padding-box;
}

/* ---------- top bar ---------- */

.topbar {
  position: relative;
  z-index: 2;
  flex: none;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 19, 0.82);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-star {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--green-bright);
  font-size: 17px;
  background: var(--green-soft);
  border: 1px solid rgba(0, 204, 102, 0.28);
  box-shadow: 0 0 24px rgba(0, 204, 102, 0.14);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stats {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stats strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- layout ---------- */

.layout {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
}

.sidebar {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 12px 24px;
  border-right: 1px solid var(--border);
  background: rgba(15, 21, 29, 0.5);
}

.search {
  position: sticky;
  top: -16px;
  z-index: 3;
  padding: 0 4px 12px;
  background: var(--bg);
}

.search input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.search input::placeholder {
  color: var(--faint);
}

.search input:focus {
  border-color: rgba(0, 204, 102, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 204, 102, 0.1);
}

.years {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.year {
  margin-bottom: 10px;
}

.year-head {
  position: sticky;
  top: 44px;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(10, 14, 19, 0.86);
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.year-count {
  font-weight: 500;
  letter-spacing: 0;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.day {
  border-radius: 10px;
  padding: 7px 9px 8px;
  cursor: pointer;
  border: 1px solid transparent;
  scroll-margin-top: 96px;
  transition: background 100ms ease, border-color 100ms ease;
}

.day:hover {
  background: var(--panel-2);
}

.day.active {
  background: var(--green-soft);
  border-color: rgba(0, 204, 102, 0.22);
}

.day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.day-num {
  flex: none;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.day-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}

.day-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.part-chip {
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  transition: all 100ms ease;
}

.part-chip:hover {
  border-color: var(--border-bright);
  color: var(--text);
}

.part-chip.active {
  border-color: rgba(0, 204, 102, 0.55);
  background: rgba(0, 204, 102, 0.14);
  color: var(--green-bright);
}

.part-chip.source-only {
  border-style: dashed;
  opacity: 0.62;
}

.part-chip.source-only.active {
  opacity: 1;
}

.sidebar-note {
  margin: 18px 8px 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--faint);
}

.sidebar-empty {
  padding: 24px 10px;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
}

/* ---------- detail ---------- */

.detail {
  min-height: 0;
  overflow-y: auto;
  padding: 26px 30px 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.detail-head {
  flex: none;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.crumbs .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}

.detail-title {
  margin: 6px 0 12px;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge.lang {
  color: var(--blue);
  border-color: rgba(108, 182, 255, 0.28);
  background: rgba(108, 182, 255, 0.08);
}

.badge.part {
  color: var(--green-bright);
  border-color: rgba(0, 204, 102, 0.28);
  background: rgba(0, 204, 102, 0.08);
}

.badge.source-only {
  color: var(--amber);
  border-color: rgba(255, 180, 84, 0.28);
  background: rgba(255, 180, 84, 0.08);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background 100ms ease, border-color 100ms ease, transform 60ms ease;
}

.btn:hover {
  background: var(--panel-3);
  border-color: var(--border-bright);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--green);
  border-color: var(--green);
  color: #04120a;
}

.btn.primary:hover {
  background: var(--green-bright);
  border-color: var(--green-bright);
}

.btn.danger {
  color: var(--red);
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08);
}

.btn.danger:hover {
  background: rgba(255, 107, 107, 0.14);
  border-color: rgba(255, 107, 107, 0.55);
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ---------- runner ---------- */

.runner {
  flex: 1;
  min-height: 420px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.pane-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 8px 13px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.pane-title {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-area {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  tab-size: 2;
}

.input-area::placeholder {
  color: var(--faint);
}

.input-area.dragover {
  background: rgba(0, 204, 102, 0.06);
  box-shadow: inset 0 0 0 2px rgba(0, 204, 102, 0.35);
}

.input-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 13px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.hint {
  color: var(--faint);
}

.output {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #cfe0f0;
  background:
    linear-gradient(rgba(0, 204, 102, 0.02), transparent 120px),
    transparent;
}

.output .err {
  color: var(--red);
}

.output .sys {
  color: var(--amber);
}

.output .muted {
  color: var(--faint);
}

.run-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.run-bar .spacer {
  flex: 1;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status.running {
  color: var(--amber);
  border-color: rgba(255, 180, 84, 0.3);
}

.status.running::before {
  animation: pulse 900ms ease-in-out infinite;
}

.status.ok {
  color: var(--green);
  border-color: rgba(0, 204, 102, 0.3);
}

.status.error {
  color: var(--red);
  border-color: rgba(255, 107, 107, 0.3);
}

.status.timeout {
  color: var(--amber);
  border-color: rgba(255, 180, 84, 0.3);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

select.timeout {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  outline: none;
  cursor: pointer;
}

select.timeout:focus {
  border-color: var(--border-bright);
}

/* ---------- notices ---------- */

.notice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 20px;
  border: 1px dashed var(--border-bright);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.notice strong {
  color: var(--text);
  font-weight: 650;
}

.notice p {
  margin: 0;
}

.empty {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.empty-inner {
  max-width: 420px;
}

.empty-star {
  display: block;
  margin-bottom: 12px;
  font-size: 34px;
  color: var(--green);
  opacity: 0.7;
}

.empty h2 {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--text);
}

.empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 38vh) minmax(0, 1fr);
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .detail {
    padding: 20px;
  }

  .runner {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 1fr) minmax(220px, 1fr);
    min-height: 560px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 0 14px;
  }

  .brand-sub,
  .stats {
    display: none;
  }

  .detail {
    padding: 16px 14px 20px;
  }

  .detail-title {
    font-size: 22px;
  }

  .runner {
    min-height: 520px;
  }
}
