:root {
  --ink: #111827;
  --muted: #687386;
  --line: #e8ebf0;
  --panel: #ffffff;
  --stage: #0b1020;
  --stage-soft: #121a31;
  --blue: #2864e8;
  --blue-dark: #1747ad;
  --blue-soft: #edf4ff;
  --cyan: #52d4f2;
  --success: #12a87a;
  --header-height: 84px;
  font-family: Pretendard, "Pretendard Variable", "Noto Sans KR", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--stage);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; }
body { background: var(--stage); overflow-x: hidden; }
button { color: inherit; font: inherit; }
button, canvas { -webkit-tap-highlight-color: transparent; }
button:focus-visible, canvas:focus-visible { outline: 3px solid rgba(82, 212, 242, .8); outline-offset: 2px; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.topbar {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(20px, 2.7vw, 48px);
  background: rgba(255, 255, 255, .98);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 20;
}

.topbar__left, .topbar__right, .progress-summary { display: flex; align-items: center; }
.topbar__left { gap: 24px; min-width: 0; }
.topbar__right { gap: 20px; }
.back-button {
  height: 42px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dce1e8;
  border-radius: 10px;
  background: #fff;
  color: #566274;
  cursor: pointer;
  transition: border-color .2s, color .2s, transform .2s;
}
.back-button:hover { color: var(--blue); border-color: #9cb9f9; transform: translateX(-2px); }
.back-button svg { width: 17px; }
.topbar__divider { width: 1px; height: 34px; background: var(--line); }
.course-heading { display: grid; gap: 4px; min-width: 0; }
.course-heading__eyebrow { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.course-heading strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-summary { min-width: 320px; gap: 12px; color: #7b8494; font-size: 12px; font-weight: 700; }
.progress-summary__track { flex: 1; height: 5px; border-radius: 999px; overflow: hidden; background: #edf0f3; }
.progress-summary__track i { display: block; width: var(--course-progress, 0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d38a30, var(--blue)); }
.progress-summary strong { color: var(--blue); font-size: 13px; }
.sidebar-toggle {
  width: 42px;
  height: 42px;
  display: none;
  place-content: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #dce1e8;
  border-radius: 10px;
  cursor: pointer;
}
.sidebar-toggle span { width: 17px; height: 1.5px; background: #4f5b6c; border-radius: 9px; }

.learning-layout {
  min-height: calc(100vh - var(--header-height));
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(380px, 32vw, 510px);
}

.experience {
  min-width: 0;
  padding: clamp(22px, 2.25vw, 40px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  background:
    radial-gradient(circle at 20% 10%, rgba(41, 101, 232, .16), transparent 34%),
    radial-gradient(circle at 86% 82%, rgba(82, 212, 242, .08), transparent 28%),
    var(--stage);
  color: #fff;
  overflow: hidden;
}

.simulator-frame {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 18px;
  background: #050811;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .38);
}
.simulator-frame__bar {
  height: 48px;
  padding: 0 16px 0 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: #aeb8cc;
  background: rgba(18, 26, 49, .96);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.live-status { display: flex; align-items: center; gap: 9px; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.live-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(18, 168, 122, .12); }
.simulator-frame__hint { margin-left: auto; font-size: 11px; color: #7f8aa2; }
#unity-fullscreen-button {
  height: 32px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #d8deea;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  cursor: pointer;
}
#unity-fullscreen-button:hover { background: rgba(255, 255, 255, .11); }
#unity-fullscreen-button svg { width: 15px; }
#unity-fullscreen-button span { font-size: 11px; font-weight: 700; }

#unity-container { width: 100%; position: relative; aspect-ratio: 16 / 9; background: #050811; }
#unity-canvas { width: 100%; height: 100%; display: block; background: #050811; }
#unity-loading-bar {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: radial-gradient(circle at 50% 45%, #17233f 0, #080d1b 58%, #050811 100%);
  transition: opacity .35s ease, visibility .35s ease;
}
#unity-loading-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 0, transparent 72%);
}
#unity-loading-bar.is-complete { opacity: 0; visibility: hidden; }
.loading-mark {
  width: 64px;
  height: 64px;
  margin-bottom: 7px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  border: 1px solid rgba(82, 212, 242, .3);
  border-radius: 18px;
  background: rgba(82, 212, 242, .08);
  animation: loadingPulse 1.8s ease-in-out infinite;
}
.loading-mark svg { width: 34px; }
#unity-loading-bar strong, #unity-loading-bar span, .loading-mark, #unity-progress-bar-empty { position: relative; z-index: 1; }
#unity-loading-bar strong { font-size: 14px; }
#unity-loading-bar > span { color: #8190aa; font-size: 11px; font-variant-numeric: tabular-nums; }
#unity-progress-bar-empty { width: min(280px, 58%); height: 5px; margin-top: 8px; overflow: hidden; border-radius: 20px; background: rgba(255, 255, 255, .1); }
#unity-progress-bar-full { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); box-shadow: 0 0 18px rgba(82, 212, 242, .5); transition: width .12s linear; }
#unity-warning { position: absolute; inset: 16px 16px auto; z-index: 5; display: none; gap: 8px; }
.unity-message { padding: 11px 14px; color: #e8edf7; border: 1px solid rgba(255, 255, 255, .15); border-radius: 9px; background: rgba(17, 24, 39, .92); font-size: 12px; box-shadow: 0 10px 28px rgba(0, 0, 0, .3); }
.unity-message--warning { color: #fff2bd; border-color: rgba(255, 209, 74, .4); }
.unity-message--error { color: #ffe2e2; border-color: rgba(255, 101, 101, .4); }

.experience__info {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}
.chapter-label { display: inline-flex; padding: 6px 9px; color: #a8c6ff; border: 1px solid rgba(76, 129, 238, .35); border-radius: 6px; background: rgba(40, 100, 232, .16); font-size: 9px; font-weight: 900; letter-spacing: .11em; }
.experience__info h1 { margin: 12px 0 5px; font-size: clamp(24px, 2vw, 34px); letter-spacing: -.04em; }
.experience__info p { margin: 0; color: #8f9bb2; font-size: 13px; line-height: 1.7; }
.lesson-meta { display: flex; gap: 18px; flex: 0 0 auto; color: #9ba6ba; font-size: 11px; }
.lesson-meta span { display: flex; align-items: center; gap: 7px; }
.meta-icon { width: 13px; height: 13px; display: inline-block; position: relative; opacity: .8; }
.meta-icon--time { border: 1.5px solid currentColor; border-radius: 50%; }
.meta-icon--time::after { content: ""; width: 3px; height: 4px; position: absolute; left: 5px; top: 2px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; }
.meta-icon--desktop { border: 1.5px solid currentColor; border-radius: 2px; }
.meta-icon--desktop::after { content: ""; width: 7px; position: absolute; left: 2px; bottom: -4px; border-bottom: 1.5px solid currentColor; }

.curriculum {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow: hidden;
}
.panel-close { width: 36px; height: 36px; display: none; place-items: center; position: absolute; z-index: 5; top: 8px; right: 10px; border: 0; border-radius: 50%; background: #f3f5f8; cursor: pointer; }
.panel-close svg { width: 18px; }

.curriculum-tabs { height: 50px; display: grid; grid-template-columns: repeat(6, 1fr); flex: 0 0 auto; border-bottom: 1px solid #e1e4e8; background: #fff; }
.curriculum-tab { min-width: 0; padding: 7px 2px 6px; display: grid; place-items: center; align-content: center; gap: 2px; position: relative; color: #9da3ac; border: 0; background: transparent; cursor: pointer; }
.curriculum-tab::after { content: ""; height: 2px; position: absolute; inset: auto 0 -1px; background: transparent; }
.curriculum-tab svg { width: 13px; height: 13px; stroke-width: 1.6; }
.curriculum-tab span { overflow: hidden; max-width: 100%; font-size: 9px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.curriculum-tab:hover { color: #386aa6; }
.curriculum-tab.is-active { color: #165a99; }
.curriculum-tab.is-active::after { background: #165a99; }
.curriculum-tab.is-active span { font-weight: 800; }

.curriculum__progress { padding: 13px 20px 14px; flex: 0 0 auto; background: #f7f7f7; border-bottom: 1px solid #dedede; }
.curriculum__progress > div:first-child { display: flex; align-items: center; justify-content: space-between; color: #222; font-size: 10px; }
.curriculum__progress > div:first-child strong { font-weight: 800; }
.curriculum__progress > div:first-child span { color: #929292; }
.curriculum__track { height: 4px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: #e0e0e0; }
.curriculum__track i { display: block; width: var(--course-progress, 0%); height: 100%; border-radius: inherit; background: #185c9d; }
.curriculum__progress p { margin: 7px 0 0; color: #9a9a9a; font-size: 9px; }
.curriculum__progress p b { color: #185c9d; }
.curriculum__progress p em { padding: 0 4px; color: #aaa; font-style: normal; }
.course-sections { flex: 0 0 auto; overflow: visible; }
.course-part { border-bottom: 1px solid #dedede; }
.course-part__toggle { width: 100%; min-height: 80px; padding: 13px 20px; display: flex; align-items: center; gap: 11px; text-align: left; border: 0; background: #fff; cursor: pointer; }
.course-part__toggle:hover { background: #fafafa; }
.part-number { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; color: #165a99; border: 1px solid #82add5; border-radius: 10px; font-size: 13px; font-weight: 800; }
.course-part.is-open .part-number { color: #fff; border-color: #165a99; background: #165a99; }
.part-title { display: grid; gap: 4px; flex: 1; }
.part-title strong { color: #111; font-size: 14px; }
.part-title small { color: #858585; font-size: 9px; }
.course-part__toggle > svg { width: 16px; color: #a1a1a1; transition: transform .25s; }
.course-part.is-open .course-part__toggle > svg { color: #165a99; }
.course-part:not(.is-open) .course-part__toggle > svg { transform: rotate(180deg); }
.lesson-list { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.lesson-list::before { content: ""; overflow: hidden; }
.course-part.is-open .lesson-list { grid-template-rows: 1fr; padding-bottom: 4px; background: #fff; }
.course-part.is-open .lesson-list::before { display: none; }
.lesson { width: 100%; min-height: 45px; padding: 7px 20px; display: none; align-items: center; gap: 9px; position: relative; text-align: left; border: 0; background: transparent; cursor: pointer; }
.course-part.is-open .lesson { display: flex; }
.lesson:hover { background: #f6f8fa; }
.lesson.is-active { background: #f3f7fc; }
.lesson__state { width: 23px; height: 23px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #d7d7d7; border-radius: 50%; background: #fff; }
.lesson.is-active .lesson__state { border-color: #165a99; background: #165a99; }
.lesson.is-active .lesson__state i { width: 0; height: 0; margin-left: 2px; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 6px solid #fff; }
.lesson__text { min-width: 0; flex: 1; }
.lesson__text strong { display: block; overflow: hidden; color: #6d6d6d; font-size: 11px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.lesson.is-active .lesson__text strong { color: #165a99; font-weight: 700; }
.lesson__duration { color: #777; font-size: 10px; font-variant-numeric: tabular-nums; }
.curriculum__footer { padding: 14px 20px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 0 0 auto; border-top: 1px solid #dedede; background: #fff; }
.curriculum__footer button { height: 40px; display: flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; font-size: 10px; font-weight: 700; cursor: pointer; }
.curriculum__footer svg { width: 14px; }
.prev-button { color: #c2c2c2; border: 1px solid #e2e2e2; background: #fff; }
.prev-button:disabled { cursor: not-allowed; }
.next-button { color: #fff; border: 1px solid #165a99; background: #165a99; }
.next-button:hover { background: #104979; }
.next-button:disabled { color: #c2c2c2; border-color: #e2e2e2; background: #fff; box-shadow: none; cursor: not-allowed; }
.panel-backdrop { display: none; }

@keyframes loadingPulse { 0%, 100% { transform: translateY(0); box-shadow: 0 0 0 0 rgba(82, 212, 242, 0); } 50% { transform: translateY(-3px); box-shadow: 0 0 0 9px rgba(82, 212, 242, .04); } }

@media (max-width: 1180px) {
  .learning-layout { grid-template-columns: minmax(0, 1fr) 380px; }
  .experience { padding: 24px; gap: 22px; }
  .lesson-meta { display: none; }
  .progress-summary { min-width: 240px; }
}

@media (max-width: 900px) {
  :root { --header-height: 72px; }
  .topbar { padding: 0 18px; }
  .topbar__divider, .progress-summary { display: none; }
  .sidebar-toggle { display: grid; }
  .learning-layout { display: block; }
  .experience { min-height: calc(100vh - var(--header-height)); padding: 20px; }
  .curriculum { width: min(440px, 92vw); height: 100dvh; min-height: 0; position: fixed; z-index: 50; inset: 0 0 0 auto; transform: translateX(102%); box-shadow: -20px 0 50px rgba(5, 10, 22, .25); transition: transform .3s ease; }
  .curriculum.is-visible { transform: translateX(0); }
  .panel-close { display: grid; }
  .panel-backdrop { position: fixed; z-index: 40; inset: 0; background: rgba(5, 10, 22, .56); backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s; }
  .panel-backdrop.is-visible { display: block; opacity: 1; }
  body.panel-open { overflow: hidden; }
}

@media (max-width: 600px) {
  :root { --header-height: 64px; }
  .topbar { gap: 12px; }
  .back-button { width: 38px; height: 38px; padding: 0; justify-content: center; }
  .back-button span { display: none; }
  .topbar__left { gap: 12px; }
  .course-heading__eyebrow { font-size: 8px; }
  .course-heading strong { max-width: 190px; font-size: 13px; }
  .sidebar-toggle { width: 38px; height: 38px; }
  .experience { min-height: auto; padding: 16px 12px 28px; justify-content: flex-start; gap: 22px; }
  .simulator-frame { border-radius: 12px; }
  .simulator-frame__bar { height: 42px; padding: 0 11px; }
  .simulator-frame__hint, #unity-fullscreen-button span { display: none; }
  #unity-fullscreen-button { width: 31px; padding: 0; justify-content: center; margin-left: auto; }
  #unity-container { aspect-ratio: 16 / 9; }
  .experience__info { display: block; padding: 0 4px; }
  .experience__info h1 { margin-top: 10px; font-size: 24px; }
  .experience__info p { font-size: 12px; }
  .curriculum__progress { padding-left: 20px; padding-right: 20px; }
  .course-part__toggle, .lesson { padding-left: 20px; padding-right: 20px; }
  .curriculum__footer { padding: 16px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
