:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", Arial, sans-serif;
  --red: #c81422;
  --deep-red: #71040d;
  --gold: #ffc83d;
  --cream: #fff4c7;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #3b0308;
  touch-action: none;
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 480px;
  overflow: hidden;
  background: #920814;
  isolation: isolate;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  position: absolute;
  z-index: 4;
  top: max(14px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}

.score-card {
  min-width: 86px;
  padding: 7px 15px 8px;
  text-align: center;
  border: 2px solid rgba(255, 215, 83, .76);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(114, 4, 13, .9), rgba(67, 2, 8, .86));
  box-shadow: 0 5px 16px rgba(51, 0, 4, .3), inset 0 1px rgba(255,255,255,.13);
}

.score-card span {
  display: block;
  color: #ffd96b;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.4px;
}

.score-card strong {
  display: block;
  color: #fff9db;
  font-size: 22px;
  line-height: 1;
  text-shadow: 0 2px #4e0208;
}

.score-card--best {
  opacity: .94;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  color: #651009;
  font-size: 22px;
  font-weight: 900;
  line-height: 38px;
  border: 2px solid #fff0a9;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe77a, #eaa316);
  box-shadow: 0 5px 14px rgba(50, 0, 0, .28);
  pointer-events: auto;
  cursor: pointer;
}

.bonus-card {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 5px 9px;
  border: 2px solid rgba(255, 215, 83, .76);
  border-radius: 18px;
  background: rgba(67, 2, 8, .86);
  box-shadow: 0 5px 14px rgba(50, 0, 0, .25);
}

.coin-dot,
.shield-badge {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 1000;
}

.coin-dot {
  color: transparent;
  background: #ffd74f url("assets/yaya-gold-coin.png?v=11") center / cover no-repeat;
  border: 2px solid #fff0a0;
}

.bonus-card strong {
  color: #fff3bd;
  font-size: 16px;
}

.shield-badge {
  color: #e8fbff;
  background: #1687b7;
  border: 2px solid #8ceaff;
  opacity: .35;
}

.shield-badge.is-active {
  opacity: 1;
  box-shadow: 0 0 13px #5ee9ff;
}

.magnet-badge {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 1000;
  border: 2px solid #ff9ac9;
  border-radius: 8px;
  background: #b70c58;
  opacity: .35;
}

.magnet-badge.is-active {
  opacity: 1;
  box-shadow: 0 0 13px #ff69b4;
}

.combo-badge {
  min-width: 38px;
  padding: 7px 8px;
  color: #fff0a4;
  font-size: 13px;
  font-weight: 1000;
  text-align: center;
  border: 2px solid rgba(255, 215, 83, .65);
  border-radius: 14px;
  background: rgba(67, 2, 8, .82);
}

.combo-badge.is-hot {
  color: #5d0806;
  background: #ffe56f;
  transform: scale(1.08);
}

.overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(70px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 26%, rgba(255, 190, 52, .13), transparent 31%),
    linear-gradient(180deg, rgba(70, 1, 7, .12), rgba(44, 0, 4, .42));
  transition: opacity .25s ease, visibility .25s ease;
}

.overlay.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

#gameOverScreen {
  z-index: 6;
}

#globalLeaderboardScreen {
  z-index: 7;
}

.panel {
  width: min(100%, 410px);
  text-align: center;
  animation: panel-in .5s cubic-bezier(.2, .8, .2, 1) both;
}

.panel--compact {
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 25px 22px 22px;
  border: 2px solid rgba(255, 218, 96, .72);
  border-radius: 30px;
  background: linear-gradient(160deg, rgba(129, 5, 15, .96), rgba(62, 1, 7, .96));
  box-shadow: 0 24px 70px rgba(35, 0, 4, .48), inset 0 1px rgba(255,255,255,.1);
  scrollbar-width: none;
}

.panel--compact::-webkit-scrollbar {
  display: none;
}

.brand-mark,
.result-medal {
  position: relative;
  width: 124px;
  height: 124px;
  margin: 0 auto 12px;
  overflow: hidden;
  border: 5px solid #ffd458;
  border-radius: 50%;
  background: #2a0003;
  box-shadow: 0 0 0 5px rgba(122, 4, 13, .95), 0 11px 34px rgba(255, 166, 22, .3);
}

.brand-mark img,
.result-medal img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transform: scale(1.65);
}

.brand-spark {
  position: absolute;
  z-index: 2;
  top: -7px;
  right: 2px;
  color: #fff2a4;
  font-size: 34px;
  text-shadow: 0 0 12px #ffb315;
}

.eyebrow {
  margin: 0 0 6px;
  color: #ffd96b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 3px;
}

h1,
h2 {
  margin: 0;
  color: #fff8d3;
  font-size: clamp(48px, 13vw, 66px);
  font-weight: 1000;
  line-height: .84;
  letter-spacing: -3px;
  text-shadow: 0 4px 0 #5d0209, 0 7px 22px rgba(55, 0, 4, .55);
}

h1 span {
  color: #ffc934;
  font-size: .8em;
  letter-spacing: 1px;
}

h2 {
  margin-bottom: 17px;
  font-size: 38px;
  letter-spacing: -1.5px;
}

.intro {
  max-width: 330px;
  margin: 19px auto 20px;
  color: var(--cream);
  font-size: 15px;
  line-height: 1.5;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: min(100%, 330px);
  margin: 0 auto 10px;
}

.setup-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 10px;
  color: #ffd96b;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .8px;
  text-align: left;
  border: 1px solid rgba(255, 218, 96, .35);
  border-radius: 13px;
  background: rgba(67, 2, 8, .55);
}

.setup-grid select {
  width: 100%;
  color: #fff4c7;
  border: 0;
  outline: 0;
  background: #7c0710;
}

.switch-row {
  justify-content: space-between;
}

.switch-row input {
  width: 20px;
  height: 20px;
  accent-color: #ffc83d;
}

.daily-challenge {
  width: min(100%, 330px);
  margin: 0 auto 12px;
  padding: 7px 10px;
  border: 1px solid rgba(106, 235, 255, .35);
  border-radius: 12px;
  background: rgba(17, 109, 142, .2);
}

.daily-challenge small,
.daily-challenge strong {
  display: block;
}

.daily-challenge small {
  color: #8cecff;
  font-size: 8px;
  letter-spacing: 1.3px;
}

.daily-challenge strong {
  color: #e9fcff;
  font-size: 11px;
}

.daily-challenge.is-complete {
  border-color: rgba(119, 255, 169, .7);
  background: rgba(21, 132, 70, .25);
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 290px);
  min-height: 58px;
  margin: 0 auto;
  padding: 7px 9px 7px 25px;
  color: #570107;
  font-weight: 1000;
  font-size: 17px;
  border: 2px solid #fff1a7;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffe774, #f4b419);
  box-shadow: 0 8px 0 #8a3608, 0 13px 26px rgba(51, 0, 3, .35), inset 0 2px rgba(255,255,255,.55);
  cursor: pointer;
}

.primary-button:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 #8a3608, 0 7px 18px rgba(51, 0, 3, .35);
}

.primary-button b {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #fff6c8;
  font-size: 30px;
  line-height: 1;
  border-radius: 15px;
  background: #b20d18;
  box-shadow: inset 0 2px rgba(255,255,255,.14);
}

.hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 20px 0 0;
  color: rgba(255, 242, 192, .8);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
}

.hint i {
  width: 22px;
  height: 1px;
  background: rgba(255, 211, 76, .5);
}

.audio-controls,
.secondary-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 15px;
}

.audio-controls {
  flex-wrap: wrap;
}

.audio-controls button,
.secondary-actions button {
  padding: 9px 12px;
  color: #ffe9a0;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid rgba(255, 218, 96, .5);
  border-radius: 12px;
  background: rgba(67, 2, 8, .65);
  cursor: pointer;
}

.result-medal {
  width: 104px;
  height: 104px;
  margin-bottom: 20px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.result-grid div {
  padding: 12px 8px;
  border: 1px solid rgba(255, 216, 87, .38);
  border-radius: 17px;
  background: rgba(44, 0, 4, .35);
}

.result-grid span {
  display: block;
  color: #eaba46;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.5px;
}

.result-grid strong {
  color: #fff4bd;
  font-size: 30px;
}

.result-message {
  min-height: 38px;
  margin: 0 0 17px;
  color: #ffe9a0;
  font-size: 13px;
  line-height: 1.45;
}

.achievement {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 0 0 13px;
  padding: 9px 12px;
  text-align: left;
  border: 1px solid rgba(255, 222, 105, .45);
  border-radius: 15px;
  background: rgba(255, 187, 31, .1);
}

.achievement.is-visible {
  display: flex;
  animation: panel-in .35s ease both;
}

.achievement > span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #651009;
  font-weight: 1000;
  border-radius: 50%;
  background: linear-gradient(#fff09b, #efaa18);
}

.achievement small,
.achievement strong {
  display: block;
}

.achievement small {
  color: #e9b73d;
  font-size: 8px;
  letter-spacing: 1.3px;
}

.achievement strong {
  color: #fff2b1;
  font-size: 14px;
}

.toast {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: calc(100% - 40px);
  padding: 10px 16px;
  color: #5b0a08;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  border-radius: 14px;
  background: #ffe579;
  box-shadow: 0 9px 25px rgba(40, 0, 3, .35);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 15px);
  transition: .25s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 18px 0;
}

.stats-grid div {
  padding: 13px 8px;
  border: 1px solid rgba(255, 216, 87, .3);
  border-radius: 14px;
  background: rgba(44, 0, 4, .32);
}

.stats-grid span,
.stats-grid strong {
  display: block;
}

.stats-grid span {
  color: #eaba46;
  font-size: 8px;
  letter-spacing: 1px;
}

.stats-grid strong {
  color: #fff2b1;
  font-size: 24px;
}

.leaderboard-tabs {
  display: flex;
  gap: 7px;
  justify-content: center;
  margin: 14px 0 10px;
}

.leaderboard-tabs button {
  padding: 8px 12px;
  color: #ffe9a0;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid rgba(255, 216, 87, .45);
  border-radius: 12px;
  background: rgba(44, 0, 4, .35);
}

.leaderboard-tabs button.is-active {
  color: #5d0806;
  border-color: #fff0a0;
  background: #ffd85c;
}

.global-leaderboard-list {
  display: grid;
  gap: 7px;
  max-height: 330px;
  margin: 12px 0 18px;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: none;
}

.global-leaderboard-list::-webkit-scrollbar {
  display: none;
}

.global-leaderboard-list li {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px 11px;
  color: #ffe9a0;
  border: 1px solid rgba(255, 216, 87, .28);
  border-radius: 13px;
  background: rgba(44, 0, 4, .32);
}

.global-leaderboard-list span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.global-leaderboard-list strong {
  color: #fff3b6;
  font-size: 12px;
  text-align: right;
}

.wallet {
  color: #ffe9a0;
}

.costume-list {
  display: grid;
  gap: 9px;
  margin: 16px 0 20px;
}

.costume-option {
  display: flex;
  justify-content: space-between;
  padding: 13px 15px;
  color: #fff2b1;
  border: 1px solid rgba(255, 216, 87, .32);
  border-radius: 14px;
  background: rgba(44, 0, 4, .35);
}

.costume-option.is-selected {
  color: #5d0806;
  border-color: #fff0a0;
  background: #ffd85c;
}

.costume-option:disabled {
  opacity: .45;
}

.countdown {
  position: absolute;
  z-index: 15;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff3b1;
  font-size: min(34vw, 150px);
  font-weight: 1000;
  text-shadow: 0 8px 0 #7a0710, 0 15px 40px rgba(45,0,3,.5);
  pointer-events: none;
}

.countdown.is-hidden {
  display: none;
}

.loading {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 13px;
  color: #ffe68b;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  background: #780710;
  transition: opacity .35s ease, visibility .35s ease;
}

.loading.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.loader {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 221, 103, .2);
  border-top-color: #ffda5c;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-height: 650px) {
  .brand-mark { width: 92px; height: 92px; margin-bottom: 8px; }
  h1 { font-size: 46px; }
  .intro { margin: 12px auto 14px; font-size: 13px; }
  .hint { margin-top: 14px; }
  .panel--compact { transform: scale(.9); }
}

#startScreen .panel {
  max-height: calc(100vh - 85px);
  overflow-y: auto;
  scrollbar-width: none;
}

#startScreen .panel::-webkit-scrollbar {
  display: none;
}

@media (min-width: 700px) {
  .app-shell {
    width: min(100%, 480px);
    margin: auto;
    box-shadow: 0 0 80px rgba(0,0,0,.6);
  }
}
