: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;
    position: relative;
}

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);
}

/* ---------- Time Bomb ---------- */

.tb-rule-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.tb-mode-label {
    font-family: var(--font-display);
    font-weight: 600;
    text-align: center;
    margin: 20px 0 10px;
}

.tb-mode-btn {
    width: 100%;
    background: var(--purple);
    font-size: 17px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tb-mode-hint {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 13px;
    opacity: .85;
}

.tb-stage {
    text-align: center;
    padding-top: 15vh;
}

.tb-bomb-icon {
    font-size: 110px;
    line-height: 1;
    margin-bottom: 20px;
    animation: tbPulse 1.1s ease-in-out infinite;
}

.tb-bomb-icon.tb-tick-flash {
    animation: tbPulse 1.1s ease-in-out infinite, tbTickFlash .25s ease-out;
}

.tb-hold-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 28px;
    color: var(--coral);
    margin: 0 0 28px;
}

.tb-pass-btn {
    width: 80%;
    max-width: 280px;
    font-size: 20px;
    padding: 22px;
    background: var(--coral);
}

/* Full-screen overlays (mission / boom) */
.tb-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
}

.tb-overlay[hidden] {
    display: none;
}

#mission-overlay {
    background: rgba(36, 26, 23, 0.75);
}

.tb-mission-card {
    max-width: 400px;
    width: 100%;
    animation: mgPop .2s ease-out;
}

.tb-mission-label {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--purple);
    margin: 0 0 10px;
}

.tb-mission-text {
    font-size: 18px;
    line-height: 1.6;
    margin: 0 0 18px;
}

.tb-mission-confirm-btn {
    width: 100%;
    background: var(--teal);
}

.tb-boom-screen {
    background: var(--ink);
    color: #fff;
}

.tb-boom-screen.tb-shake {
    animation: tbShake .4s ease-in-out;
}

.tb-boom-emoji {
    font-size: 130px;
    line-height: 1;
    margin-bottom: 10px;
    animation: mgPop .35s ease-out;
}

.tb-boom-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 30px;
    color: var(--coral);
    margin: 0 0 28px;
}

.tb-play-again-btn {
    background: var(--yellow);
    color: var(--ink);
    font-size: 18px;
    padding: 16px 32px;
}

@keyframes tbPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes tbTickFlash {
    0% { filter: drop-shadow(0 0 0 var(--coral)); }
    50% { filter: drop-shadow(0 0 18px var(--coral)); }
    100% { filter: drop-shadow(0 0 0 var(--coral)); }
}

@keyframes tbShake {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-8px, 4px); }
    40% { transform: translate(7px, -5px); }
    60% { transform: translate(-6px, -3px); }
    80% { transform: translate(8px, 5px); }
}

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