/* ============ เกมเรียนรู้ ป.1-3 — สไตล์หลัก ============ */
:root {
    --purple: #7c5cff;
    --purple-dark: #5f3dd6;
    --orange: #ff9f43;
    --pink: #ff7ab6;
    --bg: #fdf6ff;
    --bg-soft: #fff7ee;
    --text: #2c2542;
    --text-soft: #6b6480;
    --card: #ffffff;
    --border: #ece4fb;
    --success: #35c46f;
    --danger: #ff5470;
    --radius: 18px;
    --shadow: 0 10px 30px rgba(124, 92, 255, .12);
    font-size: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Prompt", "Sarabun", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
    color: var(--text);
    line-height: 1.6;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

a { color: var(--purple-dark); text-decoration: none; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
img { max-width: 100%; display: block; }

/* ---------- ปุ่ม ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4em;
    padding: 14px 26px; border-radius: 999px; font-weight: 700; font-size: 1rem;
    border: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
    text-decoration: none;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, var(--orange), #ffb35e); color: #fff; box-shadow: 0 8px 20px rgba(255,159,67,.4); }
.btn-secondary { background: linear-gradient(135deg, var(--purple), #9b7fff); color: #fff; box-shadow: 0 8px 20px rgba(124,92,255,.35); }
.btn-ghost { background: #fff; color: var(--purple-dark); border: 2px solid var(--border); padding: 10px 22px; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Header ---------- */
.site-header { padding: 16px 0; background: rgba(255,255,255,.7); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { font-weight: 800; font-size: 1.15rem; color: var(--text); }
.main-nav { display: flex; align-items: center; gap: 22px; font-weight: 600; flex-wrap: wrap; }

/* ---------- Hero ---------- */
.hero { padding: 60px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero .mascot { font-size: 70px; margin-bottom: 10px; }
.hero h1 { font-size: 2.6rem; color: var(--purple-dark); }
.hero h1 .accent { color: var(--orange); }
.hero p.lead { font-size: 1.1rem; color: var(--text-soft); max-width: 46ch; }
.hero-actions { display: flex; gap: 14px; margin-top: 24px; flex-wrap: wrap; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 34px; }
.badge { background: #fff; border: 2px solid var(--border); border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: .85rem; box-shadow: var(--shadow); }
.hero-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hero-gallery .card-thumb { background: linear-gradient(135deg,#ffe3c2,#ffd0e6); border-radius: var(--radius); aspect-ratio: 1/.8; display:flex; align-items:center; justify-content:center; font-size:2.5rem; box-shadow: var(--shadow); }

@media (max-width: 860px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2rem; }
}

/* ---------- Sections ---------- */
section { padding: 50px 0; }
.section-title { text-align: center; font-size: 1.8rem; color: var(--purple-dark); margin-bottom: 8px; }
.section-sub { text-align: center; color: var(--text-soft); margin-bottom: 34px; }

/* ---------- Demo box ---------- */
.demo-box { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 28px; display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; align-items: center; }
.demo-frame-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 4px solid var(--border); background:#fafaff; }
.demo-frame-wrap iframe { width: 100%; height: 420px; border: 0; display: block; }
.demo-overlay { position: absolute; inset: 0; background: rgba(44,37,66,.88); color:#fff; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; gap:14px; padding: 20px; }
.demo-timer { font-weight: 800; font-size: 2rem; color: var(--orange); }
@media (max-width: 860px) { .demo-box { grid-template-columns: 1fr; } }

/* ---------- Feature grid ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.feature-card .icon { font-size: 1.8rem; margin-bottom: 8px; }
.feature-card h3 { font-size: 1.05rem; }
.feature-card p { color: var(--text-soft); margin: 0; font-size: .92rem; }
@media (max-width: 760px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .feature-grid { grid-template-columns: 1fr; } }

/* ---------- Pricing ---------- */
.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 760px; margin: 0 auto; }
.price-card { background: var(--card); border-radius: 24px; padding: 30px; box-shadow: var(--shadow); position: relative; border: 3px solid transparent; }
.price-card.best { border-color: var(--orange); }
.price-card .ribbon { position: absolute; top: -14px; right: 20px; background: var(--orange); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: .8rem; font-weight: 800; }
.price-card h3 { color: var(--purple-dark); }
.price-full { text-decoration: line-through; color: var(--text-soft); font-size: .95rem; }
.price-now { font-size: 2.2rem; font-weight: 800; color: var(--text); }
.price-now .thb { font-size: 1.1rem; font-weight: 600; }
.discount-tag { display:inline-block; background:#ffe6ee; color:var(--danger); border-radius:999px; padding:2px 10px; font-size:.78rem; font-weight:800; margin-left:8px; }
.price-features { list-style: none; padding: 0; margin: 20px 0; }
.price-features li { padding: 6px 0; }
@media (max-width: 700px) { .pricing-grid { grid-template-columns: 1fr; } }

/* ---------- FAQ ---------- */
.faq { max-width: 760px; margin: 0 auto; }
.faq-item { background: var(--card); border-radius: 14px; margin-bottom: 12px; box-shadow: var(--shadow); overflow: hidden; }
.faq-item summary { padding: 16px 20px; font-weight: 700; cursor: pointer; list-style: none; display:flex; justify-content:space-between; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item .faq-body { padding: 0 20px 18px; color: var(--text-soft); }

/* ---------- Auth forms ---------- */
.auth-wrap { max-width: 420px; margin: 60px auto; }
.auth-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px; }
.auth-card h1 { text-align: center; font-size: 1.5rem; color: var(--purple-dark); }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: .92rem; }
.field input, .field select { width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--border); font-size: 1rem; font-family: inherit; }
.field input:focus, .field select:focus { outline: none; border-color: var(--purple); }
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: .92rem; font-weight: 600; }
.alert-error { background: #ffe6ea; color: var(--danger); }
.alert-success { background: #e4faee; color: var(--success); }
.auth-switch { text-align: center; margin-top: 16px; color: var(--text-soft); font-size: .92rem; }

/* ---------- Dashboard ---------- */
.dash-header { padding: 30px 0 10px; }
.dash-header h1 { color: var(--purple-dark); }
.pkg-pill { display:inline-flex; align-items:center; gap:6px; background:#eee6ff; color:var(--purple-dark); padding:6px 14px; border-radius:999px; font-weight:700; font-size:.85rem; }
.pkg-pill.none { background:#ffe6ea; color:var(--danger); }

.subject-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0 30px; }
.subject-tabs a { background:#fff; border:2px solid var(--border); border-radius:999px; padding:8px 16px; font-weight:700; font-size:.9rem; }
.subject-tabs a.active { background: var(--purple); border-color: var(--purple); color:#fff; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; padding-bottom: 60px; }
.game-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display:flex; flex-direction:column; }
.game-card .thumb { aspect-ratio: 4/3; background: linear-gradient(135deg,#e9e1ff,#ffe4f0); display:flex; align-items:center; justify-content:center; font-size:2.6rem; position: relative; }
.game-card .thumb .lock { position:absolute; inset:0; background:rgba(44,37,66,.55); color:#fff; display:flex; align-items:center; justify-content:center; font-size:1.8rem; }
.game-card .body { padding: 14px 16px; display:flex; flex-direction:column; gap:6px; flex:1; }
.game-card .subject-tag { font-size: .75rem; font-weight: 700; color: var(--purple-dark); }
.game-card h3 { font-size: .98rem; margin: 0; }
.game-card .tag-ar { background:#fff2d6; color:#b5760b; font-size:.7rem; font-weight:800; padding:2px 8px; border-radius:999px; display:inline-block; }
.game-card .tag-soon { background:#eee; color:#888; font-size:.7rem; font-weight:800; padding:2px 8px; border-radius:999px; display:inline-block; }
.game-card .stars { color: var(--orange); font-size: .85rem; }
.game-card .play-btn { margin-top: auto; }

/* ---------- Play page ---------- */
.play-wrap { max-width: 900px; margin: 20px auto; }
.play-frame-box { background:#000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.play-frame-box iframe { width: 100%; height: 600px; border: 0; display: block; }
.play-toolbar { display:flex; justify-content: space-between; align-items:center; margin-bottom: 14px; }
.difficulty-select { display:flex; gap:8px; }
.difficulty-select button { border:2px solid var(--border); background:#fff; border-radius:999px; padding:6px 16px; font-weight:700; cursor:pointer; }
.difficulty-select button.active { background: var(--purple); color:#fff; border-color: var(--purple); }

/* ---------- Checkout ---------- */
.checkout-wrap { max-width: 560px; margin: 40px auto; }
.checkout-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px; }
.method-tabs { display:flex; gap:10px; margin-bottom:20px; }
.method-tabs button { flex:1; padding:12px; border-radius: 12px; border:2px solid var(--border); background:#fff; font-weight:700; cursor:pointer; }
.method-tabs button.active { border-color: var(--purple); background:#f4f0ff; color: var(--purple-dark); }
#promptpay-qr { text-align:center; padding: 20px 0; }
#promptpay-qr img { margin: 0 auto; border-radius: 12px; border: 4px solid var(--border); }
.order-summary { display:flex; justify-content:space-between; padding:10px 0; border-bottom: 1px dashed var(--border); }
.order-summary.total { font-weight: 800; font-size: 1.2rem; border-bottom:none; }

/* ---------- Admin ---------- */
.admin-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 80vh; }
.admin-sidebar { background: #2c2542; color: #fff; padding: 24px 0; }
.admin-sidebar a { display:block; color:#d8d2f5; padding:12px 24px; font-weight:600; }
.admin-sidebar a.active, .admin-sidebar a:hover { background: rgba(255,255,255,.08); color:#fff; }
.admin-main { padding: 30px; }
.stat-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap:16px; margin-bottom: 30px; }
.stat-card { background:#fff; border-radius: 14px; padding:20px; box-shadow: var(--shadow); }
.stat-card .num { font-size: 1.8rem; font-weight: 800; color: var(--purple-dark); }
.stat-card .lbl { color: var(--text-soft); font-size: .85rem; }
table.data-table { width: 100%; border-collapse: collapse; background:#fff; border-radius: 14px; overflow:hidden; box-shadow: var(--shadow); }
table.data-table th, table.data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: .92rem; }
table.data-table th { background: #f6f2ff; color: var(--purple-dark); }
.table-wrap { overflow-x: auto; }
.status-chip { padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.status-chip.live, .status-chip.successful { background:#e4faee; color: var(--success); }
.status-chip.coming_soon, .status-chip.pending { background:#fff3d6; color:#b5760b; }
.status-chip.failed { background:#ffe6ea; color: var(--danger); }

/* ---------- Footer ---------- */
.site-footer { background: #2c2542; color: #d8d2f5; padding: 34px 0; margin-top: 60px; }
.footer-inner { text-align: center; }
.site-footer a { color: #fff; }
