:root {
  --bg: #0f1117;
  --panel: #171b24;
  --panel-2: #1f2532;
  --text: #e9edf5;
  --muted: #9ca7ba;
  --border: #2a3242;
  --accent: #4a7dff;
  --chip: #252d3d;
  --left: #2c5d90;
  --right: #7a4ea3;
}

html {
  background: #0f1117;
  overscroll-behavior: none;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #2a3242 #10141d;
}

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

*::-webkit-scrollbar-track {
  background: #10141d;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #2a3242 0%, #1f2532 100%);
  border-radius: 999px;
  border: 2px solid #10141d;
}

*::-webkit-scrollbar-thumb:hover {
  background: #3a4760;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Inter", "Roboto", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% -10%, #1a2030 0%, var(--bg) 45%);
  overscroll-behavior: none;
}

.mobile-topbar {
  display: none;
}

.mobile-backdrop {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #141925 0%, #10141d 100%);
  padding: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.title {
  font-weight: 700;
  font-size: 18px;
  margin: 0 0 6px;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 14px;
  font-size: 13px;
}

.search {
  width: 100%;
  border: 1px solid var(--border);
  background: #111724;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  outline: none;
}

.major-list {
  display: grid;
  gap: 8px;
}

.cluster-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #101623;
  padding: 8px;
}

.cluster-toggle {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121a29;
  color: #c7d3e8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 2px 0 8px;
  padding: 8px 10px;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cluster-toggle:hover {
  border-color: #40506c;
  background: #152137;
}

.cluster-chevron {
  color: var(--muted);
  font-size: 12px;
  margin-right: 8px;
}

.cluster-count {
  color: var(--muted);
  font-weight: 500;
  text-transform: none;
  margin-left: 6px;
}

.major-btn {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  background: #141a27;
  color: var(--text);
  border-radius: 10px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.major-btn:hover {
  border-color: #40506c;
  background: #182033;
}

.major-btn.active {
  border-color: var(--accent);
  background: #1b2640;
}

.major-id {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.main {
  padding: 24px;
  max-width: 1200px;
  width: 100%;
}

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  padding: 18px;
  margin-bottom: 16px;
}

.major-card {
  height: 220px;
  display: flex;
  flex-direction: column;
}

.major-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.major-name {
  margin: 0;
  font-size: 24px;
}

.pill {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.context {
  margin-top: 12px;
  color: #ced6e6;
  line-height: 1.5;
  overflow: auto;
  min-height: 0;
}

.section-title {
  margin: 0 0 12px;
  font-size: 16px;
}

.q-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #121825;
}

.q-row.accept {
  border-color: rgba(47, 145, 91, 0.7);
  background: rgba(47, 145, 91, 0.14);
}

.q-row.reject {
  border-color: rgba(166, 90, 74, 0.7);
  background: rgba(166, 90, 74, 0.14);
}

.q-text {
  color: #d6deed;
  margin-bottom: 8px;
}

.choice-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.choice-pill {
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
}

.choice-pill:not(.selected-left):not(.selected-right) {
  opacity: 0.75;
}

.choice-pill.selected-left {
  border-color: var(--left);
  color: #c2dcf8;
  background: rgba(44, 93, 144, 0.2);
}

.choice-pill.selected-right {
  border-color: var(--right);
  color: #e2cffa;
  background: rgba(122, 78, 163, 0.2);
}

.word-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.word {
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--chip);
  font-size: 12px;
}

.word.rank {
  color: #dce6ff;
  border-color: #4b6db7;
  background: rgba(74, 125, 255, 0.15);
}

.word.rank::before {
  content: attr(data-rank) ". ";
  font-weight: 700;
  color: #c8d9ff;
}

.empty {
  color: var(--muted);
}

@media (max-width: 980px) {
  body.mobile-nav-open {
    overflow: hidden;
  }

  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #141925 0%, #10141d 100%);
  }

  .mobile-title {
    font-size: 14px;
    font-weight: 700;
    color: #c7d3e8;
    letter-spacing: 0.02em;
  }

  .menu-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: #121a29;
    border-radius: 8px;
    padding: 8px;
    display: inline-flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
  }

  .menu-toggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: #d6deed;
  }

  .mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(4, 8, 14, 0.68);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.mobile-nav-open .mobile-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    width: min(88vw, 340px);
    height: 100vh;
    border-right: 1px solid var(--border);
    border-bottom: 0;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .main {
    padding: 16px;
  }

  .major-card {
    height: 260px;
  }

  .major-name {
    font-size: 20px;
  }
}
