/* ===== 기본 ===== */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2330;
  --muted: #646b7d;
  --line: #e3e6ee;
  --accent: #4f6bed;
  --radius: 14px;
  --shadow: 0 2px 8px rgba(20, 30, 60, 0.06);
  --shadow-hover: 0 10px 24px rgba(20, 30, 60, 0.12);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  line-height: 1.6;
  word-break: keep-all;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.message {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  font-size: 1.05rem;
}

/* ===== 메인: 헤더 ===== */
.site-header {
  padding: 40px 0 24px;
}

.site-title {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.site-title a { color: inherit; text-decoration: none; }

.site-intro {
  margin: 0;
  color: var(--muted);
}

main { flex: 1; }

/* ===== 메인: 게임 카드 격자 ===== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  padding-bottom: 48px;
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.game-card:hover,
.game-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.game-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card-thumb {
  aspect-ratio: 16 / 10;
  background: #e9ecf5;
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 썸네일을 못 불러왔을 때 대신 보이는 영역 */
.thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  background: linear-gradient(135deg, #6a82fb, #a77bf3);
}

.card-body { padding: 14px 16px 18px; }

.card-title {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

/* ===== 버튼 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.btn:hover { background: #eef1f8; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover { background: #3d58d6; }

.btn-large { padding: 12px 28px; font-size: 1.05rem; }

.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ===== 메인: 헤더 안 제목 + 제출 버튼 ===== */
.header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ===== 제출 페이지 ===== */
.submit-page {
  max-width: 820px;
  padding-top: 24px;
  padding-bottom: 56px;
}

.submit-lead {
  margin: 0 0 20px;
  font-size: 1.05rem;
}

.notice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.notice-warn { border-left: 4px solid #e8664a; }

.notice h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.notice p { margin: 0 0 8px; }

.notice ul,
.notice ol {
  margin: 0;
  padding-left: 1.3em;
}

.notice li { margin-bottom: 6px; }

.notice code {
  background: #eef1f8;
  padding: 1px 6px;
  border-radius: 6px;
}

.note {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 8px 0 0;
}

.submit-box {
  text-align: center;
  padding: 24px 16px 0;
}

.agree {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  cursor: pointer;
  font-weight: 600;
}

.agree input { width: 18px; height: 18px; }

/* ===== 플레이 페이지 ===== */
.play-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.play-title {
  flex: 1;
  margin: 0;
  font-size: 1.15rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-main {
  display: flex;
  flex-direction: column;
}

.frame-wrap {
  width: 100%;
  max-width: 1400px;
  margin: 12px auto 0;
  padding: 0 12px;
}

.frame-wrap iframe {
  display: block;
  width: 100%;
  /* 상단 바를 뺀 화면 대부분을 차지 */
  height: calc(100vh - 90px);
  height: calc(100dvh - 90px);
  min-height: 360px;
  border: 0;
  border-radius: var(--radius);
  background: #000;
  box-shadow: var(--shadow);
}

.exit-fs { display: none; }

/* 전체화면 API를 쓸 수 없는 기기(아이폰 등)용 대체 전체화면 */
.frame-wrap.pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100;
  max-width: none;
  margin: 0;
  padding: 0;
  background: #000;
}

.frame-wrap.pseudo-fullscreen iframe {
  height: 100%;
  min-height: 0;
  border-radius: 0;
}

.frame-wrap.pseudo-fullscreen .exit-fs {
  display: inline-flex;
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0.85;
}

body.no-scroll { overflow: hidden; }

.game-info {
  padding-top: 20px;
  padding-bottom: 48px;
  max-width: 900px;
}

.game-info h2 {
  margin: 16px 0 6px;
  font-size: 1.05rem;
}

.game-info p {
  margin: 0;
  color: var(--muted);
  white-space: pre-line;
}

/* ===== 모바일 ===== */
@media (max-width: 600px) {
  .site-header { padding: 28px 0 16px; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .card-body { padding: 10px 12px 14px; }
  .card-title { font-size: 1rem; }
  .card-desc { font-size: 0.85rem; }

  .play-bar { gap: 8px; padding: 8px 10px; }
  .play-bar .btn { padding: 6px 10px; font-size: 0.85rem; }
  .play-title { font-size: 1rem; }
  .frame-wrap { padding: 0 6px; margin-top: 6px; }
  .frame-wrap iframe {
    height: calc(100vh - 70px);
    height: calc(100dvh - 70px);
    border-radius: 10px;
  }
}
