/* style.css, continued (part 2 of 2; index.html loads the parts in order). */
/* ---------- screens ---------- */
/* Large screens: menu content scales as a whole (the background still covers the screen). */
.screen > * {
  zoom: var(--ui-z, 1);
}
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal));
}
.screen.modal {
  background: rgba(28, 17, 8, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
}
.card {
  --cut: 18px;
  position: relative;
  isolation: isolate;
  width: min(420px, 100%);
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  filter: drop-shadow(0 18px 36px rgba(9, 6, 3, 0.55));
  animation: cardIn 0.32s cubic-bezier(0.2, 1.4, 0.4, 1);
}
/* Same faceted glass as the HUD: chapter-color border + dark background (two clipped layers). */
.card::before,
.card::after {
  content: '';
  position: absolute;
  pointer-events: none;
}
.card::before {
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, var(--acc-hi), var(--acc) 18%, rgba(var(--acc-rgb), 0.45) 65%, var(--acc-lo));
  clip-path: polygon(
    var(--cut) 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%,
    var(--cut) 100%,
    0 calc(100% - var(--cut)),
    0 var(--cut)
  );
}
.card::after {
  inset: 2px;
  z-index: -1;
  --ci: calc(var(--cut) - 0.8px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 22%),
    radial-gradient(110% 60% at 50% -5%, rgba(var(--acc-rgb), 0.22), transparent 62%),
    linear-gradient(180deg, var(--hud-top), var(--hud-bot));
  clip-path: polygon(
    var(--ci) 0,
    calc(100% - var(--ci)) 0,
    100% var(--ci),
    100% calc(100% - var(--ci)),
    calc(100% - var(--ci)) 100%,
    var(--ci) 100%,
    0 calc(100% - var(--ci)),
    0 var(--ci)
  );
}
@keyframes cardIn {
  from {
    transform: translateY(18px) scale(0.94);
  }
}
.card h2 {
  margin: 0;
  text-align: center;
  font-size: 30px;
  font-weight: 700;
}
.card .sub {
  margin: -4px 0 0;
  text-align: center;
  color: var(--soft);
  font-size: 15px;
}
.card .row {
  display: flex;
  gap: 10px;
}
.card .row .btn {
  flex: 1;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-head h2 {
  text-align: left;
  font-size: 26px;
}
.toggle-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* title */
.screen.title {
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 32%, rgba(46, 28, 14, 0.7), rgba(28, 17, 8, 0.42) 75%);
} /* The demo behind is dimmed: the title takes focus. */
.title-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(520px, 100%);
}
.logo-scrim {
  position: absolute;
  left: -15%;
  right: -15%;
  top: -12%;
  height: clamp(190px, 54vw, 340px);
  background: radial-gradient(
    ellipse at 50% 52%,
    rgba(38, 23, 12, 0.92),
    rgba(38, 23, 12, 0.6) 45%,
    rgba(38, 23, 12, 0) 75%
  );
  pointer-events: none;
}
.logo {
  position: relative;
}
body.menu canvas#game,
body.menu canvas#post {
  filter: blur(2.5px) saturate(0.85);
}
.logo {
  width: calc(100% - 48px);
  margin-inline: auto;
  height: clamp(140px, 40vw, 270px);
  cursor: pointer;
}
.tagline {
  position: relative;
  margin: -6px 0 14px;
  color: #f5e8d3;
  font-size: clamp(15px, 4vw, 19px);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 8px rgba(34, 20, 10, 0.9);
}
.title-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.title-actions .btn.big {
  min-width: min(300px, 86%);
}
.title-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: min(300px, 86%);
}
/* Three buttons on one line: icon on top, label below (nothing wraps alone to a second line). */
.title-row .btn {
  flex-direction: column;
  gap: 4px;
  min-height: 66px;
  padding: 8px 4px;
  font-size: 14px;
  min-width: 0;
}
.title-row .btn svg {
  width: 22px;
  height: 22px;
}
.title-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--soft);
  font-weight: 600;
}
.title-meta svg {
  color: var(--amber);
}
.title-meta svg.tr {
  color: #f3e6ce;
}
.title-meta .sep {
  width: 4px;
  height: 4px;
  background: var(--soft);
  border-radius: 50%;
  opacity: 0.5;
}
.tap-start {
  display: none;
}
.screen.title.splash {
  cursor: pointer;
}
.screen.title.splash .title-actions {
  display: none;
}
.screen.title.splash .tap-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(20px, 5.4vw, 26px);
  font-weight: 700;
  padding: 14px 26px;
  color: #fff3c4;
  animation: tapPulse 1.3s ease-in-out infinite;
}
.screen.title.splash .tap-start svg {
  width: 32px;
  height: 32px;
  color: var(--amber);
  filter: drop-shadow(0 0 8px rgba(255, 180, 60, 0.8));
  animation: tapFinger 1.3s ease-in-out infinite;
}
@keyframes tapPulse {
  50% {
    transform: scale(1.06);
    opacity: 0.78;
  }
}
@keyframes tapFinger {
  40% {
    transform: translateY(5px) scale(0.92);
  }
}
.screen.title.reveal .title-actions > * {
  animation: rise 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.screen.title.reveal .title-actions > *:nth-child(2) {
  animation-delay: 0.06s;
}
.screen.title.reveal .title-actions > *:nth-child(3) {
  animation-delay: 0.12s;
}
@keyframes rise {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
}
.corner-tools {
  position: absolute;
  right: calc(12px + var(--sar));
  bottom: calc(12px + var(--sab));
  display: flex;
  gap: 8px;
  align-items: center;
}
@media (max-aspect-ratio: 1/1) {
  .corner-tools {
    right: 0;
    left: 0;
    justify-content: center;
  }
}
.lang-pick {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 10px;
  background: rgba(93, 59, 33, 0.82);
  clip-path: polygon(
    10px 0,
    calc(100% - 10px) 0,
    100% 10px,
    100% calc(100% - 10px),
    calc(100% - 10px) 100%,
    10px 100%,
    0 calc(100% - 10px),
    0 10px
  );
}
.lang-pick svg {
  width: 20px;
  height: 20px;
}
.lang-pick select,
.select select {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 0;
  outline-offset: 2px;
}
.lang-pick select option,
.select select option {
  color: #fcf9f4;
  background: #452b17;
}
.lang-pick select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 22px;
  cursor: pointer;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ffc94d' stroke-width='2.2'/%3E%3C/svg%3E")
    no-repeat right 4px center;
}

/* Sheet (levels, skins) */
@keyframes irisIn {
  from {
    clip-path: polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%);
  }
  to {
    clip-path: polygon(50% -75%, 175% 50%, 50% 175%, -75% 50%);
  }
}
/* Faceted curtain that opens when entering a level. */
#wipe {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  display: none;
}
#wipe.run {
  display: block;
}
#wipe::before,
#wipe::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 54%;
  background: linear-gradient(180deg, #1b1f5c, #311e0f);
}
#wipe::before {
  left: 0;
  clip-path: polygon(0 0, 100% 0, 90% 50%, 100% 100%, 0 100%);
  animation: shutL 0.5s cubic-bezier(0.65, 0, 0.25, 1) 0.05s forwards;
  box-shadow: inset -3px 0 0 #e7ca97;
}
#wipe::after {
  right: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10% 50%);
  animation: shutR 0.5s cubic-bezier(0.65, 0, 0.25, 1) 0.05s forwards;
  box-shadow: inset 3px 0 0 #e7ca97;
}
@keyframes shutL {
  to {
    transform: translateX(-105%);
  }
}
@keyframes shutR {
  to {
    transform: translateX(105%);
  }
}
.fly-star {
  position: fixed;
  z-index: 30;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  color: #ffd36e;
  filter: drop-shadow(0 0 8px rgba(255, 190, 70, 0.9));
  pointer-events: none;
}
/* Victory stars: above the HUD, below the screens (pausing mid-flight never leaves a star over the card). */
.fly-star.hud {
  z-index: 6;
  filter: drop-shadow(0 0 3px #fff6c9) drop-shadow(0 0 12px rgba(255, 200, 80, 0.95));
  will-change: transform;
}
.star-trail {
  position: fixed;
  z-index: 6;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  pointer-events: none;
  background: #fff6c9;
  box-shadow: 0 0 8px 2px rgba(255, 200, 80, 0.9);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: trailFade 0.5s ease-out forwards;
}
@keyframes trailFade {
  to {
    transform: scale(0.2) rotate(90deg);
    opacity: 0;
  }
}
.screen.sheet {
  flex-direction: column;
  justify-content: flex-start;
  background: rgba(33, 19, 9, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: irisIn 0.38s cubic-bezier(0.3, 0, 0.2, 1);
  gap: 14px;
  overflow: auto;
}
.sheet-head {
  width: min(560px, 100%);
  display: flex;
  align-items: center;
  gap: 12px;
}
/* With 50 levels the list scrolls: the title, close button and stars stay pinned at the top. */
#scr-levels {
  --sheet-pad: calc(16px + var(--sat));
}
#scr-levels .sheet-head {
  position: sticky;
  top: calc(-1 * var(--sheet-pad));
  z-index: 3;
  margin: calc(-1 * var(--sheet-pad)) 0 0;
  padding: var(--sheet-pad) 0 18px;
  background: linear-gradient(180deg, rgb(33, 21, 11) 0 78%, rgba(33, 21, 11, 0) 100%);
}
.sheet-head h2 {
  margin: 0;
  flex: 1;
  font-size: 28px;
}
.sheet-stars {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 18px;
}
.sheet-stars svg {
  color: var(--amber);
  width: 20px;
  height: 20px;
}
.level-grid {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(6px, 1.8vw, 12px);
  padding-bottom: 12px;
}
@media (min-aspect-ratio: 5/4) {
  .level-grid {
    width: min(760px, 100%);
  }
  .sheet-head {
    width: min(760px, 100%);
  }
}
/* Chapter header: strip in the chapter's gem color, with its name and stars. */
.ch-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 2px;
  padding: 8px 14px 8px 16px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--ch) 30%, transparent),
    color-mix(in srgb, var(--ch) 6%, transparent)
  );
  box-shadow: inset 4px 0 0 var(--ch);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  animation: rise 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) both;
  animation-delay: calc(var(--i) * 25ms);
}
.ch-title:first-child {
  margin-top: 2px;
}
.ch-title span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ch-title small {
  font-size: 12px;
  font-weight: 700;
  color: color-mix(in srgb, var(--ch) 70%, #fff);
}
.ch-title em {
  display: flex;
  align-items: center;
  gap: 5px;
  font-style: normal;
  font-size: 15px;
  color: #ffe7a8;
  flex: none;
}
.ch-title em svg {
  width: 16px;
  height: 16px;
  color: #ffd36a;
}
.ch-title .lock {
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.55);
  flex: none;
}
.ch-title.locked {
  color: rgba(255, 255, 255, 0.62);
}
.lvl {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  animation: rise 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) both;
  animation-delay: calc(var(--i) * 25ms);
  transition:
    transform 0.1s ease,
    filter 0.15s;
}
.lvl canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.lvl:hover {
  filter: brightness(1.12);
  transform: scale(1.03);
}
.lvl:active {
  transform: scale(0.95);
}
.lvl b {
  position: relative;
  margin-top: -10%;
  font-size: clamp(17px, 5vw, 30px);
  font-weight: 700;
  color: #fff;
  -webkit-text-stroke: 4px #2c1b0e;
  paint-order: stroke fill;
}
.lvl .stars {
  position: absolute;
  bottom: -4%;
  display: flex;
  gap: 2px;
  padding: 2px 5px;
  background: rgba(37, 22, 11, 0.85);
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 50%, calc(100% - 6px) 100%, 6px 100%, 0 50%);
}
.lvl .stars svg {
  width: clamp(9px, 2.6vw, 15px);
  height: clamp(9px, 2.6vw, 15px);
  color: transparent;
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 2px;
}
.lvl .stars svg.on {
  color: #ffd36a;
  stroke: #7a4a10;
  stroke-width: 1px;
  filter: drop-shadow(0 0 3px rgba(255, 200, 80, 0.9));
}
.lvl.locked {
  opacity: 0.6;
}
.lvl.locked canvas {
  filter: saturate(0.15) brightness(0.55);
}
.lvl.perfect canvas {
  filter: drop-shadow(0 0 1px #ffd36e) drop-shadow(0 0 1px #ffd36e);
}
.lvl .play-badge {
  position: absolute;
  top: -4%;
  right: -4%;
  width: clamp(18px, 5vw, 26px);
  height: clamp(18px, 5vw, 26px);
  display: grid;
  place-items: center;
  color: #2a1205;
  background: linear-gradient(180deg, #ffe08a, #ffa64c);
  clip-path: polygon(
    7px 0,
    calc(100% - 7px) 0,
    100% 7px,
    100% calc(100% - 7px),
    calc(100% - 7px) 100%,
    7px 100%,
    0 calc(100% - 7px),
    0 7px
  );
}
.lvl .play-badge svg {
  width: 55%;
  height: 55%;
  margin-left: 2px;
}
.lvl.locked b {
  color: #f0e2c9;
  font-size: clamp(15px, 4.4vw, 26px);
}
.lvl.locked svg.lock {
  position: absolute;
  bottom: 8%;
  width: clamp(11px, 3vw, 18px);
  height: clamp(11px, 3vw, 18px);
  color: #faf3e8;
}
.lvl.current {
  animation:
    rise 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) both,
    nextPulse 1.3s ease-in-out 0.5s infinite;
}
@keyframes nextPulse {
  0%,
  100% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 2px #ffc14d) drop-shadow(0 0 2px #ffc14d);
  }
  50% {
    transform: scale(1.1);
    filter: brightness(1.15) drop-shadow(0 0 2px #ffe08a) drop-shadow(0 0 14px rgba(255, 190, 70, 0.75));
  }
}

.skin-grid {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 640px) {
  .skin-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.skin {
  --cut: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px 12px;
  background: linear-gradient(180deg, rgba(116, 75, 44, 0.95), rgba(71, 45, 25, 0.95));
  clip-path: polygon(
    var(--cut) 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%,
    var(--cut) 100%,
    0 calc(100% - var(--cut)),
    0 var(--cut)
  );
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.16);
}
.skin canvas {
  width: 100%;
  height: 84px;
}
.skin .in-use {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 42px;
  margin-top: auto;
  font-size: 14px;
  font-weight: 700;
  color: #2a1205;
  background: linear-gradient(180deg, #fff3c4, #ffd36e);
  clip-path: polygon(
    10px 0,
    calc(100% - 10px) 0,
    100% 10px,
    100% calc(100% - 10px),
    calc(100% - 10px) 100%,
    10px 100%,
    0 calc(100% - 10px),
    0 10px
  );
}
.skin .in-use svg {
  width: 18px;
  height: 18px;
}
.skin .bar-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}
.skin .bar-row span {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
}
.skin .btn {
  margin-top: auto;
}
.skin b {
  font-size: 17px;
}
.skin small {
  color: var(--soft);
  font-size: 13px;
  text-align: center;
  min-height: 16px;
}
.skin.on {
  background: linear-gradient(180deg, rgba(190, 146, 70, 0.98), rgba(116, 72, 38, 0.98));
}
.skin.on small {
  color: #fff3c4;
  font-weight: 700;
}
.skin .btn {
  width: 100%;
}
.skin .btn.ad {
  --c1: #956139;
  --c2: #6a4427;
  color: #fff;
}
.skin .btn.ad .chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #2a1205;
  background: #ffd36a;
  border-radius: 4px;
}
.skin .bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}
.skin .bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ffd36a, #ff9f4a);
}
.skin {
  position: relative;
}
.skin.locked canvas {
  filter: saturate(0.85);
}
.skin.fresh {
  animation: reveal 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) 0.2s both;
}
.skin.fresh::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%) no-repeat;
  background-size: 250% 100%;
  opacity: 0;
  animation: revealShine 1.2s ease 0.5s 2;
  pointer-events: none;
}
@keyframes reveal {
  0% {
    transform: scale(0.6) rotate(-4deg);
    filter: brightness(2.2);
  }
  60% {
    transform: scale(1.06);
    filter: brightness(1.3);
  }
  100% {
    transform: none;
    filter: none;
  }
}
@keyframes revealShine {
  0% {
    background-position: 120% 0;
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    background-position: -120% 0;
    opacity: 0;
  }
}
.skin .new-badge {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 2;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #27170b;
  background: linear-gradient(180deg, #b8f4ff, #d7a857);
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 50%, calc(100% - 6px) 100%, 6px 100%, 0 50%);
  animation: popIn 0.3s ease 0.6s both;
}
.skin .lock-badge {
  position: absolute;
  top: 24px;
  right: 20px;
  z-index: 1;
  width: 18px;
  height: 18px;
  color: #f3e6ce;
}
.skin.on::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff3c4;
  clip-path: polygon(
    var(--cut) 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%,
    var(--cut) 100%,
    0 calc(100% - var(--cut)),
    0 var(--cut),
    0 var(--cut),
    3px calc(var(--cut) + 1px),
    3px calc(100% - var(--cut) - 1px),
    calc(var(--cut) + 1px) calc(100% - 3px),
    calc(100% - var(--cut) - 1px) calc(100% - 3px),
    calc(100% - 3px) calc(100% - var(--cut) - 1px),
    calc(100% - 3px) calc(var(--cut) + 1px),
    calc(100% - var(--cut) - 1px) 3px,
    calc(var(--cut) + 1px) 3px,
    3px calc(var(--cut) + 1px),
    0 var(--cut)
  );
  pointer-events: none;
}

/* result */
.results {
  overflow: visible;
  padding-top: 30px;
}
/* Space at the top for the chicken peeking over the card (never touches the top of the window). */
#scr-results {
  padding-top: calc(var(--sat) + 76px * var(--ui-z, 1));
}
/* In-game cards (result, pause) in the chapter color: secondary buttons and subtitle. */
:root,
body.th-geode {
  --btn-1: #99663f;
  --btn-2: #6f4728;
}
body.th-ice {
  --btn-1: #824d25;
  --btn-2: #583419;
}
body.th-forge {
  --btn-1: #873a26;
  --btn-2: #561f15;
}
body.th-emerald {
  --btn-1: #1c6b57;
  --btn-2: #0f4436;
}
body.th-coral {
  --btn-1: #6a4121;
  --btn-2: #452913;
}
body.th-amber {
  --btn-1: #7a5418;
  --btn-2: #4d330b;
}
body.th-obsidian {
  --btn-1: #6e1a2c;
  --btn-2: #44101b;
}
body.th-neon {
  --btn-1: #7b4c28;
  --btn-2: #513118;
}
body.th-storm {
  --btn-1: #584435;
  --btn-2: #37291f;
}
body.th-prism {
  --btn-1: #8b5d3a;
  --btn-2: #5d3c23;
}
#scr-results .btn:not(.primary):not(.use),
#scr-pause .btn:not(.primary) {
  --c1: var(--btn-1);
  --c2: var(--btn-2);
}
#scr-results .sub {
  color: var(--hud-soft);
}
/* The chicken peeks over the card, happy. */
.res-rico {
  position: absolute !important;
  left: 50%;
  top: -66px;
  width: 132px;
  height: 72px;
  margin-left: -66px;
  pointer-events: none;
  z-index: -3 !important;
} /* Behind the card: the border cuts the base exactly at the rim line. */
.results.lost .res-rico {
  top: -62px;
}
.results h2 {
  font-size: 28px;
  line-height: 1.12;
  background: linear-gradient(180deg, #fff6c9, #ffc24a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 #4d2e17);
}
.results.lost h2 {
  background: linear-gradient(180deg, #ffd6e0, #ff8fa8);
  -webkit-background-clip: text;
  background-clip: text;
}
.results.lost .row {
  flex-direction: column;
}
.card .row .btn.big {
  font-size: clamp(16px, 4.6vw, 21px);
  padding: 0 14px;
}
.res-stars {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 4px;
  margin: 4px 0 20px;
}
.res-stars .slot {
  z-index: 1;
}
.res-stars .slot {
  position: relative;
  width: 78px;
  height: 78px;
}
.res-stars .slot.s2 {
  width: 98px;
  height: 98px;
  margin-bottom: 10px;
}
.res-stars .slot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* The outline always stays underneath: the star slot never disappears. */
.res-stars .bg {
  color: rgba(255, 255, 255, 0.08);
  stroke: rgba(255, 214, 110, 0.38);
  stroke-width: 0.9px;
  stroke-linejoin: round;
  transform: scale(0.85);
}
.res-stars .star {
  opacity: 0;
}
.res-stars .star.on {
  opacity: 1;
  filter: drop-shadow(0 0 12px rgba(255, 190, 70, 0.7));
  animation: starIn 0.3s cubic-bezier(0.3, 0, 0.3, 1) both;
}
#res-title.pop {
  animation: titlePop 0.42s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes titlePop {
  from {
    transform: scale(1.35);
    filter: brightness(1.6) drop-shadow(0 2px 0 #4d2e17);
  }
}
@keyframes starIn {
  0% {
    transform: scale(1.9) rotate(-22deg);
    opacity: 0;
  }
  55% {
    transform: scale(0.9) rotate(4deg);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}
.star-burst {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}
.star-confetti {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: -1;
}
/* The star confetti passes behind the card text (in front of the background only). */
.results > * {
  position: relative;
  z-index: 2;
}
.results > .res-stars {
  z-index: 1;
}
.perfect-stamp {
  position: absolute;
  top: 2px;
  right: 0;
  z-index: 3;
  padding: 6px 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #2a1205;
  background: linear-gradient(180deg, #fff1b8, #ffc14d);
  clip-path: polygon(
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px),
    0 8px
  );
  transform: rotate(8deg);
  animation: stampIn 0.34s cubic-bezier(0.2, 1.6, 0.4, 1) both;
  pointer-events: none;
}
/* "Perfect!": ribbon with folded ends passing under the three stars. */
.res-stars > .perfect-stamp {
  z-index: 0;
  top: auto;
  right: auto;
  bottom: -19px;
  left: 50%;
  width: 236px;
  margin-left: -118px;
  padding: 3px 0 4px;
  text-align: center;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  clip-path: none;
  transform: none;
  color: #3a1a02;
  background: none;
  animation: bannerIn 0.42s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
/* Ribbon (::after) in front of the folded ends (::before), both behind the text. */
.res-stars > .perfect-stamp::before,
.res-stars > .perfect-stamp::after {
  content: '';
  position: absolute;
  pointer-events: none;
}
.res-stars > .perfect-stamp::after {
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, #ffe9a6, #ffc14d 60%, #f0a12e);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -2px 0 rgba(150, 70, 10, 0.35);
}
.res-stars > .perfect-stamp::before {
  left: -18px;
  right: -18px;
  top: 7px;
  height: 100%;
  z-index: -2;
  background: linear-gradient(180deg, #e8952a, #a95a16);
  clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%, 9px 50%);
}
.res-stars > .perfect-stamp svg {
  width: 11px;
  height: 11px;
  margin: 0 9px;
  vertical-align: 1px;
  color: #fffbe8;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9));
}
@keyframes bannerIn {
  from {
    transform: scaleX(0.15);
    opacity: 0;
  }
  60% {
    transform: scaleX(1.05);
    opacity: 1;
  }
  to {
    transform: none;
  }
}
@keyframes stampIn {
  from {
    transform: rotate(-10deg) scale(2.4);
    opacity: 0;
  }
  to {
    transform: rotate(8deg) scale(1);
    opacity: 1;
  }
}
@keyframes stampInC {
  from {
    transform: rotate(-12deg) scale(2.4);
    opacity: 0;
  }
  to {
    transform: rotate(-3deg) scale(1);
    opacity: 1;
  }
}
.star-confetti i {
  position: absolute;
  left: -4px;
  top: -5px;
  width: 8px;
  height: 10px;
  opacity: 0;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  animation: burstUp 1.25s cubic-bezier(0.2, 0.7, 0.4, 1) var(--w) forwards;
}
@keyframes burstUp {
  0% {
    transform: translate(0, 0) scale(0.5);
    opacity: 1;
  }
  40% {
    transform: translate(var(--x), var(--y)) rotate(calc(var(--r) * 0.5));
    opacity: 1;
  }
  100% {
    transform: translate(calc(var(--x) * 1.25), calc(var(--y) + 150px)) rotate(var(--r));
    opacity: 0;
  }
}
.star-burst i {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  background: #ffe7a0;
  box-shadow: 0 0 8px rgba(255, 200, 90, 0.9);
  transform: rotate(var(--a)) translateY(-18px) rotate(45deg);
  animation: starSpark 0.5s ease-out forwards;
}
@keyframes starSpark {
  to {
    transform: rotate(var(--a)) translateY(-52px) rotate(45deg) scale(0.2);
    opacity: 0;
  }
}
/* Best score: small badge with only a gold outline (solid gold is reserved for stars, score and Next). */
.res-score small.ribbon {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 11px 0 9px;
  color: #ffd36e;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  animation: ribbonIn 0.42s cubic-bezier(0.2, 1.6, 0.4, 1) 0.75s both;
}
.res-score small.ribbon svg {
  width: 13px;
  height: 13px;
}
.res-score small.ribbon::before,
.res-score small.ribbon::after {
  content: '';
  position: absolute;
  pointer-events: none;
}
.res-score small.ribbon::before {
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, #ffe08a, #e89a3c);
  clip-path: polygon(
    6px 0,
    calc(100% - 6px) 0,
    100% 6px,
    100% calc(100% - 6px),
    calc(100% - 6px) 100%,
    6px 100%,
    0 calc(100% - 6px),
    0 6px
  );
}
.res-score small.ribbon::after {
  inset: 1.5px;
  z-index: -1;
  background: var(--hud-bot);
  clip-path: polygon(
    5.4px 0,
    calc(100% - 5.4px) 0,
    100% 5.4px,
    100% calc(100% - 5.4px),
    calc(100% - 5.4px) 100%,
    5.4px 100%,
    0 calc(100% - 5.4px),
    0 5.4px
  );
}
@keyframes ribbonIn {
  from {
    transform: scale(0.2) rotate(-8deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.res-skin {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(180deg, rgba(var(--acc-rgb), 0.12), rgba(var(--acc-rgb), 0.04)), rgba(22, 13, 6, 0.4);
  clip-path: polygon(
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px),
    0 8px
  );
}
.res-skin .nm {
  color: var(--hud-soft);
  white-space: nowrap;
}
.res-skin .bar {
  height: 8px;
  background: rgba(22, 13, 6, 0.6);
  box-shadow: inset 0 0 0 1px rgba(var(--acc-rgb), 0.45);
  border-radius: 2px;
  overflow: hidden;
}
.res-skin .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ffc14d, #ffe08a);
  transition: width 0.6s cubic-bezier(0.3, 0, 0.2, 1);
}
.res-skin b {
  color: var(--amber);
  white-space: nowrap;
}
/* Score centered below the stars; the best-score badge comes right below it. */
.res-score {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  row-gap: 6px;
}
.res-score > span {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(180deg, #fffbe8 10%, #ffd36e 55%, #ff9f2e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(60, 20, 0, 0.6));
}
.res-score small {
  color: var(--hud-soft);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
}
.res-score small:empty {
  display: none;
}
.res-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.res-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  background: linear-gradient(180deg, rgba(var(--acc-rgb), 0.14), rgba(var(--acc-rgb), 0.04));
  box-shadow: inset 0 1px 0 rgba(var(--acc-rgb), 0.35);
  clip-path: polygon(
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px),
    0 8px
  );
}
.res-stats small {
  color: var(--hud-soft);
  font-size: 12px;
  font-weight: 600;
}
.res-stats b {
  font-size: 20px;
}
.res-note {
  margin: -2px 0 0;
  text-align: center;
  font-size: 12px;
  color: #c8b697;
}
/* Second chance: "Ad" badge inside the main button. */
.btn.continue {
  gap: 12px;
}
.btn.continue .chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #fff4dc;
  background: rgba(120, 40, 0, 0.55);
  border-radius: 4px;
  text-shadow: none;
}
.btn.continue .chip svg {
  width: 12px;
  height: 12px;
}
/* Leaderboard position: same outline badge as the best score, in the chapter color, next to it; tap opens the
   leaderboard. */
.res-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.res-chips:not(:has(> :not([hidden]):not(:empty))) {
  display: none;
}
.rank-chip {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px 0 9px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--acc-hi);
  animation: popIn 0.3s ease;
}
.rank-chip::before,
.rank-chip::after {
  content: '';
  position: absolute;
  pointer-events: none;
}
.rank-chip::before {
  inset: 0;
  z-index: -2;
  background: var(--acc);
  clip-path: polygon(
    6px 0,
    calc(100% - 6px) 0,
    100% 6px,
    100% calc(100% - 6px),
    calc(100% - 6px) 100%,
    6px 100%,
    0 calc(100% - 6px),
    0 6px
  );
}
.rank-chip::after {
  inset: 1.5px;
  z-index: -1;
  background: var(--hud-bot);
  clip-path: polygon(
    5.4px 0,
    calc(100% - 5.4px) 0,
    100% 5.4px,
    100% calc(100% - 5.4px),
    calc(100% - 5.4px) 100%,
    5.4px 100%,
    0 calc(100% - 5.4px),
    0 5.4px
  );
  transition: background 0.15s;
}
.rank-chip:hover::after {
  background: color-mix(in srgb, var(--acc) 22%, var(--hud-bot));
}
.rank-chip i {
  font-style: normal;
  font-size: 15px;
  line-height: 1;
  margin-left: 2px;
}
.rank-chip svg {
  width: 13px;
  height: 13px;
}
/* Touch area larger than the badge. */
.rank-chip > span::after {
  content: '';
  position: absolute;
  inset: -9px -4px;
}
.rank-chip.muted {
  background: rgba(93, 59, 33, 0.9);
  color: var(--soft);
}
/* Closed outline on the chamfers too: outer layer = border, inner layer = background (both clipped). */
.unlock-note {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
  color: var(--acc-hi);
  font-weight: 600;
  font-size: 14px;
}
.unlock-note::before,
.unlock-note::after {
  content: '';
  position: absolute;
  pointer-events: none;
}
.unlock-note::before {
  inset: 0;
  z-index: -2;
  background: rgba(var(--acc-rgb), 0.55);
  clip-path: polygon(
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px),
    0 8px
  );
}
.unlock-note::after {
  inset: 1.5px;
  z-index: -1;
  background: linear-gradient(90deg, rgba(var(--acc-rgb), 0.22), rgba(var(--acc-rgb), 0.07)), var(--hud-bot);
  clip-path: polygon(
    7.4px 0,
    calc(100% - 7.4px) 0,
    100% 7.4px,
    100% calc(100% - 7.4px),
    calc(100% - 7.4px) 100%,
    7.4px 100%,
    0 calc(100% - 7.4px),
    0 7.4px
  );
}
.unlock-note .txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.15;
}
.unlock-note .txt small {
  font-size: 11px;
  font-weight: 700;
  color: var(--hud-soft);
}
.unlock-note .names {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unlock-note .names i {
  font-style: normal;
  color: var(--hud-soft);
}
.unlock-note b {
  color: #fff;
}
.unlock-note .balls {
  display: flex;
  gap: 4px;
  flex: none;
}
.unlock-note canvas.ball {
  width: 22px;
  height: 22px;
}
/* "Use": secondary button in the chapter color (orange is reserved for Next); 44 px tall for fingers. */
.unlock-note .btn.use {
  --cut: 8px;
  --c1: var(--acc);
  --c2: var(--acc);
  min-height: 44px;
  padding: 0 16px;
  font-size: 14px;
  color: #fff;
  box-shadow: none;
}
.unlock-note .btn.use::before {
  content: '';
  position: absolute;
  inset: 1.5px;
  z-index: -1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 50%), var(--acc-lo);
  clip-path: polygon(
    7.4px 0,
    calc(100% - 7.4px) 0,
    100% 7.4px,
    100% calc(100% - 7.4px),
    calc(100% - 7.4px) 100%,
    7.4px 100%,
    0 calc(100% - 7.4px),
    0 7.4px
  );
}
.confetti {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  overflow: hidden;
}
.confetti.behind {
  position: absolute;
  z-index: 0;
}
.screen.modal > .card {
  position: relative;
  z-index: 1;
}
.confetti i {
  position: absolute;
  top: -20px;
  width: 9px;
  height: 12px;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  animation: fall var(--d) cubic-bezier(0.3, 0.6, 0.6, 1) var(--w) forwards;
}
@keyframes fall {
  to {
    transform: translate(var(--x), 110vh) rotate(var(--r));
  }
}

/* score screen */
.rank-card {
  width: min(460px, 100%);
}
/* Champion: strip with the achievement in light text + two large numbers (total and stars). */
.final-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.final-sub {
  --cut: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(12, 7, 4, 0.6);
  background: linear-gradient(
    90deg,
    rgba(var(--acc-rgb), 0.1),
    rgba(var(--acc-rgb), 0.3) 50%,
    rgba(var(--acc-rgb), 0.1)
  );
  clip-path: polygon(
    var(--cut) 0,
    calc(100% - var(--cut)) 0,
    100% 50%,
    calc(100% - var(--cut)) 100%,
    var(--cut) 100%,
    0 50%
  );
}
.final-sub svg {
  flex: none;
  width: 24px;
  height: 24px;
  color: #ffd36e;
  filter: drop-shadow(0 0 6px rgba(255, 200, 90, 0.55));
}
.final-stats {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 8px;
}
.final-stats .fs {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 8px 12px;
  background: rgba(14, 8, 4, 0.32);
  clip-path: polygon(
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px),
    0 8px
  );
}
.final-stats small {
  font-size: 13px;
  font-weight: 700;
  color: var(--acc-hi);
  opacity: 0.85;
}
.final-stats b {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 36px;
  line-height: 1.05;
  color: #fff3c4;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(255, 200, 90, 0.35);
}
.final-stats b svg {
  width: 26px;
  height: 26px;
}
.nick-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nick-form label {
  font-size: 14px;
  color: var(--hud-soft);
  font-weight: 700;
}
#btn-nick:disabled {
  filter: saturate(0.4) brightness(0.85);
}
.nick-row {
  display: flex;
  gap: 8px;
}
.nick-row input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  background: rgba(37, 22, 11, 0.8);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  user-select: text;
  -webkit-user-select: text;
}
.nick-row input:focus {
  border-color: var(--amber);
  outline: none;
}
.nick-status {
  margin: 0;
  min-height: 16px;
  font-size: 13px;
  color: var(--mint);
}
.nick-status.error {
  color: #ff9fb4;
}
.nick-form.shake {
  animation: shake 0.35s ease;
}
@keyframes shake {
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
.tabs {
  display: flex;
  gap: 6px;
}
.tab {
  flex: 1;
  height: 40px;
  font-weight: 700;
  color: var(--soft);
  background: rgba(42, 25, 12, 0.6);
  clip-path: polygon(
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px),
    0 8px
  );
}
.tab.on {
  color: #27170b;
  background: linear-gradient(180deg, #ffd36e, #ffb14d);
}
.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: min(44vh, 360px);
  overflow-y: auto;
  overflow-x: hidden;
}
.rank-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  background: rgba(42, 25, 12, 0.55);
  font-weight: 600;
  animation: rise 0.3s ease both;
  animation-delay: calc(var(--i) * 22ms);
}
.rank-row .pos {
  color: var(--soft);
  font-weight: 700;
}
.rank-row:nth-child(1) .pos {
  color: #ffd36e;
}
.rank-row:nth-child(2) .pos {
  color: #f9f2e5;
}
.rank-row:nth-child(3) .pos {
  color: #ffb38a;
}
.rank-row .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-row.me {
  background: linear-gradient(90deg, rgba(215, 168, 87, 0.35), rgba(215, 168, 87, 0.12));
  box-shadow: inset 3px 0 0 #e7ca97;
}
.rank-row.skeleton {
  background: rgba(255, 255, 255, 0.05);
  animation: shimmer 1s ease-in-out infinite alternate;
}
@keyframes shimmer {
  to {
    background: rgba(255, 255, 255, 0.1);
  }
}
.rank-empty {
  padding: 18px 8px;
  text-align: center;
  color: var(--hud-soft);
}
.rank-you {
  margin: 0;
  text-align: center;
  font-weight: 700;
  color: #e7ca97;
}
.rank-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--hud-soft);
  text-align: center;
}

/* settings */
.settings .slider {
  display: grid;
  grid-template-columns: 40px 92px 1fr 42px;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.settings .slider output {
  text-align: right;
  font-size: 14px;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.settings .mute {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: #331f0f;
  box-shadow: inset 0 0 0 1.5px #8c603e;
  clip-path: polygon(
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px),
    0 8px
  );
}
.settings .mute svg {
  width: 20px;
  height: 20px;
}
.settings .mute.muted {
  color: var(--danger);
  box-shadow: inset 0 0 0 1.5px rgba(255, 61, 110, 0.6);
}
.settings .slider:has(.mute.muted) input[type='range'] {
  opacity: 0.45;
}
/* Custom controls (no native system controls): dark faceted track, amber thumb. */
.settings input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 34px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.settings input[type='range']::-webkit-slider-runnable-track {
  height: 8px;
  background: linear-gradient(90deg, var(--amber) 0 var(--p, 50%), #331f0f var(--p, 50%) 100%);
  box-shadow: inset 0 0 0 1px #8c603e;
  border-radius: 2px;
}
.settings input[type='range']::-moz-range-track {
  height: 8px;
  background: #331f0f;
  box-shadow: inset 0 0 0 1px #8c603e;
  border-radius: 2px;
}
.settings input[type='range']::-moz-range-progress {
  height: 8px;
  background: var(--amber);
  border-radius: 2px;
}
.settings input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  background: #ffd36e;
  border: 3px solid #4d2e17;
  border-radius: 6px;
  box-shadow:
    0 0 0 1.5px rgba(255, 211, 110, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.4);
}
.settings input[type='range']::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #ffd36e;
  border: 3px solid #4d2e17;
  border-radius: 6px;
}
.settings input[type='range']:focus-visible {
  outline-offset: 0;
}
.settings .check {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
}
.settings .check input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  position: relative;
  width: 54px;
  height: 30px;
  margin: 0;
  cursor: pointer;
  background: #8c603e;
  clip-path: polygon(
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px),
    0 8px
  );
  transition: background 0.15s;
}
.settings .check input::before {
  content: '';
  position: absolute;
  inset: 1.5px;
  background: #331f0f;
  clip-path: polygon(
    7px 0,
    calc(100% - 7px) 0,
    100% 7px,
    100% calc(100% - 7px),
    calc(100% - 7px) 100%,
    7px 100%,
    0 calc(100% - 7px),
    0 7px
  );
  transition: background 0.15s;
}
.settings .check input::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 5px;
  width: 20px;
  height: 20px;
  background: #c0a06a;
  clip-path: polygon(
    5px 0,
    calc(100% - 5px) 0,
    100% 5px,
    100% calc(100% - 5px),
    calc(100% - 5px) 100%,
    5px 100%,
    0 calc(100% - 5px),
    0 5px
  );
  transition:
    transform 0.15s ease,
    background 0.15s;
}
.settings .check input:checked,
.settings .check input:checked::before {
  background: #ffc94d;
}
.settings .check input:checked::after {
  transform: translateX(24px);
  background: #4d2e17;
}
.settings .check:has(input:focus-visible) {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}
.settings .select select:focus-visible {
  box-shadow: inset 0 0 0 2px var(--amber);
}
.settings .check input:focus-visible {
  outline: none;
}
.settings .select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
  min-height: 44px;
}
.settings .select select {
  -webkit-appearance: none;
  appearance: none;
  min-width: 150px;
  height: 42px;
  padding: 0 36px 0 14px;
  cursor: pointer;
  background: #331f0f
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ffc94d' stroke-width='2.2'/%3E%3C/svg%3E")
    no-repeat right 14px center;
  border: 0;
  box-shadow: inset 0 0 0 1.5px #8c603e;
  border-radius: 0;
  clip-path: polygon(
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px),
    0 8px
  );
}
.settings .select select:focus-visible {
  outline: none;
}
.privacy summary {
  cursor: pointer;
  color: var(--soft);
  font-size: 13px;
}
.privacy p {
  font-size: 13px;
  color: var(--soft);
  margin: 6px 0 0;
}

/* simulated ad */
.adcover {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
}
.adcover.show {
  display: flex;
}
.ad-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px;
  color: #fff;
}
.ad-count {
  font-size: 46px;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  top: calc(70px + var(--sat));
  z-index: 30;
  transform: translate(-50%, -20px);
  padding: 10px 16px;
  font-weight: 700;
  background: rgba(68, 42, 23, 0.95);
  clip-path: polygon(
    8px 0,
    calc(100% - 8px) 0,
    100% 8px,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    8px 100%,
    0 calc(100% - 8px),
    0 8px
  );
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Phone in landscape (short screen and touch): asks to rotate. */
.rotate {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px;
  text-align: center;
  color: var(--text);
  background: radial-gradient(ellipse at 50% 30%, #1f3f78, #331e0e 55%, #1c1108);
}
.rotate::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30%;
  background: linear-gradient(180deg, transparent, rgba(226, 191, 131, 0.08));
  pointer-events: none;
}
.rotate p {
  margin: 22px 0 0;
  max-width: 460px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
}
/* Spacing measured on the drawing, not on the boxes: 20 px from the chicken to the arrow, 24 px from the phone to
   the text
   (chicken: 6 px empty above and 4 below inside the canvas; icon: the arrow reaches the top edge and 20 px below
   the 88 px box). */
.rotate .rot-rico {
  width: 120px;
  height: 66px;
  margin: -6px 0 21px;
}
.rotate .rot-anim {
  position: relative;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  margin: 2px 0 -20px;
  color: #e7ca97;
  filter: drop-shadow(0 0 10px rgba(231, 202, 151, 0.55));
}
.rotate .rot-anim svg {
  grid-area: 1 / 1;
}
.rotate .rot-arrow {
  width: 88px;
  height: 88px;
  opacity: 0.85;
  translate: -6px -13px;
} /* The arrow tip does not touch the portrait phone. */
.rotate .rot-phone {
  width: 60px;
  height: 60px;
  animation: rotPhone 1.2s cubic-bezier(0.6, 0, 0.3, 1) infinite alternate;
}
@keyframes rotPhone {
  0%,
  15% {
    transform: rotate(-90deg);
  }
  85%,
  100% {
    transform: rotate(0deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .rotate .rot-phone {
    animation: none;
  }
}
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate {
    display: flex;
  }
}

/* reduced motion */
.reduced *,
.reduced *::before {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Short screens (phone in landscape, small embed frame): compact cards and title without overlap. */
@media (max-height: 520px) {
  .card {
    padding: 12px 16px;
    gap: 8px;
    width: min(560px, 100%);
  }
  .card h2 {
    font-size: 24px;
  }
  .results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
    align-items: center;
  }
  .results > h2,
  .results > .sub,
  .results > .res-stars,
  .results > .res-score {
    grid-column: 1;
  }
  .results > .res-stats,
  .results > .rank-chip,
  .results > .unlock-note,
  .results > .btn,
  .results > .row,
  .results > .res-note {
    grid-column: 2;
  }
  .results > .res-skin {
    grid-column: 1;
    grid-row: 5;
  }
  .results > h2 {
    grid-row: 1;
  }
  .results > .sub {
    grid-row: 2;
  }
  .results > .res-stars {
    grid-row: 3;
  }
  .results > .res-score {
    grid-row: 4;
  }
  .results > .res-stats {
    grid-row: 1 / span 2;
  }
  .results > .btn {
    grid-row: 3;
  }
  .results > .row {
    grid-row: 4;
  }
  .results > .res-note,
  .results > .rank-chip,
  .results > .unlock-note {
    grid-row: 5;
  }
  .res-stars .slot {
    width: 44px;
    height: 44px;
  }
  .res-stars .slot.s2 {
    width: 54px;
    height: 54px;
    margin-bottom: 6px;
  }
  .res-rico {
    display: none;
  }
  .results {
    padding-top: 22px;
  }
  #scr-results {
    padding-top: calc(16px + var(--sat));
  }
  .res-stars {
    margin-bottom: 16px;
  }
  .res-stars > .perfect-stamp {
    width: 160px;
    margin-left: -80px;
    font-size: 12px;
    bottom: -14px;
  }
  .res-score > span {
    font-size: 30px;
  }
  .res-stats div {
    padding: 4px;
  }
  .res-stats b {
    font-size: 16px;
  }
  .btn.big {
    min-height: 46px;
    font-size: 18px;
  }
  .btn {
    min-height: 42px;
  }
  .settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
    row-gap: 4px;
  }
  .settings .card-head {
    grid-column: 1 / -1;
  }
  .logo {
    height: clamp(110px, 34vh, 190px);
  }
  .tagline {
    margin: -6px 0 6px;
  }
  .title-actions {
    gap: 8px;
  }
  .corner-tools {
    top: calc(10px + var(--sat));
    bottom: auto;
  }
  .rank-list {
    max-height: 34vh;
  }
}
/* Narrow bar (arena width below ~352 px): tighter score and divider so the name fits on one line. */
.hud.narrow:not(.landscape) .hud-btns {
  padding-right: 4px;
  margin-right: 5px;
}
.hud.narrow:not(.landscape) .lvl-badge {
  margin-right: 7px;
}
.hud.narrow:not(.landscape) .lvl-text {
  padding-right: 4px;
}
.hud.narrow:not(.landscape) .hud-stat.score {
  width: 64px;
}
.hud.narrow:not(.landscape) .hud-stat.score b {
  font-size: 20px;
}
.hud.narrow:not(.landscape) .hud-stat.score.long b {
  font-size: 16px;
}
@media (max-width: 360px) {
  .btn.big {
    font-size: 19px;
  }
}

/* End of style-2.css */
