:root {
  --meadow: #cdebc4;
  --pink: #ff5d73;
  --pink-d: #e23f58;
  --violet: #6b4ee6;
  --gold: #ffc93c;
  --ink: #2b2d42;
  --soft: #f2f8ee;
  --mute: #7c8597;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--meadow);
  color: var(--ink);
  font-family: 'Fredoka', 'Rubik', 'Arial Hebrew', system-ui, sans-serif;
}
#app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

#hud {
  flex: none;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 0;
}
.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px 0 11px;
  background: #fff;
  border-radius: 17px;
  font-weight: 600;
  font-size: 17px;
  box-shadow: 0 2px 0 rgba(60, 110, 75, 0.14);
}
.pill svg {
  width: 18px;
  height: 18px;
  flex: none;
}
#lvl {
  font-size: 14px;
  font-weight: 500;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.sp {
  flex: 1;
}
.ib {
  flex: none;
  width: 38px;
  height: 34px;
  border: 0;
  border-radius: 17px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 0 rgba(60, 110, 75, 0.14);
  color: var(--ink);
  cursor: pointer;
}
.ib svg {
  width: 18px;
  height: 18px;
}
.ib:active {
  transform: translateY(1px);
}

#stage {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
canvas {
  display: block;
  touch-action: none;
  position: absolute;
  inset: 0;
}
#toast {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -19px;
  transform: translate(-50%, -8px);
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  font-size: 15px;
  padding: 8px 16px;
  border-radius: 18px;
  opacity: 0;
  transition:
    opacity 0.2s,
    transform 0.2s;
  pointer-events: none;
  white-space: nowrap;
  max-width: 94%;
  overflow: hidden;
  text-overflow: ellipsis;
}
#toast.on {
  opacity: 0.94;
  transform: translate(-50%, 0);
}

#bar {
  flex: none;
  height: 114px;
  display: flex;
  gap: 10px;
  align-items: stretch;
  padding: 10px 12px 12px;
  background: #fff;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -3px 0 rgba(60, 110, 75, 0.1);
}
#army {
  flex: none;
  width: 70px;
  border: 0;
  border-radius: 22px;
  background: var(--pink);
  color: #fff;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--pink-d);
  touch-action: manipulation;
}
#army:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--pink-d);
}
#army svg {
  width: 26px;
  height: 26px;
}
#army b {
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
}
#army span {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.95;
}
#army.none {
  background: #e6ece2;
  color: #9aa595;
  box-shadow: 0 3px 0 #d5ddd0;
}
#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
}
.row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
}
.ttl {
  flex: 1;
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.ttl small {
  font-weight: 400;
  font-size: 13px;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.x {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 15px;
  background: var(--soft);
  color: var(--mute);
  font: 600 14px/1 inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.pb2 {
  flex: none;
  height: 30px;
  border: 0;
  border-radius: 15px;
  padding: 0 10px 0 9px;
  display: flex;
  align-items: center;
  gap: 4px;
  font: 600 13px inherit;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
}
.pb2 svg {
  width: 15px;
  height: 15px;
}
.pb2.fix {
  background: #35b978;
  box-shadow: 0 2px 0 #249560;
}
.pb2.up {
  background: #f0a800;
  box-shadow: 0 2px 0 #c98a00;
}
.pb2.del {
  background: #e2574c;
  box-shadow: 0 2px 0 #b83d34;
  padding: 0 8px;
}
.pb2.off {
  opacity: 0.45;
}
.pb2:active {
  transform: translateY(1px);
  box-shadow: none;
}
.hint {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
  padding: 0 4px;
}
.hint small {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--mute);
  margin-top: 3px;
}
.acts {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.acts::-webkit-scrollbar {
  display: none;
}
.act {
  flex: 1;
  min-width: 0;
  height: 58px;
  border: 0;
  border-radius: 18px;
  background: var(--soft);
  font: inherit;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 6px;
  position: relative;
  cursor: pointer;
  box-shadow: 0 2px 0 #dde8d6;
  touch-action: manipulation;
  margin-bottom: 2px;
}
.act:active {
  transform: translateY(2px);
  box-shadow: none;
}
.act img {
  width: 36px;
  height: 36px;
  flex: none;
}
.act .tx {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  min-width: 0;
}
.act .nm {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.act .ct {
  font-size: 13px;
  font-weight: 500;
  color: #9a7a12;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.act .ct i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--gold);
  transform: rotate(45deg);
  display: inline-block;
}
.act .ct.txt {
  color: var(--mute);
  font-size: 12px;
}
.act.off {
  opacity: 0.45;
}
.act em {
  position: absolute;
  top: -4px;
  left: -2px;
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  background: var(--pink);
  color: #fff;
  font: 600 12px/19px inherit;
  font-style: normal;
  text-align: center;
  padding: 0 5px;
}
.acts.many .act {
  flex-direction: column;
  gap: 0;
  padding: 0 2px;
  border-radius: 15px;
  min-width: 46px;
}
.acts.many .act img {
  width: 28px;
  height: 28px;
  margin-top: -2px;
}
.acts.many .act .tx {
  align-items: center;
  line-height: 1.05;
}
.acts.many .act .nm {
  font-size: 11.5px;
}
.acts.many .act .ct {
  font-size: 11.5px;
  gap: 2px;
}
.acts.many .act .ct i {
  width: 6px;
  height: 6px;
}
.chips {
  flex: 1;
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  overflow: hidden;
}
.chip {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 36px;
  padding: 0 8px 0 4px;
  border-radius: 18px;
  background: var(--soft);
  font-weight: 600;
  font-size: 15px;
}
.chip img {
  width: 28px;
  height: 28px;
}
.pbar {
  height: 6px;
  border-radius: 3px;
  background: var(--soft);
  overflow: hidden;
}
.pbar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--pink);
  border-radius: 3px;
}

#ov {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 16px;
  z-index: 5;
  overflow: auto;
  background: rgba(205, 235, 196, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
#ov.on {
  display: grid;
}
.card {
  width: 100%;
  max-width: 348px;
  background: #fff;
  border-radius: 30px;
  padding: 20px 20px 20px;
  text-align: center;
  box-shadow: 0 6px 0 rgba(60, 110, 75, 0.12);
}
.card .crew {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-bottom: 2px;
}
.card .crew img {
  width: 42px;
  height: 42px;
}
.card h1 {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--pink);
  letter-spacing: -0.5px;
}
.card h2 {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
}
.card h2 small {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--mute);
  margin-bottom: 2px;
}
.card p {
  font-size: 15.5px;
  color: var(--mute);
  margin-top: 6px;
  line-height: 1.4;
}
.how {
  margin: 14px 0 2px;
  text-align: right;
  display: grid;
  gap: 8px;
}
.how div {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 15px;
  line-height: 1.3;
}
.how img,
.how svg {
  width: 32px;
  height: 32px;
  flex: none;
}
.how svg {
  padding: 5px;
  color: var(--mute);
}
.news {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.news span {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff4d1;
  border-radius: 16px;
  padding: 3px 12px 3px 6px;
  font-size: 14px;
  font-weight: 600;
}
.news img {
  width: 28px;
  height: 28px;
}
/* level select: the painted kingdom fills the screen; the title floats on its sky, and a frosted panel holds the level cards */
#ov.menu {
  padding: 0;
  place-items: stretch;
  background: #bfe3f2 center / cover no-repeat;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100%;
  padding: 14px 12px 64px;
  text-align: center;
}
.home .logo {
  margin: 4px 0 10px;
}
.home .crew {
  display: flex;
  justify-content: center;
  gap: 6px;
  height: 34px;
}
.home .crew img {
  height: 34px;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, 0.9));
}
.home h1 {
  font-size: 46px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.5px;
  color: var(--pink);
  text-shadow:
    0 3px 0 #fff,
    3px 0 0 #fff,
    -3px 0 0 #fff,
    0 -3px 0 #fff,
    2px 2px 0 #fff,
    -2px 2px 0 #fff,
    2px -2px 0 #fff,
    -2px -2px 0 #fff,
    0 7px 0 rgba(226, 63, 88, 0.25);
}
.home .panel {
  width: 100%;
  margin-top: auto;
  border-radius: 28px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow:
    0 6px 0 rgba(60, 110, 75, 0.16),
    inset 0 0 0 2px rgba(255, 255, 255, 0.9);
}
.lvs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.lv {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 18px;
  background: var(--soft) center / cover no-repeat;
  padding: 0;
  font: inherit;
  color: #fff;
  text-align: right;
  cursor: pointer;
  touch-action: manipulation;
  overflow: hidden;
  box-shadow: 0 3px 0 rgba(60, 110, 75, 0.2);
  transition: transform 0.12s;
}
.lv::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(30, 26, 54, 0.8), rgba(30, 26, 54, 0) 55%);
}
.lv .n,
.lv .st {
  position: absolute;
  z-index: 1;
  top: 6px;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}
.lv .n {
  right: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
}
.lv .st {
  left: 6px;
  background: rgba(255, 255, 255, 0.92);
}
.lv .st svg {
  width: 15px;
  height: 15px;
  color: var(--mute);
}
.lv .t {
  position: absolute;
  z-index: 1;
  right: 7px;
  left: 7px;
  bottom: 6px;
  line-height: 1.1;
}
.lv .t b {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.lv.done .st {
  background: #35b978;
}
.lv.done .st svg {
  color: #fff;
}
.lv.on {
  outline: 3.5px solid var(--pink);
  outline-offset: -1px;
  transform: scale(1.03);
}
.lv.on .n {
  background: var(--pink);
  color: #fff;
}
.lv.lock {
  filter: grayscale(0.85) brightness(0.8);
}
.lv:active {
  transform: scale(0.97);
}
.pick {
  margin: 10px 0 2px;
  line-height: 1.25;
}
.pick b {
  display: block;
  font-size: 18px;
  font-weight: 700;
}
.pick small {
  font-size: 13px;
  color: var(--mute);
}
.links {
  display: flex;
  justify-content: center;
  gap: 16px;
}
/* story panels and level introductions: a picture on top */
.card.tale {
  padding-top: 14px;
}
.card .pic {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 20px;
  margin-bottom: 12px;
  background: var(--soft);
}
.card .tx {
  font-size: 16.5px;
  line-height: 1.5;
  color: var(--ink);
}
.card .goal {
  font-size: 13.5px;
  margin-top: 8px;
}
.dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 12px 0 2px;
}
.dots i {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--soft);
}
.dots i.on {
  background: var(--pink);
}
.seg {
  display: flex;
  gap: 6px;
  background: var(--soft);
  border-radius: 18px;
  padding: 4px;
  margin-top: 12px;
}
.seg button {
  flex: 1;
  height: 36px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font: 500 15px inherit;
  color: var(--mute);
  cursor: pointer;
}
.seg button.on {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 2px 0 rgba(60, 110, 75, 0.14);
}
.go {
  width: 100%;
  height: 52px;
  margin-top: 12px;
  border: 0;
  border-radius: 20px;
  background: var(--pink);
  color: #fff;
  font: 600 19px inherit;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--pink-d);
}
.go:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--pink-d);
}
.go.alt {
  background: var(--soft);
  color: var(--ink);
  box-shadow: 0 4px 0 #dde8d6;
  font-size: 16px;
  height: 46px;
}
.lnk {
  margin-top: 10px;
  border: 0;
  background: none;
  font: 400 13px inherit;
  color: var(--mute);
  text-decoration: underline;
  cursor: pointer;
}
.stats {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 14px;
}
.stats div {
  font-size: 13px;
  color: var(--mute);
}
.stats b {
  display: block;
  font-size: 24px;
  color: var(--ink);
  font-weight: 600;
}
button:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}
