/* Man hinh hoc sinh: kiosk, sanh, tro choi san, cong hoc sinh. Ruc ro, nut to, de cham.
   Mau sac lay tu bien; phong cach FPT / High Tech ghi de trong themes.css. */
:root {
  --kid-bg: linear-gradient(180deg, #C9F0FF 0%, #7AD6FA 38%, #29B6F6 70%, #0288D1 100%);
  --kid-wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0 60c100-40 200-40 300 0s200 40 300 0 200-40 300 0 200 40 300 0v60H0z' fill='%230277BD' opacity='.55'/%3E%3Cpath d='M0 80c100-30 200-30 300 0s200 30 300 0 200-30 300 0 200 30 300 0v40H0z' fill='%2301579B' opacity='.6'/%3E%3C/svg%3E");
  --kid-title: var(--navy);
  --kid-title-shadow: 0 3px 0 rgba(255, 255, 255, .7);
  --kid-sub: var(--ocean-dark);
  --bubble: rgba(255, 255, 255, .35);
  --bubble-hi: rgba(255, 255, 255, .5);
  --chip-bg: rgba(255, 255, 255, .85);
  --chip-hover: #FFFFFF;
  --kcard-shadow: 0 10px 0 rgba(1, 87, 155, .18), var(--shadow-lg);
  --kcard-radius: 32px;
  --kbtn-radius: 26px;
  --kbtn-bg: var(--sun);          --kbtn-ink: var(--navy);   --kbtn-edge: #D9A400;
  --kbtn-green-bg: var(--leaf);   --kbtn-green-ink: var(--navy); --kbtn-green-edge: #3F9D4E;
  --kbtn-coral-bg: var(--coral);  --kbtn-coral-ink: #5A0A2B; --kbtn-coral-edge: #D6457A;
  --kbtn-white-bg: #FFFFFF;       --kbtn-white-ink: var(--navy); --kbtn-white-edge: #B9DDF0;
  --key-bg: #FFFFFF; --key-edge: #B9DDF0; --key-ring: var(--line);
  --key-alt-bg: #FFE3EE; --key-alt-edge: #F5B3CC; --key-alt-ring: #FFC9DC;
  --code-box-bg: var(--soft); --code-box-border: var(--ocean);
  --game-grid-bg: rgba(1, 87, 155, .35);
  --game-tile-bg: rgba(255, 255, 255, .88);
  --hero-card-bg: linear-gradient(135deg, #FFE066, #FFB8D2);
  --avatar-big-bg: linear-gradient(135deg, #FFF1B8, #FFD6E6);
  --seg-bg: rgba(255, 255, 255, .75);
  --progress-grad: linear-gradient(90deg, var(--leaf), var(--aqua));
  --energy-big: var(--leaf-deep);
  --confetti-1: #FFD93D; --confetti-2: #FF6B9D; --confetti-3: #29B6F6; --confetti-4: #6BCB77; --confetti-5: #FF9F45; --confetti-6: #2EC4B6;
}

body.ocean { background: var(--kid-bg) fixed; min-height: 100vh; overflow-x: hidden; position: relative; }
body.ocean::after {  /* song / hoa tiet o day man hinh */
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 120px; pointer-events: none; z-index: 0;
  background: var(--kid-wave) repeat-x bottom / 900px 120px; animation: wave 14s linear infinite;
}
@keyframes wave { to { background-position-x: 900px; } }
.bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bubbles i {
  position: absolute; bottom: -60px; border-radius: 50%; background: var(--bubble);
  box-shadow: inset -4px -4px 0 var(--bubble-hi); animation: rise linear infinite;
}
@keyframes rise { to { transform: translateY(-115vh) translateX(30px); opacity: 0; } }

.stage { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; padding: 18px clamp(14px, 3vw, 40px) 28px; }
.kid-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kid-top .logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 20px; color: var(--kid-title); text-decoration: none; }
.kid-top .logo .mascot-mini { width: 52px; }
.kid-top .logo .org-logo { height: 44px; max-width: 120px; object-fit: contain; }
.kid-top .spacer { flex: 1; }
.chip {
  background: var(--chip-bg); border-radius: 999px; padding: 7px 14px; font-weight: 800; color: var(--navy);
  display: inline-flex; gap: 6px; align-items: center; border: 0; font-size: 14px;
}
button.chip { cursor: pointer; }
button.chip:hover { background: var(--chip-hover); }
.chip.t-sun { background: var(--t-sun-bg); color: var(--t-sun-ink); }
.chip.t-blue { background: var(--t-blue-bg); color: var(--t-blue-ink); }
.chip.t-coral { background: var(--t-coral-bg); color: var(--t-coral-ink); }

.screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: 12px 0; animation: screen-in .35s ease; }
@keyframes screen-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.big-title { font-size: clamp(30px, 6vw, 62px); font-weight: 900; color: var(--kid-title); text-shadow: var(--kid-title-shadow); font-family: var(--heading-font); }
.sub-title { font-size: clamp(16px, 2.6vw, 24px); font-weight: 800; color: var(--kid-sub); }
.bubble-card {
  background: var(--card); border-radius: var(--kcard-radius); box-shadow: var(--kcard-shadow); border: 1px solid var(--card-border);
  padding: clamp(18px, 3vw, 32px); width: min(680px, 100%);
}
.bubble-card.wide { width: min(980px, 100%); }
.mascot-big { width: clamp(150px, 26vw, 260px); animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 10px 10px rgba(1, 87, 155, .25)); }
.mascot-play { width: clamp(110px, 16vw, 180px); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-12px) rotate(-2deg); } }

/* Nut lon cho man hinh cam ung */
.kbtn {
  border: 0; border-radius: var(--kbtn-radius); min-height: 72px; padding: 14px 34px; font-size: clamp(20px, 3vw, 30px); font-weight: 900;
  cursor: pointer; color: var(--kbtn-ink); background: var(--kbtn-bg); box-shadow: 0 8px 0 var(--kbtn-edge), 0 14px 24px rgba(0, 0, 0, .15);
  transition: transform .1s, box-shadow .1s; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none; letter-spacing: .02em;
}
.kbtn:hover { text-decoration: none; filter: brightness(1.04); }
.kbtn:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--kbtn-edge); }
.kbtn:disabled { opacity: .5; cursor: not-allowed; }
.kbtn.green { background: var(--kbtn-green-bg); color: var(--kbtn-green-ink); box-shadow: 0 8px 0 var(--kbtn-green-edge), 0 14px 24px rgba(0, 0, 0, .15); }
.kbtn.green:active { box-shadow: 0 2px 0 var(--kbtn-green-edge); }
.kbtn.coral { background: var(--kbtn-coral-bg); color: var(--kbtn-coral-ink); box-shadow: 0 8px 0 var(--kbtn-coral-edge), 0 14px 24px rgba(0, 0, 0, .15); }
.kbtn.coral:active { box-shadow: 0 2px 0 var(--kbtn-coral-edge); }
.kbtn.white { background: var(--kbtn-white-bg); color: var(--kbtn-white-ink); box-shadow: 0 8px 0 var(--kbtn-white-edge), 0 14px 24px rgba(0, 0, 0, .12); }
.kbtn.white:active { box-shadow: 0 2px 0 var(--kbtn-white-edge); }
.kbtn.sm { min-height: 54px; font-size: 18px; padding: 10px 22px; border-radius: calc(var(--kbtn-radius) - 6px); }
.kbtn.pulse { animation: kpulse 1.6s ease-in-out infinite; }
@keyframes kpulse { 50% { transform: scale(1.05); } }
.kbtn-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }

/* Nhap ma + ban phim ao */
.code-display {
  font-size: clamp(26px, 5vw, 44px); font-weight: 900; letter-spacing: .06em; background: var(--code-box-bg);
  border: 4px solid var(--code-box-border); border-radius: 22px; padding: 12px 18px; min-height: 76px; display: flex;
  align-items: center; justify-content: center; gap: 2px; color: var(--navy); word-break: break-all;
}
.code-display .prefix { color: var(--muted); }
.code-display .caret { width: 4px; height: 1em; background: var(--coral); animation: caret 1s steps(2) infinite; margin-left: 4px; border-radius: 2px; }
@keyframes caret { 50% { opacity: 0; } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: min(420px, 100%); margin: 0 auto; }
.keypad.alpha { grid-template-columns: repeat(7, 1fr); width: 100%; gap: 8px; }
.key {
  border: 0; border-radius: 20px; min-height: 68px; font-size: 30px; font-weight: 900; cursor: pointer; color: var(--navy);
  background: var(--key-bg); box-shadow: 0 6px 0 var(--key-edge), inset 0 0 0 3px var(--key-ring); transition: transform .08s, box-shadow .08s;
}
.keypad.alpha .key { min-height: 52px; font-size: 20px; border-radius: 14px; }
.key:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--key-edge), inset 0 0 0 3px var(--key-ring); }
.key.alt { background: var(--key-alt-bg); box-shadow: 0 6px 0 var(--key-alt-edge), inset 0 0 0 3px var(--key-alt-ring); }
.kid-error {
  background: var(--t-coral-bg); color: var(--t-coral-ink); border-radius: 18px; padding: 12px 18px; font-weight: 800; font-size: 18px;
  animation: shake .4s ease;
}
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* O so lieu lon */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; width: 100%; }
.stat { border-radius: 24px; padding: 16px 12px; background: var(--tone, var(--soft)); color: var(--navy); text-align: center; border: 1px solid var(--card-border); }
.stat .v { font-size: clamp(28px, 5vw, 48px); font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: .45em; font-weight: 900; }
.stat .l { font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink); margin-top: 4px; }
.stat.sun { --tone: var(--t-sun-bg); } .stat.green { --tone: var(--t-green-bg); } .stat.pink { --tone: var(--t-coral-bg); }
.stat.blue { --tone: var(--t-blue-bg); } .stat.aqua { --tone: var(--t-aqua-bg); }
.stat.plain { --tone: var(--card); box-shadow: var(--shadow); }
.coin-pop { display: inline-block; animation: coin-pop .9s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes coin-pop { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
.avatar-big { width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; font-size: 62px; margin: 0 auto; background: var(--avatar-big-bg); box-shadow: 0 6px 0 rgba(1, 87, 155, .15); }

/* Confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* Bang xep hang cho tre em */
.klb { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.klb .item { display: flex; align-items: center; gap: 12px; background: var(--row); border-radius: 20px; padding: 10px 14px; font-weight: 800; }
.klb .item.top1 { background: linear-gradient(90deg, var(--t-sun-bg), var(--row)); }
.klb .item.top2 { background: linear-gradient(90deg, var(--t-gray-bg), var(--row)); }
.klb .item.top3 { background: linear-gradient(90deg, var(--t-sim-bg), var(--row)); }
.klb .pos { width: 44px; text-align: center; font-size: 28px; flex: none; font-weight: 900; color: var(--ocean-dark); }
.klb .nm { flex: 1; min-width: 0; font-size: clamp(16px, 2vw, 22px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.klb .nm small { display: block; font-size: 13px; color: var(--muted); font-weight: 700; }
.klb .pt { font-size: clamp(18px, 2.2vw, 26px); font-weight: 900; white-space: nowrap; }
.klb .pt small { display: block; font-size: 12px; color: var(--muted); font-weight: 700; text-align: right; }

.seg { display: inline-flex; background: var(--seg-bg); border-radius: 999px; padding: 5px; gap: 4px; flex-wrap: wrap; justify-content: center; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 9px 18px; font-weight: 900; cursor: pointer; color: var(--ink); font-size: 15px; min-height: 42px; }
.seg button.active { background: var(--btn-primary); color: var(--on-primary); }

.sim-tag { background: var(--t-sim-bg); border: 3px dashed var(--t-sim-border); color: var(--t-sim-ink); border-radius: 16px; padding: 8px 14px; font-weight: 900; display: inline-flex; gap: 8px; align-items: center; }

/* Tro choi tren san */
.game-grid { display: grid; gap: clamp(6px, 1vw, 12px); width: 100%; padding: clamp(10px, 1.6vw, 20px); background: var(--game-grid-bg); border-radius: 30px; }
.game-tile {
  aspect-ratio: 1; border-radius: clamp(10px, 1.6vw, 20px); background: var(--game-tile-bg); position: relative;
  transition: background .5s ease, transform .2s ease, box-shadow .5s ease; box-shadow: inset 0 -5px 0 rgba(1, 87, 155, .12);
}
.game-tile.lit { transform: scale(1.06); transition: none; box-shadow: 0 0 26px 6px var(--glow, #FFD93D); background: var(--glow, #FFD93D); }
.game-tile .fly { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); font-weight: 900; color: var(--navy); font-size: clamp(11px, 1.5vw, 18px); white-space: nowrap; animation: fly 1s ease-out forwards; pointer-events: none; z-index: 3; }
@keyframes fly { to { transform: translate(-50%, -160%); opacity: 0; } }

/* Cong hoc sinh */
.portal { width: min(960px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 16px; position: relative; z-index: 1; padding-bottom: 96px; }
.hero-card { background: var(--hero-card-bg); color: var(--navy); border-radius: 30px; padding: 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; box-shadow: 0 8px 0 rgba(1, 87, 155, .15); }
.hero-card h2 { color: inherit; }
.hero-card .wallet { margin-left: auto; text-align: right; }
.hero-card .wallet .v { font-size: clamp(34px, 7vw, 54px); font-weight: 900; line-height: 1; }
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 30; background: var(--card); border-radius: 999px; padding: 6px; display: flex; gap: 4px; box-shadow: var(--shadow-lg); max-width: calc(100vw - 20px); border: 1px solid var(--card-border); }
.tabbar button { border: 0; background: transparent; border-radius: 999px; padding: 8px 14px; font-weight: 900; cursor: pointer; color: var(--ink); display: flex; flex-direction: column; align-items: center; font-size: 12px; min-width: 62px; }
.tabbar button span { font-size: 22px; line-height: 1.1; }
.tabbar button.active { background: var(--btn-primary); color: var(--on-primary); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile-card { background: var(--card); border-radius: 24px; padding: 16px; text-align: center; box-shadow: 0 6px 0 rgba(1, 87, 155, .12); display: flex; flex-direction: column; gap: 8px; align-items: center; border: 1px solid var(--card-border); }
.tile-card .big { font-size: 52px; line-height: 1; }
.tile-card.locked { filter: grayscale(1); opacity: .7; }
.progress { width: 100%; height: 16px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--progress-grad); transition: width .6s ease; }
.panel-card { background: var(--card); border-radius: 26px; padding: 18px; box-shadow: 0 6px 0 rgba(1, 87, 155, .12); border: 1px solid var(--card-border); }
.panel-card h3 { font-size: 18px; margin-bottom: 12px; }
.panel-card .list-row { border-radius: 16px; }

/* Man hinh sanh */
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; flex: 1; margin-top: 16px; align-items: start; }
.lobby-col { display: flex; flex-direction: column; gap: 16px; }
.hero-energy { text-align: center; }
.hero-energy .v { font-size: clamp(54px, 9vw, 120px); font-weight: 900; line-height: 1; color: var(--energy-big); font-variant-numeric: tabular-nums; }
.hero-energy .v small { font-size: .35em; color: var(--navy); }
.equiv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.game-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; margin-top: 16px; flex: 1; align-items: start; }
.game-side { display: flex; flex-direction: column; gap: 12px; }

@media (max-width: 900px) { .lobby-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .game-wrap { grid-template-columns: 1fr; } .game-side { flex-direction: row; flex-wrap: wrap; } .game-side > * { flex: 1 1 140px; } }
@media (max-width: 560px) {
  .kbtn { min-height: 62px; padding: 12px 22px; }
  .keypad.alpha { grid-template-columns: repeat(6, 1fr); }
  .hero-card .wallet { margin-left: 0; text-align: left; width: 100%; }
}
/* Man hinh thap (laptop, tablet ngang): thu gon ban phim de nut XAC NHAN luon nam trong man hinh */
@media (max-height: 760px) {
  .screen { gap: 10px; padding: 4px 0; }
  .keypad { gap: 8px; width: min(360px, 100%); }
  .key { min-height: 50px; font-size: 24px; border-radius: 16px; }
  .code-display { min-height: 58px; padding: 6px 14px; font-size: clamp(22px, 4vw, 34px); }
  .kbtn { min-height: 58px; }
  .mascot-big { width: clamp(110px, 18vw, 180px); }
  .bubble-card { padding: 16px 20px; }
}

/* ---- Hinh minh hoa (logo phat sang) cho FPT / High Tech ---- */
.hero-art { position: relative; display: grid; place-items: center; }
.art-brand { position: relative; place-items: center; width: 100%; aspect-ratio: 1.15; }
.art-brand .hero-logo { width: 62%; height: auto; aspect-ratio: 1; position: relative; z-index: 2; animation: bob 3.2s ease-in-out infinite; }
.art-brand .hero-logo svg { filter: drop-shadow(0 16px 22px rgba(10, 42, 94, .28)); }
.pulse-ring { position: absolute; width: 70%; aspect-ratio: 1; border-radius: 34%; border: 3px solid var(--wm-accent); opacity: 0; animation: ring 2.8s ease-out infinite; }
.pulse-ring.r2 { animation-delay: 1.4s; border-color: var(--logo-toe-2); }
@keyframes ring { 0% { transform: scale(.75) rotate(0deg); opacity: .7; } 100% { transform: scale(1.35) rotate(18deg); opacity: 0; } }
.mascot-big.hero-art { animation: none; }
.kid-top .logo .brand-mark { width: 46px; height: 46px; }
.kid-top .logo .wordmark b { font-size: 21px; color: var(--kid-title); }
.chip .i { font-size: 15px; }
button.chip.icon-only { width: 40px; height: 40px; padding: 0; justify-content: center; }
.stat .stat-ico { display: flex; justify-content: center; margin-bottom: 8px; }

.kbtn .i { font-size: .9em; }

/* ---- Thu hang (lop / khoi / truong) ---- */
.rank-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; }
.rank-card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: 22px; padding: 14px 12px; text-align: center;
  display: flex; flex-direction: column; gap: 6px; align-items: center; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.rank-card .meta { display: flex; flex-direction: column; gap: 6px; align-items: center; width: 100%; }
.rank-card .scope { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.rank-card .big-rank { font-size: clamp(30px, 6vw, 46px); font-weight: 900; line-height: 1; color: var(--navy); font-variant-numeric: tabular-nums; }
.rank-card .big-rank small { font-size: .42em; color: var(--muted); font-weight: 800; }
.rank-card .bar { width: 100%; height: 8px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.rank-card .bar i { display: block; height: 100%; border-radius: 999px; background: var(--progress-grad); }
.rank-card .note { font-size: 13px; font-weight: 800; color: var(--ink); line-height: 1.3; }
.rank-card.first { background: linear-gradient(160deg, var(--t-sun-bg), var(--card) 70%); }
.rank-card.first .big-rank { color: var(--sun-deep); }
.cheer {
  display: flex; gap: 12px; align-items: center; text-align: left; background: var(--t-green-bg); color: var(--t-green-ink);
  border-radius: 18px; padding: 12px 14px; font-weight: 800; width: 100%;
}
.cheer .i { font-size: 22px; flex: none; }
.cheer.gold { background: var(--t-sun-bg); color: var(--t-sun-ink); }
.insight-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.insight { background: var(--card); border: 1px solid var(--card-border); border-radius: 20px; padding: 14px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow); }
.insight .v { font-size: 22px; font-weight: 900; line-height: 1.1; }
.insight .l { font-size: 12px; font-weight: 800; color: var(--muted); }
.klb .item.me { outline: 3px solid var(--wm-accent); outline-offset: -3px; }
.me-tag { font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 999px; background: var(--btn-primary); color: var(--on-primary); margin-left: 6px; vertical-align: 2px; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px; align-items: end; margin: 6px 0 14px; }
.podium .p { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.podium .p .nm { font-weight: 900; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .p .pts { font-weight: 900; font-size: 13px; color: var(--muted); }
.podium .p .block { width: 100%; border-radius: 14px 14px 6px 6px; display: grid; place-items: center; font-weight: 900; font-size: 22px; }
.podium .p1 .block { height: 86px; background: var(--gold); color: var(--gold-ink); }
.podium .p2 .block { height: 62px; background: var(--silver); color: var(--silver-ink); }
.podium .p3 .block { height: 46px; background: var(--bronze); color: var(--bronze-ink); }
.podium .p.me .nm { color: var(--wm-accent); }

/* ---- Dien thoai (iPhone 11 tro len: 375-430px) ---- */
@media (max-width: 560px) {
  .stage { padding: calc(10px + var(--safe-t)) 14px calc(18px + var(--safe-b)); }
  .kid-top { gap: 8px; }
  .kid-top .logo .wordmark b { font-size: 18px; }
  .kid-top .logo .brand-mark { width: 38px; height: 38px; }
  .kid-top .chip.info { display: none; }
  .kid-top .chip.info.keep { display: inline-flex; max-width: 42vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .chip { padding: 6px 11px; font-size: 13px; }
  button.chip.icon-only { width: 36px; height: 36px; }
  .big-title { font-size: clamp(26px, 8vw, 34px); }
  .sub-title { font-size: 16px; }
  .bubble-card { padding: 16px; border-radius: 22px; }
  .kbtn { width: 100%; min-height: 60px; font-size: 20px; }
  .kbtn-row { flex-direction: column; gap: 12px; width: 100%; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { padding: 12px 8px; border-radius: 18px; }
  .stat .v { font-size: 26px; }
  .stat-row.three .stat .v { font-size: 22px; }
  .stat .l { font-size: 11px; }
  .rank-grid { grid-template-columns: 1fr; gap: 10px; }
  .rank-card { flex-direction: row; text-align: left; padding: 12px 14px; gap: 12px; }
  .rank-card .meta { align-items: flex-start; flex: 1; min-width: 0; }
  .rank-card .big-rank { font-size: 32px; min-width: 78px; text-align: center; }
  .insight-row { grid-template-columns: 1fr; gap: 10px; }
  .mascot-big { width: 150px; }
  .hero-energy .v { font-size: 64px; }
  .code-display { font-size: 26px; min-height: 60px; }
  .key { min-height: 58px; font-size: 26px; }
  .keypad.alpha { grid-template-columns: repeat(6, 1fr); }
  .tabbar { bottom: calc(10px + var(--safe-b)); left: 10px; right: 10px; transform: none; justify-content: space-between; max-width: none; }
  .tabbar button { min-width: 0; flex: 1; padding: 6px 2px; font-size: 10.5px; }
  .portal { padding-bottom: calc(100px + var(--safe-b)); }
  .hero-card { padding: 16px; border-radius: 24px; }
  .equiv { grid-template-columns: 1fr 1fr; }
  .game-grid { border-radius: 20px; padding: 8px; gap: 6px; }
  .klb .item { padding: 8px 10px; gap: 10px; border-radius: 16px; }
  .klb .pos { width: 38px; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 8px 8px; font-size: 13px; }
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile-card { padding: 12px; border-radius: 18px; }
}

.rank-card .big-rank { position: relative; }
.rank-card .big-rank .crown { position: absolute; top: -.55em; left: 50%; transform: translateX(-50%) rotate(-8deg); font-size: .45em; color: var(--sun-deep); }
@media (max-width: 560px) { .rank-card .big-rank { padding-top: 10px; } .rank-card .big-rank .crown { top: -.25em; } }
@media (max-width: 440px) {
  .kid-top .logo .wordmark { display: none; }
  .kid-top button.chip[aria-label="Toàn màn hình"], .kid-top button.chip[aria-label="Full screen"] { display: none; }
}
@media (max-width: 440px) {
  .kid-top { gap: 6px; flex-wrap: nowrap; }
  .kid-top .spacer { min-width: 0; }
  .kid-top button.chip.icon-only { width: 34px; height: 34px; }
  .kid-top button.chip:not(.icon-only) { padding: 6px 9px; }
  .kid-top button.chip:not(.icon-only) .i { display: none; }
  .kid-top .chip.info.keep { max-width: 36vw; padding: 6px 9px; }
  .kid-top .chip.info.keep .i { display: none; }
  .kid-top > .chip:not(button):not(.keep) { display: none; }
}

.kid-top .logo .logo-card { padding: 0; }
.kid-top .logo .org-logo { height: 40px; width: auto; max-width: 160px; }
.art-brand .hero-logo.logo-card { width: 64%; aspect-ratio: auto; }
.art-brand .hero-logo .org-logo { width: 100%; height: auto; }
@media (max-width: 440px) { .kid-top .logo .org-logo { height: 30px; max-width: 96px; } }

html[data-theme="fpt"] .mascot-big, html[data-theme="hitech"] .mascot-big { width: clamp(240px, 34vw, 380px); }
.art-brand .hero-logo.logo-card { width: 86%; }

.hero-emblem { position: relative; z-index: 2; width: 58%; aspect-ratio: 1; border-radius: 32%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--logo-1), var(--logo-2)); box-shadow: 0 18px 36px rgba(10, 42, 94, .3); animation: bob 3.2s ease-in-out infinite; }
.hero-emblem .em-step { color: #fff; font-size: clamp(54px, 9vw, 96px); transform: rotate(-12deg); }
.hero-emblem .em-bolt, .hero-emblem .em-bulb { position: absolute; width: 30%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  font-size: clamp(20px, 3.2vw, 34px); background: #fff; box-shadow: 0 8px 18px rgba(10, 42, 94, .25); }
.hero-emblem .em-bolt { top: -8%; right: -8%; color: var(--logo-bolt); }
.hero-emblem .em-bulb { bottom: -8%; left: -8%; color: #F5B400; }
html[data-theme="hitech"] .hero-emblem { box-shadow: 0 0 40px rgba(34, 211, 238, .45); }
