/* Princess Castle: a storybook meadow. Candy pastels, plum outlines, round everything. */
@font-face {
  font-family: "Nunito Sans";
  src: url("/site/brand/NunitoSans-Black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/site/brand/DMSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #4a2c5e;
  --paper: #fff7fb;
  --pink: #ff5d8f;
  --rose: #ffd6ea;
  --gold: #ffd23f;
  --lilac: #b28cf0;
  --display: "Nunito Sans", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "DM Sans", system-ui, sans-serif;
  --shell-ink: var(--ink);
  --shell-paper: var(--paper);
  --shell-accent: var(--pink);
  --shell-on-accent: #fff;
  --shell-font: var(--body);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  background: #ffe3f1;
  color: var(--ink);
  font: 700 16px/1.4 var(--body);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
[hidden] {
  display: none !important;
}

/* HUD */
.hud {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.hud > * {
  pointer-events: auto;
}
.pill {
  background: rgba(255, 255, 255, 0.88);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  font: 900 15px/1.2 var(--display);
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(74, 44, 94, 0.25);
}
.hearts {
  color: var(--pink);
  letter-spacing: 2px;
}
.hearts .lost {
  color: #d9c8e0;
}
.stars {
  margin-left: auto;
}
.star-i {
  color: #f2b632;
  margin-right: 4px;
}
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 3px 0 rgba(74, 44, 94, 0.25);
}
.icon-btn svg,
.round-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn.corner {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
}

/* Buttons */
.btn {
  font: 900 18px/1 var(--display);
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 12px 22px;
  min-height: 52px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.08s;
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}
.btn.primary {
  background: linear-gradient(#ff8ab4, var(--pink));
  color: #fff;
  text-shadow: 0 2px 0 rgba(120, 20, 60, 0.35);
}
.btn.big {
  font-size: 24px;
  padding: 16px 48px;
}
.btn.nudge {
  animation: nudge 1.4s ease-in-out infinite;
}
@keyframes nudge {
  0%,
  100% {
    box-shadow: 0 4px 0 var(--ink), 0 0 0 0 rgba(255, 93, 143, 0.5);
  }
  50% {
    box-shadow: 0 4px 0 var(--ink), 0 0 0 9px rgba(255, 93, 143, 0.35);
  }
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
button:focus-visible {
  outline: 3px solid var(--lilac);
  outline-offset: 3px;
}
.round-btn {
  width: 52px;
  padding: 0;
  display: grid;
  place-items: center;
}

/* Build bar: under the HUD, a tip and the Turn / Ready buttons (the piece tray is drawn on the canvas). */
.build-bar {
  position: fixed;
  top: calc(max(10px, env(safe-area-inset-top)) + 54px);
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.build-bar > * {
  pointer-events: auto;
}
.tip {
  margin: 0;
  background: rgba(255, 255, 255, 0.9);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 6px 12px;
  font-size: 15px;
  line-height: 1.25;
}
.tip.warn {
  background: #fff0c2;
}
.build-btns {
  display: flex;
  gap: 8px;
  flex: none;
}

/* Banner */
.banner {
  position: fixed;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  margin: 0;
  font: 900 clamp(26px, 7vw, 44px) / 1.1 var(--display);
  color: #fff;
  text-align: center;
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--ink);
  pointer-events: none;
  width: min(92vw, 640px);
  animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.5, 1);
}
@keyframes pop {
  from {
    transform: translateX(-50%) scale(0.6);
    opacity: 0;
  }
}

/* Bottom sheets */
.sheet {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 20px));
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 26px;
  padding: 14px 14px 16px;
  box-shadow: 0 8px 0 rgba(74, 44, 94, 0.3);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: center;
  animation: rise 0.3s ease-out;
}
.sheet.small {
  grid-template-columns: 1fr;
  text-align: center;
  bottom: auto;
  top: calc(max(10px, env(safe-area-inset-top)) + 58px);
  animation-name: drop;
}
@keyframes drop {
  from {
    transform: translate(-50%, -30px);
    opacity: 0;
  }
}
@keyframes rise {
  from {
    transform: translate(-50%, 40px);
    opacity: 0;
  }
}
.sheet h2 {
  margin: 0;
  font: 900 22px/1.15 var(--display);
}
.sheet p {
  margin: 2px 0;
}
.clue {
  font-weight: 700;
  font-size: 15px;
  color: #7a5a8c;
}
.ask {
  font: 900 16px/1.2 var(--display);
}
#guess-princess {
  width: 84px;
  height: 84px;
}
.symbols {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.sym {
  display: grid;
  justify-items: center;
  gap: 2px;
  font: 900 13px/1.1 var(--display);
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 6px 2px 8px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
  min-height: 84px;
}
.sym:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}
.sym canvas {
  width: 46px;
  height: 46px;
}
.sym kbd {
  font: 700 10px/1 var(--body);
  opacity: 0.55;
}
.sheet.small .btn {
  justify-self: center;
  margin-top: 8px;
  min-width: 200px;
}

/* Title and wardrobe */
.title {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, 0.55), rgba(255, 214, 234, 0.25) 60%, rgba(178, 140, 240, 0.25));
}
.title-card {
  width: min(440px, 100%);
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 6px;
}
.title h1 {
  margin: 0;
  font: 900 clamp(38px, 11vw, 60px) / 0.95 var(--display);
  color: #fff;
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink);
}
.title h1 span {
  color: #ffb3d0;
  display: block;
}
.sub {
  margin: 4px 0 0;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  padding: 4px 10px;
}
#wardrobe-princess {
  width: 200px;
  height: 230px;
  margin: -6px 0 -10px;
}
.wardrobe {
  display: grid;
  gap: 6px;
  width: 100%;
  /* The rows are drawn by the script; hold their place so Play doesn't jump
     ~100 px when it loads (seconds after the page shows, on a slow network). */
  min-height: 194px;
  align-content: start;
}
.w-row {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 6px;
}
.w-row .icon-btn {
  font: 900 20px/1 var(--display);
  color: var(--ink);
}
.w-name {
  background: rgba(255, 255, 255, 0.9);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 7px 10px;
  font: 900 15px/1.15 var(--display);
  display: flex;
  justify-content: center;
  gap: 6px;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
}
.w-name small {
  font: 700 12px/1 var(--body);
  opacity: 0.7;
}
.w-name.locked {
  background: #f1e8f5;
}
.w-name .lock {
  background: #ecdff3;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 13px;
}
.w-row > .icon-btn {
  background: #ffd6ea;
  font-size: 26px;
}
.w-buy {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 16px;
}
.w-note {
  margin: -2px 0 2px;
  font-size: 13px;
  opacity: 0.8;
}
#wardrobe-princess {
  cursor: pointer;
}
.best {
  min-height: 27px;
  margin: 4px 0 0;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 3px 12px;
}
.keys {
  margin: 4px 0 0;
  font-size: 12px;
  opacity: 0.7;
}
@media (hover: none) {
  .keys {
    display: none;
  }
}
@media (max-height: 700px) {
  #wardrobe-princess {
    width: 150px;
    height: 172px;
  }
  .w-name,
  .w-row .icon-btn {
    min-height: 40px;
    height: 40px;
  }
  .wardrobe {
    min-height: 178px;
  }
}
/* Short screens: Play must show without scrolling. */
@media (max-height: 600px) {
  #wardrobe-princess {
    width: 104px;
    height: 120px;
  }
}
@media (max-height: 460px) and (min-width: 600px) {
  .title {
    padding-left: max(64px, env(safe-area-inset-left));
    padding-right: max(64px, env(safe-area-inset-right));
  }
  #wardrobe-princess {
    width: 126px;
    height: 145px;
  }
  .title-card {
    width: min(760px, 100%);
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "h1 wardrobe" "sub wardrobe" "princess best" "princess play" "princess keys";
    column-gap: 20px;
    align-items: center;
  }
  .title h1 {
    grid-area: h1;
    font-size: 40px;
  }
  .title .sub {
    grid-area: sub;
  }
  #wardrobe-princess {
    grid-area: princess;
    margin: 0;
  }
  .wardrobe {
    grid-area: wardrobe;
  }
  .best {
    grid-area: best;
  }
  #play {
    grid-area: play;
  }
  .title .keys {
    grid-area: keys;
  }
}
/* Narrow phones: five guess buttons must fit side by side. */
@media (max-width: 360px) {
  .symbols {
    gap: 5px;
  }
  .sym {
    padding: 6px 0 8px;
    font-size: 12px;
  }
  .sym canvas {
    width: 38px;
    height: 38px;
  }
}
/* Landscape phones: a one-row guess sheet, so the dragon circling in the sky stays visible. */
@media (max-height: 460px) and (min-width: 600px) {
  .sheet:not(.small) {
    width: min(820px, calc(100vw - 20px));
    grid-template-columns: 1fr auto;
    padding: 10px 12px;
    bottom: max(8px, env(safe-area-inset-bottom));
  }
  #guess-princess {
    display: none;
  }
  .sheet h2 {
    font-size: 19px;
  }
  .symbols {
    grid-column: auto;
    grid-template-columns: repeat(5, 64px);
    gap: 6px;
    margin-top: 0;
  }
  .sym {
    min-height: 70px;
    padding: 4px 2px 6px;
  }
  .sym canvas {
    width: 36px;
    height: 36px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn.nudge,
  .banner,
  .sheet {
    animation: none;
  }
}
