/* =====================================================================
   DUNIA CILIK — IDENTITI NUSANTARA (lapisan v3)
   Palet tempatan (kunyit, pandan, cili, nila, terung, kayu, krim),
   motif pucuk rebung & songket, dan tema bercorak Melayu.
   ===================================================================== */
:root {
  --ink: #2b2140; --ink-soft: #6b5f7e;
  --kunyit: #f2a922; --kunyit-d: #c9820b;
  --pandan: #2f9e6a; --pandan-d: #1f7a50;
  --cili: #e2553f; --cili-d: #b53a28;
  --nila: #2e5aac; --nila-d: #1f3f86;
  --terung: #7a4eb0; --terung-d: #573391;
  --kayu: #9a5b34; --kayu-d: #6f3f22;
  --krim: #fff6e6;
  --primary: var(--pandan); --primary-d: var(--pandan-d);
  --accent: var(--kunyit); --accent-d: var(--kunyit-d);
  --hero1: #34ad75; --hero2: #1f7a50;
  --chip: rgba(255, 250, 241, .96);
  --card-line: rgba(111, 63, 34, .12);
  --ring-bg: #f1e6d4;
  /* motif pucuk rebung (segi tiga) & songket (berlian) */
  --pucuk: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='14' viewBox='0 0 20 14'%3E%3Cpath d='M0 0h20L10 14z'/%3E%3C/svg%3E");
  --songket: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.22' stroke-width='1.6'%3E%3Cpath d='M14 2l12 12-12 12L2 14z'/%3E%3Cpath d='M14 9l5 5-5 5-5-5z'/%3E%3C/g%3E%3C/svg%3E");
}
body { color: var(--ink); }

/* ---------- jalur pucuk rebung ---------- */
.mode-card::before {
  display: block !important; content: ""; position: absolute; left: 0; right: 0; top: 0; height: 14px; opacity: 1;
  background: var(--c); -webkit-mask: var(--pucuk) 0 0 / 20px 14px repeat-x; mask: var(--pucuk) 0 0 / 20px 14px repeat-x;
}
.stage::before { height: 14px !important; opacity: 1 !important; background: var(--mc, var(--primary)) !important; -webkit-mask: var(--pucuk) 0 0 / 22px 14px repeat-x; mask: var(--pucuk) 0 0 / 22px 14px repeat-x; }
.tier-card { position: relative; overflow: hidden; padding-top: 22px; }
.tier-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px; background: var(--kunyit); -webkit-mask: var(--pucuk) 0 0 / 18px 12px repeat-x; mask: var(--pucuk) 0 0 / 18px 12px repeat-x; }
.win-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -13px; height: 14px; background: var(--hero2); -webkit-mask: var(--pucuk) 0 0 / 22px 14px repeat-x; mask: var(--pucuk) 0 0 / 22px 14px repeat-x; }
.win-head { margin-bottom: 10px; }

/* ---------- kad & panel: krim hangat ---------- */
.panel, .player-card, .daily-item, .coll-item, .explore-card, .tier-card, .guide .bubble, .topbar .title, .pill, .play-title, .play-head .progress { background: var(--chip); }
.guide .bubble::before { border-right-color: var(--chip); }
.mode-card {
  background: #fffaf1; padding-top: 22px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 14%, #fffaf1) 0%, #fffaf1 55%);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 38%, #f1e6d4), 0 12px 22px rgba(111, 63, 34, .12);
}
.mode-card .mc-ring::after { background: radial-gradient(circle at 35% 30%, #fff, #fff6e6); }
.stage { background: rgba(255, 250, 241, .94); }
.choice, .drag-src { background: linear-gradient(180deg, #fffdf8, #fff5e4); box-shadow: 0 6px 0 #ecdcc3, 0 10px 18px rgba(111, 63, 34, .1); }
.choice:active { box-shadow: 0 1px 0 #ecdcc3; }
.mcard .b, .cell, .strip .s { box-shadow: 0 5px 0 #ecdcc3; }
.lvl { background: linear-gradient(180deg, #fffdf8, #f6ead6); box-shadow: 0 6px 0 #e3cfae, 0 10px 16px rgba(111, 63, 34, .14); }
.lvl.locked { background: linear-gradient(180deg, #f1e9dc, #e6dac6); color: #b7a58b; box-shadow: 0 5px 0 #d6c4a6; }
.lvl.done { background: linear-gradient(180deg, #ffd56a, var(--kunyit)); color: #6f3f0b; box-shadow: 0 6px 0 var(--kunyit-d), 0 10px 16px rgba(201, 130, 11, .3); }
.lv-row::before { background: repeating-linear-gradient(90deg, rgba(154, 91, 52, .35) 0 12px, transparent 12px 22px); box-shadow: none; height: 6px; }

/* ---------- butang palet tempatan ---------- */
.btn { --b1: #f9c24b; --b2: var(--kunyit); --bd: var(--kunyit-d); color: #fff; }
.btn.green { --b1: #49b985; --b2: var(--pandan); --bd: var(--pandan-d); }
.btn.blue { --b1: #4a78cc; --b2: var(--nila); --bd: var(--nila-d); }
.btn.purple { --b1: #9670cb; --b2: var(--terung); --bd: var(--terung-d); }
.btn.pink { --b1: #ee7a95; --b2: #db4f74; --bd: #a9334f; }
.btn.red { --b1: #ec7663; --b2: var(--cili); --bd: var(--cili-d); }
.btn.ghost { --b1: #fffdf8; --b2: #fbf1e0; --bd: #e3cfae; color: var(--ink); }
.btn-round { --b1: #9670cb; --b2: var(--terung); --bd: var(--terung-d); }
.btn-round.rb-sky { --b1: #4a78cc; --b2: var(--nila); --bd: var(--nila-d); }
.btn-round.rb-red { --b1: #ec7663; --b2: var(--cili); --bd: var(--cili-d); }
.btn-round.rb-green { --b1: #49b985; --b2: var(--pandan); --bd: var(--pandan-d); }
.btn-round.rb-orange { --b1: #f9c24b; --b2: var(--kunyit); --bd: var(--kunyit-d); }
.btn-round.rb-white { --b1: #fffdf8; --b2: #fbf1e0; --bd: #e3cfae; color: var(--terung); }
.dpad button { --b1: #4a78cc; --b2: var(--nila); --bd: var(--nila-d); }
.tabs button.on { background: var(--terung); box-shadow: 0 4px 0 var(--terung-d); }

/* ---------- logo ---------- */
.logo h1 { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--cili); display: flex; align-items: center; justify-content: center; gap: 10px; }
.logo h1 .l2 { color: var(--pandan); }
.logo h1 .logo-wau { width: .9em; height: 1.1em; flex: none; }
.logo p { color: var(--kayu-d); }

/* ---------- jubin halaman utama ---------- */
.tile-btn::after { content: ""; position: absolute; inset: 0; background: var(--songket) 0 0 / 28px 28px; pointer-events: none; border-radius: inherit; }
.tile-btn::before { background: linear-gradient(180deg, rgba(255, 255, 255, .22), transparent 45%); }
.tile-btn.t-orange { background: linear-gradient(170deg, #ec7663, var(--cili)); box-shadow: 0 6px 0 var(--cili-d), 0 12px 22px rgba(181, 58, 40, .25); }
.tile-btn.t-yellow { background: linear-gradient(170deg, #f9c24b, var(--kunyit)); box-shadow: 0 6px 0 var(--kunyit-d), 0 12px 22px rgba(201, 130, 11, .25); }
.tile-btn.t-pink { background: linear-gradient(170deg, #9670cb, var(--terung)); box-shadow: 0 6px 0 var(--terung-d), 0 12px 22px rgba(87, 51, 145, .25); }
.tile-btn.t-sky { background: linear-gradient(170deg, #4a78cc, var(--nila)); box-shadow: 0 6px 0 var(--nila-d), 0 12px 22px rgba(31, 63, 134, .25); }
.tile-btn .tb-ico { background: rgba(255, 246, 230, .25); }
.tile-btn.parent-link::after { display: none; }
.tile-btn.parent-link .tb-ico { background: linear-gradient(160deg, #b78a66, var(--kayu)); }
.play-cta { background: linear-gradient(135deg, var(--hero1), var(--hero2)); box-shadow: 0 8px 0 rgba(0, 0, 0, .2), 0 16px 30px rgba(31, 122, 80, .28); }
.play-cta::before { background: var(--songket) 0 0 / 28px 28px; opacity: .9; }
.play-cta::after { display: none; }
.play-cta .pc-play { color: var(--hero2); }
.section-title .ic { color: var(--cili); }
.guide .char { background: radial-gradient(circle at 35% 30%, #fffdf8, #fff1d6 60%, #ffe1a8); box-shadow: 0 0 0 4px #fff, 0 0 0 7px rgba(242, 169, 34, .35), 0 6px 14px rgba(111, 63, 34, .2); }
.avatar { background: radial-gradient(circle at 35% 30%, #fffdf8, #ffe1a8 60%, var(--kunyit)); }
.lvl-bar > i { background: linear-gradient(90deg, var(--kunyit), var(--cili)); }
.mcard .f { background: var(--songket) 0 0 / 24px 24px, linear-gradient(160deg, var(--terung), var(--nila)); box-shadow: 0 5px 0 var(--nila-d); }
.cell.cover { background: var(--songket) 0 0 / 24px 24px, linear-gradient(160deg, var(--terung), var(--nila)); box-shadow: 0 5px 0 var(--nila-d); }
.daily-item .chk { background: var(--kunyit); box-shadow: 0 4px 0 var(--kunyit-d); }
.daily-item.done .chk { background: var(--pandan); box-shadow: 0 4px 0 var(--pandan-d); }
.win-head { background: var(--songket) 0 0 / 28px 28px, linear-gradient(135deg, var(--hero1), var(--hero2)); }

/* ---------- tema gelap (songket, malam) ---------- */
html.dark-theme { --on-bg: #fff6e6; --on-bg-soft: #f3dfc1; }
html.dark-theme .section-title, html.dark-theme .logo p, html.dark-theme .screen > .center.muted, html.dark-theme .tier-head .muted { color: var(--on-bg); }
html.dark-theme .logo h1 { color: #ffd56a; }
html.dark-theme .logo h1 .l2 { color: #fff6e6; }
html.dark-theme .coll-item.off { opacity: .75; }
html.dark-theme .parent .panel h3 { color: var(--ink); }
html.dark-theme .boot-text { color: #fff; }

/* ==================== TEMA ==================== */
/* Kampung Ceria (lalai) */
html[data-theme="kampung"] { --hero1: #34ad75; --hero2: #1f7a50; }
html[data-theme="kampung"] body { background: linear-gradient(180deg, #ffd98a 0%, #ffe9c2 32%, #fff6e6 65%, #fff6e6 100%); }
html[data-theme="kampung"] .sun { top: 26px; right: 30px; width: 96px; height: 96px; border-radius: 50%; background: radial-gradient(circle, #fffbe6 0 42%, #ffe08a 58%, rgba(255, 224, 138, 0) 72%); animation: sunPulse 7s ease-in-out infinite; }
html[data-theme="kampung"] .cloud { left: -180px; animation: cloudMove linear infinite; }
html[data-theme="kampung"] .cloud svg, html[data-theme="kampung"] .wau svg, html[data-theme="kampung"] .bird svg { width: 100%; height: auto; display: block; }
html[data-theme="kampung"] .wau { left: 5%; top: 9%; width: 64px; transform-origin: 50% 0; animation: wauFly 6s ease-in-out infinite; }
html[data-theme="kampung"] .bird { left: -40px; width: 26px; animation: cloudMove linear infinite; }
html[data-theme="kampung"] .land, html[data-theme="malam"] .land { left: 0; right: 0; bottom: 0; height: min(30vh, 260px); }
html[data-theme="kampung"] .land svg, html[data-theme="malam"] .land svg, html[data-theme="batik"] .waves svg { width: 100%; height: 100%; display: block; }
@keyframes wauFly { 0%, 100% { transform: translate(0, 0) rotate(-6deg); } 50% { transform: translate(14px, -10px) rotate(6deg); } }

/* Batik Laut */
html[data-theme="batik"] { --hero1: #3f78c9; --hero2: #1f3f86; --primary: var(--nila); --primary-d: var(--nila-d); }
html[data-theme="batik"] body {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='60' viewBox='0 0 90 60'%3E%3Cg fill='none' stroke='%232e5aac' stroke-opacity='.12' stroke-width='2'%3E%3Cpath d='M5 40c0-12 14-12 14 0 0-18 22-18 22 0 0-12 14-12 14 0'/%3E%3Ccircle cx='70' cy='16' r='5'/%3E%3Ccircle cx='70' cy='16' r='10'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 90px 60px,
    linear-gradient(180deg, #e3eeff 0%, #cfe0fb 60%, #b9d2f6 100%);
}
html[data-theme="batik"] .waves { left: 0; right: 0; bottom: 0; height: min(24vh, 200px); }
html[data-theme="batik"] .perahu { right: 8%; bottom: calc(min(24vh, 200px) - 62px); width: 96px; animation: bobBoat 4s ease-in-out infinite; z-index: 1; }
html[data-theme="batik"] .perahu svg, html[data-theme="batik"] .ikan svg { width: 100%; height: auto; display: block; }
html[data-theme="batik"] .ikan { left: -120px; width: 70px; top: auto !important; animation: swimLow linear infinite; z-index: 2; }
html[data-theme="batik"] .ikan:nth-of-type(2) { bottom: 3vh; } html[data-theme="batik"] .ikan:nth-of-type(3) { bottom: 9vh; } html[data-theme="batik"] .ikan:nth-of-type(4) { bottom: 14vh; }
@keyframes bobBoat { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes swimLow { from { transform: translateX(0); } to { transform: translateX(calc(100vw + 240px)); } }

/* Songket Diraja (gelap) */
html[data-theme="songket"] { --hero1: #c9373f; --hero2: #7a1f2b; --primary: #c9373f; --primary-d: #7a1f2b; --chip: rgba(255, 250, 241, .97); }
html[data-theme="songket"] body {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23f2c14e' stroke-opacity='.22' stroke-width='1.4'%3E%3Cpath d='M20 2l18 18-18 18L2 20z'/%3E%3Cpath d='M20 12l8 8-8 8-8-8z'/%3E%3Ccircle cx='20' cy='20' r='1.8' fill='%23f2c14e' fill-opacity='.4'/%3E%3C/g%3E%3C/svg%3E") 0 0 / 40px 40px,
    linear-gradient(180deg, #6b1724 0%, #8f2531 50%, #6b1724 100%);
}
html[data-theme="songket"] .band { left: 0; right: 0; height: 26px; background: #f2c14e; -webkit-mask: var(--pucuk) 0 0 / 26px 26px repeat-x; mask: var(--pucuk) 0 0 / 26px 26px repeat-x; opacity: .9; }
html[data-theme="songket"] .band.top { top: 0; }
html[data-theme="songket"] .band.bottom { bottom: 0; transform: scaleY(-1); }
html[data-theme="songket"] .spark { width: 8px; height: 8px; background: #f2c14e; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: twinkle ease-in-out infinite; }

/* Malam Bulan (gelap) */
html[data-theme="malam"] { --hero1: #4a5fb5; --hero2: #2b3a73; --primary: #4a5fb5; --primary-d: #2b3a73; --accent: #f2a922; }
html[data-theme="malam"] body { background: radial-gradient(ellipse at 80% 8%, #3b4c94 0%, #24346b 40%, #142046 100%); }
html[data-theme="malam"] .star { width: 4px; height: 4px; border-radius: 50%; background: #fff6d6; box-shadow: 0 0 6px 2px rgba(255, 246, 214, .55); animation: twinkle ease-in-out infinite; }
html[data-theme="malam"] .moon { right: 7%; top: 5%; width: 92px; filter: drop-shadow(0 0 24px rgba(255, 243, 196, .55)); }
html[data-theme="malam"] .moon svg { width: 100%; height: auto; display: block; }
html[data-theme="malam"] .pelita { bottom: 3vh; width: 22px; animation: flicker 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
html[data-theme="malam"] .pelita svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 0 10px rgba(255, 176, 58, .8)); }
@keyframes flicker { 0%, 100% { transform: scale(1); opacity: 1; } 40% { transform: scale(1.05, .96); opacity: .85; } 70% { transform: scale(.97, 1.04); opacity: .95; } }

/* Kuih-muih */
html[data-theme="kuih"] { --hero1: #db4f74; --hero2: #a9334f; --primary: #db4f74; --primary-d: #a9334f; }
html[data-theme="kuih"] body {
  background:
    repeating-linear-gradient(0deg, rgba(255, 143, 171, .08) 0 18px, rgba(255, 255, 255, 0) 18px 36px),
    linear-gradient(165deg, #d9f5e3 0%, #fff1d6 50%, #ffe0ea 100%);
}
html[data-theme="kuih"] .kuih { animation: bob ease-in-out infinite; opacity: .9; }
html[data-theme="kuih"] .kuih svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 4px 4px rgba(111, 63, 34, .15)); }

/* pratonton tema di kedai */
.theme-prev.kampung { background: linear-gradient(180deg, #ffd98a 55%, #7fc36b 55%); }
.theme-prev.batik { background: linear-gradient(180deg, #cfe0fb 60%, #2e5aac 60%); }
.theme-prev.songket { background: var(--songket) 0 0 / 20px 20px, linear-gradient(180deg, #6b1724, #8f2531); }
.theme-prev.malam { background: radial-gradient(circle at 75% 25%, #fff3c4 0 10px, transparent 11px), linear-gradient(180deg, #24346b, #142046); }
.theme-prev.kuih { background: linear-gradient(165deg, #d9f5e3, #fff1d6 50%, #ffe0ea); }
.theme-prev.klasik { background: linear-gradient(180deg, #fff6e6, #fdeee0); }

.voice-warn { background: #fff4e0; border: 2px solid var(--kunyit); border-radius: 16px; padding: 10px 14px; margin-bottom: 10px; font-size: 14px; color: #6f3f0b; }
.voice-warn b { display: block; margin-bottom: 4px; font-size: 15px; }
