:root {
  --bg: #08121c;
  --bg-2: #102132;
  --felt: #0b5c68;
  --gold: #d7b56a;
  --gold-2: #f0d9a0;
  --wood: #6a3b1f;
  --ink: #f4efe4;
  --muted: rgba(244, 239, 228, 0.68);
  --panel: rgba(10, 18, 28, 0.88);
  --line: rgba(215, 181, 106, 0.35);
  --line-bright: rgba(240, 217, 160, 0.62);
  --shadow-deep: 0 24px 70px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.24);
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 36px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --popup-width: 390px;
  --popup-radius: 28px;
  --popup-gap: 12px;
  --popup-pad-x: clamp(20px, 6vw, 30px);
  --popup-gold: #e0ba67;
  --popup-gold-bright: #f5dfa5;
  --popup-teal: #0d3540;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --hud-h: clamp(56px, 10vh, 72px);
  --hint-h: clamp(44px, 8vh, 64px);
}

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

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  overflow: hidden;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  min-width: 320px;
}

#app {
  position: relative;
  width: 100%;
  min-width: min(100vw, 320px);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(21, 92, 102, 0.35), transparent 60%),
    var(--bg);
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.screen.is-active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: clamp(0.68rem, 2.4vw, 0.78rem);
  color: var(--gold);
}

.logo-title {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 0.92;
  font-size: clamp(2.4rem, 11vw, 4.2rem);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.42);
}

.logo-title span {
  color: var(--gold-2);
}

.btn,
.icon-btn,
.text-btn {
  font: inherit;
  cursor: pointer;
  border: 0;
  color: inherit;
}

.btn {
  width: 100%;
  max-width: 320px;
  min-height: 52px;
  border-radius: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.btn,
.utility-btn,
.text-btn,
.toggle-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.btn > *,
.utility-btn > * {
  position: relative;
  z-index: 1;
}

.ui-icon,
.btn-icon,
.inline-icon,
.rating-star,
.result-star,
.state-icon,
.lock-icon,
.difficulty-lock {
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
}

.btn-icon {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.26));
}

.utility-btn .btn-icon {
  width: 22px;
  height: 22px;
}

.inline-icon {
  width: 15px;
  height: 15px;
  display: inline-block;
  vertical-align: -3px;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 1px 1px 55% 1px;
  border-radius: 15px 15px 8px 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent);
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(180deg, #efd7a2, #c49a4a);
  color: #2a1708;
  border: 1px solid rgba(255, 239, 196, 0.5);
  box-shadow:
    0 12px 28px rgba(196, 154, 74, 0.2),
    inset 0 -2px 0 rgba(80, 42, 8, 0.2);
}

.btn-secondary {
  background: linear-gradient(180deg, rgba(244, 239, 228, 0.11), rgba(244, 239, 228, 0.05));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.utility-btn {
  min-width: 112px;
  min-height: 44px;
  padding: 0 var(--space-md);
  border: 1px solid rgba(215, 181, 106, 0.25);
  border-radius: 14px;
  background: rgba(8, 18, 28, 0.4);
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.utility-btn.is-muted {
  opacity: 0.68;
}

.btn-compact {
  width: auto;
  min-width: 160px;
  max-width: 220px;
  min-height: 44px;
  padding: 0 18px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(244, 239, 228, 0.11), rgba(244, 239, 228, 0.05));
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.icon-btn .ui-icon {
  width: 27px;
  height: 27px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.28));
}

.icon-btn span {
  display: block;
  width: 12px;
  height: 12px;
  border-left: 3px solid var(--gold-2);
  border-bottom: 3px solid var(--gold-2);
  transform: rotate(45deg);
  margin-left: 4px;
}

.text-btn {
  min-width: 52px;
  min-height: 44px;
  padding: 0 4px;
  background: transparent;
  color: var(--gold-2);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.text-btn .btn-icon {
  width: 18px;
  height: 18px;
}

.hud .text-btn span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

#screen-loading {
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
  background:
    linear-gradient(180deg, rgba(8, 18, 28, 0.2), rgba(8, 18, 28, 0.78)),
    url("../assets/images/backgrounds/home-bg.webp") center / cover no-repeat,
    var(--bg-2);
}

#screen-home {
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
  padding:
    calc(10px + var(--safe-top))
    max(12px, var(--safe-right))
    calc(14px + var(--safe-bottom))
    max(12px, var(--safe-left));
  background-color: #05090c;
  background-image: url("../assets/images/backgrounds/home-lounge.webp");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.loading-card {
  text-align: center;
}

#screen-loading .eyebrow {
  margin-bottom: clamp(5px, 0.8vh, 9px);
  color: #e4bd6b;
  font-size: clamp(0.58rem, 2.2vw, 0.75rem);
  font-weight: 800;
  letter-spacing: 0.2em;
  text-shadow: 0 2px 8px #000;
}

#screen-loading .logo-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.45rem, 7.3vh, 4.15rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 0.88;
  text-transform: uppercase;
  -webkit-text-stroke: 1px rgba(72, 53, 38, 0.58);
  text-shadow:
    0 3px 0 #25150b,
    0 7px 15px rgba(0, 0, 0, 0.72);
}

#screen-loading .logo-title span {
  display: inline-block;
  margin-top: 5px;
  color: #f0c668;
  font-size: 0.76em;
  letter-spacing: -0.01em;
  -webkit-text-stroke-color: rgba(88, 49, 11, 0.62);
}

.load-track {
  width: min(260px, 70vw);
  height: 8px;
  margin: 28px auto 12px;
  border-radius: 99px;
  background: rgba(244, 239, 228, 0.12);
  overflow: hidden;
}

.loader-mark {
  width: 96px;
  height: 96px;
  margin: 0 auto var(--space-lg);
  position: relative;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.34));
}

.loader-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.load-meta {
  width: min(260px, 70vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.load-percent {
  margin: 0;
  color: var(--gold-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.load-fill {
  width: 8%;
  height: 100%;
  background: linear-gradient(90deg, #c49a4a, #f0d9a0);
}

.load-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.home-veil {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(2, 7, 10, 0.2);
  pointer-events: none;
}

.home-topbar {
  position: absolute;
  z-index: 5;
  top: calc(12px + var(--safe-top));
  right: max(14px, var(--safe-right));
  left: max(14px, var(--safe-left));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.daily-reward-btn,
.home-settings-btn {
  pointer-events: auto;
  border: 1px solid rgba(214, 166, 58, 0.5);
  background: rgba(7, 15, 20, 0.78);
  box-shadow:
    0 9px 18px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 231, 157, 0.05);
  color: #efd598;
}

.daily-reward-btn {
  min-width: 100px;
  min-height: 44px;
  padding: 5px 10px 5px 7px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1.35;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.daily-reward-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.home-settings-btn {
  width: 44px;
  height: 44px;
  padding: 8px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.home-settings-btn img {
  width: 27px;
  height: 27px;
  object-fit: contain;
}

.home-composition {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.home-copy {
  width: min(100%, 510px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.home-ctm-logo {
  width: clamp(72px, 10.5vh, 94px);
  height: clamp(72px, 10.5vh, 94px);
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.42));
}

.home-motto {
  width: min(82%, 410px);
  margin-top: clamp(3px, 0.7vh, 8px);
  display: grid;
  grid-template-columns: minmax(28px, 1fr) auto minmax(28px, 1fr);
  align-items: center;
  gap: 8px;
  color: #e4bd6b;
  font-size: clamp(0.58rem, 2.2vw, 0.75rem);
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
}

.home-motto img {
  width: 100%;
  height: 11px;
  display: block;
  object-fit: fill;
}

.home-title {
  margin: clamp(3px, 0.7vh, 8px) 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
  line-height: 0.88;
  text-transform: uppercase;
  text-shadow:
    0 3px 0 #25150b,
    0 7px 15px rgba(0, 0, 0, 0.72);
}

.home-title-carrom {
  color: #eee8db;
  font-size: clamp(2.45rem, 7.3vh, 4.15rem);
  letter-spacing: 0.01em;
  -webkit-text-stroke: 1px rgba(72, 53, 38, 0.58);
}

.home-title-master {
  margin-top: 5px;
  color: #f0c668;
  font-size: clamp(1.8rem, 8.6vw, 3.15rem);
  letter-spacing: -0.01em;
  white-space: nowrap;
  -webkit-text-stroke: 1px rgba(88, 49, 11, 0.62);
}

.home-tagline {
  margin: clamp(4px, 0.8vh, 9px) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #e6d5ae;
  font-size: clamp(0.72rem, 2.8vw, 0.93rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 8px #000;
}

.home-tagline img {
  width: 20px;
  height: 12px;
  display: block;
  object-fit: contain;
}

.home-board-art {
  width: min(96%, clamp(306px, 43vh, 470px));
  margin: clamp(1px, 0.4vh, 5px) auto 0;
  position: relative;
  flex: 0 0 auto;
  filter: drop-shadow(0 17px 14px rgba(0, 0, 0, 0.52));
}

.home-board-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.home-actions {
  width: min(100%, 470px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(7px, 1vh, 11px);
}

.home-play-btn {
  width: min(76%, 320px);
  min-height: clamp(50px, 6.5vh, 58px);
  padding: 4px 18px;
  border: 2px solid #f6d47d;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  background: #dca53d;
  box-shadow:
    0 8px 0 #6f3b0d,
    0 13px 24px rgba(0, 0, 0, 0.48),
    inset 0 0 0 3px rgba(115, 59, 12, 0.3),
    inset 0 8px 13px rgba(255, 239, 173, 0.38);
  color: #2d160a;
  font: inherit;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  font-size: clamp(1.5rem, 6.4vw, 1.9rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.home-play-btn img {
  width: clamp(28px, 6.4vw, 34px);
  height: clamp(28px, 6.4vw, 34px);
  object-fit: contain;
}

.home-utilities {
  width: 84%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}

.home-secondary-btn {
  min-width: 0;
  min-height: clamp(44px, 5.1vh, 46px);
  padding: 4px 8px;
  border: 1px solid #46d2ca;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(5, 32, 42, 0.92);
  box-shadow:
    0 6px 0 #03161d,
    0 10px 18px rgba(0, 0, 0, 0.4),
    inset 0 0 0 2px rgba(219, 174, 78, 0.22);
  color: #f0d99e;
  font: inherit;
  font-size: clamp(0.68rem, 2.7vw, 0.82rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.home-secondary-btn img {
  width: clamp(22px, 5vw, 26px);
  height: clamp(22px, 5vw, 26px);
  object-fit: contain;
}

.home-action-diamond {
  width: 18px;
  height: 30px;
  display: block;
  object-fit: contain;
}

.home-collection {
  width: min(62%, 235px);
  min-height: clamp(44px, 5.6vh, 50px);
  padding: 4px 11px;
  border: 1px solid rgba(218, 169, 70, 0.74);
  border-radius: 20px;
  display: grid;
  grid-template-columns: 27px 1fr 27px;
  align-items: center;
  gap: 8px;
  background: rgba(5, 14, 20, 0.72);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
}

.home-collection div {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home-collection span {
  color: #e6c77f;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.home-collection strong {
  margin-top: 1px;
  color: #fff0bd;
  font-size: clamp(1rem, 3.9vw, 1.2rem);
  letter-spacing: 0.04em;
}

.collection-star {
  width: 27px;
  height: 27px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.42));
}

.home-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.home-particle {
  position: absolute;
  width: 28px;
  height: 28px;
  object-fit: contain;
  opacity: 0.66;
}

.home-particle-one {
  left: 8%;
  top: 41%;
}

.home-particle-two {
  right: 7%;
  top: 48%;
  width: 20px;
  height: 20px;
}

.home-particle-three {
  right: 14%;
  bottom: 20%;
  width: 16px;
  height: 16px;
  opacity: 0.45;
}

.screen-top,
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--hud-h);
  padding:
    calc(10px + var(--safe-top))
    max(12px, var(--safe-right))
    10px
    max(12px, var(--safe-left));
}

.hud {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 52px;
  gap: 8px;
}

.screen-top h2,
.hud-objective {
  margin: 0;
  font-size: clamp(1rem, 4vw, 1.25rem);
}

.screen-heading {
  text-align: center;
}

.screen-heading .eyebrow {
  margin-bottom: 2px;
  font-size: 0.62rem;
}

.screen-heading h2 {
  margin: 0;
}

.top-spacer {
  width: 44px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 10px 16px 18px;
  overflow: visible;
  touch-action: pan-y;
}

.world-section {
  min-height: 0;
  overflow: auto;
  padding-bottom: var(--safe-bottom);
  touch-action: pan-y;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.world-section::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.world-list {
  width: 100%;
  padding-bottom: calc(18px + var(--safe-bottom));
}

.world-block {
  width: 100%;
  position: relative;
}

.world-block + .world-block {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(215, 181, 106, 0.13);
}

.world-block.is-locked .world-heading {
  opacity: 0.72;
}

.world-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 15px 16px 4px;
}

.world-heading .eyebrow {
  margin-bottom: 3px;
}

.world-heading h3 {
  margin: 0;
  color: #f4ead2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.world-progress {
  color: var(--gold-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.level-card {
  min-height: 126px;
  border-radius: 18px;
  padding: 13px 14px 12px;
  text-align: left;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0, rgba(215, 181, 106, 0.12), transparent 48%),
    linear-gradient(145deg, rgba(244, 239, 228, 0.085), rgba(244, 239, 228, 0.025));
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.level-card::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -28px;
  width: 86px;
  height: 86px;
  border: 1px solid rgba(215, 181, 106, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 10px rgba(215, 181, 106, 0.025);
}

.level-card.is-complete {
  border-color: rgba(215, 181, 106, 0.58);
  background:
    radial-gradient(circle at 100% 0, rgba(215, 181, 106, 0.2), transparent 50%),
    linear-gradient(145deg, rgba(244, 239, 228, 0.1), rgba(244, 239, 228, 0.035));
}

.level-card[aria-disabled="true"] {
  opacity: 0.74;
  cursor: default;
  filter: saturate(0.62);
  background:
    radial-gradient(circle at 100% 0, rgba(215, 181, 106, 0.08), transparent 50%),
    linear-gradient(145deg, rgba(244, 239, 228, 0.06), rgba(244, 239, 228, 0.018));
}

.level-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 18px;
  margin-bottom: 9px;
}

.level-number {
  color: var(--gold-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.level-stars {
  min-height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.rating-star {
  width: 14px;
  height: 14px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.24));
}

.rating-star.is-empty,
.result-star.is-empty {
  opacity: 0.2;
  filter: grayscale(0.65);
}

.lock-icon {
  width: 20px;
  height: 20px;
}

.level-card strong {
  display: block;
  max-width: 94%;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.level-card small {
  display: block;
  margin-top: 6px;
  max-width: 96%;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.3;
}

.level-skill {
  position: absolute;
  left: 14px;
  bottom: 10px;
  color: rgba(240, 217, 160, 0.72);
  font-size: 0.53rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.level-state {
  position: absolute;
  right: 14px;
  bottom: 10px;
  padding: 3px 7px;
  border-radius: 99px;
  background: rgba(8, 18, 28, 0.55);
  border: 1px solid rgba(215, 181, 106, 0.2);
  color: var(--muted);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.state-icon {
  width: 14px;
  height: 14px;
}

.level-card.is-current {
  border-color: rgba(93, 221, 208, 0.94);
  background:
    radial-gradient(circle at 100% 0, rgba(215, 181, 106, 0.22), transparent 50%),
    linear-gradient(145deg, rgba(14, 78, 84, 0.62), rgba(8, 28, 39, 0.92));
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.28),
    0 0 0 2px rgba(93, 221, 208, 0.13),
    0 0 30px rgba(66, 204, 194, 0.15);
}

.level-card.is-current::before {
  content: "";
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 0;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #62ded2;
  box-shadow: 0 0 12px rgba(98, 222, 210, 0.68);
}

.level-card.is-current .level-state {
  padding: 4px 9px;
  background: linear-gradient(180deg, #f5dfa5, #d2a64d);
  border-color: transparent;
  color: #2a1708;
  font-size: 0.58rem;
  box-shadow: 0 4px 12px rgba(215, 181, 106, 0.22);
}

.level-card.is-current .level-number,
.level-card.is-current strong {
  color: #fff3c8;
}

.level-card.is-locked strong {
  color: rgba(244, 239, 228, 0.82);
}

.level-card.is-locked small {
  color: rgba(244, 239, 228, 0.56);
}

.level-card.is-locked .level-skill {
  display: none;
}

.level-grid .level-card:last-child:nth-child(odd) {
  width: calc(50% - 6px);
  grid-column: 1 / -1;
  justify-self: center;
}

#screen-game {
  background-color: #071526;
  background-image: url("../assets/images/backgrounds/gameplay-navy.webp");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

#screen-levels {
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(29, 112, 119, 0.28), transparent 62%),
    linear-gradient(180deg, rgba(18, 43, 57, 0.55), transparent 42%),
    var(--bg);
}

.hud {
  min-height: clamp(94px, 14vh, 116px);
  grid-template-columns: 58px minmax(0, 1fr) 96px;
  gap: clamp(7px, 2vw, 14px);
  padding:
    calc(10px + var(--safe-top))
    max(12px, var(--safe-right))
    7px
    max(12px, var(--safe-left));
  background: rgba(3, 12, 23, 0.16);
  position: relative;
  z-index: 3;
}

.game-pause-btn,
.game-retry-btn {
  border: 1px solid rgba(235, 188, 87, 0.8);
  background: rgba(7, 25, 38, 0.88);
  box-shadow:
    0 8px 17px rgba(0, 0, 0, 0.38),
    inset 0 0 0 2px rgba(223, 175, 70, 0.14);
  color: #ebcb84;
  cursor: pointer;
}

.game-pause-btn {
  width: 56px;
  height: 56px;
  padding: 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.game-pause-btn img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.game-retry-btn {
  min-width: 92px;
  min-height: 48px;
  padding: 7px 13px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.game-retry-btn img {
  width: 24px;
  height: 24px;
  display: block;
  object-fit: contain;
}

.hud-center {
  text-align: center;
  min-width: 0;
  flex: 1;
  position: relative;
}

.hud-title-row {
  display: grid;
  grid-template-columns: minmax(24px, 1fr) auto minmax(24px, 1fr);
  align-items: center;
  gap: 7px;
}

.hud-title-row img {
  width: 100%;
  height: 8px;
  display: block;
  object-fit: contain;
}

.hud-game-title {
  margin: 0;
  color: #e8c77f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.67rem, 2.7vw, 0.92rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.hud-center::after {
  content: "POCKET!";
  position: absolute;
  left: 50%;
  bottom: -18px;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(8, 18, 28, 0.82);
  border: 1px solid rgba(240, 217, 160, 0.38);
  color: var(--gold-2);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
}

.hud-level {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hud-objective {
  margin-top: 7px;
  display: -webkit-box;
  color: #f1e6cc;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.75rem, 3.2vw, 1rem);
  line-height: 1.15;
  white-space: normal;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hud-shots {
  margin: 0;
  color: #e3b65d;
  font-size: clamp(0.68rem, 2.7vw, 0.84rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-status {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.hud-status .hud-shots {
  margin: 0;
}

.hud-rating {
  margin: 0;
  display: inline-flex;
  gap: 5px;
}

.game-rating-star {
  width: clamp(15px, 4vw, 19px);
  height: clamp(15px, 4vw, 19px);
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.game-rating-star.is-empty {
  opacity: 0.24;
  filter: grayscale(0.72);
}

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    0
    max(8px, var(--safe-right))
    0
    max(8px, var(--safe-left));
  position: relative;
}

.stage::before {
  content: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
  background: transparent;
}

.game-instruction {
  min-height: var(--hint-h);
  display: grid;
  grid-template-columns: minmax(28px, 1fr) auto minmax(28px, 1fr);
  align-items: center;
  gap: 8px;
  padding:
    0
    max(12px, var(--safe-right))
    var(--safe-bottom)
    max(12px, var(--safe-left));
}

.game-instruction > img {
  width: 100%;
  height: 8px;
  display: block;
  object-fit: contain;
}

.shot-hint {
  margin: 0;
  min-height: auto;
  display: grid;
  place-items: center;
  padding: 7px 0 10px;
  text-align: center;
  color: #e9ddc1;
  font-size: clamp(0.78rem, 3.2vw, 0.92rem);
  letter-spacing: 0.015em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.game-feedback {
  position: absolute;
  z-index: 18;
  top: calc(var(--hud-h) + 12px + var(--safe-top));
  left: 50%;
  max-width: min(78vw, 340px);
  padding: 7px 14px;
  border: 1px solid rgba(224, 186, 103, 0.5);
  border-radius: 999px;
  background: rgba(5, 25, 38, 0.9);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 244, 211, 0.07);
  color: var(--ink);
  font-size: clamp(0.72rem, 2.8vw, 0.9rem);
  font-weight: 900;
  letter-spacing: 0.13em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 5px);
}

.game-feedback[data-tone="combo"],
.game-feedback[data-tone="bank"] {
  color: var(--gold);
  border-color: rgba(239, 215, 162, 0.72);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(24px + var(--safe-top))
    max(24px, var(--safe-right))
    calc(24px + var(--safe-bottom))
    max(24px, var(--safe-left));
  background: rgba(2, 8, 14, 0.78);
  backdrop-filter: blur(8px) saturate(0.84);
  -webkit-backdrop-filter: blur(8px) saturate(0.84);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.overlay.is-open,
.overlay-global.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.overlay-global {
  z-index: 40;
}

.panel {
  width: min(var(--popup-width), 100%);
  max-height: calc(100dvh - 48px - var(--safe-top) - var(--safe-bottom));
  padding: 30px var(--popup-pad-x) 24px;
  border-radius: var(--popup-radius);
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% -8%, rgba(224, 186, 103, 0.18), transparent 42%),
    linear-gradient(155deg, rgba(16, 45, 55, 0.985), rgba(6, 17, 28, 0.99) 58%, rgba(5, 12, 21, 0.995));
  border: 1px solid rgba(237, 201, 122, 0.72);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--popup-gap);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.58),
    0 0 36px rgba(21, 106, 111, 0.1),
    inset 0 1px 0 rgba(255, 244, 211, 0.11),
    inset 0 -18px 30px rgba(0, 0, 0, 0.2);
  scrollbar-width: thin;
  scrollbar-color: rgba(224, 186, 103, 0.45) transparent;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(224, 186, 103, 0.18);
  border-radius: calc(var(--popup-radius) - 7px);
  pointer-events: none;
}

.panel-success {
  border-color: rgba(245, 223, 165, 0.9);
  background:
    radial-gradient(circle at 50% -5%, rgba(224, 186, 103, 0.3), transparent 42%),
    linear-gradient(155deg, rgba(17, 54, 55, 0.99), rgba(6, 19, 27, 0.99) 60%, rgba(5, 12, 21, 0.995));
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.58),
    0 0 48px rgba(224, 186, 103, 0.14),
    inset 0 1px 0 rgba(255, 244, 211, 0.12);
}

.panel-fail {
  background:
    radial-gradient(circle at 50% -10%, rgba(184, 119, 70, 0.15), transparent 43%),
    linear-gradient(155deg, rgba(21, 42, 48, 0.99), rgba(7, 17, 27, 0.995));
  border-color: rgba(205, 159, 96, 0.68);
}

.panel-reward {
  border-color: rgba(245, 215, 137, 0.92);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.58),
    0 0 52px rgba(224, 186, 103, 0.16),
    inset 0 1px 0 rgba(255, 244, 211, 0.13);
}

.panel-locked {
  border-color: rgba(184, 154, 97, 0.58);
}

.panel-guide {
  --popup-width: 380px;
}

.guide-demo {
  width: min(100%, 290px);
  height: 112px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(224, 186, 103, 0.28);
  border-radius: 18px;
  background: rgba(3, 15, 23, 0.54);
  box-shadow: inset 0 1px 0 rgba(255, 244, 211, 0.05);
}

.guide-rail,
.guide-knob,
.guide-striker {
  display: block;
  position: absolute;
  object-fit: contain;
  pointer-events: none;
}

.guide-rail {
  width: calc(100% - 26px);
  height: 42px;
  left: 13px;
  top: 35px;
}

.guide-knob {
  width: 54px;
  height: 54px;
  left: 26px;
  top: 29px;
}

.guide-striker {
  display: none;
  width: 64px;
  height: 64px;
  left: calc(50% - 32px);
  top: 20px;
}

.guide-demo[data-step="aim"] .guide-rail,
.guide-demo[data-step="aim"] .guide-knob,
.guide-demo[data-step="shoot"] .guide-rail,
.guide-demo[data-step="shoot"] .guide-knob {
  display: none;
}

.guide-demo[data-step="aim"] .guide-striker,
.guide-demo[data-step="shoot"] .guide-striker {
  display: block;
}

.panel h3 {
  margin: 0;
  color: #f8edcf;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 7vw, 2rem);
  letter-spacing: 0.035em;
  line-height: 1.05;
  text-transform: uppercase;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.48);
}

.panel .eyebrow {
  margin: -2px 0 -5px;
  color: var(--popup-gold);
  font-size: 0.68rem;
  font-weight: 800;
}

.panel-medallion {
  width: clamp(66px, 19vw, 82px);
  height: clamp(66px, 19vw, 82px);
  margin-bottom: 1px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.3));
}

.panel-medallion img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.panel-medallion-success {
  width: clamp(78px, 23vw, 96px);
  height: clamp(78px, 23vw, 96px);
}

.panel-medallion-fail {
  width: clamp(72px, 21vw, 88px);
  height: clamp(72px, 21vw, 88px);
}

.panel-medallion-reward {
  width: clamp(78px, 23vw, 94px);
  height: clamp(78px, 23vw, 94px);
}

.panel-kicker {
  margin: -4px 0 0;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.panel-copy {
  margin: 0;
  max-width: 31ch;
  color: var(--muted);
  line-height: 1.5;
}

.panel-highlight {
  margin: 0;
  color: var(--popup-gold-bright);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.panel-score {
  margin: -2px 0 2px;
  color: var(--popup-gold-bright);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 10vw, 2.7rem);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-shadow: 0 4px 18px rgba(224, 186, 103, 0.2);
}

.panel-meta {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.result-stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.result-stats p {
  margin: 0;
  padding: 11px 10px;
  border: 1px solid rgba(224, 186, 103, 0.24);
  border-radius: 14px;
  background: rgba(3, 13, 20, 0.46);
  box-shadow: inset 0 1px 0 rgba(255, 244, 211, 0.04);
}

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

.pause-audio {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.pause-audio .utility-btn {
  min-width: 0;
  width: 100%;
}

.result-stats span {
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-stats strong {
  margin-top: 3px;
  color: var(--gold-2);
  font-size: 1rem;
}

.stars {
  margin: -3px 0 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.result-star {
  width: clamp(38px, 12vw, 48px);
  height: clamp(38px, 12vw, 48px);
  filter: drop-shadow(0 5px 10px rgba(215, 181, 106, 0.28));
}

.toggle-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(224, 186, 103, 0.2);
  border-radius: 15px;
  background: rgba(3, 13, 20, 0.4);
}

.toggle-label {
  justify-content: flex-start;
}

.toggle-label .btn-icon {
  width: 26px;
  height: 26px;
}

.toggle-row input {
  width: 52px;
  height: 30px;
  margin: 0;
  border: 1px solid rgba(224, 186, 103, 0.35);
  border-radius: 99px;
  position: relative;
  appearance: none;
  background: rgba(2, 10, 17, 0.72);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.toggle-row input::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 4px;
  background: #d5c69f;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.42);
  transition: transform 180ms ease, background-color 160ms ease;
}

.toggle-row input:checked {
  border-color: rgba(97, 214, 200, 0.72);
  background: #0b5c68;
}

.toggle-row input:checked::after {
  transform: translateX(21px);
  background: var(--popup-gold-bright);
}

.panel > .btn:first-of-type,
.panel > .panel-copy + .btn {
  margin-top: 4px;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.text-btn:focus-visible,
.utility-btn:focus-visible,
.level-card:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(159, 231, 221, 0.9);
  outline-offset: 3px;
}

.btn:disabled,
.utility-btn:disabled {
  cursor: default;
  opacity: 0.48;
  filter: grayscale(0.4);
}
