:root {
  color-scheme: dark;
  --bg: #0b1017;
  --bg-elevated: rgba(18, 27, 39, 0.82);
  --bg-panel: rgba(15, 22, 32, 0.92);
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #f4efe7;
  --muted: #94a4b8;
  --accent: #ff6b3d;
  --accent-soft: rgba(255, 107, 61, 0.14);
  --accent-alt: #24d0b4;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(36, 208, 180, 0.14), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 107, 61, 0.12), transparent 25%),
    linear-gradient(180deg, #0d131b 0%, #0a0f16 100%);
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent);
  pointer-events: none;
}

a {
  color: inherit;
}

button,
select {
  font: inherit;
}

p {
  margin: 0;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1800px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 16px 0 24px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-topbar,
.preview-panel,
.notice-banner {
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.field__label,
.meta-pill {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent-alt);
}

.panel-meta__summary,
.panel-meta__path {
  color: var(--muted);
  line-height: 1.65;
}

.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.app-topbar__brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.app-topbar__brand h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-alt);
  letter-spacing: -0.02em;
}

.app-topbar__desc {
  font-size: 0.85rem;
  color: var(--muted);
}

.app-topbar__stats {
  display: flex;
  gap: 12px;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.stat-badge--subtle {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.stat-badge__label {
  color: var(--muted);
}

.stat-badge__value {
  color: var(--text);
  font-weight: 700;
}

#topRecommendationOrders {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
}

.notice-banner {
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  color: #ffd7cd;
  background: rgba(116, 29, 8, 0.55);
}

.workspace {
  display: block;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.meta-pill strong {
  color: var(--text);
  letter-spacing: 0;
  text-transform: none;
}

.panel-meta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ghost-button,
.vote-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.ghost-button,
.vote-button {
  padding: 0 16px;
}

.ghost-button:hover,
.vote-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 107, 61, 0.65);
}

.ghost-button--primary {
  background: rgba(255, 255, 255, 0.05);
}

.vote-button {
  background: linear-gradient(135deg, var(--accent), #ff8a5a);
  color: #1b130f;
  border-color: transparent;
  font-weight: 700;
}

.vote-button--active {
  background: rgba(36, 208, 180, 0.12);
  color: var(--accent-alt);
  border-color: rgba(36, 208, 180, 0.32);
}

.vote-button[disabled] {
  cursor: default;
  background: rgba(255, 255, 255, 0.12);
  color: var(--muted);
  border-color: transparent;
  transform: none;
}

.compare-stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preview-panel {
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 600px;
}

.panel-control {
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 16px;
}

.panel-control__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-control__nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.select-wrapper {
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(10, 17, 31, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.select-wrapper:hover {
  border-color: rgba(148, 163, 184, 0.42);
}

.select-wrapper:focus-within {
  border-color: rgba(36, 208, 180, 0.58);
  box-shadow:
    0 0 0 4px rgba(36, 208, 180, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.title-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: rgba(9, 15, 24, 0.92);
  color: var(--text);
  color-scheme: dark;
  border: 0;
  border-radius: 18px;
  min-height: 64px;
  padding: 0 56px 0 18px;
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a4b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: calc(100% - 18px) center;
  background-size: 20px;
}

.title-select:hover,
.title-select:focus {
  color: var(--text);
}

.title-select option,
.title-select optgroup {
  background-color: #0f1724;
  color: var(--text);
}

.title-select:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 1;
}

.panel-control__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-control__meta {
  display: grid;
  gap: 12px;
}

.panel-meta__tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-meta__path {
  font-size: 0.84rem;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.panel-meta__tags .panel-meta__path {
  margin-left: auto;
}

.panel-frame-wrap {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
}

.panel-frame {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: #ffffff;
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 32px;
}

.noscript-message {
  padding: 20px;
  color: white;
}

@media (max-width: 1280px) {
  .app-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .app-topbar__brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .app-topbar__stats {
    flex-wrap: wrap;
  }

  .panel-control__header {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-control__actions {
    justify-content: flex-start;
  }

  .panel-meta__tags .panel-meta__path {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 14px;
  }

  .app-topbar,
  .panel-control {
    padding: 18px;
  }

  .panel-control__header {
    padding-bottom: 14px;
  }

  .title-select {
    font-size: 1.15rem;
    min-height: 58px;
    padding-left: 16px;
    padding-right: 48px;
  }

  .panel-frame {
    min-height: 580px;
  }

  .preview-panel {
    min-height: 580px;
  }
}
