/* แก๊งค์ซ่า ฝ่าบอร์ดเกม! */
.gs .gs-big { font-size: 20px; min-height: 56px; }
.gs-center { text-align: center; margin: 0; }
.gs-h { font-size: 19px; text-align: center; display: block; }

/* character select */
.gs-chars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.gs-soon { background: #ece9f5; }
.gs-soon canvas { filter: drop-shadow(0 0 6px rgba(255, 194, 26, 0.6)); }
.gs-soon b { letter-spacing: 2px; }
.gs-soontag { font: 700 10.5px "Mitr", sans-serif !important; color: #7c3aed !important; }
.gs-soon.on { outline: 3px dashed #7c3aed; outline-offset: 1px; transform: translateY(-2px); }
.gs-soon:not(.on) canvas { animation: gsPeek 1.6s ease-in-out infinite; }
@keyframes gsPeek { 50% { transform: translateY(-3px) rotate(-3deg); } }
.gs-char {
  display: grid; justify-items: center; gap: 0; padding: 4px 2px 6px; border: 2.5px solid var(--sg-ink); border-radius: 14px;
  background: #fff; color: var(--sg-ink); font: inherit; cursor: pointer; box-shadow: 0 3px 0 var(--sg-ink); touch-action: manipulation;
  line-height: 1.2; min-width: 0;
}
.gs-char canvas { width: 100%; max-width: 72px; aspect-ratio: 1; }
.gs-char b { font-size: 13px; }
.gs-char small.gs-role { font-size: 17px; line-height: 1.25; overflow: visible; }
.gs-char small { font-size: 10.5px; color: var(--sk-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.gs-char i { font-style: normal; font: 600 10.5px "Fredoka", "Mitr", sans-serif; color: #b45309; }
.gs-char.on { background: color-mix(in srgb, var(--c) 28%, white); transform: translateY(-2px); box-shadow: 0 5px 0 var(--sg-ink); outline: 3px solid var(--c); outline-offset: 1px; }
.gs-info { display: grid; gap: 6px; padding: 10px; border: 2.5px solid var(--sg-ink); border-radius: 14px; background: var(--sk-cream); }
.gs-infohead b { font-size: 20px; }
.gs-infohead span { color: var(--sk-muted); font-size: 14px; }
.gs-inforow { display: grid; grid-template-columns: 30px 1fr; gap: 6px; align-items: start; font-size: 14px; line-height: 1.4; }
.gs-inforow small { display: block; color: var(--sk-muted); font-size: 12.5px; }
.gs-ie { font-size: 22px; text-align: center; line-height: 1.2; }
.gs-best { text-align: center; font-weight: 600; }

/* play: full screen */
body.gs-playing { overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#scrPlay[hidden] { display: none; }
.gs-stage { position: fixed; inset: 0; z-index: 120; background: #86cd80; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; overflow: hidden; }
.gs-stage * { -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.gs-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.gs-xp { position: absolute; left: 0; right: 0; top: 0; height: 8px; background: rgba(35, 31, 32, 0.35); }
.gs-xp i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #1a9bf0, #7dd3fc); transition: width 0.15s; }
.gs-hud {
  position: absolute; left: 50%; translate: -50% 0; width: min(760px, calc(100% - 16px)); top: calc(14px + env(safe-area-inset-top)); display: grid; grid-template-columns: auto 1fr auto auto auto auto;
  align-items: center; gap: 8px; pointer-events: none;
}
.gs-hud > * { pointer-events: auto; }
.gs-hud .sfx-toggle.inline { width: 38px; height: 38px; border-radius: 12px; box-shadow: 0 2px 0 var(--sg-ink); opacity: 1; font-size: 16px; touch-action: manipulation; }
.gs-lv {
  padding: 3px 8px; border: 2.5px solid var(--sg-ink); border-radius: 999px; background: var(--sg-yellow);
  font: 700 14px "Fredoka", sans-serif; box-shadow: 0 2px 0 var(--sg-ink);
}
.gs-hp { position: relative; height: 20px; border: 2.5px solid var(--sg-ink); border-radius: 999px; background: #fff; overflow: hidden; box-shadow: 0 2px 0 var(--sg-ink); }
.gs-hp i { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(90deg, #e8202a, #ff6b6b); transition: width 0.12s; }
.gs-hp span { position: relative; display: block; text-align: center; font: 700 12px/15px "Fredoka", sans-serif; color: #231f20; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.gs-time { font: 700 22px "Fredoka", sans-serif; color: #fff; text-shadow: 0 2px 0 #231f20, 0 0 6px rgba(0, 0, 0, 0.4); min-width: 54px; text-align: center; }
.gs-time.boss-soon { color: #ffc21a; animation: gsPulse 0.5s infinite alternate; }
.gs-kills { font: 700 14px "Fredoka", sans-serif; color: #fff; text-shadow: 0 2px 0 #231f20; }
.gs-ibtn {
  width: 38px; height: 38px; border: 2.5px solid var(--sg-ink); border-radius: 12px; background: #fff; color: var(--sg-ink);
  font-size: 14px; cursor: pointer; box-shadow: 0 2px 0 var(--sg-ink);
}
.gs-boss {
  position: absolute; left: 50%; top: calc(56px + env(safe-area-inset-top)); translate: -50% 0; width: min(86%, 420px);
  display: grid; gap: 3px; text-align: center; pointer-events: none;
}
.gs-boss[hidden] { display: none; }
.gs-boss b { font: 700 14px "Kanit", "Mitr", sans-serif; color: #fff; text-shadow: 0 2px 0 #231f20; }
.gs-bossbar { height: 14px; border: 2.5px solid var(--sg-ink); border-radius: 999px; background: #fff; overflow: hidden; }
.gs-bossbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #7c3aed, #e8202a); transition: width 0.12s; }

.gs-rule {
  position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); translate: -50% 0; width: min(70%, 360px);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 7px 10px; border: 3px solid var(--sg-ink);
  border-radius: 16px; background: #fff3d6; box-shadow: 0 4px 0 var(--sg-ink); pointer-events: none; animation: gsRise 0.3s ease-out;
}
.gs-rule[hidden] { display: none; }
.gs-rule.warn { background: #ffc21a; animation: gsShake 0.3s infinite; }
.gs-rulee { font-size: 28px; }
.gs-ruletext { display: grid; line-height: 1.25; min-width: 0; }
.gs-ruletext b { font-size: 14px; }
.gs-ruletext small { font-size: 12px; color: #6b6461; }
.gs-rule i { font: 700 18px "Fredoka", sans-serif; font-style: normal; }

.gs-toasts { position: absolute; left: 10px; right: 10px; top: calc(96px + env(safe-area-inset-top)); display: grid; justify-items: center; gap: 5px; pointer-events: none; }
.gs-toast {
  max-width: 100%; padding: 5px 12px; border: 2.5px solid var(--sg-ink); border-radius: 999px; background: #fff;
  box-shadow: 0 3px 0 var(--sg-ink); font-weight: 600; font-size: 13.5px; text-align: center; line-height: 1.35; animation: gsToast 2.8s ease forwards;
}
.gs-toast.good { background: var(--sk-green); color: #fff; }
.gs-toast.news { background: var(--sg-yellow); }
.gs-toast.boss { background: #7c3aed; color: #fff; }

.gs-special {
  --p: 0; position: absolute; right: calc(16px + env(safe-area-inset-right)); bottom: calc(86px + env(safe-area-inset-bottom));
  width: 74px; height: 74px; border-radius: 50%; border: 3px solid var(--sg-ink); cursor: pointer; padding: 0;
  background: conic-gradient(#ffc21a calc(var(--p) * 360deg), rgba(255, 255, 255, 0.85) 0); box-shadow: 0 4px 0 var(--sg-ink);
  touch-action: manipulation; display: grid; place-items: center;
}
.gs-special b { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: #fff; border: 2.5px solid var(--sg-ink); font-size: 28px; filter: grayscale(0.8); opacity: 0.7; }
.gs-special.ready { animation: gsPulse 0.6s infinite alternate; }
.gs-special.ready b { filter: none; opacity: 1; background: #fff8e1; }

/* level up + chest */
.gs-pick {
  position: absolute; inset: 0; z-index: 5; background: rgba(29, 27, 46, 0.6); padding: 16px;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; overflow-y: auto;
}
.gs-pick[hidden] { display: none; }
.gs-pick > * { width: min(100%, 420px); }
.gs-picktitle { font: 800 21px "Kanit", "Mitr", sans-serif; color: #fff; text-align: center; text-shadow: 0 2px 0 var(--sg-ink); }
.gs-pickcard {
  display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 8px; padding: 10px; border: 3px solid var(--sg-ink);
  border-radius: 16px; background: #fff; color: var(--sg-ink); font: inherit; text-align: left; cursor: pointer;
  box-shadow: 0 4px 0 var(--sg-ink); animation: gsRise 0.25s ease-out; touch-action: manipulation;
}
.gs-pickcard:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--sg-ink); }
.gs-pickcard.k-wnew, .gs-pickcard.k-pnew { background: #e0f2fe; }
.gs-pickcard.k-evo { background: linear-gradient(135deg, #fff3d6, #ffd3da); }
.gs-pickcard.k-up2 { background: #ecfccb; }
.gs-pickicon { font-size: 32px; text-align: center; line-height: 1.1; letter-spacing: -3px; }
.gs-picktext { display: grid; gap: 2px; min-width: 0; }
.gs-picktext b { font-size: 16px; line-height: 1.25; }
.gs-picktext em { font-style: normal; font: 700 13px "Fredoka", "Mitr", sans-serif; color: #b45309; }
.gs-picktext small { font-size: 13px; color: #6b6461; line-height: 1.35; }

.gs-pause { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 16px; background: rgba(29, 27, 46, 0.55); }
.gs-pause[hidden] { display: none; }
.gs-pause > .sg-panel { width: min(100%, 360px); }
.gs-pauserule { text-align: center; color: var(--sk-muted); }
.gs-build { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.gs-build span {
  position: relative; display: grid; place-items: center; width: 42px; height: 42px; border: 2.5px solid var(--sg-ink); border-radius: 12px;
  background: #fff; font-size: 22px;
}
.gs-build b { position: absolute; right: -6px; bottom: -6px; min-width: 18px; height: 18px; border-radius: 999px; background: var(--sg-yellow); border: 2px solid var(--sg-ink); font: 700 11px/14px "Fredoka", sans-serif; text-align: center; }

/* game over */
.gs-over { text-align: center; }
.gs-overpic { justify-self: center; width: 110px; height: 118px; }
.gs-overtitle { font: 600 18px "Mitr", sans-serif; color: var(--sk-muted); margin-top: -6px; }
.gs-overtime { font: 700 64px/1 "Fredoka", sans-serif; color: #e8202a; }
.gs-record { justify-self: center; padding: 4px 14px; border: 2.5px solid var(--sg-ink); border-radius: 999px; background: var(--sg-yellow); font-weight: 700; animation: gsPulse 0.6s infinite alternate; }
.gs-record[hidden] { display: none; }
.gs-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gs-stats > div { padding: 10px 4px; border: 2.5px solid var(--sg-ink); border-radius: 16px; background: var(--sk-cream); }
.gs-stats small { display: block; color: var(--sk-muted); font-size: 13px; }
.gs-stats b { font: 700 28px "Fredoka", "Mitr", sans-serif; }
#changeBtn { margin-top: 8px; }

@keyframes gsPulse { to { transform: scale(1.08); } }
@keyframes gsRise { from { transform: translateY(10px) scale(0.97); } }
@keyframes gsShake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@keyframes gsToast { 0% { opacity: 0; transform: translateY(-8px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .gs-special.ready, .gs-record, .gs-time.boss-soon, .gs-rule.warn { animation: none; } }

@media (max-width: 560px) {
  .gs-chars { grid-template-columns: repeat(3, 1fr); }
  .gs-char canvas { max-width: 80px; }
}
@media (max-width: 420px) {
  .gs-chars { gap: 6px; }
  .gs-char b { font-size: 12px; }
}

/* share sheet */
.gs-sheet { position: fixed; inset: 0; z-index: 200; display: flex; padding: 16px; overflow-y: auto; background: rgba(29, 27, 46, 0.6); }
.gs-sheet[hidden] { display: none; }
.gs-sheetcard { position: relative; margin: auto; width: min(100%, 400px); display: grid; gap: 10px; text-align: center; }
.gs-sheetcard > b { font-size: 20px; }
.gs-sheetx { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 2px solid var(--sg-ink); border-radius: 50%; background: #fff; color: var(--sg-ink); cursor: pointer; font-size: 15px; }
.gs-sheetimg { position: relative; aspect-ratio: 1080 / 1350; width: min(100%, calc((100svh - 300px) * 0.8)); justify-self: center; border-radius: 14px; overflow: hidden; background: var(--sk-soft); }
.gs-sheetimg img { display: block; width: 100%; height: 100%; object-fit: contain; }
.gs-spin { position: absolute; inset: 0; display: none; place-items: center; color: var(--sk-muted); }
.gs-sheet.loading .gs-spin { display: grid; }
.gs-sheet.loading img { visibility: hidden; }
.gs-sheetcard a.sg-btn { text-decoration: none; }
.gs-sheet.loading a.sg-btn { pointer-events: none; opacity: 0.5; }

/* dice on level-up, rule sub line, daily challenge, buddy line */
.gs-picksub { color: #fff; text-align: center; font-size: 13px; text-shadow: 0 1px 0 var(--sg-ink); }
.gs-dice {
  display: grid; gap: 1px; justify-items: center; padding: 8px 10px; border: 3px dashed #fff; border-radius: 16px; background: rgba(255, 194, 26, 0.95);
  color: var(--sg-ink); font: 700 15px "Mitr", sans-serif; cursor: pointer; touch-action: manipulation; box-shadow: 0 3px 0 var(--sg-ink);
}
.gs-dice small { font: 400 12px "Mitr", sans-serif; color: #5b4300; }
.gs-dice:disabled { background: #fff3d6; border-style: solid; border-color: var(--sg-ink); cursor: default; }
.gs-dierow { display: inline-flex; align-items: center; gap: 10px; }
.gs-die {
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); gap: 2px; width: 34px; height: 34px; padding: 5px; box-sizing: border-box;
  background: #fff; border: 2.5px solid var(--sg-ink); border-radius: 9px; box-shadow: 0 2px 0 var(--sg-ink); flex: none;
}
.gs-die i { border-radius: 50%; }
.gs-die i.on { background: var(--sg-ink); }
.gs-die.f1 i.on { background: #e5484d; }
.gs-die.spin { animation: gs-tumble 0.32s linear infinite; }
.gs-die.landed { animation: gs-dieland 0.42s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes gs-tumble {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(180deg) scale(0.9); }
  100% { transform: translateY(0) rotate(360deg); }
}
@keyframes gs-dieland { 0% { transform: scale(1.5) rotate(-20deg); } 100% { transform: scale(1) rotate(0); } }
.gs-pick.gs-rolling [data-pick] { pointer-events: none; opacity: 0.55; transition: opacity 0.2s; }
.gs-dice:disabled .gs-dierow { font-size: 15px; }
.gs-pickcard.k-rule { background: #fff3d6; }
.gs-daily { min-height: 50px; font-size: 16px; }
.gs-daily.hot { animation: gsPulse 0.7s infinite alternate; }
.gs-mode { justify-self: center; padding: 3px 12px; border: 2.5px solid var(--sg-ink); border-radius: 999px; background: var(--sg-yellow); font-weight: 700; font-size: 14px; }
.gs-mode[hidden], .gs-overbuddy[hidden] { display: none; }
.gs-overbuddy { font-size: 14px; color: var(--sk-muted); }
