/* ------------------------------------------------------------------
   Menu screens
   ------------------------------------------------------------------ */

.screens {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: rgba(16, 8, 38, 0);
  transition: background 0.35s ease, backdrop-filter 0.35s ease;
}

.screens.open {
  pointer-events: auto;
  background: rgba(16, 8, 38, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.screens[data-current='title'],
.screens[data-current='main'] {
  background: rgba(16, 8, 38, 0.5);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(18px * var(--ui-scale));
  padding: 20px 16px;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96) translateY(10px);
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 1.4, 0.4, 1), visibility 0s linear 0.25s;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 1.4, 0.4, 1), visibility 0s;
}

.screen-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: calc(44px * var(--ui-scale));
  color: #fff;
  text-align: center;
  letter-spacing: 1px;
  text-shadow: 0 4px 0 var(--ink), 0 0 24px rgba(154, 107, 255, 0.6);
}

.screen-title.big {
  font-size: calc(64px * var(--ui-scale));
}

.row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: calc(15px * var(--ui-scale));
  text-align: center;
}

/* ---------------------------------------------------------------- logo */

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-bomb {
  width: calc(200px * var(--ui-scale));
  height: calc(200px * var(--ui-scale));
  margin-bottom: calc(-40px * var(--ui-scale));
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.4));
}

.logo-text {
  margin: 0;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: calc(96px * var(--ui-scale));
  line-height: 1;
  letter-spacing: 2px;
  white-space: nowrap;
}

.logo-text span {
  display: inline-block;
  color: var(--c, var(--yellow));
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 7px 0 var(--ink), 0 0 26px rgba(255, 138, 31, 0.45);
  animation: wave 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.08s);
}

.logo-text span:nth-child(6n + 1) { --c: #ffd23f; }
.logo-text span:nth-child(6n + 2) { --c: #ff9a3c; }
.logo-text span:nth-child(6n + 3) { --c: #ff5c93; }
.logo-text span:nth-child(6n + 4) { --c: #4cc6ff; }
.logo-text span:nth-child(6n + 5) { --c: #7bea5a; }
.logo-text span:nth-child(6n + 6) { --c: #b98bff; }

@keyframes wave {
  0%, 60%, 100% {
    transform: translateY(0) rotate(0);
  }
  30% {
    transform: translateY(-10px) rotate(-3deg);
  }
}

.logo-small .logo-text {
  font-size: calc(64px * var(--ui-scale));
}

.logo-tagline {
  margin: 10px 0 0;
  font-size: calc(20px * var(--ui-scale));
  color: #ffe9c4;
  text-shadow: 0 2px 0 var(--ink);
}

.press-start {
  font-family: var(--font-display);
  font-size: calc(28px * var(--ui-scale));
  color: #fff;
  padding: 10px 26px;
  text-shadow: 0 3px 0 var(--ink);
  animation: blink 1.1s ease-in-out infinite;
}

@keyframes blink {
  50% {
    opacity: 0.35;
    transform: scale(0.97);
  }
}

.footer-note {
  position: absolute;
  bottom: 14px;
  left: 16px;
  right: 16px;
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  opacity: 0.8;
}

.menu-best {
  margin: 0;
  font-family: var(--font-display);
  font-size: calc(20px * var(--ui-scale));
  color: var(--muted);
}

.menu-best b {
  color: var(--yellow);
  font-weight: normal;
  margin-left: 6px;
}

/* ---------------------------------------------------------------- buttons */

.menu {
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--ui-scale));
  width: min(420px, 86vw);
}

.btn {
  --c1: #6b5aa0;
  --c2: #3f2f73;
  --cd: #241845;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(64px * var(--ui-scale));
  padding: 8px 28px;
  border-radius: var(--radius);
  background: linear-gradient(var(--c1), var(--c2));
  box-shadow: 0 0 0 3px var(--ink), inset 0 3px 0 rgba(255, 255, 255, 0.35), 0 7px 0 var(--cd), 0 7px 0 3px var(--ink);
  font-family: var(--font-display);
  font-size: calc(30px * var(--ui-scale));
  line-height: 1.05;
  text-shadow: 0 3px 0 rgba(27, 19, 48, 0.75);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn small {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: calc(14px * var(--ui-scale));
  opacity: 0.9;
  text-shadow: none;
}

.btn-small {
  min-height: calc(48px * var(--ui-scale));
  font-size: calc(22px * var(--ui-scale));
  padding: 6px 26px;
}

.btn-orange { --c1: #ffb347; --c2: var(--orange); --cd: var(--orange-d); }
.btn-pink { --c1: #ff85b1; --c2: var(--pink); --cd: var(--pink-d); }
.btn-blue { --c1: #7fd4ff; --c2: var(--blue); --cd: var(--blue-d); }
.btn-purple { --c1: #bb9cff; --c2: var(--purple); --cd: var(--purple-d); }

.menu-item {
  outline: none;
}

.btn.focused {
  transform: translateY(-3px) scale(1.05);
  filter: brightness(1.12) saturate(1.1);
}

.btn.focused::before {
  content: '';
  position: absolute;
  left: -34px;
  top: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #7a7fa8, #1b1c2e 70%);
  box-shadow: 0 0 0 2px var(--ink), 10px -10px 0 -7px var(--yellow);
  animation: pointer 0.6s ease-in-out infinite alternate;
}

@keyframes pointer {
  to {
    transform: translateX(-6px);
  }
}

.btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 3px var(--ink), inset 0 3px 0 rgba(255, 255, 255, 0.35), 0 3px 0 var(--cd), 0 3px 0 3px var(--ink);
}

/* ---------------------------------------------------------------- options */

.option-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(560px, 92vw);
}

.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: calc(52px * var(--ui-scale));
  padding: 6px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08);
  font-family: var(--font-display);
  font-size: calc(22px * var(--ui-scale));
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.option.focused {
  background: rgba(154, 107, 255, 0.35);
  box-shadow: inset 0 0 0 3px var(--yellow);
  transform: scale(1.02);
}

.option.danger .opt-label {
  color: #ff9aa6;
}

.opt-value {
  color: var(--yellow);
  display: flex;
  align-items: center;
}

.option[data-opt] .opt-value::before,
.option[data-opt] .opt-value::after {
  content: '◀';
  font-size: 0.7em;
  margin: 0 10px;
  opacity: 0.4;
}

.option[data-opt] .opt-value::after {
  content: '▶';
}

.option.focused .opt-value::before,
.option.focused .opt-value::after {
  opacity: 1;
}

.pips {
  display: flex;
  gap: 4px;
}

.pips i {
  width: 12px;
  height: 20px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
}

.pips i.on {
  background: linear-gradient(#fff3a0, var(--orange));
  box-shadow: 0 0 8px rgba(255, 138, 31, 0.6);
}

/* ---------------------------------------------------------------- worlds */

.world-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: min(820px, 94vw);
}

.world-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: calc(150px * var(--ui-scale));
  padding: 16px 18px;
  border-radius: 20px;
  text-align: left;
  background: linear-gradient(135deg, var(--wc1), var(--wc2));
  box-shadow: 0 0 0 3px var(--ink), inset 0 3px 0 rgba(255, 255, 255, 0.4), 0 7px 0 3px var(--ink);
  overflow: hidden;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.world-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 12px, transparent 12px 24px);
  pointer-events: none;
}

.world-card.focused {
  transform: translateY(-4px) scale(1.03) rotate(-0.6deg);
  filter: brightness(1.1);
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 7px var(--yellow), inset 0 3px 0 rgba(255, 255, 255, 0.4), 0 7px 0 7px var(--ink);
}

.world-card.locked {
  filter: grayscale(0.85) brightness(0.6);
  cursor: not-allowed;
}

.world-num {
  font-size: calc(14px * var(--ui-scale));
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(27, 19, 48, 0.75);
}

.world-name {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: calc(30px * var(--ui-scale));
  color: #fff;
  text-shadow: 0 3px 0 var(--ink);
}

.world-blurb {
  font-size: calc(14px * var(--ui-scale));
  color: #fff;
  text-shadow: 0 1px 0 rgba(27, 19, 48, 0.8);
  max-width: 90%;
}

.world-enemies {
  display: flex;
  gap: 2px;
  margin-top: auto;
}

.world-enemies img {
  width: calc(40px * var(--ui-scale));
  height: calc(40px * var(--ui-scale));
}

.lock {
  width: 26px;
  height: 22px;
  border-radius: 5px;
  background: var(--ink);
  position: relative;
  margin-top: 12px;
}

.lock::before {
  content: '';
  position: absolute;
  left: 5px;
  top: -12px;
  width: 16px;
  height: 16px;
  border: 4px solid var(--ink);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}

/* ---------------------------------------------------------------- battle setup */

.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: min(900px, 94vw);
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px 12px;
  border-radius: 20px;
  background: linear-gradient(color-mix(in srgb, var(--pc) 60%, #2a1a55), color-mix(in srgb, var(--pcd) 70%, #1b1330));
  box-shadow: 0 0 0 3px var(--ink), inset 0 3px 0 rgba(255, 255, 255, 0.3), 0 6px 0 3px var(--ink);
  cursor: pointer;
  transition: transform 0.15s, filter 0.2s, box-shadow 0.15s;
}

.slot.focused {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 7px var(--yellow), inset 0 3px 0 rgba(255, 255, 255, 0.3), 0 6px 0 7px var(--ink);
}

.slot.off {
  filter: grayscale(1) brightness(0.55);
}

.slot-avatar {
  width: calc(72px * var(--ui-scale));
  height: calc(72px * var(--ui-scale));
  animation: idle-bob 1.6s ease-in-out infinite;
}

.slot.off .slot-avatar {
  animation: none;
  opacity: 0.5;
}

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

.slot-name {
  font-family: var(--font-display);
  font-size: calc(20px * var(--ui-scale));
  text-shadow: 0 2px 0 var(--ink);
}

.slot-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: calc(14px * var(--ui-scale));
  text-align: center;
}

.slot-value b {
  min-height: 2.4em;
  display: flex;
  align-items: center;
}

.slot-value .arrow {
  font-style: normal;
  opacity: 0.45;
  font-size: 0.8em;
}

.slot.focused .arrow {
  opacity: 1;
  color: var(--yellow);
}

/* ---------------------------------------------------------------- how to play */

.howto-scroll {
  width: min(900px, 94vw);
  max-height: 64vh;
  overflow-y: auto;
  padding: 4px 10px 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-color: var(--purple) transparent;
}

.howto-block {
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.howto-block h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 24px;
  color: var(--yellow);
}

.howto-block p {
  margin: 6px 0;
  font-weight: 700;
  line-height: 1.45;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.ctrl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 14px;
}

.ctrl b {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 18px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.info-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.info-card img {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 10px;
}

.info-card b {
  display: block;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 18px;
}

.info-card em {
  font-style: normal;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--yellow);
  margin-left: 4px;
}

.info-card small {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.3;
}

/* ---------------------------------------------------------------- results */

.big-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: normal;
  font-size: calc(72px * var(--ui-scale));
  text-align: center;
  line-height: 1.05;
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink);
  animation: title-pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.big-title.bad {
  color: #ff6b7a;
}

.big-title.good {
  color: var(--yellow);
}

@keyframes title-pop {
  from {
    transform: scale(0.3) rotate(-8deg);
    opacity: 0;
  }
}

.result-text {
  margin: 0;
  font-size: calc(18px * var(--ui-scale));
  text-align: center;
}

.result-box {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.result-box > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 150px;
  padding: 10px 18px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.result-box small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
}

.result-box b {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: calc(36px * var(--ui-scale));
}

.new-record {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--yellow);
  animation: blink 0.6s ease-in-out infinite;
}

.scoreboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(560px, 92vw);
}

.board-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px 6px 6px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--pc) 25%, #1b1330);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pc) 70%, transparent);
}

.board-row.winner {
  background: color-mix(in srgb, var(--pc) 50%, #1b1330);
  box-shadow: inset 0 0 0 3px var(--yellow), 0 0 20px rgba(255, 210, 63, 0.4);
  animation: winner 0.8s ease-in-out infinite alternate;
}

@keyframes winner {
  to {
    transform: scale(1.03);
  }
}

.board-row img {
  width: 52px;
  height: 52px;
}

.board-name {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-family: var(--font-display);
  font-size: 22px;
}

.board-name small {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--muted);
}

.board-stars {
  display: flex;
  gap: 4px;
}

.board-stars i {
  width: 24px;
  height: 24px;
}

.champ-avatar {
  width: calc(150px * var(--ui-scale));
  height: calc(150px * var(--ui-scale));
  filter: drop-shadow(0 0 30px var(--pc, #fff));
  animation: champ-bounce 0.7s ease-in-out infinite alternate;
}

@keyframes champ-bounce {
  to {
    transform: translateY(-14px) rotate(3deg);
  }
}

.champ-rays {
  position: absolute;
  left: 50%;
  top: 30%;
  width: 900px;
  height: 900px;
  margin: -450px 0 0 -450px;
  background: repeating-conic-gradient(rgba(255, 210, 63, 0.12) 0 10deg, transparent 10deg 20deg);
  border-radius: 50%;
  mask-image: radial-gradient(circle, #000 20%, transparent 65%);
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 65%);
  animation: spin 20s linear infinite;
  pointer-events: none;
}

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

/* ---------------------------------------------------------------- small screens */

@media (max-width: 760px) {
  .world-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .world-card {
    min-height: 0;
  }
  .world-blurb {
    display: none;
  }
  .slot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .logo-text {
    font-size: calc(64px * var(--ui-scale));
  }
  .btn.focused::before {
    display: none;
  }
}

@media (max-height: 560px) {
  .logo-bomb {
    display: none;
  }
  .screen {
    gap: 10px;
  }
}

.row .btn.focused::before {
  display: none;
}
