:root {
  --paper: #f8f6ef;
  --panel: #fffefa;
  --ink: #142f45;
  --muted: #66798b;
  --line: #d8e0e6;
  --shadow: 0 18px 48px rgba(31, 51, 67, .13);
  --foundation: #e7edf4;
  --foundation-accent: #52677f;
  --tech: #d8eef3;
  --tech-accent: #23788a;
  --management: #dfecc8;
  --management-accent: #63842e;
  --data: #f8c99e;
  --data-accent: #bd701e;
  --capstone: #e4ebf8;
  --capstone-accent: #2e6094;
  --active: #173f61;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(20, 47, 69, .045) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(0deg, rgba(20, 47, 69, .035) 1px, transparent 1px) 0 0 / 72px 72px,
    radial-gradient(circle at 12% 8%, rgba(216, 238, 243, .75), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(248, 201, 158, .42), transparent 30%),
    var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

button,
input {
  font: inherit;
}

.app {
  width: 1920px;
  height: 1080px;
  margin: 0 auto;
  padding: 22px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: end;
  padding: 4px 4px 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .08em;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(32px, 3vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

.status {
  min-width: 260px;
  border: 1px solid rgba(20, 47, 69, .15);
  border-radius: 12px;
  background: rgba(255, 254, 250, .72);
  padding: 12px 14px;
  box-shadow: 0 8px 22px rgba(31, 51, 67, .08);
}

.status strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.status span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(980px, 1fr) 390px;
  gap: 16px;
}

.panel {
  min-height: 0;
  border: 1px solid rgba(20, 47, 69, .18);
  border-radius: 16px;
  background: rgba(255, 254, 250, .86);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.controls,
.detail {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.controls {
  overflow: auto;
}

.section-title {
  margin: 0 0 10px;
  color: #40566a;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.search {
  width: 100%;
  border: 2px solid rgba(20, 47, 69, .18);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  font-weight: 800;
}

.search:focus {
  border-color: rgba(23, 63, 97, .72);
  box-shadow: 0 0 0 4px rgba(35, 120, 138, .13);
}

.chips,
.paths {
  display: grid;
  gap: 8px;
}

.chip,
.path-choice,
.reset-btn {
  width: 100%;
  border: 1px solid rgba(20, 47, 69, .18);
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
  color: #29435a;
  cursor: pointer;
  text-align: left;
  font-weight: 900;
  transition: transform .14s ease, border-color .14s ease, background .14s ease, color .14s ease, opacity .14s ease;
}

.chip {
  padding: 10px 11px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip:hover,
.path-choice:hover,
.reset-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 63, 97, .45);
}

.chip.active,
.path-choice.active {
  background: var(--active);
  border-color: var(--active);
  color: #fff;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(20, 47, 69, .16);
  flex: 0 0 auto;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid rgba(20, 47, 69, .18);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.segmented button {
  min-width: 0;
  border: 0;
  border-right: 1px solid rgba(20, 47, 69, .13);
  background: transparent;
  color: #40566a;
  padding: 10px 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--active);
  color: white;
}

.path-choice {
  padding: 11px 12px;
  display: grid;
  gap: 3px;
}

.path-choice span {
  font-size: 12px;
  color: currentColor;
  opacity: .72;
  font-weight: 800;
  line-height: 1.25;
}

.reset-btn {
  padding: 11px 12px;
  text-align: center;
  background: #f3f6f8;
}

.map-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(20, 47, 69, .16);
  background: rgba(246, 248, 246, .76);
}

.view-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid rgba(20, 47, 69, .18);
  border-radius: 999px;
  background: white;
  color: #40566a;
  padding: 8px 13px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.tab.active {
  background: var(--active);
  color: white;
  border-color: var(--active);
}

.legend {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.board-wrap {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.board {
  min-width: 1160px;
  display: grid;
  grid-template-columns: 124px repeat(8, minmax(132px, 1fr));
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .68);
}

.corner,
.term-head,
.lane-name,
.term-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.corner,
.term-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f4f7f4;
}

.corner {
  left: 0;
  z-index: 7;
}

.term-head {
  min-height: 54px;
  padding: 9px 6px;
  text-align: center;
  font-size: 17px;
  font-weight: 950;
  color: #263f53;
}

.term-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.lane-name {
  position: sticky;
  left: 0;
  z-index: 4;
  min-height: var(--lane-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: #eef3ef;
  color: #20384f;
  font-size: 17px;
  font-weight: 950;
  writing-mode: vertical-rl;
  letter-spacing: .05em;
}

.term-cell {
  height: var(--lane-height);
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  background: rgba(255, 255, 255, .36);
}

.term-cell::-webkit-scrollbar,
.controls::-webkit-scrollbar,
.board-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.term-cell::-webkit-scrollbar-thumb,
.controls::-webkit-scrollbar-thumb,
.board-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(20, 47, 69, .22);
}

.course {
  --bg: var(--foundation);
  --accent: var(--foundation-accent);
  position: relative;
  border: 1.5px solid rgba(20, 47, 69, .24);
  border-left: 0;
  border-radius: 10px;
  background: var(--bg);
  color: #20384f;
  padding: 8px 9px 7px;
  cursor: pointer;
  min-height: 48px;
  text-align: left;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .75) inset;
  transition: transform .14s ease, box-shadow .14s ease, opacity .14s ease, filter .14s ease, border-color .14s ease;
}

.course::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  border-radius: 10px 0 0 10px;
  background: var(--accent);
}

.course::after {
  content: "";
  display: none;
  position: absolute;
  inset: 3px;
  border: 1.5px dashed rgba(20, 47, 69, .24);
  border-radius: 7px;
  pointer-events: none;
}

.course:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(31, 51, 67, .13);
}

.course[data-category="tech"] {
  --bg: var(--tech);
  --accent: var(--tech-accent);
}

.course[data-category="management"] {
  --bg: var(--management);
  --accent: var(--management-accent);
}

.course[data-category="data"] {
  --bg: var(--data);
  --accent: var(--data-accent);
}

.course[data-category="capstone"] {
  --bg: var(--capstone);
  --accent: var(--capstone-accent);
}

.course.elective {
  border-style: solid;
}

.course.elective::after {
  display: block;
}

.course.hidden {
  display: none;
}

.course.dimmed {
  opacity: .22;
  filter: grayscale(.55);
}

.course.recommended {
  border-color: #173f61;
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(23, 63, 97, .32), 0 6px 14px rgba(23, 63, 97, .18);
  filter: saturate(1.15) brightness(1.03);
}

.course.recommended::before {
  width: 9px;
  filter: brightness(.78);
}

.course.recommended strong::after {
  content: " ★";
  color: #c9971b;
  font-size: 11px;
  letter-spacing: 0;
}

.course.selected {
  border-color: #173f61;
  box-shadow: 0 0 0 4px rgba(23, 63, 97, .16), 0 8px 18px rgba(31, 51, 67, .14);
}

.course strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #173047;
  font-size: 14px;
  line-height: 1.18;
  font-weight: 950;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.course small {
  display: block;
  margin-top: 3px;
  color: #536879;
  font-size: 11px;
  line-height: 1.1;
  font-weight: 900;
}

.detail {
  overflow: auto;
}

.detail-card {
  border: 1px solid rgba(20, 47, 69, .14);
  border-radius: 14px;
  background: rgba(255, 255, 255, .68);
  padding: 16px;
}

.detail-name {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: 0;
}

.meta-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta {
  border: 1px solid rgba(20, 47, 69, .14);
  border-radius: 999px;
  background: #fff;
  color: #41586b;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 900;
}

.detail-text {
  margin: 14px 0 0;
  color: #43596c;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 650;
}

.list {
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.list li {
  border-left: 4px solid rgba(23, 63, 97, .45);
  border-radius: 8px;
  background: rgba(244, 247, 244, .9);
  padding: 8px 9px;
  color: #344c61;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.28;
}

.matrix {
  display: none;
  min-width: 940px;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.matrix.active {
  display: grid;
}

.matrix-card {
  border: 1px solid rgba(20, 47, 69, .16);
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
  padding: 14px;
  min-height: 360px;
}

.matrix-card h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
}

.matrix-card button {
  display: block;
  width: 100%;
  margin-top: 7px;
  border: 1px solid rgba(20, 47, 69, .12);
  border-radius: 8px;
  background: #f7faf9;
  color: #2e465a;
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
}

.board-view.hidden,
.matrix-view.hidden {
  display: none;
}

