:root {
  --bg: #f3ede1;
  --panel: rgba(255, 252, 246, 0.86);
  --panel-strong: #fffaf0;
  --line: rgba(61, 38, 19, 0.12);
  --ink: #1d1a17;
  --muted: #685e56;
  --accent: #bd4f19;
  --accent-deep: #7d2d10;
  --teal: #0f6a67;
  --gold: #cf9d2d;
  --shadow: 0 24px 60px rgba(85, 48, 19, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 205, 124, 0.35), transparent 28%),
    linear-gradient(180deg, #f7f1e6 0%, #f0e5d5 52%, #ece4d6 100%);
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
  position: relative;
  overflow-x: hidden;
}

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

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(22px);
  pointer-events: none;
  opacity: 0.55;
}

.bg-orb-a {
  width: 320px;
  height: 320px;
  background: rgba(214, 110, 49, 0.2);
  top: -60px;
  right: -80px;
}

.bg-orb-b {
  width: 260px;
  height: 260px;
  background: rgba(15, 106, 103, 0.18);
  bottom: 8%;
  left: -90px;
}

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 700;
}

.hero h1,
.panel h2,
.detail-section h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 5rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.hero-text {
  max-width: 58ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  scroll-snap-type: x proximity;
}

.metric-card,
.panel,
.score-card {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.metric-card {
  border-radius: 22px;
  padding: 16px;
  min-height: 106px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  scroll-snap-align: start;
}

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-card strong {
  font-size: 1.4rem;
}

.runtime-strip {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.runtime-card {
  background: rgba(255, 249, 240, 0.82);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.runtime-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.18rem;
}

.status-banner {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(15, 106, 103, 0.16);
  background: rgba(15, 106, 103, 0.08);
  color: var(--teal);
  font-size: 0.94rem;
}

.status-banner.is-error {
  border-color: rgba(189, 79, 25, 0.18);
  background: rgba(189, 79, 25, 0.08);
  color: var(--accent-deep);
}

.toolbar {
  margin-top: 22px;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  background: rgba(255, 250, 240, 0.78);
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.toolbar label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.toolbar select,
.toolbar input[type="search"] {
  min-width: 180px;
  border: 1px solid rgba(61, 38, 19, 0.16);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
  font: inherit;
}

.search-field {
  flex: 1 1 260px;
}

.search-field input {
  width: 100%;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
}

.toolbar-note {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.accent-button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, #de7d34 100%);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 16px 30px rgba(189, 79, 25, 0.24);
}

.accent-button:hover {
  transform: translateY(-1px);
}

.accent-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.view-switcher {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.view-switcher::-webkit-scrollbar {
  display: none;
}

.mobile-panel-nav {
  display: none;
}

.view-tab {
  flex: 0 0 auto;
  min-height: 42px;
  border: 1px solid rgba(61, 38, 19, 0.12);
  background: rgba(255, 252, 246, 0.8);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.view-tab.is-active {
  color: white;
  background: linear-gradient(135deg, var(--teal) 0%, #129088 100%);
  border-color: rgba(15, 106, 103, 0.2);
}

.workspace {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 18px;
}

.workspace.is-alt {
  grid-template-columns: 1fr;
}

.panel {
  border-radius: 28px;
  padding: 18px;
  scroll-margin-top: 136px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.panel h2 {
  margin: 0;
  font-size: 1.6rem;
}

.panel-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.feed-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 250px);
  overflow: auto;
  padding-right: 4px;
}

.feed-item {
  appearance: none;
  border: 1px solid rgba(61, 38, 19, 0.1);
  border-radius: 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.feed-item,
.candidate-item {
  width: 100%;
  text-align: left;
}

.feed-item:hover,
.feed-item.is-active {
  transform: translateX(3px);
  border-color: rgba(189, 79, 25, 0.28);
  background: rgba(255, 245, 234, 0.94);
}

.feed-item h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.3;
}

.feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
}

.chip {
  background: rgba(15, 106, 103, 0.08);
  color: var(--teal);
}

.badge {
  background: rgba(189, 79, 25, 0.1);
  color: var(--accent-deep);
  align-self: start;
}

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

.score-card {
  border-radius: 22px;
  padding: 16px;
}

.score-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
  font-size: 0.85rem;
}

.score-card strong {
  font-size: 2rem;
}

.detail-columns {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.detail-section {
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(61, 38, 19, 0.1);
  border-radius: 20px;
  padding: 14px;
}

.candidate-list {
  display: grid;
  gap: 12px;
}

.candidate-item {
  border: 1px solid rgba(61, 38, 19, 0.1);
  border-radius: 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
}

.candidate-item h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.35;
}

.candidate-item a {
  color: var(--teal);
  text-decoration: none;
}

.candidate-item a:hover {
  text-decoration: underline;
}

.candidate-grid {
  display: grid;
  gap: 8px;
}

.candidate-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.is-hidden {
  display: none;
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  background: rgba(207, 157, 45, 0.12);
  color: #72550b;
}

.pill.is-true {
  background: rgba(15, 106, 103, 0.12);
  color: var(--teal);
}

.pill.is-false {
  background: rgba(189, 79, 25, 0.1);
  color: var(--accent-deep);
}

.code-box {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: #1f2424;
  color: #eff6f2;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.84rem;
  line-height: 1.5;
  overflow: auto;
  max-height: 420px;
}

.time-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.time-list div {
  display: grid;
  gap: 4px;
}

.time-list dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.time-list dd {
  margin: 0;
  font-weight: 600;
}

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

  .hero {
    align-items: start;
  }

  .feed-list {
    max-height: 420px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .runtime-strip {
    grid-template-columns: 1fr;
  }

  .search-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 18px 12px 24px;
  }

  .bg-orb-a {
    width: 220px;
    height: 220px;
    top: -50px;
    right: -90px;
  }

  .bg-orb-b {
    width: 180px;
    height: 180px;
    left: -80px;
  }

  .hero {
    gap: 14px;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 13vw, 3.4rem);
    line-height: 0.96;
  }

  .hero-text {
    font-size: 0.94rem;
    line-height: 1.55;
  }

  .hero-metrics {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .runtime-card {
    border-radius: 18px;
    padding: 14px;
  }

  .hero-metrics::-webkit-scrollbar {
    display: none;
  }

  .metric-card {
    min-width: 170px;
    min-height: 96px;
    padding: 14px;
    flex: 0 0 auto;
  }

  .metric-card strong {
    font-size: 1.2rem;
  }

  .toolbar {
    margin-top: 18px;
    gap: 10px;
    padding: 12px;
    border-radius: 20px;
    grid-template-columns: 1fr;
  }

  .toolbar label,
  .toolbar .accent-button {
    width: 100%;
  }

  .toolbar select,
  .toolbar input[type="search"] {
    min-width: 100%;
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
  }

  .toggle {
    width: 100%;
    justify-content: space-between;
    padding: 4px 2px 0;
    margin-top: 2px;
    border-top: 1px dashed rgba(61, 38, 19, 0.12);
  }

  .view-switcher {
    margin-top: 14px;
    gap: 8px;
  }

  .mobile-panel-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-top: 10px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .mobile-panel-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-panel-link {
    flex: 0 0 auto;
    min-height: 38px;
    border: 1px solid rgba(61, 38, 19, 0.12);
    border-radius: 999px;
    padding: 9px 12px;
    background: rgba(255, 252, 246, 0.84);
    color: var(--muted);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    white-space: nowrap;
  }

  .view-tab {
    padding: 10px 12px;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .workspace {
    margin-top: 16px;
    gap: 14px;
  }

  .panel {
    border-radius: 22px;
    padding: 14px;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
  }

  .panel h2 {
    font-size: 1.34rem;
  }

  .feed-list {
    max-height: none;
    padding-right: 0;
    gap: 8px;
  }

  .feed-item,
  .candidate-item {
    border-radius: 16px;
    padding: 12px;
  }

  .feed-item h3,
  .candidate-item h3 {
    font-size: 0.96rem;
  }

  .feed-meta {
    gap: 6px;
  }

  .chip,
  .badge,
  .pill {
    font-size: 0.72rem;
    padding: 5px 8px;
  }

  .score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .score-card {
    border-radius: 18px;
    padding: 14px;
  }

  .score-card span {
    margin-bottom: 8px;
    font-size: 0.8rem;
  }

  .score-card strong {
    font-size: 1.5rem;
  }

  .detail-columns {
    gap: 10px;
    margin-top: 12px;
  }

  .detail-section {
    border-radius: 16px;
    padding: 12px;
  }

  .detail-section h3 {
    font-size: 1rem;
    margin-bottom: 8px;
  }

  .pill-row {
    gap: 6px;
  }

  .candidate-meta {
    word-break: break-word;
  }

  .code-box {
    padding: 12px;
    font-size: 0.78rem;
    line-height: 1.45;
    max-height: 300px;
  }

  .time-list {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .shell {
    padding: 14px 10px 20px;
  }

  .eyebrow {
    font-size: 0.7rem;
  }

  .hero h1 {
    font-size: clamp(2rem, 14vw, 2.9rem);
  }

  .hero-text {
    font-size: 0.9rem;
  }

  .metric-card {
    min-width: 152px;
  }

  .toolbar {
    position: sticky;
    top: 0;
    z-index: 3;
    backdrop-filter: blur(22px);
  }

  .view-switcher {
    position: sticky;
    top: 72px;
    z-index: 4;
    padding-top: 8px;
    background: linear-gradient(180deg, rgba(240, 229, 213, 0.96), rgba(240, 229, 213, 0));
  }

  .mobile-panel-nav {
    position: sticky;
    top: 124px;
    z-index: 3;
    padding-top: 6px;
    background: linear-gradient(180deg, rgba(240, 229, 213, 0.96), rgba(240, 229, 213, 0));
  }

  .code-box {
    max-height: 240px;
  }
}

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

  .view-tab {
    font-size: 0.84rem;
  }

  .metric-card {
    min-width: 138px;
  }
}
