/* Teka Teki Sabahan — mobile-first base styles.
   Sabah-flavoured palette: zircon blue, sunset orange, gold. Big tap targets. */
:root {
  --blue:    #0B5FA5;
  --blue-2:  #1493C7;
  --ink:     #0E2433;
  --sunset:  #FF6A3D;
  --gold:    #FFC93C;
  --fb:      #1877F2;
  --wa:      #25D366;
  --bg:      #F4F8FB;
  --card:    #FFFFFF;
  --muted:   #5B6B79;
  --radius:  18px;
  --shadow:  0 8px 24px rgba(11, 95, 165, .12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.screen {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Hero ------------------------------------------------------------------- */
.hero {
  position: relative;
  margin: 14px 0 0;            /* gap from the top, contained card */
  color: #fff;
  text-align: center;
  overflow: hidden;
  border-radius: 24px;         /* rounded on all corners */
  box-shadow: var(--shadow);
}
.hero-art { position: absolute; inset: 0; z-index: 0; }
.hero-art svg { width: 100%; height: 100%; display: block; }
.hero-img { display: block; width: 100%; height: auto; }
.hero-text {
  position: relative;
  z-index: 1;
  padding: calc(28px + env(safe-area-inset-top)) 16px 26px;
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.badge {
  display: inline-block;
  background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.35);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.hero-text h1 { margin: 12px 0 6px; font-size: 30px; letter-spacing: -.5px; }
.tagline { margin: 0; font-size: 15px; font-weight: 600; color: var(--gold); }

/* Cards ------------------------------------------------------------------ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
}
.lede { margin: 0 0 18px; font-size: 15.5px; color: #2a3b49; }
.h2 { margin: 0 0 14px; font-size: 18px; }

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  transition: transform .08s ease, filter .15s ease;
  font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn-lg { margin-bottom: 12px; }
.btn-ico {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  background: rgba(255,255,255,.25);
  border-radius: 8px; font-weight: 800; font-size: 15px;
}
.btn-primary { background: linear-gradient(135deg, var(--sunset), #ff8a5b); }
.btn-fb { background: var(--fb); }

.share-card .share-row { display: flex; flex-direction: column; gap: 10px; }
.btn-share { box-shadow: var(--shadow); }
.btn-native { background: linear-gradient(135deg, var(--blue), var(--blue-2)); }
.btn-wa { background: var(--wa); }
.btn-fbshare { background: var(--fb); }

/* Misc ------------------------------------------------------------------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.note-login { margin: 4px 0 0; text-align: center; }
.links { text-align: center; font-size: 13px; }
.links a { color: var(--blue); text-decoration: none; }
.foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: auto; padding-top: 8px; }

/* Forms ------------------------------------------------------------------ */
.fld { display: block; margin-bottom: 14px; }
.fld > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.fld input:not([type="checkbox"]) {
  width: 100%;
  border: 2px solid #dbe6ef;
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;          /* >=16px stops iOS zoom-on-focus */
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
.fld input:not([type="checkbox"]):focus { outline: none; border-color: var(--blue-2); }
.fld.invalid input { border-color: #e23b3b; }
.fld .err { display: none; color: #e23b3b; font-size: 13px; font-weight: 600; margin-top: 6px; }
.fld.invalid .err { display: block; }
.form-error {
  background: #fdecec; color: #b42318; border: 1px solid #f5c2c0;
  padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600;
  margin-bottom: 14px; display: none;
}
.form-error.show { display: block; }

/* Menu / profile bits ---------------------------------------------------- */
.kv { display: flex; justify-content: space-between; align-items: center; gap: 10px;
      padding: 12px 0; border-bottom: 1px solid #eef3f7; }
.kv:last-child { border-bottom: 0; }
.kv .k { font-size: 13px; color: var(--muted); }
.kv .v { font-weight: 800; font-size: 16px; }
.code-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: #eef6ff; color: var(--blue); border: 1px dashed var(--blue-2);
  padding: 8px 12px; border-radius: 10px; font-weight: 800; letter-spacing: .5px;
  font-family: ui-monospace, "Courier New", monospace;
}
.btn-ghost { background: transparent; color: var(--blue); border: 2px solid #dbe6ef; }
.btn-disabled { background: #cfd9e2; color: #708090; cursor: not-allowed; }
.greet { font-size: 22px; margin: 0 0 2px; }

/* Game screen ------------------------------------------------------------ */
.play-screen { gap: 14px; }
/* consistent top gap for game screens (main/daily/cabar) — the intro/end cards
   no longer stick to the top; matches the spacing on other pages. */
.play-body .screen { padding-top: 22px; }
.hud { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-top: 0; }
.hud-row { display: flex; align-items: center; justify-content: space-between; font-weight: 800; }
.hud-lives { font-size: 18px; letter-spacing: 1px; }
.hud-level { background: var(--blue); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 14px; }
.hud-score { font-size: 20px; color: var(--sunset); }
.hud-score::before { content: '★ '; color: var(--gold); }
.hud-progress { font-size: 12px; color: var(--muted); margin: 8px 0 6px; text-align: center; }
.timer-track { height: 8px; background: #e6eef5; border-radius: 8px; overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--wa), var(--gold)); border-radius: 8px; transition: width .06s linear; }
.timer-fill.danger { background: linear-gradient(90deg, var(--sunset), #e23b3b); }

/* The [hidden] attribute must always win — otherwise an author `display` rule
   (e.g. .q-card.center { display:flex }) overrides it and the element stays
   visible even after JS sets el.hidden = true (the stuck "Memuatkan…" bug). */
[hidden] { display: none !important; }

.q-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 18px; }
.q-card.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 18px; }
.q-cat { display: inline-block; background: #eef6ff; color: var(--blue); font-size: 15px; font-weight: 700;
         padding: 6px 14px; border-radius: 999px; margin-bottom: 12px; }
.q-text { font-size: 22px; line-height: 1.35; margin: 0 0 20px; }
.q-options { display: flex; flex-direction: column; gap: 12px; }
.opt {
  width: 100%; text-align: left; border: 2px solid #dbe6ef; background: #fff; color: var(--ink);
  border-radius: 14px; padding: 16px 16px; font-size: 16px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: transform .07s ease, border-color .15s ease, background .15s ease;
}
.opt:active { transform: scale(.98); }
.opt:disabled { cursor: default; }
.opt.correct { border-color: var(--wa); background: #e7faf0; color: #0b7a44; }
.opt.wrong { border-color: #e23b3b; background: #fdecec; color: #b42318; }

.spinner { width: 36px; height: 36px; border: 4px solid #dbe6ef; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* End / Game Over -------------------------------------------------------- */
.endcard { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
           padding: 28px 20px; text-align: center; margin-top: 16px; }
.end-emoji { font-size: 64px; line-height: 1; }
.endcard h1 { margin: 8px 0 4px; font-size: 26px; }
.end-stats { display: flex; justify-content: center; gap: 14px; margin: 18px 0 22px; }
.end-stats > div { background: var(--bg); border-radius: 12px; padding: 12px 10px; flex: 1; }
.end-k { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.end-v { display: block; font-size: 22px; font-weight: 800; color: var(--ink); }

.levelup-banner {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%) scale(.8);
  background: linear-gradient(135deg, var(--sunset), var(--gold)); color: #fff;
  font-size: 24px; font-weight: 900; padding: 16px 28px; border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.3); opacity: 0; transition: opacity .25s ease, transform .25s ease; z-index: 60;
}
.levelup-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* Result share page ------------------------------------------------------ */
.result-img { width: 100%; max-width: 360px; aspect-ratio: 1/1; border-radius: 18px;
              box-shadow: var(--shadow); margin: 8px auto 18px; display: block; }

/* Daily challenge -------------------------------------------------------- */
.hud-streak { font-size: 16px; font-weight: 800; }
.streak-line { font-weight: 700; color: var(--sunset); margin: 4px 0 8px; }
.reward-line { background: #fff7e6; color: #9a6700; border: 1px solid #ffe2a8;
               padding: 10px 12px; border-radius: 10px; font-weight: 700; margin: 0 0 14px; }
.daily-card { background: linear-gradient(135deg, #0B5FA5, #1493C7); color: #fff; }
.daily-card .h2, .daily-card .muted { color: #fff; }
.daily-streak-big { font-size: 30px; font-weight: 900; }

/* Leaderboard ------------------------------------------------------------ */
.tabs { display: flex; gap: 6px; background: #e6eef5; padding: 5px; border-radius: 14px; margin-bottom: 14px; }
.tab { flex: 1; border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px;
       padding: 10px 4px; border-radius: 10px; cursor: pointer; font-family: inherit; }
.tab.active { background: #fff; color: var(--blue); box-shadow: 0 2px 6px rgba(11,95,165,.12); }
.lb-card { padding: 14px 12px; }
.lb-row { display: grid; grid-template-columns: 44px 1fr 64px 56px; align-items: center; gap: 6px;
          padding: 11px 8px; border-bottom: 1px solid #eef3f7; font-size: 15px; }
.lb-row:last-child { border-bottom: 0; }
.lb-head { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.lb-rank { font-weight: 800; text-align: center; }
.lb-nick { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 800; color: var(--sunset); text-align: right; }
.lb-time { color: var(--muted); text-align: right; font-size: 13px; }
.lb-row.me { background: #eef6ff; border-radius: 10px; }
.lb-me { margin-top: -6px; padding: 6px 12px; border: 2px solid var(--blue-2); }
.lb-me .lb-row { border: 0; }

/* Admin panel ------------------------------------------------------------ */
body.admin { background: #eef3f7; }
.admin-wrap { max-width: 860px; margin: 0 auto; padding: 0 16px 40px; }
.admin-top { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center;
             padding: 14px 4px; border-bottom: 2px solid #d8e3ec; margin-bottom: 18px; }
.admin-top nav a { color: var(--blue); text-decoration: none; font-weight: 600; font-size: 14px; }
.admin h1 { font-size: 22px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 16px; text-align: center; }
.stat-ico { font-size: 26px; }
.stat-v { font-size: 24px; font-weight: 800; color: var(--ink); margin: 4px 0; }
.stat-k { font-size: 12px; color: var(--muted); }
.admin-form { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.admin-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fld textarea { width: 100%; border: 2px solid #dbe6ef; border-radius: 12px; padding: 12px; font-family: inherit; font-size: 15px; }
.fld.chk { display: flex; align-items: flex-start; gap: 10px; margin-top: 26px; }
.fld.chk input[type="checkbox"] { width: 20px; height: 20px; flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--blue); cursor: pointer; }
.fld.chk span { margin: 0; }
.opt-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.opt-row input[type=radio] { width: 22px; height: 22px; flex: 0 0 auto; }
.opt-input { flex: 1; border: 2px solid #dbe6ef; border-radius: 10px; padding: 11px 12px; font-size: 15px; font-family: inherit; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 10px; border-bottom: 1px solid #eef3f7; text-align: left; }
.admin-table th { background: #f4f8fb; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.admin-table tr.inactive { opacity: .55; }
.admin-table .actions { white-space: nowrap; }
.admin-table .actions a { color: var(--blue); text-decoration: none; margin-right: 8px; }
.link-danger { background: none; border: 0; color: #e23b3b; cursor: pointer; font: inherit; padding: 0; }
.filter-bar { display: flex; align-items: center; gap: 14px; margin: 14px 0; }
.filter-bar select { padding: 8px; border-radius: 8px; border: 2px solid #dbe6ef; font: inherit; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.pager a { padding: 8px 12px; background: #fff; border-radius: 8px; text-decoration: none; color: var(--blue); box-shadow: var(--shadow); }
.pager a.on { background: var(--blue); color: #fff; }
.admin-flash { background: #e7faf0; color: #0b7a44; border: 1px solid #b6e7cd; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; }
.err-list { color: #b42318; font-size: 13px; }
.code-block { background: #0e2433; color: #cfe6f7; padding: 14px; border-radius: 12px; overflow-x: auto; font-size: 13px; }
.admin hr { border: 0; border-top: 1px solid #d8e3ec; margin: 22px 0; }

/* Landing — dual-tone backdrop (biru "header" → cerah) + modern polish ---- */
.landing-body {
  /* dwi-warna pastel lembut: biru langit -> hijau hutan (echo ilustrasi) */
  background: linear-gradient(180deg, #d4e8f6 0%, #eef5f1 48%, #d9ecdd 100%) no-repeat;
  background-color: var(--bg);
  min-height: 100dvh;
}
#landing .card { animation: cardIn .45s cubic-bezier(.2,.7,.2,1) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* leaderboard teaser: rows fade-in one-by-one (stagger) when a tab is shown */
.lb-list.show-anim .lb-row { animation: rowIn .34s cubic-bezier(.2,.7,.2,1) both; }
.lb-list.show-anim .lb-row:nth-child(1) { animation-delay: 0s; }
.lb-list.show-anim .lb-row:nth-child(2) { animation-delay: .05s; }
.lb-list.show-anim .lb-row:nth-child(3) { animation-delay: .10s; }
.lb-list.show-anim .lb-row:nth-child(4) { animation-delay: .15s; }
.lb-list.show-anim .lb-row:nth-child(5) { animation-delay: .20s; }
.lb-list.show-anim .lb-row:nth-child(6) { animation-delay: .25s; }
@keyframes rowIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lb-list.show-anim .lb-row { animation: none; } }

/* scrollable list (top 5 visible, scroll for the rest) + sticky header */
.lb-scroll { max-height: 296px; overflow-y: auto; overscroll-behavior: contain; }
.lb-scroll .lb-head { position: sticky; top: 0; background: var(--card); z-index: 1; }
.lb-scroll::-webkit-scrollbar { width: 6px; }
.lb-scroll::-webkit-scrollbar-thumb { background: #c5d4e2; border-radius: 6px; }
/* pinned "your rank" row (always visible below the scroll) */
.lb-merow { display: grid; align-items: center; gap: 6px; padding: 12px 8px; margin-top: 8px;
            border: 2px solid var(--blue-2); background: #eef6ff; border-radius: 12px; font-weight: 800; }
.lb-merow .lb-time { color: var(--blue); }

.hero-text h1 { text-shadow: 0 3px 18px rgba(0,0,0,.4); letter-spacing: .5px; }
.hero-art .sun { animation: floaty 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.demo-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.demo-count { font-size: 13px; font-weight: 800; color: var(--muted); }
.demo-q { font-size: 20px; margin: 14px 0 16px; }
.demo-hint { text-align: center; font-weight: 700; margin: 16px 0 0; min-height: 20px; color: var(--muted); transition: color .2s; }
.demo-hint.good { color: #0b7a44; }
.demo-hint.bad  { color: #e23b3b; }

.demo-result { text-align: center; }
.demo-emoji { font-size: 56px; line-height: 1; }
.demo-result h2 { margin: 8px 0 4px; font-size: 24px; }
.login-card { text-align: center; }

.pop { animation: pop .42s cubic-bezier(.2,.8,.2,1.25) both; }
@keyframes pop { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }

/* Snappier, more tactile options + buttons (helps the real game too) */
.opt { transition: transform .08s ease, border-color .15s ease, background .2s ease, box-shadow .2s ease; }
.opt:not(:disabled):hover { border-color: var(--blue-2); box-shadow: 0 6px 16px rgba(11,95,165,.14); transform: translateY(-1px); }
.opt.correct { animation: optpop .35s ease; }
@keyframes optpop { 0% { transform: scale(1); } 40% { transform: scale(1.025); } 100% { transform: scale(1); } }
.btn-lg { transition: transform .08s ease, filter .15s ease, box-shadow .2s ease; }
.btn-primary:hover, .btn-fb:hover, .btn-wa:hover { filter: brightness(1.05); box-shadow: 0 8px 22px rgba(0,0,0,.18); }

@media (prefers-reduced-motion: reduce) {
  #landing .card, .pop, .hero-art .sun, .opt.correct { animation: none; }
}

/* Menu hub — game-style ------------------------------------------------- */
.menu-body { background: linear-gradient(180deg, #d4e8f6 0, var(--bg) 230px) no-repeat; background-color: var(--bg); min-height: 100dvh; }
.menu-screen { padding-top: 16px; }
.menu-screen > * { animation: cardIn .45s cubic-bezier(.2,.7,.2,1) both; }
.menu-screen > *:nth-child(2) { animation-delay: .05s; }
.menu-screen > *:nth-child(3) { animation-delay: .10s; }
.menu-screen > *:nth-child(4) { animation-delay: .15s; }
.menu-screen > *:nth-child(5) { animation-delay: .20s; }
.menu-screen > *:nth-child(6) { animation-delay: .25s; }

.profile-card { display: flex; align-items: center; gap: 14px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0B5FA5, #1493C7); color: #fff; border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }
.profile-card::after { content: ''; position: absolute; top: -45%; right: -8%; width: 170px; height: 170px;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); pointer-events: none; }
.avatar { flex: 0 0 auto; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.22); border: 2px solid rgba(255,255,255,.5); font-size: 28px; font-weight: 900; }
.profile-info { position: relative; z-index: 1; }
.profile-info .hello { margin: 0; opacity: .85; font-size: 13px; }
.profile-info .pname { margin: 2px 0 7px; font-size: 24px; line-height: 1.1; }
.rank-badge { display: inline-block; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.4);
  padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }

.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.stat-tile { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 4px; text-align: center; }
.st-ico { display: block; font-size: 20px; }
.st-num { display: block; font-size: 21px; font-weight: 900; color: var(--ink); line-height: 1.25; }
.st-lbl { display: block; font-size: 10px; color: var(--muted); }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.action-btn { display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  background: var(--card); color: var(--blue); font-weight: 800; font-size: 15px; border-radius: 14px; padding: 16px 8px;
  box-shadow: var(--shadow); border: 2px solid transparent; transition: transform .08s ease, border-color .15s ease, box-shadow .2s ease; }
.action-btn:hover { transform: translateY(-2px); border-color: var(--blue-2); box-shadow: 0 8px 20px rgba(11,95,165,.16); }
.action-btn:active { transform: scale(.97); }
.action-btn .ico { font-size: 20px; }

.btn-glow { box-shadow: 0 6px 20px rgba(255,106,61,.42); animation: glowPulse 2.4s ease-in-out infinite; }
@keyframes glowPulse { 0%, 100% { box-shadow: 0 6px 18px rgba(255,106,61,.38); } 50% { box-shadow: 0 9px 30px rgba(255,106,61,.62); } }

.refcode-box { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #eef6ff; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }

@media (prefers-reduced-motion: reduce) {
  .menu-screen > *, .btn-glow { animation: none; }
}

/* Game Over / result cards pop in (play, daily, challenge) */
.endcard { animation: pop .42s cubic-bezier(.2,.8,.2,1.2) both; }
.endcard .end-emoji, .demo-emoji { display: inline-block; animation: emojiPop .55s cubic-bezier(.2,.8,.2,1.5) both; }
@keyframes emojiPop { 0% { transform: scale(.2); opacity: 0; } 65% { transform: scale(1.18); } 100% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .endcard, .endcard .end-emoji, .demo-emoji { animation: none; } }

/* Toast ------------------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  max-width: 90vw; text-align: center;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .btn, .toast { transition: none; }
}

/* ===========================================================================
   Landing — web/desktop layout (hybrid). Mobile keeps the single column; from
   820px up the post-hero content becomes 2 columns (demo | leaderboard) with
   the login as a centred CTA below. Game screens stay the centred column.
   =========================================================================== */
.landing-top { display: flex; flex-direction: column; gap: 16px; }
.landing-top .lt-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.login-feats { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--ink); text-align: left; }
.login-feats li { background: #eef6ff; border-radius: 10px; padding: 9px 12px; }

@media (min-width: 820px) {
  #landing { max-width: 1000px; }
  /* top row: demo (left) + login Google (right) */
  #landing .landing-top { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 22px; align-items: start; }
  /* leaderboard = full width, players in 2 columns */
  #landing .landing-board { width: 100%; }
  #landing .landing-board .lb-head { display: none; }
  #landing .landing-board .lb-scroll {
    column-count: 2; column-gap: 30px;
    max-height: none; overflow: visible;
  }
  #landing .landing-board .lb-row { break-inside: avoid; }
}

/* Menu — desktop dashboard (profil + stat penuh atas; 2 kolum bawah). Mobile stacks. */
.menu-grid { display: flex; flex-direction: column; gap: 14px; }
.menu-grid .mg-col { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 820px) {
  #menu { max-width: 860px; }
  #menu .menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
}

/* Papan Markah — desktop: lebih lebar + board 2 lajur pemain */
@media (min-width: 820px) {
  #lbpage { max-width: 820px; }
  #lbpage #board { column-count: 2; column-gap: 30px; }
  #lbpage #board .lb-head { display: none; }
  #lbpage #board .lb-row { break-inside: avoid; }
}

/* Game / daily / cabar / form / content screens — a touch wider on desktop
   (focused but not cramped). Pages with their own id-width (#landing/#menu/
   #lbpage) override this via higher specificity, so they keep their layouts. */
@media (min-width: 820px) {
  .screen { max-width: 600px; }
}

/* Game screens (menu/play/leaderboard/daily/challenge) keep the centred column,
   but on desktop get a Sabah sky→forest backdrop + faint hills so the empty
   sides look intentional. Mobile is untouched (flat background). */
@media (min-width: 820px) {
  body {
    background: linear-gradient(180deg, #d4e8f6 0%, #eef5f1 46%, #d9ecdd 100%);
    background-attachment: fixed;
  }
  body::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image:
      radial-gradient(820px 460px at 86% -6%, rgba(255,201,60,.18), transparent 62%),
      url("/assets/hills.svg");
    background-repeat: no-repeat;
    background-position: center, bottom center;
    background-size: auto, 100% 300px;
  }
}
