/* WebGame8bit Portal — Steam/OP.GG 벤치마킹 */

:root {
  /* 색상: 차콜 네이비 다크 (Steam 참고) */
  --bg: #1b2838;
  --bg2: #213044;
  --bg3: #2a475e;
  --bg-card: #1e3044;
  --bg-hover: #2a475e;

  /* 텍스트 */
  --fg: #c7d5e0;
  --fg2: #8f98a0;
  --fg-bright: #ffffff;

  /* 강조: 티얼 블루 (Steam 할인 뱃지 느낌) */
  --accent: #66c0f4;
  --accent-dark: #4a9ac9;
  --accent-hover: #89d4ff;

  /* 시맨틱 */
  --green: #4caf50;
  --red: #e74c3c;
  --yellow: #f1c40f;
  --orange: #e67e22;

  /* 기본 */
  --radius: 4px;
  --radius-lg: 8px;
  --shadow: 0 2px 4px rgba(0,0,0,0.3);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
  --font: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Malgun Gothic', 'Segoe UI', sans-serif;
  --font-mono: 'Consolas', 'SF Mono', monospace;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; }

/* ── Layout ── */
#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Header ── */
.header {
  background: linear-gradient(to right, #171a21, #1b2838);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0 1.5rem;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-size: 1rem; font-weight: 700; line-height: 1; }

/* ── Logo SVG + Glitter ── */
.logo-link { display: inline-flex; align-items: center; }
.logo-svg { height: 24px; width: auto; }
.logo-shine-text {
  animation: logo-glitter 3s ease-in-out infinite;
}
@keyframes logo-glitter {
  0% { opacity: 0; }
  40% { opacity: 0; }
  50% { opacity: 1; }
  60% { opacity: 0; }
  100% { opacity: 0; }
}
.logo-link:hover .logo-svg text:first-of-type { fill: #a8e6ff; }
.logo-link:hover .logo-svg line { opacity: 0.7; }
.header nav { display: flex; gap: 0.25rem; align-items: center; }
.header nav a {
  color: var(--fg2);
  font-size: 0.85rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.header nav a:hover { color: var(--fg-bright); background: rgba(255,255,255,0.06); }
.header nav a.active { color: var(--accent); background: rgba(102,192,244,0.1); }

/* ── Main content ── */
.main {
  flex: 1;
  padding: 1.25rem;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  overflow-x: hidden;
}

/* ── Pages (SPA) ── */
.page { display: none; }
.page.active { display: block; }

/* ── Forms ── */
.form-group { margin-bottom: 0.9rem; }
.form-group label { display: block; color: var(--fg2); font-size: 0.8rem; margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 0.9rem;
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0,0,0,0.35);
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  background: linear-gradient(to right, #47bfff, #1a9fff);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { background: linear-gradient(to right, #66d1ff, #47bfff); box-shadow: var(--shadow); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--fg);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: rgba(102,192,244,0.05); }

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.card h3 { color: var(--fg-bright); font-size: 1rem; margin-bottom: 0.5rem; }

/* ── Game grid (Steam 스타일) ── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.game-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid rgba(255,255,255,0.04);
}
.game-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(102,192,244,0.3);
}
.game-card .thumb {
  height: 100px;
  background: linear-gradient(135deg, var(--bg3), var(--bg));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.game-card .thumb span { font-size: 1.8rem; color: var(--fg2); }
.game-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.game-card .info { padding: 0.6rem 0.7rem; }
.game-card .info h4 { font-size: 0.85rem; color: var(--fg-bright); margin-bottom: 0.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card .info .genre { font-size: 0.75rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; }

/* Admin card (홈 하단) */
.admin-card .thumb { background: linear-gradient(135deg, #2a475e, #1b2838); }

/* ── Landing sections ── */
.landing-section { margin-bottom: 1.75rem; }
.landing-section h2 {
  font-size: 1.1rem;
  color: var(--fg-bright);
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* ── Doc list (인벤 스타일 리스트) ── */
.doc-list { display: flex; flex-direction: column; gap: 0.35rem; }
.doc-item {
  padding: 0.55rem 0.75rem;
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.12s;
}
.doc-item:hover { background: var(--bg-hover); border-color: rgba(102,192,244,0.2); }
.doc-title { font-size: 0.9rem; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.doc-meta { font-size: 0.75rem; color: var(--fg2); white-space: nowrap; margin-left: 1rem; flex-shrink: 0; }
.doc-badge { font-size: 0.65rem; background: var(--accent); color: #fff; padding: 1px 6px; border-radius: 2px; text-transform: uppercase; letter-spacing: 0.3px; }
.pin { font-size: 0.8rem; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 999; padding: 1rem; }
.modal-content {
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.5rem;
}
.modal-header h3 { color: var(--fg-bright); margin-bottom: 0.25rem; }
.modal-date { font-size: 0.8rem; color: var(--fg2); }
.modal-body { margin: 1rem 0; line-height: 1.8; color: var(--fg); }
.modal-body h2, .modal-body h3 { color: var(--accent); margin: 1rem 0 0.5rem; }
.modal-body ul, .modal-body ol { margin-left: 1.5rem; }
.modal-body li { margin-bottom: 0.3rem; }
.modal-close-btn { margin-top: 1rem; }

/* ── Chat ── */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - 140px); }
.chat-messages { flex: 1; overflow-y: auto; padding: 0.75rem 0; }
.chat-msg { margin-bottom: 0.5rem; padding: 0.3rem 0; }
.chat-msg .nick { color: var(--accent); font-size: 0.8rem; font-weight: 600; }
.chat-msg .text { color: var(--fg); font-size: 0.9rem; margin-left: 0.3rem; word-break: break-word; }
.chat-msg .time { color: var(--fg2); font-size: 0.7rem; margin-left: 0.4rem; }
.chat-input { display: flex; gap: 0.5rem; padding-top: 0.75rem; border-top: 1px solid rgba(255,255,255,0.08); }
.chat-input input { flex: 1; min-width: 0; }

/* ── Auth ── */
.auth-box { max-width: 360px; margin: 2.5rem auto; }
.auth-box h2 { text-align: center; margin-bottom: 1.5rem; color: var(--accent); font-size: 1.3rem; }
.auth-toggle { text-align: center; margin-top: 1rem; color: var(--fg2); font-size: 0.85rem; }

/* ── Status dot ── */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--red); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius);
  background: var(--bg3);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--fg-bright);
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s;
  z-index: 1000;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Footer (3-column) ── */
.site-footer {
  background: #171a21;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 0.75rem 1.5rem;
  margin-top: auto;
}
.footer-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1000px;
  margin: 0 auto;
}
.footer-left { flex-shrink: 0; }
.footer-copyright { color: var(--fg2); font-size: 0.7rem; opacity: 0.6; }
.footer-center { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.footer-center a { color: rgba(255,255,255,0.25); font-size: 0.7rem; transition: color 0.15s; }
.footer-center a:hover { color: var(--fg2); }
.footer-sep { color: rgba(255,255,255,0.12); font-size: 0.6rem; }
.footer-right { flex-shrink: 0; }
.footer-right select {
  background: rgba(255,255,255,0.05);
  color: var(--fg2);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 2px 6px;
  font-size: 0.75rem;
  cursor: pointer;
}
.footer-right select:hover { border-color: rgba(255,255,255,0.15); }

/* ── Lang tabs ── */
.doc-lang-tab { font-size: 0.78rem; padding: 3px 10px; }
.doc-lang-tab.active { background: rgba(102,192,244,0.15); border-color: var(--accent); color: var(--accent); }

/* ── Tables (admin) ── */
table { width: 100%; border-collapse: collapse; }
table th { color: var(--fg2); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.5px; text-align: left; }
table th, table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid rgba(255,255,255,0.06); }
table tbody tr:hover { background: rgba(255,255,255,0.03); }

/* ══════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════ */

/* Mobile (< 640px) */
@media (max-width: 640px) {
  .header { padding: 0 0.75rem; height: 44px; }
  .header h1 { font-size: 0.9rem; }
  .header nav { gap: 0.15rem; }
  .header nav a { font-size: 0.78rem; padding: 0.3rem 0.45rem; }

  .main { padding: 0.75rem; }

  .game-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .game-card .thumb { height: 80px; }
  .game-card .info { padding: 0.45rem 0.5rem; }
  .game-card .info h4 { font-size: 0.8rem; }

  .auth-box { margin: 1.5rem 0.5rem; }

  .doc-item { padding: 0.45rem 0.6rem; }
  .doc-title { font-size: 0.85rem; }

  .chat-container { height: calc(100vh - 110px); }
  .chat-input { flex-wrap: nowrap; }
  .chat-input input { font-size: 16px; /* iOS zoom 방지 */ }

  .modal-content { padding: 1rem; margin: 0.5rem; }

  .toast { bottom: 0.75rem; right: 0.75rem; left: 0.75rem; text-align: center; }

  .footer-grid { flex-direction: column; gap: 0.5rem; text-align: center; }
  .footer-center { order: -1; }

  .landing-section h2 { font-size: 0.95rem; }

  /* 테이블 가로 스크롤 */
  .card { overflow-x: auto; }
  table { min-width: 500px; }
}

/* Tablet (641 ~ 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  .game-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Desktop (> 1024px) */
@media (min-width: 1025px) {
  .main { max-width: 1000px; }
  .game-grid { grid-template-columns: repeat(4, 1fr); }
}
