/* 겜놀이터 공통 스타일 */
:root {
  --bg: #fff7ef;
  --ink: #1d1433;
  --muted: #6c6184;
  --card: #ffffff;
  --card2: #f6f1ff;
  --line: rgba(29, 20, 51, 0.1);
  --shadow: 0 12px 30px -12px rgba(110, 60, 200, 0.28);
  --blob1: rgba(255, 99, 160, 0.32);
  --blob2: rgba(255, 196, 0, 0.3);
  --blob3: rgba(64, 196, 255, 0.28);
  --ok: #12a150;
  --bad: #e5304f;
  /* 페이지마다 바꾸는 색 */
  --a1: #ff4d8d;
  --a2: #ff9f1c;
  --a3: #7c3aed;
  --adark: #b3135a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #120c21;
    --ink: #f6f1ff;
    --muted: #b8acd2;
    --card: #1f1736;
    --card2: #2a2047;
    --line: rgba(255, 255, 255, 0.12);
    --shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.7);
    --blob1: rgba(255, 64, 140, 0.2);
    --blob2: rgba(255, 170, 0, 0.13);
    --blob3: rgba(64, 160, 255, 0.18);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(42% 30% at 8% 6%, var(--blob1), transparent 70%),
    radial-gradient(40% 28% at 96% 22%, var(--blob2), transparent 70%),
    radial-gradient(48% 34% at 30% 98%, var(--blob3), transparent 70%);
}
button, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--a1); outline-offset: 2px; }

.wrap { max-width: 480px; margin: 0 auto; padding: 10px 16px 8px; }

/* 맨 위 돌아가기 */
.top { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 10px; }
.back {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; font-weight: 800; font-size: 15px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.back:active { transform: scale(0.95); }
.top .pill { font-size: 13px; font-weight: 700; color: var(--muted); }

/* 머리 카드 */
.hero {
  position: relative; overflow: hidden;
  border-radius: 28px; padding: 18px 20px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--a1), var(--a2) 60%, var(--a3));
  box-shadow: 0 16px 30px -14px var(--a1);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16); pointer-events: none;
}
.hero::before { width: 180px; height: 180px; right: -50px; top: -70px; }
.hero::after { width: 110px; height: 110px; right: 60px; bottom: -60px; }
.hero .row { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.hero .emoji {
  font-size: 54px; line-height: 1; flex: none;
  display: inline-block; transform-origin: 50% 80%;
  animation: wobble 2.8s ease-in-out infinite;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.18));
}
.hero .eyebrow {
  display: inline-block; margin: 0 0 2px; padding: 2px 10px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.24);
  font-size: 12.5px; font-weight: 800;
}
.hero h1 { margin: 2px 0 0; font-size: clamp(24px, 7vw, 30px); line-height: 1.15; font-weight: 900; letter-spacing: -0.02em; }
.hero .lead { position: relative; z-index: 1; margin: 10px 0 0; font-size: 15px; font-weight: 600; opacity: 0.95; }

/* 판 */
.panel {
  margin-top: 16px; padding: 18px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 24px; box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 12px; font-size: 18px; font-weight: 900; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.panel h2 .count { margin-left: auto; font-size: 13px; font-weight: 800; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

/* 버튼 */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 16px; border-radius: 18px;
  font-weight: 800; font-size: 16px;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s, opacity 0.2s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-main {
  width: 100%; min-height: 60px; font-size: 20px; color: #fff;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  box-shadow: 0 6px 0 var(--adark), 0 14px 26px -10px var(--a1);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.btn-main:not(:disabled):active { transform: translateY(5px); box-shadow: 0 1px 0 var(--adark), 0 6px 14px -8px var(--a1); }
.btn-soft { background: var(--card2); color: var(--ink); border: 1px solid var(--line); }
.btn-soft:not(:disabled):active { transform: scale(0.94); }
.btn-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.btn-row .btn { min-height: 46px; padding: 10px 6px; font-size: 15px; }
.btn-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* 칩 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none; cursor: pointer;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; min-height: 42px;
  font-weight: 800; font-size: 15px;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
  touch-action: manipulation;
}
.chip:active { transform: scale(0.92); }
.chip[aria-pressed="true"] {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--a1), var(--a2));
  box-shadow: 0 6px 14px -8px var(--a1);
  animation: pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 진행 막대 */
.bar { height: 14px; border-radius: 999px; background: var(--card2); overflow: hidden; border: 1px solid var(--line); }
.bar > i {
  display: block; height: 100%; width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--a1), var(--a2), var(--a3));
  transition: width 0.45s cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* 알림 */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 60;
  transform: translate(-50%, 30px); opacity: 0;
  max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 999px;
  background: #1d1433; color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
  pointer-events: none; text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
@media (prefers-color-scheme: dark) { .toast { background: #fff; color: #1d1433; } }

/* 친구 결과 안내 */
.notice {
  margin-top: 14px; padding: 12px 14px; border-radius: 18px;
  background: var(--card2); border: 2px dashed var(--a1);
  font-weight: 700; font-size: 14.5px;
}

/* 빈 목록 */
.empty { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* 저장 목록 */
.saved { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.saved li {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 10px 10px 14px; border-radius: 16px;
  background: var(--card2); border: 1px solid var(--line);
  font-weight: 700; font-size: 14.5px;
  animation: rise 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.saved li > span { flex: 1; min-width: 0; }
.x {
  appearance: none; border: 0; cursor: pointer; flex: none;
  width: 36px; height: 36px; border-radius: 12px;
  background: transparent; color: var(--muted); font-size: 18px; font-weight: 900;
}
.x:active { transform: scale(0.9); }

/* 공통 꼬리 */
footer { max-width: 480px; margin: 34px auto 0; padding: 0 16px 44px; text-align: center; }
footer > p:first-of-type {
  margin: 0; padding: 18px 16px;
  border-radius: 22px; color: #fff;
  background: linear-gradient(135deg, #6a4cff, #ff6fa5);
  box-shadow: 0 14px 28px -14px #6a4cff;
  font-size: 15.5px; font-weight: 600; line-height: 1.55;
}
footer > p:first-of-type b { display: block; font-size: 21px; font-weight: 900; margin-bottom: 4px; }
footer > p:nth-of-type(2) { margin: 12px 0 0; }
footer > p:nth-of-type(2) a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 22px; border-radius: 999px;
  background: var(--card); border: 2px solid #ff6fa5;
  font-weight: 900; text-decoration: none; color: var(--ink);
}
footer > p:nth-of-type(2) a:active { transform: scale(0.95); }
footer .fine { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }

/* 움직임 */
@keyframes wobble {
  0%, 100% { transform: rotate(-6deg) scale(1); }
  50% { transform: rotate(6deg) scale(1.06); }
}
@keyframes pop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes jelly {
  0% { transform: scale(1, 1); }
  30% { transform: scale(1.08, 0.92); }
  50% { transform: scale(0.95, 1.05); }
  70% { transform: scale(1.03, 0.97); }
  100% { transform: scale(1, 1); }
}
.jelly { animation: jelly 0.5s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
