/* ==========================================================
   เกมของเราสองคน — ธีมพาสเทลน่ารัก
   ========================================================== */

:root {
  --pink: #ff8fb1;
  --pink-deep: #f05a86;
  --pink-ink: #a82a58;
  --lav: #b6a4ff;
  --mint: #7fdcc0;
  --sun: #ffd479;
  --sky: #8fc9ff;
  --coral: #ff9e7d;

  --cream: #fff7fa;
  --card: #ffffff;
  --ink: #4a3b45;
  --muted: #77636c;
  --line: #ffe1ea;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 28px rgba(240, 90, 134, 0.14);
  --shadow-lg: 0 18px 44px rgba(240, 90, 134, 0.22);
  --font: "Mali", "Itim", "Segoe UI", "Noto Sans Thai", sans-serif;
  --font-cute: "Itim", "Mali", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1000px 600px at 12% -5%, #ffe6f0 0%, rgba(255, 230, 240, 0) 60%),
    radial-gradient(900px 500px at 92% 4%, #e9e2ff 0%, rgba(233, 226, 255, 0) 55%),
    radial-gradient(800px 600px at 50% 100%, #e2fbf1 0%, rgba(226, 251, 241, 0) 60%),
    var(--cream);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--pink-deep);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- พื้นหลังหัวใจลอย ---------- */
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.sky span {
  position: absolute;
  bottom: -12vh;
  font-size: 22px;
  opacity: 0.45;
  animation-name: floatUp;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform;
}
@keyframes floatUp {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  12%  { opacity: 0.5; }
  100% { transform: translate3d(30px, -115vh, 0) rotate(28deg); opacity: 0; }
}

/* ---------- แถบบน ---------- */
.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px clamp(14px, 3vw, 30px);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-cute);
  font-size: 1.3rem;
  color: var(--pink-ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand-emoji { font-size: 1.5rem; }
.brand:hover .brand-text { text-decoration: underline wavy var(--pink); }

.score {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline: auto;
  font-size: 0.95rem;
}
.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid var(--line);
  max-width: 42vw;
}
.score-chip b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score-chip em {
  font-style: normal;
  font-weight: 700;
  color: var(--pink-ink);
  min-width: 1.2em;
  text-align: center;
}
.score-p2 { border-color: #dbe9ff; }
.score-p2 em { color: #2f6bb0; }
.score-vs { color: var(--muted); }
.score-chip.bump { animation: bump 0.45s ease; }
@keyframes bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.16) rotate(-2deg); }
  100% { transform: scale(1); }
}

.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  font-size: 1.1rem;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.icon-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.icon-btn:active { transform: scale(0.94); }

/* ---------- โครงหน้า ---------- */
.view {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 36px) clamp(14px, 4vw, 28px) 50px;
  flex: 1 0 auto;
}

.site-foot {
  position: relative;
  z-index: 2;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0 16px 26px;
}
.site-foot p { margin: 0; }

/* ---------- หน้าแรก ---------- */
.hero {
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 240, 246, 0.9));
  border: 2px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: clamp(22px, 5vw, 40px) 22px;
  margin-bottom: 26px;
}
.hero-kicker {
  margin: 0 0 6px;
  color: var(--pink-ink);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.hero h1 {
  font-family: var(--font-cute);
  font-size: clamp(1.7rem, 6vw, 2.7rem);
  margin: 0 0 10px;
  line-height: 1.25;
  word-break: break-word;
}
.hero h1 .amp {
  color: var(--pink-deep);
  margin: 0 6px;
  display: inline-block;
  animation: beat 1.6s ease-in-out infinite;
}
@keyframes beat {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.22); }
  60% { transform: scale(0.95); }
}
.hero-sub { margin: 0 auto 4px; color: var(--muted); max-width: 46ch; }
.hero-sub strong { color: var(--pink-ink); font-size: 1.15em; }
.hero-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
}
.section-head h2 {
  font-family: var(--font-cute);
  font-size: 1.35rem;
  margin: 0;
}
.section-head span { color: var(--muted); font-size: 0.9rem; }

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

.card {
  --accent: var(--pink);
  position: relative;
  text-align: left;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px 18px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: 0 6px 18px rgba(240, 90, 134, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
}
.card::after {
  content: "";
  position: absolute;
  inset: auto -30% -60% auto;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.16;
  transition: transform 0.35s ease;
}
.card:hover, .card:focus-visible {
  transform: translateY(-5px) rotate(-0.6deg);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}
.card:hover::after { transform: scale(1.25); }
.card:active { transform: translateY(-1px) scale(0.99); }
.card-emoji {
  font-size: 2.1rem;
  display: block;
  margin-bottom: 8px;
}
.card h3 {
  font-family: var(--font-cute);
  margin: 0 0 6px;
  font-size: 1.2rem;
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.card-tag {
  position: relative;
  display: inline-block;
  margin-top: 12px;
  font-size: 0.76rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fff4f8;
  color: var(--pink-ink);
  border: 1px solid var(--line);
}

/* ---------- ปุ่ม ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  padding: 11px 20px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  line-height: 1.3;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, #ff7aa8, #d63a70);
  color: #fff;
  box-shadow: 0 8px 20px rgba(214, 58, 112, 0.32);
}
.btn-ghost {
  background: #fff;
  color: var(--pink-ink);
  border-color: var(--line);
  box-shadow: 0 4px 14px rgba(240, 90, 134, 0.1);
}
.btn-quiet {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  text-decoration: underline;
}
.btn-mint {
  background: linear-gradient(135deg, #7fdcc0, #2f9c7c);
  color: #fff;
  box-shadow: 0 8px 20px rgba(47, 156, 124, 0.28);
}
.btn-lav {
  background: linear-gradient(135deg, #b6a4ff, #6a4fd8);
  color: #fff;
  box-shadow: 0 8px 20px rgba(106, 79, 216, 0.28);
}
.btn-sun {
  background: linear-gradient(135deg, #ffd479, #d98a00);
  color: #fff;
  box-shadow: 0 8px 20px rgba(217, 138, 0, 0.26);
}
.btn-block { display: block; width: 100%; }

/* ---------- แถบหัวเกม ---------- */
.game-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.game-bar h1 {
  font-family: var(--font-cute);
  font-size: clamp(1.3rem, 4.5vw, 1.8rem);
  margin: 0;
  flex: 1 1 auto;
}
.back-btn {
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 2px solid var(--line);
  color: var(--pink-ink);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}
.back-btn:hover { box-shadow: var(--shadow); }

/* ---------- แผงเกม ---------- */
.panel {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 4vw, 26px);
}
.panel + .panel { margin-top: 16px; }
.panel-soft {
  background: linear-gradient(135deg, #fffdfe, #fff4f8);
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.row-center { justify-content: center; }
.stack { display: grid; gap: 12px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.big { font-size: clamp(1.3rem, 5vw, 1.9rem); font-family: var(--font-cute); }
.mt { margin-top: 16px; }
.mb { margin-bottom: 12px; }
.hidden { display: none !important; }

.turn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff4f8;
  border: 2px solid var(--line);
  font-weight: 600;
  color: var(--pink-ink);
}
.turn.p2 { background: #eff5ff; border-color: #dbe9ff; color: #2f6bb0; }

.pill-score {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.pill {
  padding: 7px 14px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid var(--line);
  font-size: 0.92rem;
}
.pill b { color: var(--pink-ink); }
.pill.on {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 143, 177, 0.16);
}

.banner {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #fff0f6, #ffe6f0);
  border: 2px dashed var(--pink);
  text-align: center;
  font-family: var(--font-cute);
  font-size: 1.15rem;
}

.field { display: grid; gap: 6px; margin-bottom: 12px; font-size: 0.95rem; }
.field > span { color: var(--muted); }
.field input, .field textarea, .field select {
  font: inherit;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: #fffdfe;
  color: inherit;
  width: 100%;
}
.field input:focus, .field textarea:focus { border-color: var(--pink); outline: none; }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.6; }

/* ---------- XO ---------- */
.xo {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 330px;
  margin: 0 auto;
}
.xo button {
  aspect-ratio: 1 / 1;
  font-size: clamp(28px, 9vw, 42px);
  border-radius: 18px;
  border: 2px solid var(--line);
  background: #fffdfe;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.14s ease, background 0.2s ease;
}
.xo button:hover:not(:disabled) { transform: translateY(-3px); background: #fff4f8; }
.xo button:disabled { cursor: default; }
.xo button span { animation: pop 0.28s ease; display: block; }
.xo button.win {
  background: linear-gradient(135deg, #fff0f6, #ffdcea);
  border-color: var(--pink);
  animation: bump 0.5s ease;
}
@keyframes pop {
  0% { transform: scale(0.3); opacity: 0; }
  70% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); }
}

/* ---------- จับคู่ความจำ ---------- */
.mgrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 430px;
  margin: 0 auto;
}
.mcard {
  aspect-ratio: 3 / 4;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  perspective: 800px;
}
.mcard-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.mcard.flipped .mcard-inner { transform: rotateY(180deg); }
.mface {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-size: clamp(24px, 7vw, 36px);
}
.mface-back {
  background: linear-gradient(135deg, var(--pink), var(--lav));
  color: #fff;
  box-shadow: 0 6px 16px rgba(240, 90, 134, 0.22);
}
.mface-front {
  background: #fff;
  border: 2px solid var(--line);
  transform: rotateY(180deg);
}
.mcard.matched .mface-front {
  background: linear-gradient(135deg, #fff0f6, #ffe0ee);
  border-color: var(--pink);
  animation: bump 0.5s ease;
}
.mcard.matched { pointer-events: none; }

/* ---------- ความจริงหรือกล้าท้า ---------- */
.td-card {
  min-height: 170px;
  display: grid;
  place-items: center;
  padding: 26px 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, #ffffff, #fff4f8);
  border: 2px dashed var(--pink);
  text-align: center;
  font-family: var(--font-cute);
  font-size: clamp(1.1rem, 4vw, 1.45rem);
  line-height: 1.6;
  animation: pop 0.3s ease;
}
.td-card.dare { border-color: var(--sun); background: linear-gradient(135deg, #fffdf6, #fff6e2); }
.td-kind {
  display: inline-block;
  font-size: 0.8rem;
  font-family: var(--font);
  padding: 3px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--pink-ink);
  margin-bottom: 10px;
}

/* ---------- วงล้อ ---------- */
.wheel-wrap {
  position: relative;
  width: min(360px, 82vw);
  margin: 0 auto;
}
.wheel-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 50%;
  box-shadow: 0 14px 34px rgba(240, 90, 134, 0.25);
  background: #fff;
}
.wheel-pin {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 26px solid var(--pink-deep);
  filter: drop-shadow(0 3px 4px rgba(240, 90, 134, 0.35));
  z-index: 2;
}
.wheel-hub {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 54px; height: 54px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--pink);
  display: grid;
  place-items: center;
  font-size: 22px;
  box-shadow: var(--shadow);
}

/* ---------- เป่ายิ้งฉุบ ---------- */
.hand-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 5vw, 40px);
  margin: 10px 0 6px;
}
.hand {
  font-size: clamp(46px, 14vw, 78px);
  line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(240, 90, 134, 0.2));
}
.hand.shake { animation: shake 0.42s ease infinite; }
@keyframes shake {
  0%, 100% { transform: rotate(-14deg) translateY(0); }
  50% { transform: rotate(-14deg) translateY(-14px); }
}
.hand.mirror { transform: scaleX(-1); }
.hand-vs { font-family: var(--font-cute); color: var(--pink-deep); font-size: 1.4rem; }
.choices {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.choice {
  font: inherit;
  width: clamp(76px, 22vw, 104px);
  padding: 12px 6px;
  border-radius: 20px;
  border: 2px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: grid;
  gap: 4px;
  place-items: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.choice span:first-child { font-size: clamp(28px, 8vw, 38px); }
.choice small { color: var(--muted); }
.choice:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--pink); }

/* ---------- ควิซ ---------- */
.q-progress {
  height: 10px;
  border-radius: 999px;
  background: #ffe9f1;
  overflow: hidden;
  margin-bottom: 16px;
}
.q-progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--lav));
  transition: width 0.35s ease;
}
.q-title {
  font-family: var(--font-cute);
  font-size: clamp(1.15rem, 4.4vw, 1.5rem);
  margin: 0 0 14px;
  text-align: center;
}
.opts { display: grid; gap: 10px; }
.opt {
  font: inherit;
  text-align: left;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: #fffdfe;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.opt:hover { transform: translateX(4px); border-color: var(--pink); background: #fff4f8; }
.result-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: #fffdfe;
  text-align: left;
}
.result-line.hit { border-color: var(--mint); background: #f3fdf9; }
.result-line .rl-body { flex: 1; }
.result-line .rl-q { font-weight: 600; margin: 0 0 4px; }
.result-line .rl-a { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* ---------- เครื่องวัดความรัก ---------- */
.meter {
  height: 26px;
  border-radius: 999px;
  background: #ffe9f1;
  border: 2px solid var(--line);
  overflow: hidden;
  margin: 12px 0 6px;
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffb3c9, #f05a86);
  transition: width 1.1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.percent {
  font-family: var(--font-cute);
  font-size: clamp(2.4rem, 12vw, 4rem);
  color: var(--pink-deep);
  line-height: 1;
}

/* ---------- ตู้คำหวาน ---------- */
.sweet-card {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 26px 22px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 15% 15%, #fff3f8 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(135deg, #ffffff, #fff0f6);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
  font-family: var(--font-cute);
  font-size: clamp(1.15rem, 4.4vw, 1.55rem);
  line-height: 1.65;
  text-align: center;
  animation: pop 0.32s ease;
}

/* ---------- toast + confetti ---------- */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  display: grid;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 420px);
}
.toast {
  background: rgba(74, 59, 69, 0.94);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.95rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.toast.out { opacity: 0; transition: opacity 0.3s ease; }

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
  overflow: hidden;
}
.confetti span {
  position: absolute;
  top: -8vh;
  font-size: 22px;
  animation: fall linear forwards;
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(112vh) rotate(520deg); opacity: 0.9; }
}

/* ---------- dialog ตั้งค่า ---------- */
.sheet {
  border: 0;
  padding: 0;
  border-radius: 26px;
  width: min(430px, 92vw);
  box-shadow: var(--shadow-lg);
  background: var(--cream);
  color: var(--ink);
}
.sheet::backdrop { background: rgba(74, 59, 69, 0.42); backdrop-filter: blur(2px); }
.sheet-form { padding: 24px; margin: 0; }
.sheet-title {
  font-family: var(--font-cute);
  margin: 0 0 16px;
  font-size: 1.35rem;
}
.sheet-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.sheet-note { color: var(--muted); font-size: 0.82rem; margin: 14px 0 0; }

/* ---------- responsive ---------- */
@media (max-width: 620px) {
  .brand-text { display: none; }
  .score { order: 3; width: 100%; margin: 0; justify-content: center; }
  .score-chip { max-width: 38vw; }
  .topbar-actions { margin-left: auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card { padding: 16px 14px; }
  .card-emoji { font-size: 1.8rem; }
  .card h3 { font-size: 1.05rem; }
  .card p { font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .sky { display: none; }
}

/* ==========================================================
   ส่วนเพิ่ม: หมวดหมู่ + เกมชุดใหม่
   ========================================================== */

/* ---------- ชิปหมวดหมู่ ---------- */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.chip {
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 15px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.chip:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.chip.on {
  background: linear-gradient(135deg, #ff7aa8, #d63a70);
  color: #fff;
  border-color: transparent;
}

/* ---------- สนามแบ่งครึ่ง (คนละฝั่งจอ) ---------- */
.split {
  display: grid;
  gap: 10px;
  grid-template-rows: 1fr auto 1fr;
  min-height: min(66vh, 500px);
}
.split-half {
  border-radius: 22px;
  border: 3px solid var(--line);
  background: linear-gradient(160deg, #ffffff, #fff4f8);
  display: grid;
  place-items: center;
  padding: 14px;
  font: inherit;
  font-family: var(--font-cute);
  font-size: clamp(1.05rem, 4.4vw, 1.5rem);
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.split-half.top { transform: rotate(180deg); }
.split-half.blue { background: linear-gradient(160deg, #ffffff, #eff5ff); border-color: #dbe9ff; }
.split-half.go { background: linear-gradient(160deg, #ffe0ec, #ffb9d0); border-color: var(--pink-deep); }
.split-half.win { background: linear-gradient(160deg, #f1fff9, #c4f2e0); border-color: var(--mint); }
.split-half.bad { background: linear-gradient(160deg, #fff2f2, #ffd9d9); border-color: #ff9f9f; }
.split-half:active { filter: brightness(0.97); }
.split-mid {
  text-align: center;
  font-family: var(--font-cute);
  color: var(--pink-ink);
  font-size: 1.05rem;
}
.tap-count { display: block; font-size: clamp(1.9rem, 10vw, 3.2rem); line-height: 1.1; }

.race {
  height: 16px;
  border-radius: 999px;
  background: #ffe9f1;
  border: 2px solid var(--line);
  overflow: hidden;
  margin-top: 8px;
}
.race i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ffb3c9, #f05a86);
  transition: width 0.12s linear;
}
.race.blue i { background: linear-gradient(90deg, #b8d9ff, #3b7ec4); }

/* ---------- ตีหัวใจ ---------- */
.whack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 350px;
  margin: 0 auto;
}
.hole {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 3px solid var(--line);
  background: radial-gradient(circle at 50% 32%, #ffffff, #ffeaf2);
  display: grid;
  place-items: center;
  font-size: clamp(26px, 8vw, 40px);
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
}
.hole span { animation: pop 0.18s ease; }
.hole.hit {
  background: radial-gradient(circle at 50% 32%, #fff0f6, #ffc4da);
  border-color: var(--pink);
}
.hole.oops { background: radial-gradient(circle at 50% 32%, #fff2f2, #ffcccc); border-color: #ff9f9f; }

/* ---------- ปิงปองหัวใจ ---------- */
.pong-wrap { max-width: 340px; margin: 0 auto; }
.pong-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 20px;
  background: linear-gradient(180deg, #fff6fa, #f7f1ff);
  border: 3px solid var(--line);
  touch-action: none;
}

/* ---------- สล็อตทำนายรัก ---------- */
.slot { display: flex; gap: 10px; justify-content: center; margin: 4px 0 8px; }
.reel {
  width: clamp(62px, 20vw, 86px);
  height: clamp(78px, 24vw, 104px);
  border-radius: 18px;
  border: 3px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  font-size: clamp(32px, 10vw, 44px);
  box-shadow: inset 0 -6px 12px rgba(240, 90, 134, 0.08);
}
.reel.spin { animation: reelShake 0.12s linear infinite; }
@keyframes reelShake {
  0%, 100% { transform: translateY(-4px); }
  50% { transform: translateY(4px); }
}
.reel.hit {
  border-color: var(--pink);
  background: linear-gradient(135deg, #fff0f6, #ffe1ec);
  animation: bump 0.45s ease;
}

/* ---------- ขูดคูปองรัก ---------- */
.scratch {
  position: relative;
  width: min(420px, 100%);
  margin: 0 auto;
  aspect-ratio: 8 / 5;
}
.scratch-under {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background: linear-gradient(135deg, #ffffff, #fff0f6);
  border: 2px dashed var(--pink);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  font-family: var(--font-cute);
  font-size: clamp(1.05rem, 4.2vw, 1.4rem);
  line-height: 1.5;
}
.scratch canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 22px;
  touch-action: none;
  cursor: crosshair;
}
.coupon-list { display: grid; gap: 8px; margin-top: 12px; }
.coupon {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fffdfe;
}
.coupon .cp-text { flex: 1; text-align: left; font-size: 0.95rem; }
.coupon.used .cp-text { opacity: 0.5; text-decoration: line-through; }

/* ---------- บันไดงูคู่รัก ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-width: 420px;
  margin: 0 auto;
}
.sq {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: #fffdfe;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: var(--muted);
}
.sq .no { position: absolute; top: 2px; left: 5px; font-size: 0.62rem; opacity: 0.7; }
.sq .ic { font-size: 1rem; }
.sq.ladder { background: #eefaf4; border-color: #a9e6cf; }
.sq.snake { background: #fff0f0; border-color: #ffc2c2; }
.sq.mission { background: #fff9e8; border-color: #ffdd9a; }
.sq.goal { background: linear-gradient(135deg, #fff0f6, #ffd9e8); border-color: var(--pink); }
.sq .tok { position: absolute; font-size: 1.15rem; animation: pop 0.25s ease; }
.sq .tok.a { left: 3px; bottom: 1px; }
.sq .tok.b { right: 3px; bottom: 1px; }
.dice { font-size: clamp(2.6rem, 11vw, 3.6rem); line-height: 1; }
.dice.rolling { animation: diceSpin 0.5s ease; }
@keyframes diceSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(200deg) scale(1.25); }
  100% { transform: rotate(360deg) scale(1); }
}
.legend { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); }

/* ---------- ใบ้คำ / วาดให้ทาย ---------- */
.word-card {
  border-radius: 22px;
  border: 3px dashed var(--pink);
  background: linear-gradient(135deg, #ffffff, #fff4f8);
  padding: 26px 18px;
  font-family: var(--font-cute);
  font-size: clamp(1.4rem, 6.5vw, 2.2rem);
  text-align: center;
  line-height: 1.4;
}
.word-card small { display: block; font-family: var(--font); font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
.word-blur { filter: blur(12px); user-select: none; -webkit-user-select: none; }
.timer-big {
  font-family: var(--font-cute);
  font-size: clamp(2rem, 9vw, 3rem);
  color: var(--pink-deep);
  line-height: 1;
}
.timer-big.low { animation: beat 0.6s ease-in-out infinite; }

.draw-wrap { max-width: 460px; margin: 0 auto; }
.draw-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  background: #fff;
  border: 2px solid var(--line);
  touch-action: none;
  cursor: crosshair;
}
.swatches { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--line);
  cursor: pointer;
  padding: 0;
}
.swatch.on { box-shadow: 0 0 0 3px var(--pink-deep); transform: scale(1.08); }

/* ---------- ทำนายอนาคต ---------- */
.fortune { display: grid; gap: 10px; }
.fline {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fffdfe;
  animation: pop 0.32s ease both;
  text-align: left;
}
.fline b { color: var(--pink-ink); flex: 0 0 auto; min-width: 8.5em; }
.fline .v { flex: 1; }

/* ---------- 2 จริง 1 โกหก ---------- */
.tt-list { display: grid; gap: 10px; }
.tt-opt {
  font: inherit;
  text-align: left;
  padding: 13px 16px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fffdfe;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}
.tt-opt:hover { transform: translateX(4px); border-color: var(--pink); }
.tt-opt.lie { border-color: #ff9f9f; background: #fff2f2; }
.tt-opt.truth { border-color: #8fe3c9; background: #f1fdf8; }
.tt-opt.chosen { box-shadow: 0 0 0 4px rgba(255, 143, 177, 0.2); }

/* ---------- นาฬิกาจับเวลา 10 วิ ---------- */
.clock-face {
  width: min(220px, 62vw);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 50%;
  border: 6px solid var(--line);
  background: radial-gradient(circle at 50% 30%, #fff, #fff2f7);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}
.clock-face .val {
  font-family: var(--font-cute);
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  color: var(--pink-deep);
}

/* ==========================================================
   ส่วนเพิ่ม: เล่นออนไลน์ (ห้อง + แชท)
   ========================================================== */

.net-btn {
  width: auto;
  min-width: 42px;
  padding: 0 10px;
  gap: 6px;
  display: inline-flex;
  align-items: center;
}
.net-btn.on { border-color: var(--mint); background: #f2fdf9; }
.net-btn.wait { border-color: var(--sun); background: #fffaf0; }
.net-btn.bad { border-color: #ff9f9f; background: #fff4f4; }
.net-code {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--pink-ink);
}

.net-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: -6px 0 16px;
  padding: 10px 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f2fdf9, #eef6ff);
  border: 2px solid #d6f1e6;
  font-size: 0.86rem;
}
.net-bar.warn {
  background: linear-gradient(135deg, #fffaf0, #fff4e2);
  border-color: #ffdd9a;
  color: #7a5300;
}
.net-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}

.room-code {
  font-family: var(--font-cute);
  font-size: clamp(2.2rem, 11vw, 3.2rem);
  letter-spacing: 0.16em;
  color: var(--pink-deep);
  line-height: 1.1;
  margin: 2px 0 4px;
}

.card-net {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.95rem;
  opacity: 0.85;
}
.card.dim { opacity: 0.62; }
.card.dim:hover { opacity: 0.85; }

/* ---------- แชท ---------- */
.chat-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 55;
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: grid;
  place-items: center;
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab.ring { animation: bump 0.6s ease infinite; border-color: var(--pink); }
.chat-badge {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 20px; height: 20px;
  border-radius: 999px;
  background: var(--pink-deep);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 5px;
}

.chat-panel {
  position: fixed;
  right: 16px;
  bottom: 82px;
  z-index: 56;
  width: min(340px, calc(100vw - 32px));
  max-height: min(60vh, 460px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 2px solid var(--line);
  background: linear-gradient(135deg, #fff5f9, #fff);
}
.chat-head .icon-btn { width: 32px; height: 32px; font-size: 0.9rem; }
.chat-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 16px;
  background: #fff4f8;
  border: 1px solid var(--line);
  font-size: 0.92rem;
  align-self: flex-start;
  word-break: break-word;
}
.chat-msg b {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.chat-msg.mine {
  align-self: flex-end;
  background: #eff5ff;
  border-color: #dbe9ff;
}
.chat-quick {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px 10px 0;
}
.chat-emoji {
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  padding: 5px 7px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.chat-emoji:hover { background: #fff4f8; }
.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 2px solid var(--line);
}
.chat-form input {
  font: inherit;
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fffdfe;
}
.chat-form input:focus { border-color: var(--pink); outline: none; }
.chat-form .btn { padding: 9px 16px; font-size: 0.92rem; }

@media (max-width: 620px) {
  .chat-fab { right: 12px; bottom: 12px; width: 48px; height: 48px; font-size: 1.2rem; }
  .chat-panel { right: 10px; left: 10px; bottom: 70px; width: auto; }
}

/* ============================================================
   สไตล์เกมใหม่: Connect Four, Simon, Bingo, Dice, Coin
   ============================================================ */

/* ---------- Connect Four ---------- */
.c4 {
  display: grid;
  grid-template-columns: repeat(7, minmax(38px, 1fr));
  gap: 6px;
  background: linear-gradient(180deg, #ffe7f0, #ffd9e6);
  padding: 8px;
  border-radius: 14px;
  max-width: 100%;
  margin: 0 auto;
}
.c4-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 10px;
  cursor: pointer;
  padding: 2px;
  transition: background 0.18s;
}
.c4-col:hover { background: rgba(255, 255, 255, 0.35); }
.c4-col.locked { cursor: not-allowed; opacity: 0.65; }
.c4-cell {
  aspect-ratio: 1 / 1;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 5vw, 26px);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08);
}
.c4-cell.win {
  background: linear-gradient(135deg, #fff9c4, #ffe0b3);
  box-shadow: 0 0 0 2px #ffb347, inset 0 2px 6px rgba(0, 0, 0, 0.08);
}
@supports not (aspect-ratio: 1) {
  .c4-cell { height: 0; padding-top: 100%; position: relative; }
  .c4-cell > * { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
}

/* ---------- Simon ---------- */
.simon-pad {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 340px;
  margin: 0 auto;
}
.simon-btn {
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 18px;
  font-size: clamp(28px, 8vw, 48px);
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s, filter 0.12s;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}
.simon-btn:disabled { cursor: not-allowed; opacity: 0.65; }
.simon-btn.s-0 { background: linear-gradient(135deg, #ffb0c9, #ff7cad); }
.simon-btn.s-1 { background: linear-gradient(135deg, #a4d0ff, #6aa8ff); }
.simon-btn.s-2 { background: linear-gradient(135deg, #a8ecc4, #67d197); }
.simon-btn.s-3 { background: linear-gradient(135deg, #ffe07d, #ffc247); }
.simon-btn.lit { transform: scale(1.06); filter: brightness(1.3) saturate(1.2); }
.simon-btn:active { transform: scale(0.96); }

/* ---------- Bingo ---------- */
.bingo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-width: 340px;
  margin: 0 auto;
}
.bingo-cell {
  aspect-ratio: 1 / 1;
  background: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: transform 0.12s, background 0.2s;
}
.bingo-cell:hover { background: #fff4f8; }
.bingo-cell.hit {
  background: linear-gradient(135deg, #ff9dbe, #ff6f9b);
  color: #fff;
  transform: scale(1.05);
}
.bingo-cell.free { background: linear-gradient(135deg, #ffcae0, #ff9dbe); color: #fff; cursor: default; }

/* ---------- Dice ---------- */
.dice-holder {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1.05rem;
}
.dice-face {
  display: inline-block;
  font-size: 2rem;
  line-height: 1;
  background: #fff;
  border-radius: 10px;
  padding: 4px 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  animation: dice-in 0.36s ease;
}
@keyframes dice-in {
  from { transform: rotate(-30deg) scale(0.6); opacity: 0.3; }
  to { transform: rotate(0) scale(1); opacity: 1; }
}

/* ---------- Coin ---------- */
.coin-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  font-size: 2.4rem;
  background: linear-gradient(135deg, #ffe08a, #ffbb47);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14), inset 0 -6px 10px rgba(0, 0, 0, 0.12);
  animation: coin-flip 0.6s ease;
}
.coin-face.head { background: linear-gradient(135deg, #ffe08a, #ffb547); }
.coin-face.tail { background: linear-gradient(135deg, #ffcae0, #ff9dbe); }
@keyframes coin-flip {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(360deg) scale(0.85); }
  100% { transform: rotateY(720deg); }
}

/* กันเผื่อ Btn-block ยังไม่ทั่ว */
.btn.btn-block { width: 100%; display: block; }

/* pill-score กันตัดขอบมือถือ */
.pill-score { flex-wrap: wrap; }
