:root {
  --bg: #2B1214;
  --card: #3F1D20;
  --line: #6E3A2C;
  --main: #F7931E;
  --accent: #E5352B;
  --text: #FFEBD2;
  --muted: #C9A68C;
  --ok: #3FA34D;
  --nav-h: 68px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 700 15px/1.4 Nunito, Poppins, 'Noto Sans Thai', system-ui, sans-serif;
  overscroll-behavior: none;
}
.sky {
  position: fixed; inset: 0 0 auto 0; height: 300px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120px 46px at 18% 34%, rgba(255, 190, 120, .30), transparent 70%),
    radial-gradient(170px 56px at 82% 22%, rgba(255, 160, 90, .26), transparent 70%),
    radial-gradient(220px 70px at 50% 62%, rgba(229, 83, 43, .22), transparent 70%),
    linear-gradient(180deg, #8A3A22 0%, #5A2219 45%, var(--bg) 100%);
}
header, main { position: relative; z-index: 1; }
header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 6px; }
.brand { display: flex; align-items: center; gap: 6px; font-size: 22px; font-weight: 900; letter-spacing: .5px; }
.brand b { color: var(--main); }
.brand-plane { width: 40px; height: 22px; }
.chips { display: flex; align-items: center; gap: 6px; }
.chip {
  display: flex; align-items: center; gap: 5px; background: rgba(43, 18, 20, .75);
  border: 1.5px solid var(--main); padding: 5px 11px 5px 7px; border-radius: 999px; font-weight: 900; font-size: 15px;
}
.chip svg { width: 20px; height: 20px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line); background: rgba(43, 18, 20, .75);
  color: var(--text); display: grid; place-items: center; cursor: pointer; font-size: 16px; padding: 0;
}
.icon-btn svg { width: 20px; height: 20px; }
main { padding: 4px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; }
h1 { font-size: 22px; font-weight: 900; margin: 12px 0 10px; }
h2 { font-size: 20px; font-weight: 900; margin: 8px 0; text-align: center; }
h2.left { text-align: left; margin-top: 22px; }
p { margin: 8px 0; }
.muted { color: var(--muted); font-size: 13.5px; }
.center { text-align: center; }
.strong { font-weight: 900; }
.hidden { display: none !important; }
.tab { display: none; }
.tab.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.title-row { display: flex; align-items: center; justify-content: space-between; }
.day-badge { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--main); }

.card, .item { background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.card { padding: 16px; margin-bottom: 12px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 68px; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 800; font-size: 15px; }
.item .pts { color: var(--main); font-weight: 900; font-size: 13.5px; }
.note { color: var(--muted); font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; }
.notice { background: rgba(247, 147, 30, .14); border: 1px solid var(--main); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; }

.btn {
  border: 0; border-radius: 999px; background: var(--main); color: #2B1214;
  font: 900 14px Nunito, 'Noto Sans Thai', sans-serif; letter-spacing: .3px;
  padding: 0 16px; min-width: 104px; height: 44px; cursor: pointer;
  box-shadow: 0 3px 0 #B5650A; transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #B5650A; }
.btn.big { width: 100%; height: 54px; font-size: 17px; margin-top: 12px; }
.btn.ghost { background: transparent; color: var(--main); border: 2px solid var(--main); box-shadow: none; }
.btn.claim { background: var(--accent); color: #fff; box-shadow: 0 3px 0 #8E1A14; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { filter: brightness(1.18); } }
.btn.wait { background: transparent; color: var(--text); border: 2px dashed var(--muted); box-shadow: none; font-variant-numeric: tabular-nums; }
.btn.done { background: var(--ok); color: #fff; box-shadow: none; }
.btn.locked { background: #5A3A36; color: #A98C80; box-shadow: none; }
.btn:disabled { cursor: default; transform: none; animation: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.row2 .btn { min-width: 0; height: 48px; }
.link-btn { display: block; margin: 14px auto 4px; background: none; border: 0; color: var(--main); font: 900 15px Nunito, sans-serif; text-decoration: underline; cursor: pointer; }

/* Roda */
.spin-count { text-align: center; font-size: 20px; font-weight: 900; margin: 10px 0 6px; }
.wheel-wrap { position: relative; width: min(88vw, 360px); margin: 6px auto 0; aspect-ratio: 1; }
.wheel { width: 100%; height: 100%; display: block; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .45)); }
#wheel-disc { transform-origin: 0 0; will-change: transform; }
.wheel text { font-family: Nunito, 'Noto Sans Thai', sans-serif; }
.wheel-pointer {
  position: absolute; left: 50%; top: -6px; z-index: 2; transform: translateX(-50%);
  border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 26px solid #FFEBD2;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .5));
}
.spin-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2;
  width: 27%; aspect-ratio: 1; border-radius: 50%; border: 4px solid #FFEBD2; background: var(--main); color: #2B1214;
  font: 900 17px Nunito, 'Noto Sans Thai', sans-serif; cursor: pointer; box-shadow: 0 4px 0 #B5650A, 0 8px 14px rgba(0, 0, 0, .4);
}
.spin-btn:active { transform: translate(-50%, calc(-50% + 3px)); box-shadow: 0 1px 0 #B5650A; }
.spin-btn:disabled { background: #7A5A50; color: #C9A68C; box-shadow: none; cursor: default; }

/* Gift Shop */
.coin-card { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 900; }
.coin-card svg { width: 30px; height: 30px; }
.gifts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.gift { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 12px 10px; text-align: center; display: flex; flex-direction: column; gap: 3px; }
.gift.out { opacity: .6; }
.gift-icon { font-size: 40px; line-height: 1.15; }
.gift-icon.small { font-size: 28px; }
.gift-name { font-weight: 800; font-size: 14px; min-height: 38px; display: flex; align-items: center; justify-content: center; }
.gift-cost { display: flex; align-items: center; justify-content: center; gap: 5px; color: var(--main); font-weight: 900; font-size: 16px; }
.gift-cost svg { width: 18px; height: 18px; }
.gift .btn { min-width: 0; width: 100%; height: 40px; margin-top: 6px; font-size: 13px; padding: 0 6px; }
.status { font-size: 12px; font-weight: 900; padding: 4px 9px; border-radius: 999px; background: var(--line); text-align: center; max-width: 42%; }
.status.checked { background: #2F5F8A; } .status.shipped { background: var(--ok); color: #fff; } .status.rejected { background: #7A2A26; }

/* Tab bar */
nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(3, 1fr); background: #241012; border-top: 1px solid var(--line);
}
nav button {
  background: none; border: 0; color: var(--muted); font: 800 12px Nunito, 'Noto Sans Thai', sans-serif;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer;
}
nav svg { width: 26px; height: 26px; }
nav button.active { color: var(--main); }

/* Overlay & sheet */
.overlay { position: fixed; inset: 0; z-index: 10; background: rgba(20, 8, 9, .86); display: flex; align-items: flex-end; justify-content: center; }
.overlay.center-box { align-items: center; padding: 24px; }
.sheet {
  width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 24px 24px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); animation: up .25s ease;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet ul, .sheet ol { padding-left: 22px; margin: 10px 0; }
.sheet li { margin: 6px 0; }
.sheet label { display: block; margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.sheet input, .sheet textarea {
  display: block; width: 100%; margin-top: 4px; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: 700 16px Nunito, 'Noto Sans Thai', sans-serif; resize: none;
}
.sheet input:focus, .sheet textarea:focus { outline: 2px solid var(--main); border-color: transparent; }
.welcome-plane { display: block; width: 120px; height: 64px; margin: 0 auto; }
.badge18 { width: 52px; height: 52px; line-height: 46px; margin: 8px auto; text-align: center; border-radius: 50%; border: 3px solid var(--accent); color: var(--accent); font-weight: 900; font-size: 17px; }
.langs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.lang { height: 40px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--text); font: 900 14px Nunito, sans-serif; cursor: pointer; }
.lang.on { border-color: var(--main); color: var(--main); background: rgba(247, 147, 30, .14); }
.ref-link { background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; padding: 12px; font-size: 14px; word-break: break-all; color: var(--main); margin-top: 10px; }
.result-box { width: 100%; max-width: 340px; background: var(--card); border: 2px solid var(--line); border-radius: 24px; padding: 26px 20px 20px; text-align: center; animation: pop .3s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.result-title { font-size: 32px; font-weight: 900; }
.overlay.win .result-box { border-color: var(--main); }
.overlay.win .result-title { color: var(--main); }

/* Main AviaX */
.game { position: fixed; inset: 0; z-index: 15; background: #140809; display: flex; flex-direction: column; }
.game-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.game-bar b { flex: 1; font-size: 16px; }
.game-time { font-weight: 900; font-size: 17px; font-variant-numeric: tabular-nums; }
.game-status { font-size: 11.5px; font-weight: 900; padding: 4px 9px; border-radius: 999px; }
.game-status.on { background: var(--ok); color: #fff; }
.game-status.off { background: var(--accent); color: #fff; }
.game-status.done { background: var(--main); color: #2B1214; }
.game-note { padding: 6px 12px; font-size: 12.5px; color: var(--muted); text-align: center; background: #241012; }
.game-frame { flex: 1; width: 100%; border: 0; background: #000; }
.game-ext { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 26px); transform: translate(-50%, 20px); z-index: 30;
  background: #FFEBD2; color: #2B1214; padding: 10px 18px; border-radius: 999px; font-weight: 900; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--accent); color: #fff; }
