/* 로비: 밝은 스티커 아케이드.
   규칙: 테두리 2.5px 잉크, 그림자는 번짐 없는 4px 오프셋.
   모서리: 카드 18px, 버튼·입력 12px, 태그 999px.
   색: 카드 분류색(노랑=보드, 분홍=심리, 민트=감각, 파랑=그림·말) + 주 버튼은 잉크. */
:root {
  --paper: #f3f2ee;
  --card: #fffffb;
  --ink: #17171c;
  --ink-2: #45454f;
  --muted: #6a6a74;
  --yellow: #ffd43b;
  --pink: #ff9ccf;
  --mint: #7ee3bb;
  --blue: #8fb8ff;
  --danger: #e5484d;
  --ok: #1f9d55;
  --bw: 2.5px;
  --shadow: 4px 4px 0 var(--ink);
  --r-card: 18px;
  --r-ctl: 12px;
  --display: "Black Han Sans", "Pretendard Variable", sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: calc(100 * var(--vh, 1dvh));
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(23, 23, 28, 0.11) 1px, transparent 1.2px);
  background-size: 22px 22px;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.card {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}

/* 상단 */
.topbar {
  max-width: 1160px;
  margin: 0 auto;
  height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: var(--display);
  font-size: 24px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.logo span {
  background: var(--yellow);
  border: var(--bw) solid var(--ink);
  border-radius: 10px;
  padding: 0 8px;
  transform: rotate(-3deg);
  box-shadow: 2px 2px 0 var(--ink);
}
.creator {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 14px; text-decoration: none;
  background: var(--card);
  border: var(--bw) solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: 2px 2px 0 var(--ink);
}
.creator .ti { font-size: 18px; color: #e5484d; }

.lobby { max-width: 1160px; margin: 0 auto; padding: 8px 24px 72px; }

/* 히어로 */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 48px;
  align-items: center;
  padding: 24px 0 56px;
}
.hero h1 {
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(56px, 8vw, 104px);
  line-height: 1.02;
  letter-spacing: -0.01em;
}
.hero mark {
  background: none;
  color: inherit;
  position: relative;
  z-index: 0;
}
.hero mark::after {
  content: "";
  position: absolute;
  left: -4px; right: -6px; bottom: 6%; height: 38%;
  background: var(--yellow);
  z-index: -1;
  transform: rotate(-1.5deg);
}
.hero-copy p { margin: 0; font-size: 18px; font-weight: 500; color: var(--ink-2); max-width: 30ch; }
.hero-stickers { list-style: none; margin: 32px 0 0; padding: 0; display: flex; gap: 14px; }
.hero-stickers li {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border: var(--bw) solid var(--ink);
  border-radius: 16px;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 28px;
}
.hero-stickers li:nth-child(1) { transform: rotate(-8deg); }
.hero-stickers li:nth-child(2) { transform: rotate(5deg) translateY(6px); }
.hero-stickers li:nth-child(3) { transform: rotate(-3deg); }
.hero-stickers li:nth-child(4) { transform: rotate(9deg) translateY(4px); }
.s-yellow { background: var(--yellow); }
.s-pink { background: var(--pink); }
.s-mint { background: var(--mint); }
.s-blue { background: var(--blue); }

/* 시작 카드 */
.start { padding: 22px; display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 800; }
.optional { font-weight: 600; color: var(--muted); margin-left: 4px; }
.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--card);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-ctl);
  font-weight: 600;
  outline: none;
  transition: box-shadow .15s var(--ease);
}
.input::placeholder { color: var(--muted); font-weight: 500; }
.input:focus { box-shadow: 3px 3px 0 var(--blue); }
.code-input { text-transform: uppercase; letter-spacing: 0.14em; }
.code-input::placeholder { letter-spacing: 0; text-transform: none; }

.tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-ctl);
  overflow: hidden;
}
.tab {
  height: 42px; border: 0; background: var(--card);
  font-weight: 800; color: var(--muted);
}
.tab + .tab { border-left: var(--bw) solid var(--ink); }
.tab.active { background: var(--ink); color: var(--card); }
.pane { display: grid; gap: 14px; }
.pane[hidden] { display: none; }

.picked {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--yellow);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-ctl);
}
.picked span { font-size: 12px; font-weight: 800; }
.picked strong { font-family: var(--display); font-weight: 400; font-size: 20px; flex: 1; }
.picked a { font-size: 13px; font-weight: 800; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segment {
  height: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-ctl);
  background: var(--card);
  font-weight: 700; color: var(--ink-2);
}
.segment.active { background: var(--blue); color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }

.btn {
  height: 52px;
  padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-ctl);
  font-weight: 800; font-size: 16px;
  white-space: nowrap;
  box-shadow: var(--shadow);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--card); }
.btn-secondary { background: var(--card); color: var(--ink); height: 46px; font-size: 15px; }
.btn .ti { font-size: 20px; }

/* 게임 목록 */
.catalog h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.1;
}
.catalog-sub { margin: 0 0 24px; color: var(--ink-2); font-weight: 500; max-width: 52ch; }
.game-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.game-card {
  position: relative;
  text-align: left;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 6px;
  min-height: 190px;
  padding: 18px;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.game-card:hover { transform: translate(-2px, -2px) rotate(-0.6deg); box-shadow: 6px 6px 0 var(--ink); }
.game-card:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.c-yellow { background: var(--yellow); }
.c-pink { background: var(--pink); }
.c-mint { background: var(--mint); }
.c-blue { background: var(--blue); }
.game-card > .ti {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  font-size: 28px;
  background: var(--card);
  border: var(--bw) solid var(--ink);
  border-radius: 14px;
  margin-bottom: 6px;
}
.game-card strong { font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.15; }
.desc { font-size: 14px; font-weight: 500; line-height: 1.4; }
.meta {
  justify-self: start;
  font-size: 12px; font-weight: 800;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 9px;
}
.game-card.selected { box-shadow: 0 0 0 4px var(--card), 0 0 0 7px var(--ink); }
.game-card.selected::after {
  content: "선택됨";
  position: absolute; top: -12px; right: 14px;
  font-size: 12px; font-weight: 800;
  color: var(--card); background: var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  transform: rotate(4deg);
}

/* 대회 우승자 */
.winner {
  margin-top: 56px;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  align-items: center;
  padding: 16px;
  max-width: 520px;
}
.winner-banner img { display: block; width: 100%; height: auto; border-radius: 10px; border: 2px solid var(--ink); }
.winner-text { display: grid; gap: 10px; }
.winner h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.2; }
.winner-profile { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; }
.winner-profile:hover { text-decoration: underline; }
.winner-profile img { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--ink); object-fit: cover; }

/* 토스트 */
.toast-container { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 10px; }
.toast {
  max-width: 340px;
  padding: 12px 16px;
  background: var(--card);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-ctl);
  box-shadow: var(--shadow);
  font-weight: 700;
}
.toast.error { background: #ffd6d6; }
.toast.success { background: var(--mint); }

@media (prefers-reduced-motion: no-preference) {
  .hero-copy, .start { animation: pop .5s var(--ease) both; }
  .start { animation-delay: .08s; }
  .game-card { animation: pop .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms + 150ms); }
  @keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .game-card { transition: none; }
}

@media (max-width: 1023px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-bottom: 40px; }
  .start { max-width: 520px; }
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .topbar { padding: 0 16px; height: 64px; }
  .logo { font-size: 20px; }
  .creator { font-size: 13px; padding: 4px 10px; }
  .lobby { padding: 0 16px 56px; }
  .hero { padding-top: 8px; }
  .hero h1 { font-size: 60px; }
  .hero-copy p { font-size: 16px; }
  .hero-stickers { margin-top: 22px; }
  .hero-stickers li { width: 48px; height: 48px; font-size: 24px; }
  .start { padding: 18px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .game-card { min-height: 170px; padding: 14px; }
  .game-card strong { font-size: 19px; }
  .desc { font-size: 13px; }
  .winner { grid-template-columns: 110px 1fr; }
  .toast-container { left: 16px; right: 16px; }
  .toast { max-width: none; }
}

/* 대표·신규 게임은 두 칸. 카드 수 + 두 칸 카드 수 = 4의 배수가 되게 맞출 것 (지금 14장 + 2 = 16칸) */
@media (min-width: 768px) {
  .game-card.wide { grid-column: span 2; }
  .game-card.wide .desc { font-size: 15px; }
}
.game-card.is-new::before {
  content: "NEW";
  position: absolute; top: -12px; left: 14px;
  font-size: 12px; font-weight: 800;
  color: var(--ink); background: var(--pink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 9px;
  transform: rotate(-4deg);
}

/* 고해상도 모니터: 방 화면(style.css)과 같은 단계로 통째로 확대 */
@supports (zoom: 2) { /* zoom 미지원 브라우저(구형 파이어폭스)는 확대·높이 보정 모두 건너뜀 */
  @media (min-width: 2400px) and (min-height: 1250px) { :root { zoom: 1.25; --vh: calc(1dvh / 1.25); } }
  @media (min-width: 3000px) and (min-height: 1600px) { :root { zoom: 1.5; --vh: calc(1dvh / 1.5); } }
  @media (min-width: 3600px) and (min-height: 1900px) { :root { zoom: 2; --vh: calc(1dvh / 2); } }
  @media (min-width: 5000px) and (min-height: 2600px) { :root { zoom: 2.5; --vh: calc(1dvh / 2.5); } }
}
