/* Shared look for the store and every game: pastel, round, Thai-first. */
:root {
  --bg: #fff8ef;
  --ink: #3b2f2a;
  --muted: #8a7a70;
  --card: #ffffff;
  --line: #f0e2d3;
  --brand: #ff8a5b;
  --brand-ink: #ffffff;
  --mint: #6cc7a8;
  --sky: #69b7ea;
  --sun: #ffc94a;
  --berry: #b35c9e;
  --danger: #e2574c;
  --radius: 18px;
  --font: "Leelawadee UI", "Noto Sans Thai", "Sarabun", Tahoma, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); }
button { font-family: inherit; }

.lab-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg); border-bottom: 2px solid var(--line);
}
.lab-title { flex: 1; font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab-icon {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer;
}
.lab-coins {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: 999px; background: #fff3c4; border: 2px solid #f5d77a; font-size: 15px;
}
.lab-coin {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff2a8 0 25%, #ffc93c 26% 70%, #e6a417 71%);
  box-shadow: inset 0 0 0 2px #d49412; vertical-align: -3px;
}

.lab-btn {
  border: 0; border-radius: 999px; padding: 12px 22px; font-size: 17px; font-weight: 700;
  background: var(--brand); color: var(--brand-ink); cursor: pointer;
  box-shadow: 0 4px 0 #d9663c; transition: transform .08s;
  text-decoration: none; text-align: center; display: inline-block;
}
.lab-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #d9663c; }
.lab-btn-ghost { background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.lab-btn-ghost:active { box-shadow: 0 1px 0 var(--line); }
.lab-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

.lab-modal {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(59, 47, 42, .45); padding: 16px; animation: lab-fade .2s;
}
.lab-card {
  width: min(360px, 100%); background: var(--card); border-radius: 24px; padding: 22px 20px;
  text-align: center; animation: lab-pop .25s cubic-bezier(.2, 1.4, .5, 1);
}
.lab-card h2 { margin: 0 0 8px; font-size: 24px; }
.lab-card p { margin: 6px 0; font-size: 16px; color: var(--muted); }
.lab-card .lab-earn { color: var(--ink); font-size: 20px; font-weight: 700; }

.lab-toast {
  position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 999px; font-size: 15px;
  animation: lab-toast 1.6s forwards; pointer-events: none;
}
.lab-levels {
  position: fixed; inset: 56px 0 0; z-index: 30; overflow-y: auto; background: var(--bg);
  padding: 12px 16px 30px; text-align: center; animation: lab-fade .2s;
}
.lab-levels h2 { margin: 6px 0 2px; font-size: 22px; }
.lab-levels > p { margin: 0 0 12px; color: var(--muted); }
.lab-level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; max-width: 560px; margin: 0 auto; }
.lab-level {
  border: 2px solid var(--line); background: var(--card); border-radius: 16px; padding: 10px 4px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; color: var(--ink); font-family: inherit;
  box-shadow: 0 3px 0 var(--line);
}
.lab-level b { font-size: 22px; }
.lab-level span { color: #f0b429; font-size: 13px; letter-spacing: 1px; }
.lab-level small { font-size: 11px; color: var(--muted); }
.lab-level.next { border-color: var(--brand); box-shadow: 0 3px 0 #d9663c; }
.lab-level.locked { opacity: .45; cursor: default; }
.lab-stars { font-size: 30px; color: #f0b429; letter-spacing: 4px; margin: 2px 0 6px; }
.lab-energy {
  display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; cursor: pointer;
  background: #e7f1fb; border: 2px solid #b9d6f2; color: #24527a; font: inherit; font-size: 15px;
}
.lab-energy.empty { background: #fbebeb; border-color: #f3b4b0; color: var(--danger); }
.lab-hint { color: var(--muted); font-size: 13px; margin-top: 14px; }
.lab-btn-ad { display: block; width: 100%; margin-top: 10px; background: var(--mint); box-shadow: 0 4px 0 #48a284; }
.lab-btn-ad:disabled { opacity: .7; }

.lab-items { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 6px 10px; }
.lab-item {
  position: relative; display: flex; flex-direction: column; align-items: center; min-width: 64px;
  padding: 6px 8px 4px; border-radius: 14px; border: 2px solid var(--line); background: var(--card);
  font: inherit; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--line);
}
.lab-item .ic { font-size: 22px; line-height: 1.1; }
.lab-item .nm { font-size: 11px; color: var(--muted); }
.lab-item .ct {
  position: absolute; top: -8px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; line-height: 22px;
}

.lab-opt.lab-step { cursor: default; background: var(--card); }
.lab-opt.lab-step .ic {
  width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 16px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}

.lab-offline {
  position: fixed; left: 50%; bottom: calc(10px + var(--banner-h, 0px)); transform: translateX(-50%); z-index: 70; pointer-events: none;
  background: #3b2f2a; color: #fff; font-size: 12px; padding: 5px 12px; border-radius: 999px; opacity: .85; white-space: nowrap;
}

.lab-input {
  width: 100%; padding: 12px 14px; margin-bottom: 10px; border-radius: 14px; border: 2px solid var(--line);
  font: inherit; font-size: 17px; color: var(--ink); background: var(--bg); outline: none; text-align: center;
}
.lab-input:focus { border-color: var(--brand); }
.lab-board { list-style: none; margin: 0 0 10px; padding: 0; max-height: 46vh; overflow-y: auto; text-align: left; }
.lab-board li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 12px; }
.lab-board li:nth-child(odd) { background: var(--bg); }
.lab-board li.me { background: #fff3c4; font-weight: 700; }
.lab-board li.empty { display: block; text-align: center; color: var(--muted); }
.lab-board .rk { text-align: center; font-size: 15px; }
.lab-board .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Short phones: a slimmer bar and item row leave more room for the game. */
@media (max-height: 700px) {
  .lab-bar { padding: 5px 10px; }
  .lab-icon { width: 34px; height: 34px; font-size: 19px; }
  .lab-title { font-size: 16px; }
  .lab-items { padding: 3px 8px; gap: 6px; }
  .lab-item { min-width: 54px; padding: 3px 6px 2px; flex-direction: row; gap: 4px; }
  .lab-item .ic { font-size: 18px; }
}

.lab-sheet .sub { margin-bottom: 12px; }
.lab-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin-bottom: 8px;
  padding: 10px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--bg);
  font: inherit; color: var(--ink); cursor: pointer;
}
.lab-opt:disabled { opacity: .45; cursor: default; }
.lab-opt .ic { font-size: 26px; width: 32px; text-align: center; }
.lab-opt b { display: block; font-size: 16px; }
.lab-opt small { color: var(--muted); font-size: 13px; }
.lab-sheet > .lab-btn { margin-top: 6px; }

.lab-ad {
  position: fixed; inset: 0; z-index: 90; background: #20242b; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 20px;
}
.lab-ad-box { width: min(340px, 100%); aspect-ratio: 9 / 12; border-radius: 20px; background: #343a44; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 16px; }
.lab-ad-box small { opacity: .6; }
.lab-ad-box b { font-size: 26px; }
.lab-ad-box p { opacity: .8; margin: 0; }
@keyframes lab-fade { from { opacity: 0; } }
@keyframes lab-pop { from { transform: scale(.7); opacity: 0; } }
@keyframes lab-toast { 0% { opacity: 0; transform: translate(-50%, -8px); } 12%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
