:root {
  --navy-0: #020814;
  --navy-1: #06162d;
  --navy-2: #0b2a55;
  --panel: rgba(7, 23, 48, .92);
  --panel-2: rgba(12, 38, 76, .9);
  --line: rgba(128, 190, 255, .34);
  --white: #f7fbff;
  --muted: #b9c8dd;
  --gold: #ffd24a;
  --cyan: #78eaff;
  --green: #23b951;
  --red: #cf3037;
  --blue: #1f78bd;
  --ink: #132440;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--white);
  background:
    radial-gradient(circle at 50% 0%, rgba(43, 132, 237, .35), transparent 38%),
    linear-gradient(180deg, #020714, #061b38 55%, #020714);
  font-family: Impact, "Arial Black", "Trebuchet MS", Arial, sans-serif;
}

button {
  margin: 0;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

.phone {
  position: relative;
  width: min(100vw, calc(100dvh * 9 / 16), 540px);
  height: min(100dvh, calc(100vw * 16 / 9), 960px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  isolation: isolate;
  background: var(--navy-0);
  border-radius: clamp(0px, 2vw, 24px);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .65);
}

.screen-bg,
.game-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("assets/images/home-bg.png");
  background-size: cover;
  background-position: center;
}

.game-bg {
  background-image:
    linear-gradient(180deg, rgba(2, 8, 19, .76), rgba(2, 8, 19, .2) 30%, rgba(2, 8, 19, .78)),
    url("assets/images/gameplay-bg.png");
}

.screen-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(1, 7, 17, .45), rgba(1, 7, 17, .08) 42%, rgba(1, 7, 17, .72)),
    radial-gradient(circle at 50% 42%, transparent 35%, rgba(0, 3, 12, .42));
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transform: translateX(5%);
  transition: opacity .26s ease, transform .32s ease;
  overflow: hidden;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.glass,
.hud-card,
.xp-track,
.wallet,
.icon-btn,
.round-btn,
.level-card,
.theme-shop,
.theme-card,
.doc-tabs,
.scanner-panel,
.rules-card,
.prohibited,
.feedback-bar,
.modal,
.settings-line {
  background: linear-gradient(180deg, rgba(13, 38, 75, .93), rgba(4, 16, 36, .95));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 12px 24px rgba(0, 0, 0, .34);
}

.icon-btn,
.round-btn {
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
}

.icon-btn img,
.round-btn img {
  width: 56%;
  height: 56%;
  object-fit: contain;
}

/* Home */
.home-screen {
  display: grid;
  grid-template-rows: 8.5% 34.5% 22.5% 17% 11%;
  gap: 1.5%;
  padding: 3.2% 6% 2%;
}

.home-screen .top-bar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 13% minmax(0, 1fr) 28% 11%;
  align-items: center;
  gap: 2%;
  padding: 0 3%;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(9, 34, 72, .92), rgba(2, 13, 31, .94));
  border: 1px solid rgba(125, 191, 255, .28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 14px 26px rgba(0,0,0,.35);
}

.level-hex {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #4b2a00;
  background: linear-gradient(180deg, #ffe66e, #f0a40d);
  clip-path: polygon(50% 0, 91% 22%, 91% 77%, 50% 100%, 9% 77%, 9% 22%);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(16px, 4.5vw, 24px);
  font-weight: 900;
  text-shadow: 0 1px 0 #fff0a8;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, .42));
}

.xp-track,
.wallet {
  height: 50%;
  min-height: 24px;
  border-radius: 999px;
  overflow: hidden;
}

.xp-track {
  position: relative;
}

.xp-track span {
  position: absolute;
  inset: 5px 65% 5px 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #efa00c, #ffe66a);
  transition: right .25s ease;
}

.xp-track b,
.wallet b {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  place-items: center;
  padding-inline: 5px;
  overflow: hidden;
  white-space: nowrap;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(9px, 2.75vw, 14px);
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .42);
}

.wallet {
  display: grid;
  grid-template-columns: 32% minmax(0, 1fr);
  align-items: center;
  padding-inline: 6px;
}

.wallet img {
  width: 100%;
  max-width: 28px;
  justify-self: center;
}

.home-screen .icon-btn {
  width: 100%;
  aspect-ratio: 1;
}

.logo {
  position: relative;
  z-index: 2;
  width: 68%;
  align-self: center;
  justify-self: center;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .42));
  animation: logoFloat 3.6s ease-in-out infinite;
}

@keyframes logoFloat {
  50% { transform: translateY(-4px); }
}

.home-panel {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-rows: minmax(68px, .92fr) minmax(82px, 1fr);
  gap: 10%;
  align-self: center;
}

.primary-play,
.mini-card,
.game-btn,
.action-btn {
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .42));
}

.primary-play {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 0;
  background-image: url("assets/ui/home-art-play-button.png");
  background-size: contain;
  overflow: hidden;
  aspect-ratio: 665 / 173;
  align-self: center;
  justify-self: stretch;
}

.primary-play img {
  display: none;
}

.primary-play span,
.mini-card span,
.mini-card b {
  overflow: hidden;
  white-space: nowrap;
}

.primary-play b {
  display: none;
  color: #3e2100;
  font-size: clamp(22px, 6.2vw, 32px);
  line-height: 1;
}

.primary-play small {
  display: none;
  color: #583100;
  font-size: clamp(7px, 2vw, 10px);
  line-height: 1;
}

.secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4%;
  min-height: 74px;
  align-self: stretch;
}

.mini-card {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 3%;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  background-size: 100% 100%;
  align-self: stretch;
}

.mini-card.daily-card {
  background-image: url("assets/ui/home-art-daily-card.png");
}

.mini-card.endless-card {
  background-image: url("assets/ui/home-art-endless-card.png");
}

.mini-card img {
  display: none;
}

.mini-card span {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  pointer-events: none;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(13px, 3.35vw, 18px);
  font-weight: 900;
  line-height: 1;
}

.mini-card b {
  display: none;
  color: rgba(255, 255, 255, .78);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(6px, 1.8vw, 9px);
  line-height: 1;
}

.reward-card {
  position: relative;
  z-index: 3;
  align-self: center;
  display: grid;
  grid-template-rows: 26% 1fr;
  padding: 2.4% 3.2% 3%;
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(8, 31, 66, .94), rgba(2, 12, 30, .96));
  border: 1px solid rgba(126, 194, 255, .38);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 12px 24px rgba(0,0,0,.36);
}

.reward-card h2 {
  margin: 0;
  text-align: center;
  align-self: center;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 900;
  line-height: 1;
}

.reward-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1%;
  align-items: stretch;
}

.reward-box {
  display: grid;
  grid-template-rows: 22% 1fr 22%;
  place-items: center;
  min-width: 0;
  padding: 4px 1px;
  border-radius: 10px;
  background: rgba(7, 22, 48, .78);
  border: 1px solid rgba(129, 191, 255, .28);
  overflow: hidden;
}

.reward-box span,
.reward-box b,
.nav-btn span {
  overflow: hidden;
  white-space: nowrap;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(6px, 1.55vw, 8px);
  font-weight: 900;
  line-height: 1;
}

.reward-box img {
  width: 58%;
  max-width: 27px;
}

.bottom-nav {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  padding: 5px 6px;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(8, 32, 68, .96), rgba(2, 12, 29, .98));
  border: 1px solid rgba(126, 194, 255, .32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 12px 22px rgba(0,0,0,.36);
}

.nav-btn {
  display: grid;
  grid-template-rows: clamp(24px, 48%, 34px) auto;
  place-items: center;
  align-content: center;
  gap: 2px;
  min-width: 0;
  height: 100%;
  padding: 3px 0;
  border-radius: 11px;
  color: #b8c6d8;
}

.nav-btn.active {
  color: var(--gold);
  background:
    linear-gradient(180deg, rgba(27, 91, 166, .98), rgba(8, 43, 91, .95));
  box-shadow: inset 0 -2px 0 rgba(255, 210, 74, .9);
}

.nav-btn img {
  height: clamp(20px, 4.8vw, 28px);
  object-fit: contain;
  align-self: center;
}

.nav-btn span {
  align-self: center;
  color: currentColor;
  font-size: clamp(7px, 1.85vw, 9px);
  line-height: 1;
}

/* Level select */
.level-screen {
  display: grid;
  grid-template-rows: 13% 11% minmax(0, 1fr);
  gap: 2.2%;
  padding: 4% 4.5% 4%;
}

.sub-header {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 11% minmax(0, 1fr) 26%;
  gap: 3%;
  align-items: start;
}

.sub-header .icon-btn {
  width: 100%;
  aspect-ratio: 1;
}

.sub-header h1 {
  margin: 0;
  font-size: clamp(30px, 8.5vw, 48px);
  line-height: .9;
  overflow: hidden;
  white-space: nowrap;
}

.sub-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(9px, 2.4vw, 12px);
  line-height: 1.05;
}

.theme-shop {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-rows: 30% 1fr;
  padding: 2.5% 3.5%;
  border-radius: 16px;
  overflow: hidden;
}

.theme-shop h2 {
  margin: 0;
  font-size: clamp(11px, 3vw, 15px);
  line-height: 1;
}

.theme-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3%;
}

.theme-card {
  display: grid;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
}

.theme-card span {
  display: none;
}

.theme-card b,
.theme-card small {
  overflow: hidden;
  white-space: nowrap;
}

.theme-card b {
  font-size: clamp(9px, 2.45vw, 12px);
}

.theme-card small {
  color: var(--muted);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(6px, 1.55vw, 8px);
}

.level-grid {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 2%;
  overflow: hidden;
}

.level-card {
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 7%;
  border-radius: 15px;
  overflow: hidden;
}

.level-card b,
.level-card span,
.level-card em,
.level-card small {
  overflow: hidden;
  line-height: 1.05;
}

.level-card b {
  color: var(--gold);
  font-size: clamp(13px, 3.8vw, 20px);
}

.level-card span {
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(8px, 2.15vw, 11px);
}

.level-card em {
  display: none;
}

.level-card small {
  color: var(--muted);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(7px, 1.9vw, 10px);
}

.level-card.locked {
  opacity: .48;
  filter: grayscale(.25);
}

/* Gameplay: normal flow */
.game-screen {
  --gap: clamp(5px, 1.35vw, 8px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows:
    clamp(62px, 10.8%, 84px)
    minmax(112px, .94fr)
    minmax(168px, 1.22fr)
    clamp(50px, 7.8%, 62px)
    clamp(58px, 8.6%, 74px)
    clamp(40px, 6%, 52px);
  gap: var(--gap);
  padding: clamp(7px, 1.8vw, 12px) clamp(9px, 2.4vw, 15px);
  overflow: hidden;
}

.game-screen .hud,
.passenger-stage,
.scanner-panel,
.rules-card,
.prohibited,
.decision-row,
.feedback-bar {
  position: relative;
  z-index: 3;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.game-screen .hud {
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: clamp(40px, 11%, 54px) repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr) clamp(20px, 28%, 26px);
  gap: clamp(4px, 1.1vw, 7px);
}

.game-screen .hud .round-btn,
.hud-card {
  border-radius: 13px;
  overflow: hidden;
}

.hud-card {
  display: grid;
  grid-template-columns: clamp(18px, 23%, 28px) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  align-items: center;
  column-gap: 4px;
  padding: 4px 5px;
}

.hud-card img {
  grid-row: 1 / 3;
  width: 100%;
  max-width: 26px;
}

.hud-card b,
.hud-card span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.hud-card b {
  align-self: end;
  font-size: clamp(12px, 3.6vw, 19px);
  line-height: .95;
}

.hud-card span {
  align-self: start;
  color: var(--muted);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(6px, 1.7vw, 9px);
  font-weight: 900;
}

.status-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.status-row span {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
  padding-inline: 2px;
  border-radius: 999px;
  background: rgba(6, 20, 43, .92);
  border: 1px solid rgba(126, 194, 255, .22);
  font-size: clamp(7px, 2vw, 10px);
}

.status-row b {
  margin-left: 3px;
}

.passenger-stage {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--gap);
}

.passenger-portrait {
  grid-column: 2;
  grid-row: 1 / 3;
  z-index: 1;
  align-self: end;
  justify-self: center;
  width: min(142%, 230px);
  max-height: 132%;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .42));
}

.doc-area {
  grid-column: 1;
  grid-row: 1 / 3;
  z-index: 3;
  display: grid;
  grid-template-rows: clamp(30px, 22%, 38px) minmax(0, 1fr);
  gap: 5px;
  overflow: hidden;
}

.doc-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-radius: 12px;
  overflow: hidden;
}

.doc-tabs button {
  overflow: hidden;
  white-space: nowrap;
  color: #aeb9c9;
  font-size: clamp(10px, 2.8vw, 14px);
}

.doc-tabs button.active {
  color: var(--gold);
  background: rgba(26, 62, 108, .72);
  box-shadow: inset 0 -3px 0 var(--gold);
}

.paper-stack {
  display: grid;
  overflow: hidden;
}

.paper-stack::-webkit-scrollbar {
  display: none;
}

.doc-card {
  grid-area: 1 / 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 4px;
  padding: clamp(7px, 1.9vw, 10px);
  border-radius: 14px;
  color: var(--ink);
  text-align: left;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(220, 232, 244, .76) 0 34%, transparent 34%),
    linear-gradient(180deg, #f7fbff, #dce8f4);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 10px 20px rgba(0, 0, 0, .24);
}

.doc-card.boarding {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 3px;
  padding: clamp(7px, 1.8vw, 9px);
}

.paper-stack[data-active="boarding"] .doc-card.passport {
  display: none;
}

.paper-stack:not([data-active="boarding"]) .doc-card.boarding {
  display: none;
}

.doc-card h2 {
  margin: 0;
  color: #142646;
  font-size: clamp(13px, 3.4vw, 18px);
  line-height: 1;
}

.doc-card.boarding h2 {
  font-size: clamp(12px, 3vw, 15px);
}

.doc-head {
  display: grid;
  grid-template-columns: clamp(36px, 28%, 58px) minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.doc-head img {
  width: 100%;
  max-width: 58px;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  object-position: center top;
  background: #d8e8f8;
}

.doc-head span,
.doc-card dt {
  color: #536a8d;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(7px, 1.8vw, 9px);
  line-height: 1;
}

.doc-head b,
.doc-card dd {
  margin: 0;
  color: #132542;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(9px, 2.35vw, 12px);
  line-height: 1.08;
  overflow: hidden;
}

.doc-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, .7fr) minmax(0, 1fr);
  gap: 2px 7px;
  overflow: hidden;
}

.doc-card.boarding dl {
  grid-template-columns: minmax(0, .48fr) minmax(0, 1fr);
  gap: 1px 5px;
}

.doc-card dt,
.doc-card dd {
  white-space: nowrap;
}

.doc-card.boarding dt,
.doc-card.boarding dd {
  white-space: normal;
  line-height: 1.02;
  font-size: clamp(7px, 1.95vw, 10px);
}

.doc-card .bad {
  color: #bd1c2b;
}

.speech {
  grid-column: 2;
  grid-row: 1;
  z-index: 4;
  align-self: start;
  justify-self: stretch;
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 6px 8px;
  border-radius: 13px;
  color: #142344;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 9px 18px rgba(0, 0, 0, .26);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  text-align: center;
  font-size: clamp(11px, 3.1vw, 16px);
  line-height: 1.08;
  overflow: hidden;
}

.doc-status {
  grid-column: 2;
  grid-row: 2;
  z-index: 4;
  align-self: end;
  justify-self: stretch;
  display: grid;
  grid-template-columns: clamp(22px, 20%, 30px) minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 12px;
  background: linear-gradient(180deg, #153b6c, #061b38);
  border: 1px solid rgba(110, 177, 255, .42);
  overflow: hidden;
}

.doc-status.valid { background: linear-gradient(180deg, #36ce5a, #118827); }
.doc-status.invalid { background: linear-gradient(180deg, #ff675d, #a8131c); }

.doc-status img {
  width: 100%;
  max-width: 30px;
}

.doc-status span {
  overflow: hidden;
  white-space: nowrap;
  font-size: clamp(9px, 2.35vw, 12px);
}

.scanner-panel {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(38px, 12%, 54px);
  grid-template-rows: clamp(38px, 16%, 50px) minmax(0, 1fr);
  gap: var(--gap);
  padding: clamp(7px, 1.9vw, 10px);
  border-radius: 18px;
}

.scanner-toolbar {
  grid-column: 1;
  display: grid;
  grid-template-columns: clamp(32px, 13%, 42px) minmax(0, 1fr) clamp(32px, 13%, 42px);
  align-items: center;
  gap: 8px;
}

.mini-btn {
  height: 80%;
  min-height: 30px;
  border-radius: 10px;
  color: #112242;
  background: linear-gradient(180deg, #f8fbff, #cdd8e6);
  font-size: clamp(16px, 4.4vw, 24px);
  font-weight: 900;
  overflow: hidden;
}

.scanner-title {
  text-align: center;
  overflow: hidden;
}

.scanner-title b,
.scanner-title span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
}

.scanner-title b {
  color: var(--cyan);
  font-size: clamp(14px, 4vw, 22px);
  line-height: 1;
}

.scanner-title span {
  margin-top: 2px;
  color: #c4d3e7;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(8px, 2.1vw, 11px);
  font-weight: 900;
}

.scanner-window {
  position: relative;
  grid-column: 1;
  grid-row: 2;
  overflow: hidden;
  border-radius: 15px;
  border: 2px solid rgba(117, 234, 255, .7);
  background: radial-gradient(circle at 50% 45%, rgba(46, 174, 229, .25), rgba(3, 13, 28, .96));
  touch-action: none;
}

.conveyor {
  position: absolute;
  inset: 0;
  opacity: .42;
  background:
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(116, 213, 255, .16) 35px 37px),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(116, 213, 255, .12) 28px 30px);
  animation: conveyorMove 2.8s linear infinite;
}

@keyframes conveyorMove {
  from { transform: translateX(0); }
  to { transform: translateX(37px); }
}

.scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  top: -18px;
  height: 18px;
  opacity: 0;
  z-index: 5;
  background: linear-gradient(180deg, transparent, rgba(117, 234, 255, .95), transparent);
  box-shadow: 0 0 20px rgba(117, 234, 255, .95);
}

.scanner-window.scanning .scan-beam {
  opacity: 1;
  animation: scanSweep 1.2s ease-in-out 2;
}

@keyframes scanSweep {
  to { transform: translateY(240px); }
}

.xray-content {
  position: absolute;
  inset: 0;
  transform-origin: center;
  transition: transform 120ms ease;
}

.bag-img {
  position: absolute;
  left: 3%;
  top: 2%;
  width: 94%;
  height: 94%;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(91, 225, 255, .45));
}

.xray-item {
  position: absolute;
  width: var(--size);
  left: var(--x);
  top: var(--y);
  transform: rotate(var(--rot));
  border-radius: 12px;
  padding: 2px;
  filter: drop-shadow(0 0 10px rgba(112, 234, 255, .75)) hue-rotate(155deg);
  opacity: .82;
  transition: filter 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.xray-item.selected {
  opacity: 1;
  filter: drop-shadow(0 0 16px rgba(255, 210, 77, 1)) saturate(1.35);
  outline: 2px solid rgba(255, 210, 77, .88);
}

.xray-item.suspicious {
  filter: drop-shadow(0 0 16px rgba(255, 80, 54, 1)) saturate(1.65);
  animation: suspectPulse .7s ease-in-out infinite alternate;
}

@keyframes suspectPulse {
  to { transform: rotate(var(--rot)) scale(1.08); }
}

.scan-toast {
  position: absolute;
  left: 50%;
  bottom: 8px;
  z-index: 6;
  transform: translateX(-50%);
  padding: 5px 9px;
  border-radius: 8px;
  color: #082042;
  background: #9df0ff;
  font-size: clamp(9px, 2.5vw, 12px);
  opacity: 0;
  transition: opacity 180ms ease;
}

.scan-toast.show {
  opacity: 1;
}

.threat-meter {
  grid-column: 2;
  grid-row: 1 / 3;
  display: grid;
  grid-template-rows: 16% repeat(6, minmax(0, 1fr));
  gap: 3%;
  padding: clamp(6px, 1.7vw, 10px);
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(9, 18, 34, .95), rgba(1, 7, 16, .98));
  border: 1px solid rgba(160, 193, 222, .35);
  overflow: visible;
}

.threat-meter span {
  align-self: center;
  color: #e5e9f1;
  text-align: center;
  font-size: clamp(6px, 1.7vw, 9px);
  line-height: 1.05;
}

.threat-meter i {
  border-radius: 5px;
}

.threat-meter i:nth-of-type(1) { background: #df1c2c; }
.threat-meter i:nth-of-type(2) { background: #f2602a; }
.threat-meter i:nth-of-type(3) { background: #ffc941; }
.threat-meter i:nth-of-type(4) { background: #9ed64a; }
.threat-meter i:nth-of-type(5) { background: #39ba50; }
.threat-meter i:nth-of-type(6) { background: #168f3d; }

.threat-meter b {
  position: absolute;
  right: -10px;
  top: 75%;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 14px solid #effaff;
  filter: drop-shadow(0 0 6px var(--cyan));
  transition: top 240ms ease;
}

.rules-card {
  grid-column: 1;
  grid-row: 4;
  display: grid;
  padding: clamp(6px, 1.7vw, 9px);
  border-radius: 14px;
}

.rules-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.rules-toggle span,
.rules-toggle b {
  overflow: hidden;
}

.rules-toggle span,
.prohibited::before {
  color: #dceaff;
  font-size: clamp(10px, 2.8vw, 14px);
  line-height: 1;
}

.rules-toggle b {
  color: var(--muted);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(8px, 2vw, 10px);
  line-height: 1.1;
}

.rules-card ul,
.rules-card.collapsed ul {
  display: none;
}

.prohibited {
  grid-column: 2;
  grid-row: 4;
  padding: clamp(6px, 1.7vw, 9px);
  border-radius: 14px;
}

.prohibited::before {
  content: "PROHIBITED ITEMS";
  display: block;
  margin-bottom: 3px;
  overflow: hidden;
  white-space: normal;
}

.prohibited-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
}

.prohibited-grid div {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(4, 17, 38, .75);
  border: 1px solid rgba(124, 181, 242, .3);
}

.prohibited-grid img {
  width: 60%;
  height: 60%;
  object-fit: contain;
}

.prohibited-grid span {
  display: none;
}

.decision-row {
  grid-column: 1 / -1;
  grid-row: 5;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1.5vw, 10px);
}

.action-btn {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  align-items: center;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 0;
  box-shadow: 0 10px 18px rgba(0, 0, 0, .38);
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .26));
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

.action-btn.approve {
  background-image: url("assets/ui/game-ref-approve.png");
}

.action-btn.reject {
  background-image: url("assets/ui/game-ref-reject.png");
}

.action-btn.search {
  background-image: url("assets/ui/game-ref-search.png");
}

.action-btn img {
  display: none;
}

.action-btn b,
.action-btn span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.action-btn b {
  align-self: end;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(10px, 2.7vw, 14px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.action-btn span {
  align-self: start;
  color: rgba(255, 255, 255, .75);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(6px, 1.55vw, 8px);
  font-weight: 900;
  line-height: 1;
}

.feedback-bar {
  grid-column: 1 / -1;
  grid-row: 6;
  display: grid;
  grid-template-columns: clamp(24px, 8%, 34px) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: clamp(5px, 1.4vw, 8px);
  border-radius: 12px;
}

.feedback-bar.success { border-color: rgba(91, 238, 129, .75); }
.feedback-bar.error { border-color: rgba(255, 91, 83, .8); }

.feedback-bar img {
  width: 100%;
  max-width: 34px;
}

.feedback-bar p {
  margin: 0;
  overflow: hidden;
  color: #eaf3ff;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(8px, 2.25vw, 12px);
  line-height: 1.12;
}

/* Overlays */
.overlay-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 8%;
  opacity: 0;
  pointer-events: none;
  background: rgba(1, 7, 16, .72);
  backdrop-filter: blur(7px);
  transition: opacity .24s ease;
}

.overlay-screen.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: min(86%, 390px);
  max-height: 90%;
  display: grid;
  gap: clamp(8px, 2.2vw, 12px);
  padding: clamp(16px, 4.6vw, 24px);
  border-radius: 22px;
  text-align: center;
  overflow: hidden;
}

.modal h1 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(30px, 8.5vw, 48px);
  line-height: .92;
  white-space: nowrap;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .45);
}

.settings-line {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 16px;
}

.settings-line span,
.toggle {
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(12px, 3.2vw, 17px);
}

.toggle {
  min-width: 70px;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(180deg, #e7f8ff, #7bdfff);
}

.toggle.on {
  color: #fff;
  background: linear-gradient(180deg, #4ee36c, #118628);
}

.toggle.danger {
  color: #fff;
  background: linear-gradient(180deg, #ff6b5f, #a91d27);
}

.game-btn {
  min-height: 50px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 15px;
  overflow: hidden;
}

.game-btn.green { background-image: url("assets/ui/btn-green.png"); }
.game-btn.blue { background-image: url("assets/ui/btn-blue.png"); }
.game-btn.red { background-image: url("assets/ui/btn-red.png"); }
.game-btn.gold { background-image: url("assets/ui/btn-gold.png"); }

.game-btn img {
  width: 32px;
  height: 32px;
}

.game-btn span {
  display: grid;
  justify-items: start;
  overflow: hidden;
}

.game-btn b,
.game-btn small {
  overflow: hidden;
  white-space: nowrap;
}

.game-btn b {
  font-size: clamp(16px, 4.2vw, 24px);
  line-height: .95;
}

.game-btn small {
  color: rgba(255, 255, 255, .8);
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(7px, 2vw, 10px);
  font-weight: 900;
}

.rank-emblem {
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 50%;
  color: #4b2a00;
  background: radial-gradient(circle at 32% 25%, #fff2a4, #ffd24d 46%, #d88a09);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .45), 0 14px 28px rgba(0, 0, 0, .42);
  font-size: clamp(42px, 11vw, 62px);
}

.result-stats,
.result-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.result-breakdown {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-stats div,
.result-breakdown div {
  min-width: 0;
  padding: 8px 6px;
  border-radius: 12px;
  background: rgba(3, 14, 32, .62);
  border: 1px solid rgba(126, 194, 255, .22);
  overflow: hidden;
}

.result-stats span,
.result-breakdown span,
.result-stats b,
.result-breakdown b {
  display: block;
  overflow: hidden;
  white-space: nowrap;
}

.result-stats span,
.result-breakdown span {
  color: #cbdcf1;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(7px, 1.9vw, 10px);
  font-weight: 900;
}

.result-stats b,
.result-breakdown b {
  margin-top: 3px;
  color: var(--gold);
  font-size: clamp(15px, 4vw, 22px);
}

.result-modal p {
  margin: 0;
  color: #dceaff;
  font-family: "Trebuchet MS", Arial, sans-serif;
  font-weight: 900;
  line-height: 1.2;
  font-size: clamp(11px, 3vw, 14px);
}

.coachmark {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: none;
  place-items: center;
  padding: 9%;
  background: rgba(0, 7, 18, .72);
}

.coachmark.active {
  display: grid;
}

.coachmark > div {
  display: grid;
  gap: 10px;
  padding: 20px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.coachmark h2,
.coachmark p {
  margin: 0;
}

.coachmark p {
  font-family: "Trebuchet MS", Arial, sans-serif;
}

.coach-next,
.coach-skip {
  padding: 10px;
  border-radius: 12px;
  background: var(--blue);
}

.achievement-toast {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 12%;
  z-index: 40;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.achievement-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.achievement-toast img {
  width: 42px;
}

.achievement-toast span,
.achievement-toast b {
  overflow: hidden;
  white-space: nowrap;
}

.pressed,
button:active {
  transform: scale(.97);
}

.pop {
  animation: pop .26s ease;
}

.shake {
  animation: shake .32s ease;
}

.success-burst {
  animation: successBurst .55s ease;
}

@keyframes pop {
  50% { transform: scale(1.04); }
}

@keyframes shake {
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

@keyframes successBurst {
  45% { filter: brightness(1.45); }
}

@media (max-width: 380px) {
  .home-screen {
    grid-template-rows: 8.5% 34.5% 22.5% 17% 11%;
    padding-inline: 5%;
  }

  .logo {
    width: 66%;
  }

  .primary-play b {
    font-size: 22px;
  }

  .mini-card span {
    font-size: 1px;
  }

  .reward-card h2 {
    font-size: 14px;
  }

  .home-panel {
    grid-template-rows: minmax(64px, .92fr) minmax(76px, 1fr);
  }

  .game-screen {
    grid-template-rows: 60px minmax(108px, .94fr) minmax(158px, 1.16fr) 48px 56px 38px;
    padding-inline: 8px;
  }

  .status-row span {
    font-size: 6px;
    padding-inline: 2px;
  }

  .doc-tabs button {
    font-size: 10px;
  }

  .hud-card b {
    font-size: 11px;
  }

  .scanner-title b {
    font-size: 14px;
  }

  .action-btn b {
    font-size: 10px;
  }

  .action-btn span {
    font-size: 6px;
  }

  .feedback-bar p {
    font-size: 8px;
  }

  .sub-header h1 {
    font-size: 30px;
  }

  .modal {
    width: min(86%, 360px);
    padding: 15px;
  }
}
