:root {
    --bg: #FFF7EE;
    --ink: #241A17;
    --text-secondary: #5A4A42;
    --text-muted: #8C7E77;
    --chip-bg: #FFF1E0;
    --coral: #FF5A4D;
    --yellow: #FFC93C;
    --teal: #2FBF9A;
    --purple: #7C5CFF;
    --pink: #FF7DAE;
    --font-display: 'Mitr', sans-serif;
    --font-body: 'IBM Plex Sans Thai', sans-serif;
}

* { box-sizing: border-box; }

input, select, textarea, button {
    font-family: inherit;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
}

.page {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

h1 {
    font-family: var(--font-display);
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    color: var(--coral);
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 14px;
}

.back-home {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
}

.back-home:hover {
    color: var(--coral);
}

.card {
    background: #fff;
    border: 2px solid var(--ink);
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 5px 5px 0 var(--ink);
}

.center-text { text-align: center; }
.muted { color: var(--text-muted); font-size: 14px; }

button {
    padding: 12px;
    border-radius: 999px;
    border: 2px solid var(--ink);
    background: var(--coral);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform .12s, box-shadow .12s;
}

button:hover {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 var(--ink);
}

button.secondary {
    background: #fff;
    color: var(--ink);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--chip-bg);
    border: 1.5px solid var(--ink);
    color: var(--ink);
}

/* ---------- Mini-game roulette ---------- */

.mg-stage {
    text-align: center;
}

.mg-roll-btn {
    width: 100%;
    background: var(--purple);
    font-size: 19px;
    padding: 20px;
    margin-bottom: 16px;
}

.mg-card {
    text-align: center;
}

.mg-card.mg-pop-anim {
    animation: mgPop .25s ease-out;
}

.mg-card-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.mg-card-icon {
    font-size: 48px;
    line-height: 1;
}

.mg-card-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    margin: 4px 0 12px;
}

.mg-card-rule {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0 0 18px;
}

.mg-pool {
    margin-bottom: 16px;
}

.mg-pool-btn {
    width: 100%;
}

.mg-pool-result {
    margin-top: 10px;
    padding: 10px;
    border-radius: 14px;
    background: var(--chip-bg);
    border: 1.5px solid var(--ink);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 20px;
}

.mg-pool-result.mg-pop-anim {
    animation: mgPop .2s ease-out;
}

.mg-timer {
    margin-bottom: 16px;
}

.mg-timer-display {
    font-family: var(--font-display);
    font-size: 56px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-bottom: 10px;
    transition: color .15s;
}

.mg-timer-display.mg-timer--done {
    color: var(--coral);
    animation: mgFlash .6s ease-in-out 3;
}

.mg-timer-controls {
    display: flex;
    gap: 10px;
}

.mg-timer-controls button {
    flex: 1;
}

.mg-reroll-btn {
    width: 100%;
    margin-top: 4px;
}

@keyframes mgPop {
    0% { transform: scale(.92); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes mgFlash {
    0%, 100% { background: transparent; }
    50% { background: #FFE1DD; }
}
