:root {
  --bg: #07090d;
  --bg-elev: #0d121a;
  --bg-panel: rgba(12, 17, 25, 0.92);
  --line: rgba(120, 160, 190, 0.18);
  --text: #e8eef5;
  --muted: #8fa0b3;
  --accent: #7eb6ff;
  --accent-2: #e8a35c;
  --danger: #ff6b6b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font: "Outfit", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --display: "Syne", "Outfit", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  background: var(--bg);
  line-height: 1.55;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(126, 182, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 182, 255, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 20%, black 20%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  inset: -20% 10% auto;
  height: 55vh;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(126, 182, 255, 0.16), transparent 55%),
    radial-gradient(ellipse at 70% 20%, rgba(232, 163, 92, 0.12), transparent 50%);
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
}

main, .footer { position: relative; z-index: 1; }

.topbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1rem;
  padding: 1.1rem 4vw;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  background: rgba(7, 9, 13, 0.92);
  position: sticky;
  top: 0;
  /* Must sit above hero/chat transforms or links become unclickable */
  z-index: 200;
}

.logo {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1rem;
  margin-left: auto;
  max-width: min(72vw, 920px);
  justify-content: flex-end;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  padding: 0.2rem 0;
  pointer-events: auto;
}
.nav a:hover,
.nav a[aria-current="page"] { color: var(--text); }
.nav-mobile-only { display: none; }

.nav-toggle {
  display: none;
  margin-left: auto;
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.model-badge {
  margin: 0;
  align-self: end;
  padding: 0.65rem 0.1rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
}
.model-badge strong {
  color: var(--accent);
  font-weight: 600;
}

.semester {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  border: 1px solid rgba(126, 182, 255, 0.4);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 2.5rem;
  align-items: stretch;
  min-height: calc(100vh - 72px);
  padding: 3.2rem 4vw 2.5rem;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: rise 0.8s ease both;
}

.brand-mark {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.6rem, 5.5vw, 4.4rem);
  letter-spacing: 0.02em;
  line-height: 0.95;
  background: linear-gradient(120deg, #fff 10%, var(--accent) 55%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero h1 {
  margin: 0;
  max-width: 22ch;
  font-size: clamp(1.35rem, 2.3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.lead {
  margin: 1.1rem 0 1.8rem;
  color: var(--muted);
  max-width: 38ch;
  font-size: 1.02rem;
}

.hero-actions, .course-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.78rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn.primary {
  background: linear-gradient(135deg, #8ec0ff, #4f8fe0);
  color: #071018;
}
.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn.ghost:hover { border-color: rgba(126, 182, 255, 0.5); }
.btn:disabled { opacity: 0.55; cursor: wait; transform: none; }

.chat-panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  min-height: 620px;
  max-height: min(820px, calc(100vh - 110px));
  animation: rise 0.9s 0.1s ease both;
}

.chat-head {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.chat-kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--accent-2);
}

.chat-head h2 {
  margin: 0.2rem 0 0;
  font-size: 1.25rem;
}

.chat-controls {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 0.6rem;
  align-items: end;
}

.chat-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
}

.chat-controls select,
.chat-form textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0a0f16;
  color: var(--text);
  font: inherit;
  padding: 0.65rem 0.75rem;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 240px;
}

.msg {
  max-width: 92%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  animation: fade-in 0.28s ease both;
  font-size: 0.95rem;
}
.msg.user {
  align-self: flex-end;
  background: rgba(126, 182, 255, 0.14);
  border: 1px solid rgba(126, 182, 255, 0.3);
}
.msg-body { line-height: 1.55; }
.msg-body p { margin: 0 0 0.55rem; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol {
  margin: 0.35rem 0 0.55rem;
  padding-left: 1.2rem;
}
.msg-body li { margin: 0.15rem 0; }
.msg-body strong, .msg-body b { color: #fff; font-weight: 650; }
.msg-body code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}
.msg-body pre {
  margin: 0.5rem 0;
  padding: 0.7rem 0.8rem;
  background: #0a0f16;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
}
.msg-body pre code { background: none; padding: 0; }
.msg.assistant {
  align-self: flex-start;
  background: #101722;
  border: 1px solid var(--line);
}
.msg.error {
  align-self: stretch;
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: #ffc9c9;
}
.msg .role {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.typing {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}
.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

.suggests {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}
.suggests button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.suggests button:hover {
  color: var(--text);
  border-color: rgba(126, 182, 255, 0.45);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  align-items: end;
}
.chat-form textarea { resize: none; min-height: 74px; }
.chat-note {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}
.chat-note strong { color: #d7e6ff; }

.section {
  padding: 4.5rem 4vw;
  border-top: 1px solid var(--line);
}

.section-head {
  max-width: 46rem;
  margin-bottom: 2rem;
  animation: rise 0.7s ease both;
}
.section-head h2 {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}
.section-head p { margin: 0; color: var(--muted); }

.course-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}
.course-grid--subjects {
  grid-template-columns: repeat(2, 1fr);
}

.course {
  background: linear-gradient(180deg, rgba(16, 22, 32, 0.95), rgba(10, 14, 20, 0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
  animation: rise 0.75s ease both;
}
.course:nth-child(2) { animation-delay: 0.08s; }
.course:nth-child(3) { animation-delay: 0.16s; }
.course:hover {
  border-color: rgba(126, 182, 255, 0.45);
  transform: translateY(-3px);
}
.course .code {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
}
.course h3 { margin: 0.25rem 0 0; font-size: 1.35rem; }
.course .lang { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; }

.meta {
  margin: 0;
  display: grid;
  gap: 0.45rem;
}
.meta div {
  display: grid;
  grid-template-columns: 4.2rem 1fr;
  gap: 0.4rem;
  font-size: 0.9rem;
}
.meta dt { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 0.75rem; }
.meta dd { margin: 0; }
.meta dd span { color: var(--muted); font-size: 0.82rem; }

.summary { margin: 0; color: #c4cfdb; font-size: 0.92rem; }

.eval { display: grid; gap: 0.4rem; }
.eval-bar {
  display: grid;
  grid-template-columns: 4.5rem 1fr 2.4rem;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.8rem;
}
.eval-bar .track {
  height: 6px;
  background: #18202c;
  border-radius: 999px;
  overflow: hidden;
}
.eval-bar .track i {
  display: block;
  height: 100%;
  width: var(--w);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
}
.eval-bar strong { text-align: right; font-family: var(--mono); font-weight: 500; }

.weeks summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
}
.weeks ol {
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}
.weeks li {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 0.5rem;
  font-size: 0.86rem;
  color: #d5dde8;
}
.weeks li span {
  font-family: var(--mono);
  color: var(--accent-2);
  font-size: 0.75rem;
}

.goals .goal-lines {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}
.goals article {
  border-top: 2px solid rgba(126, 182, 255, 0.55);
  padding-top: 1rem;
  animation: rise 0.7s ease both;
}
.goals h3 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.goals p { margin: 0; color: var(--muted); }

.meta .time {
  color: var(--text);
  font-weight: 650;
  letter-spacing: 0.02em;
}

.course-links {
  display: grid;
  gap: 0.45rem;
}

.link-chip {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.link-chip:hover {
  transform: translateY(-1px);
  text-decoration: none;
}
.link-chip strong {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}
.link-chip span {
  color: var(--muted);
  font-size: 0.82rem;
}
.link-chip.live {
  background: rgba(126, 182, 255, 0.08);
  border-color: rgba(126, 182, 255, 0.35);
}
.link-chip.live strong { color: var(--accent); }
.link-chip.bonus {
  background: rgba(232, 163, 92, 0.08);
  border-color: rgba(232, 163, 92, 0.35);
}
.link-chip.bonus strong { color: var(--accent-2); }

.links-board .link-board-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}
.link-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  background: rgba(12, 17, 25, 0.9);
}
.link-card h3 { margin: 0.2rem 0 0; }
.link-card .course-links { margin-top: 1rem; }

@media (max-width: 1100px) {
  .links-board .link-board-grid { grid-template-columns: 1fr; }
}

.game-story {
  display: grid;
  gap: 0.9rem;
  max-width: 62rem;
  margin-bottom: 1.4rem;
}
.game-story p {
  margin: 0;
  color: #c5d0de;
  font-size: 0.98rem;
}
.game-story strong { color: #fff; }

.game-promo .game-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem;
  background: linear-gradient(120deg, rgba(126, 182, 255, 0.08), rgba(232, 163, 92, 0.06));
}
.game-promo .game-cta p {
  margin: 0;
  color: var(--muted);
  max-width: 48ch;
}
.game-promo .game-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 0.35rem !important;
}

.game-ports {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.game-ports article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.25rem;
  background: rgba(12, 17, 25, 0.9);
}
.game-ports h3 {
  margin: 0.15rem 0 0.45rem;
  font-size: 1.15rem;
}
.game-ports p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.game-ports code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: #d7e6ff;
}
.game-dl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.95rem;
}
@media (max-width: 800px) {
  .game-ports { grid-template-columns: 1fr; }
}

.contact-line {
  font-size: 1.05rem;
  color: var(--muted);
}
.contact-line a { font-family: var(--mono); }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 4vw 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--mono);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 1100px) {
  .course-grid, .goals .goal-lines { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .chat-panel { max-height: none; min-height: 560px; }
}

/* Menu items are many — collapse earlier so LLM/기업 LLM links are not clipped */
@media (max-width: 1180px) {
  .topbar {
    flex-wrap: wrap;
    gap: 0.7rem;
    padding: 0.85rem 4.5vw;
  }
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    order: 3;
    width: 100%;
    max-width: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.15rem;
    padding: 0.35rem 0 0.2rem;
  }
  body.nav-open .nav { display: flex; }
  .nav a {
    padding: 0.75rem 0.35rem;
    border-bottom: 1px solid rgba(120, 160, 190, 0.12);
    font-size: 0.95rem;
  }
  .nav-mobile-only { display: block; }
  .semester {
    font-size: 0.68rem;
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .semester { font-size: 0.68rem; }
  .hero {
    padding: 1.6rem 4.5vw 1.4rem;
    gap: 1.4rem;
  }
  .brand-mark { font-size: clamp(2.1rem, 12vw, 3rem); }
  .hero h1 {
    max-width: none;
    font-size: 1.2rem;
  }
  .hero-actions .btn { flex: 1 1 auto; }
  .chat-panel {
    min-height: 70vh;
    max-height: none;
    padding: 0.95rem;
  }
  .chat-controls, .chat-form { grid-template-columns: 1fr; }
  .section { padding: 2.6rem 4.5vw; }
  .footer {
    flex-direction: column;
    padding: 1.2rem 4.5vw 1.8rem;
  }
  .goal-lines, .course-grid { gap: 0.85rem; }
}
