/* ═══════════════════════════════════════════════
   portal.css — Student Portal
   ═══════════════════════════════════════════════ */

/* ── Canvas background ── */
#bg-canvas {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}

/* ══════════════════════════════════════════════
   NAVIGATION
   ══════════════════════════════════════════════ */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 32px;
  padding: 0 40px; height: 64px;
  background: rgba(8,8,15,.8);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0;
}
.nav-logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--orange);
  box-shadow: 0 0 16px rgba(255,107,53,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.nav-logo-text {
  font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.02em;
}
.nav-logo-text em { color: var(--orange); font-style: normal; }

.nav-links { display: flex; gap: 28px; list-style: none; }
.nav-links a {
  font-size: 14px; color: var(--muted); text-decoration: none;
  font-weight: 500; transition: color .18s;
}
.nav-links a:hover { color: var(--text); }

.nav-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
#factory-btn { display: none; }

/* ══════════════════════════════════════════════
   HERO
   ══════════════════════════════════════════════ */
.hero {
  position: relative; z-index: 1;
  min-height: 88vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 80px 24px 100px;
  overflow: hidden;
}

/* Background radial glow */
.hero::before {
  content: '';
  position: absolute; top: -10%; left: 50%; transform: translateX(-50%);
  width: 700px; height: 700px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,107,53,.07) 0%, transparent 65%);
  pointer-events: none;
}

/* SVG geo */
.hero-geo {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -60%);
  width: 480px; height: 480px; pointer-events: none;
}
.geo-svg { width: 100%; height: 100%; }

.hero-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  max-width: 800px;
}

/* Eyebrow tag */
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; padding: 6px 18px; border-radius: 100px;
  background: var(--w04); color: var(--w72);
  border: 1px solid var(--border2);
}
.eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--orange); box-shadow: 0 0 8px var(--orange);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

/* Headline */
.hero-headline {
  font-size: clamp(40px, 6.5vw, 76px);
  font-weight: 900; line-height: 1.05;
  letter-spacing: -.035em; color: var(--text);
}
.hero-headline .line { display: block; }

/* 타이핑 줄 — 레이아웃 고정 (높이 변화 방지) */
.typed-line {
  display: block;
  min-height: 1.1em;       /* 한 줄 높이 고정 */
  white-space: nowrap;     /* 줄바꿈 방지 */
  overflow: hidden;
}

.hl-orange {
  background: linear-gradient(135deg, var(--orange), #ffad84);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hl-white { color: var(--white); }

/* Cursor blink */
.cursor-blink {
  display: inline-block; width: 3px; height: .8em;
  background: var(--orange); margin-left: 2px; vertical-align: middle;
  animation: cur-blink .75s step-end infinite;
  /* cursor는 gradient clip 영향 안 받게 */
  -webkit-text-fill-color: var(--orange);
  background: var(--orange);
}
@keyframes cur-blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* Subhead */
.hero-sub {
  font-size: 17px; color: var(--w56); line-height: 1.75;
  max-width: 480px; font-weight: 400;
}

/* Stats pill */
.hero-stats {
  display: flex; gap: 40px;
  padding: 24px 48px; border-radius: 20px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border2);
  backdrop-filter: blur(12px);
}
.stat { text-align: center; }
.stat-n {
  font-size: 38px; font-weight: 900; line-height: 1;
  letter-spacing: -.04em; color: var(--white);  /* 흰색 */
}
.stat-l {
  font-size: 10px; font-weight: 600; color: var(--muted);
  margin-top: 5px; letter-spacing: .1em; text-transform: uppercase;
}

/* ══════════════════════════════════════════════
   SEARCH & FILTERS
   ══════════════════════════════════════════════ */
.search-section {
  position: relative; z-index: 2;
  max-width: 920px; margin: 0 auto; padding: 0 24px 28px;
}
.search-wrap { position: relative; margin-bottom: 14px; }
.search-icon {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  font-size: 16px; color: var(--muted); pointer-events: none;
}
.search-input {
  width: 100%; background: var(--w04);
  border: 1px solid var(--border2);
  border-radius: 14px; color: var(--text);
  font-family: var(--font); font-size: 15px;
  padding: 15px 20px 15px 50px; outline: none;
  transition: border-color .22s, box-shadow .22s;
}
.search-input:focus {
  border-color: rgba(255,255,255,.25);
  box-shadow: 0 0 0 3px rgba(255,255,255,.04);
}
.search-input::placeholder { color: var(--muted); }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ftag {
  font-size: 13px; font-weight: 500; padding: 7px 18px; border-radius: 100px;
  cursor: pointer; border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  font-family: var(--font); transition: all .18s;
}
.ftag:hover { border-color: var(--border2); color: var(--text2); }
/* 활성 탭: 흰색 테두리 + 흰색 텍스트 (오렌지 X) */
.ftag.active { background: var(--w08); border-color: var(--border2); color: var(--white); }

.filter-select {
  margin-left: auto; background: var(--w04);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text2); font-family: var(--font); font-size: 13px;
  padding: 8px 14px; outline: none; cursor: pointer;
  transition: border-color .18s;
}
.filter-select:focus { border-color: rgba(255,107,53,.4); }
.filter-select option { background: var(--card); }

/* ══════════════════════════════════════════════
   GAME GRID
   ══════════════════════════════════════════════ */
.grid-section {
  position: relative; z-index: 2;
  max-width: 1160px; margin: 0 auto; padding: 0 24px 100px;
}
.grid-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.grid-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.grid-count { font-size: 13px; color: var(--muted); }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(204px, 1fr));
  gap: 16px;
}

/* ══════════════════════════════════════════════
   GAME CARDS
   ══════════════════════════════════════════════ */
.game-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; overflow: hidden;
  cursor: pointer; position: relative;
  display: flex; flex-direction: column;
  transform-style: preserve-3d;
  transition: border-color .22s, box-shadow .22s;
}
.game-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: rgba(255,255,255,.02);
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.game-card:hover::before { opacity: 1; }
.game-card:hover {
  border-color: var(--border2);
  box-shadow: 0 16px 50px rgba(0,0,0,.3);
}
.game-card.locked { opacity: .45; cursor: not-allowed; filter: grayscale(.5); }
.game-card.locked:hover { border-color: var(--border); box-shadow: none; }

/* Shine overlay (3D tilt) */
.card-shine {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%),
    rgba(255,255,255,.06) 0%, transparent 55%);
  opacity: 0; transition: opacity .25s;
}
.game-card:hover .card-shine { opacity: 1; }

/* Thumb */
.card-thumb {
  height: 100px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #100e20, #18101e);
  display: flex; align-items: center; justify-content: center;
}
.card-thumb-glow {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 80%, rgba(255,255,255,.04), transparent 60%);
}
.card-emoji {
  font-size: 36px; z-index: 1; position: relative;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255,255,255,.15));
}
.card-thumb::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 36px; background: linear-gradient(transparent, var(--card));
}
.card-lv-badge {
  position: absolute; bottom: 9px; left: 11px; z-index: 2;
  font-size: 9px; font-weight: 600; padding: 2px 9px; border-radius: 100px;
  background: rgba(0,0,0,.65); border: 1px solid var(--border2);
  color: var(--w72); backdrop-filter: blur(4px); letter-spacing: .04em;
}
.card-lock {
  position: absolute; top: 9px; right: 9px; z-index: 2;
  font-size: 13px; padding: 3px 7px; border-radius: 8px;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
}

/* Body */
.card-body {
  padding: 14px 16px; flex: 1;
  display: flex; flex-direction: column; gap: 5px;
}
.card-title    { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; letter-spacing: -.01em; }
.card-scenario { font-size: 11px; color: var(--muted); }
.card-tags     { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
/* 태그: 흰색 계열만 */
.ctag {
  font-size: 9px; font-weight: 600; padding: 2px 9px; border-radius: 100px;
  background: var(--w08); color: var(--w72);
  border: 1px solid var(--border); letter-spacing: .03em;
}
.ctag.blue  { background:rgba(59,130,246,.08); color:rgba(147,197,253,.9); border-color:rgba(59,130,246,.18); }
.ctag.pink  { background:rgba(244,114,182,.08);color:rgba(249,168,212,.9); border-color:rgba(244,114,182,.18); }
.ctag.green { background:rgba(74,222,128,.08); color:rgba(134,239,172,.9); border-color:rgba(74,222,128,.18); }

/* ── Empty state ── */
.empty-state {
  grid-column: 1/-1; text-align: center; padding: 80px 24px;
}
.empty-icon { font-size: 52px; margin-bottom: 16px; opacity: .35; }
.empty-text {
  font-size: 15px; color: var(--muted); line-height: 1.75;
  margin-bottom: 24px; font-weight: 400;
}

/* ══════════════════════════════════════════════
   GAME VIEWER MODAL
   ══════════════════════════════════════════════ */
.viewer {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.97); flex-direction: column;
}
.viewer.open { display: flex; animation: viewer-in .18s ease; }
@keyframes viewer-in {
  from { opacity:0; transform:scale(.985); }
  to   { opacity:1; transform:scale(1); }
}
.viewer-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 22px; flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.viewer-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--white); opacity: .7;
  flex-shrink: 0;
}
.viewer-title {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.viewer-actions { display: flex; gap: 8px; }
#game-iframe { flex: 1; border: none; width: 100%; }

/* ── Responsive ── */
@media (max-width: 680px) {
  .nav { padding: 0 20px; gap: 18px; }
  .nav-links { display: none; }
  .hero-stats { gap: 22px; padding: 20px 28px; }
  .stat-n { font-size: 28px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; }
  .hero-geo { width: 260px; height: 260px; }
  .hero-headline { font-size: 38px; }
}
