:root {
  --navy: #16324f;
  --navy-2: #1a3c6e;
  --navy-3: #245089;
  --danger: #b3352e;
  --danger-2: #922b25;
  --ok: #1d6b28;
  --ink: #1f2430;
  --muted: #5b6472;
  --line: #e7ebf1;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(22, 50, 79, .10), 0 2px 6px rgba(22, 50, 79, .06);
}
* { box-sizing: border-box; margin: 0; }
body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  background: linear-gradient(180deg, #f7f9fc 0%, #e9eef5 100%);
  min-height: 100vh; color: var(--ink); line-height: 1.55;
}
.container { max-width: 720px; margin: 0 auto; padding: 20px 16px 48px; }
.wide { max-width: 1080px; }
header.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff; padding: 12px 18px;
  box-shadow: 0 2px 10px rgba(22, 50, 79, .25);
  position: sticky; top: 0; z-index: 10;
}
header.topbar h1 { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { height: 28px; background: #fff; border-radius: 8px; padding: 3px 7px; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.topbar button { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .3); }
.topbar button:hover { background: rgba(255, 255, 255, .24); filter: none; }
.card {
  background: #fff; border-radius: var(--radius); padding: 24px; margin: 18px 0;
  box-shadow: var(--shadow); border: 1px solid rgba(22, 50, 79, .05);
}
h2 { font-size: 17px; margin-bottom: 14px; letter-spacing: -.2px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
input, select, button {
  font: inherit; padding: 11px 13px; border: 1px solid #d4dae3; border-radius: 10px; width: 100%;
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(26, 60, 110, .12); }
button {
  background: linear-gradient(135deg, var(--navy-2), var(--navy-3));
  color: #fff; border: none; cursor: pointer; margin-top: 14px; font-weight: 700;
  transition: filter .15s, transform .05s;
}
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: default; }
button.small { width: auto; padding: 7px 14px; font-size: 13px; margin: 0; border-radius: 8px; }
button.danger { background: var(--danger); }
button.danger:hover { background: var(--danger-2); filter: none; }
.error { color: var(--danger); font-size: 14px; margin-top: 8px; min-height: 1.2em; }
.status-done { color: var(--ok); font-weight: 700; }
#status-table th:first-child, #status-table td:first-child {
  position: sticky; left: 0; background: #fff;
}
.notice { color: var(--muted); font-size: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { color: var(--muted); font-size: 12.5px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; }
.table-wrap { overflow-x: auto; }
.video-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 14px 10px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit;
  border-radius: 10px; transition: background .12s;
}
.video-item:hover { background: #f0f4fa; }
.badge {
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--line); color: var(--muted); white-space: nowrap;
}
.badge.done { background: #d9f0dc; color: var(--ok); }
.tabs { display: flex; gap: 8px; margin: 18px 0 0; flex-wrap: wrap; }
.tabs button {
  width: auto; margin: 0; background: #fff; color: var(--ink);
  border: 1px solid #d4dae3; border-radius: 999px; padding: 8px 18px; font-weight: 600;
}
.tabs button:hover { filter: none; background: #f0f4fa; }
.tabs button.active { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
/* 아래쪽에 display를 지정하는 규칙(.dictation-controls 등)이 같은 우선순위로 이겨서
   숨김이 안 먹히는 일이 없도록 유틸리티 클래스는 !important로 고정한다 */
.hidden { display: none !important; }

/* ===== GrammarPT 진입 카드 (학생 홈) ===== */
.gpt-card {
  background: linear-gradient(135deg, #f8f6ff 0%, #eefafd 100%);
  border-color: rgba(107, 92, 255, .18);
}
.gpt-title {
  background: linear-gradient(100deg, var(--navy-3) 0%, #6b5cff 52%, #16b4d8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gpt-link { border-bottom: none; }
.gpt-link:hover { background: rgba(255, 255, 255, .75); }
.gpt-link > div { flex: 1; min-width: 0; word-break: keep-all; }
.gpt-thumb {
  width: 64px; height: 64px; flex-shrink: 0;
  /* 원본 PNG의 사각 배경이 박스로 보이지 않게 원형으로 페이드아웃 */
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 66%, transparent 78%);
  mask-image: radial-gradient(circle at 50% 50%, #000 66%, transparent 78%);
}
.badge.gpt-badge { background: linear-gradient(100deg, #6b5cff, #16b4d8); color: #fff; }
/* 좁은 화면에서는 썸네일을 줄여 설명 문구가 어색하게 접히지 않게 */
@media (max-width: 480px) {
  .gpt-link { padding: 12px 4px; gap: 8px; }
  .gpt-thumb { width: 44px; height: 44px; }
}

/* ===== 로그인 랜딩 ===== */
.landing-body {
  background: #f6f8fc;
  position: relative;
  overflow-x: hidden;
}
/* GrammarPT 이미지의 라벤더·시안 톤을 배경에 깔아 비주얼이 페이지에 녹아들게 */
.landing-body::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(52vw 46vw at 14% 18%, rgba(124, 92, 255, .13), transparent 62%),
    radial-gradient(48vw 44vw at 78% 72%, rgba(34, 190, 216, .14), transparent 60%),
    linear-gradient(180deg, #f9fbff 0%, #eef2f9 100%);
}
.landing {
  position: relative; z-index: 1;
  max-width: 1280px; margin: 0 auto; padding: 48px 24px;
  min-height: 100vh; /* 넓은 화면에서 아래가 비지 않도록 뷰포트를 채운다 */
  display: grid; gap: 4px clamp(24px, 4.5vw, 60px);
  /* 창이 좁아져도 2단을 유지할 수 있도록 로그인 컬럼을 가변으로 */
  grid-template-columns: minmax(0, 1.05fr) clamp(300px, 30vw, 396px);
  grid-template-areas:
    'hero   login'
    'visual login';
  align-items: start;
  align-content: center;
}
.landing-hero { grid-area: hero; }
.landing-visual { grid-area: visual; }
.landing-login { grid-area: login; align-self: center; }

.brand-row { display: flex; align-items: center; gap: 16px; }
.brand-educore { height: 62px; width: auto; }
.brand-core { height: 34px; width: auto; }
.brand-divider { width: 1px; height: 32px; background: linear-gradient(180deg, transparent, #c5cede, transparent); }

.hero-title {
  margin: 22px 0 12px; font-size: clamp(30px, 4.4vw, 46px); font-weight: 800;
  line-height: 1.18; letter-spacing: -1.4px; color: var(--navy);
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(100deg, var(--navy-3) 0%, #6b5cff 52%, #16b4d8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--muted); font-size: 16px; line-height: 1.7; word-break: keep-all; }

.hero-visual { position: relative; margin: 26px 0 0; text-align: center; }
.hero-visual img {
  width: 100%; max-width: 400px; height: auto; display: block; margin: 0 auto;
  /* 원본 PNG의 사각 배경이 박스로 보이지 않게 원형으로 페이드아웃 */
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 70%, transparent 79%);
  mask-image: radial-gradient(circle at 50% 50%, #000 70%, transparent 79%);
  animation: hero-float 7s ease-in-out infinite;
}
/* 마스크가 drop-shadow를 잘라내므로 글로우는 뒤에 따로 깐다 */
.hero-visual::before {
  content: ''; position: absolute; z-index: -1;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(400px, 100%); aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, .16) 0%, rgba(34, 190, 216, .10) 45%, transparent 70%);
}
.hero-visual figcaption { margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.hero-visual figcaption strong { color: var(--navy-3); }
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

.hero-chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; }
.hero-chips li {
  font-size: 13px; font-weight: 600; color: var(--navy-2);
  padding: 7px 15px; border-radius: 999px;
  background: rgba(255, 255, 255, .78); border: 1px solid rgba(36, 80, 137, .16);
  box-shadow: 0 1px 2px rgba(22, 50, 79, .05);
}

.login-panel {
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 20px; padding: 30px 28px 26px;
  box-shadow: 0 20px 44px rgba(22, 50, 79, .13), 0 2px 8px rgba(22, 50, 79, .06);
}
.login-panel h2 { font-size: 20px; font-weight: 800; letter-spacing: -.4px; margin-bottom: 4px; }
.login-panel .notice { text-align: center; margin-top: 16px; font-size: 13px; }

/* 대형 모니터: 여백만 늘리지 말고 콘텐츠도 함께 키운다 */
@media (min-width: 1440px) {
  .landing { max-width: 1400px; gap: 6px 88px; grid-template-columns: minmax(0, 1.05fr) 430px; }
  .hero-title { font-size: 54px; letter-spacing: -1.8px; }
  .hero-sub { font-size: 17px; }
  .hero-visual img { max-width: 480px; }
  .hero-visual { margin-top: 32px; }
  .login-panel { padding: 34px 32px 30px; }
}

/* 세로가 짧은 노트북(768p 등): 스크롤 없이 한 화면에 담기도록 압축 */
@media (min-width: 701px) and (max-height: 820px) {
  .landing { padding: 28px 24px; }
  .hero-title { margin: 16px 0 10px; }
  .hero-visual { margin-top: 14px; }
  .hero-visual img { max-width: 320px; }
  .hero-chips { margin-top: 16px; }
}

/* 1단(모바일) 전환 조건
   - 터치 기기(pointer: coarse)가 900px 이하일 때
   - 또는 기기와 무관하게 700px 미만 (2단이 성립하지 않는 폭)
   마우스를 쓰는 PC는 창이 좁거나 확대 상태여도 700px까지 2단을 유지한다. */
@media (max-width: 900px) and (pointer: coarse), (max-width: 700px) {
  .landing {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'hero' 'login' 'visual';
    gap: 0; padding: 32px 18px 44px; max-width: 460px;
  }
  .landing-login { margin-top: 24px; }
  .landing-visual { margin-top: 32px; }
  .brand-educore { height: 52px; }
  .brand-core { height: 29px; }
  .hero-title { margin: 18px 0 10px; letter-spacing: -1px; }
  .hero-sub { font-size: 15px; }
  .hero-sub br { display: none; } /* 좁은 폭에서는 자연스럽게 흐르도록 */
  .hero-visual { margin-top: 0; }
  .hero-visual img { max-width: 280px; }
  .hero-chips { justify-content: center; margin-top: 18px; }
  .login-panel { padding: 24px 20px 22px; border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-visual img { animation: none; }
}

/* 현대적 모니터 프레임 (재생 페이지) */
.monitor { margin: 6px auto 10px; }
.monitor-shell {
  background: linear-gradient(180deg, #2a2f3a, #171b23);
  border-radius: 18px; padding: 14px 14px 18px;
  box-shadow: 0 18px 40px rgba(15, 20, 30, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.player-wrap { position: relative; padding-top: 56.25%; background: #000; border-radius: 8px; overflow: hidden; }
.player-wrap iframe, .player-wrap #player { position: absolute; inset: 0; width: 100%; height: 100%; }
.monitor-stand {
  width: 110px; height: 26px; margin: 0 auto;
  background: linear-gradient(180deg, #20242e, #171b23);
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
}
.monitor-base {
  width: 220px; height: 10px; margin: 0 auto;
  background: linear-gradient(180deg, #262b36, #141821);
  border-radius: 999px; box-shadow: 0 6px 14px rgba(15, 20, 30, .35);
}
@media (max-width: 480px) {
  .monitor-shell { padding: 8px 8px 10px; border-radius: 12px; }
  .monitor-stand { height: 18px; width: 80px; }
  .monitor-base { width: 150px; }
}

/* ===== 시청 코드 입력 화면 (잠긴 보강 영상) ===== */
.code-gate { text-align: center; padding: 28px 12px; }
.code-gate-icon { font-size: 40px; margin-bottom: 8px; }
.code-gate h2 { font-size: 18px; margin-bottom: 8px; }
.code-gate form {
  display: flex; gap: 10px; justify-content: center; align-items: center;
  margin: 18px auto 0; max-width: 320px;
}
#code-input {
  width: 160px; text-align: center; font-size: 26px; font-weight: 700;
  letter-spacing: 10px; padding: 10px 12px; text-indent: 10px;
}
#code-submit { width: auto; padding: 12px 22px; }

/* 딕테이션 컨트롤 바 */
.dictation-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.dictation-controls button {
  font-size: 1.05rem;
  padding: 10px 18px;
}
.dictation-controls select {
  width: auto;
}
.dictation-controls label {
  margin: 0;
}

/* 듣기평가 답안지 */
.answer-sheet { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.answer-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.answer-row .q-no { flex: 0 0 44px; font-weight: 700; text-align: right; font-size: 14px; }
.choice-btn {
  flex: 0 1 52px; margin: 0; padding: 9px 0; font-size: 1.05rem;
  background: #fff; color: var(--ink); border: 1px solid #d4dae3; border-radius: 10px;
}
.choice-btn:hover { filter: none; background: #f0f4fa; }
.choice-btn.selected { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.score-display { font-size: 34px; font-weight: 800; text-align: center; margin: 18px 0 6px; color: var(--navy-2); }
.marks-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.mark { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--line); }
.mark-o { background: #d9f0dc; color: var(--ok); }
.mark-x { background: #f6dedd; color: var(--danger); }

/* 발음 녹음기 */
.pron-word { font-size: 34px; font-weight: 800; text-align: center; margin: 18px 0 4px; letter-spacing: -.3px; word-break: break-word; }
.pron-meaning { text-align: center; color: var(--muted); font-size: 16px; min-height: 1.4em; margin-bottom: 18px; }
.pron-controls { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pron-listen { width: auto; padding: 12px 22px; border-radius: 999px; background: linear-gradient(135deg, #1a8f6e, #14b8a6); }
.pron-slow { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 0; font-weight: 600; }
.pron-slow input { width: auto; margin: 0; }
.pron-record {
  display: block; width: 96px; height: 96px; border-radius: 50%; margin: 20px auto;
  font-size: 40px; padding: 0; box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--navy-2), var(--navy-3));
}
.pron-record.recording { background: linear-gradient(135deg, var(--danger), var(--danger-2)); font-size: 15px; font-weight: 800; animation: pron-pulse 1s infinite; }
@keyframes pron-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.pron-result { text-align: center; min-height: 2em; margin-top: 6px; }
.pron-score { font-size: 26px; font-weight: 800; }
.pron-best { font-size: 15px; color: var(--muted); font-weight: 700; }
.pron-words { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.pron-w { padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 15px; }
.pron-w-good { background: #d9f0dc; color: var(--ok); }
.pron-w-ok { background: #fdf1cf; color: #8a6d1a; }
.pron-w-miss { background: #f6dcd9; color: var(--danger); }
.pron-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }
.pron-nav button { flex: 1; }

/* ===== 숙제 코스 편집기 (관리자) ===== */
.course-builder { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .course-builder { grid-template-columns: 1fr; } }
.course-pane { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.course-pane h3 { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.pool-group { font-size: 12px; font-weight: 700; color: var(--muted); margin: 10px 0 4px; }
.pool-item {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  padding: 8px 6px; border-bottom: 1px solid var(--line);
}
.pool-item.taken { opacity: .5; }
.pool-item button, .seq-head button { width: auto; margin: 0; padding: 4px 10px; font-size: 12px; }
.seq-block { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: #fff; }
.seq-block.dragging { opacity: .4; }
.seq-block.gone { border-color: var(--danger); }
.seq-head { display: flex; gap: 8px; align-items: center; }
.seq-head .grow { flex: 1; min-width: 0; }
.seq-drag { cursor: grab; color: var(--muted); user-select: none; }
.seq-pass { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; padding-left: 22px; }
.seq-pass select, .seq-pass input { width: auto; margin: 0; padding: 4px 8px; font-size: 13px; }
.seq-pass input[type="number"] { width: 72px; }

/* ===== 숙제 코스 (학생) ===== */
.course-block {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 10px; border-bottom: 1px solid var(--line);
  border-radius: 10px; text-decoration: none; color: inherit;
}
.course-block .step {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--line); color: var(--muted);
}
.course-block .grow { flex: 1; min-width: 0; }
.course-block.done .step { background: #d9f0dc; color: var(--ok); }
.course-block.open { background: #eef4ff; box-shadow: inset 0 0 0 1px rgba(36, 80, 137, .25); }
.course-block.open .step { background: var(--navy-3); color: #fff; }
.course-block.locked, .course-block.missing { opacity: .5; cursor: not-allowed; }
.course-due { color: var(--muted); font-size: 13px; }
.course-due.overdue { color: var(--danger); font-weight: 700; }

/* ===== 숙제 유형 아이콘·제목 위계 (학생 화면) ===== */
.hw-head { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.hw-head h2 { font-size: 21px; font-weight: 900; letter-spacing: -.7px; margin: 0; overflow-wrap: anywhere; }
.hw-icon {
  width: 56px; height: 56px; flex: none;
  border-radius: 14px; overflow: hidden; background: #fff;
  /* 액자 안이 흰색이라 흰 카드 위에서 경계가 사라진다. 테두리와 그림자로
     '얹힌 타일'로 읽히게 해서 붕 뜬 네모가 아니라 의도로 보이게 한다 */
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(22, 50, 79, .12);
}
.hw-icon img { width: 100%; height: 100%; display: block; }
.hw-icon.sm { width: 26px; height: 26px; border-radius: 8px; box-shadow: none; }
.item-title { font-size: 16px; font-weight: 800; letter-spacing: -.3px; overflow-wrap: anywhere; }
/* 제목에 자리를 내주려고 메타 줄을 줄인다 — 제목만 키우면 위계가 그대로다 */
.video-item .notice, .course-block .notice { font-size: 12.5px; }
.video-item .badge, .course-block .badge { font-weight: 700; }
/* 긴 제목이 배지를 밀어내지 않고 접히게 한다 */
.video-item > div { min-width: 0; }
@media (max-width: 480px) {
  .hw-icon { width: 48px; height: 48px; border-radius: 12px; }
  .hw-head h2 { font-size: 19px; }
}
