/* Save the Tails — game page only. Sits on top of world.css. */

body.save {
  margin: 0;
  font-family: var(--ui);
  color: #fff6e8;
  background:
    radial-gradient(circle at 50% -10%, #3a4a8c 0%, #1a2140 42%, #12162a 100%);
  min-height: 100dvh;
  overflow-x: hidden;
}

body.save .topbar {
  background: rgba(18, 22, 42, .78);
  border-bottom: 3px solid #e6c15a;
  color: #fff6e8;
}

body.save .topbar h1 {
  font-family: var(--title);
  font-size: clamp(1.05rem, 3vw, 1.45rem);
  color: #c9a227;
}

body.save .top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

body.save .chip {
  border: 0;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  font-family: inherit;
  font-size: .9rem;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(22, 49, 92, .1);
}

body.save .chip:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(22, 49, 92, .1); }

body.save .playfield {
  display: flex;
  justify-content: center;
  margin: 8px auto 4px;
  padding: 0 12px;
}

/* Landscape playfield: 1120 x 700. Sized from the width so the canvas
   never gets squashed, and capped by the viewport height so the whole
   page (stage + pads + hints) still fits without scrolling. */
body.save .stage {
  position: relative;
  inset: auto;
  background: #1d1a36;
  border: 4px solid #e6c15a;
  border-radius: 22px;
  overflow: hidden;
  aspect-ratio: 1120 / 700;
  width: min(100%, calc((100dvh - 218px) * 1.6), 1180px);
  height: auto;
  min-width: 300px;
  margin: 0 auto;
  box-shadow: 0 16px 0 rgba(0, 0, 0, .3);
  touch-action: none;
}

body.save .stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

body.save .hud {
  position: absolute;
  left: 9px;
  right: 9px;
  top: 7px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
  font-weight: 800;
}

body.save .hud .stat {
  background: rgba(255, 248, 232, .93);
  border: 2px solid #e6c15a;
  border-radius: 12px;
  padding: 3px 9px;
  font-size: clamp(.68rem, 1.3vw, .92rem);
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}

body.save .hud .num { font-size: 1.12em; color: var(--blue); }

body.save .heart {
  color: #c45d86;
  font-size: 1.05em;
  line-height: 1;
}
body.save .heart.gone { color: rgba(22, 49, 92, .2); }

body.save .overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(14, 12, 34, .58);
  backdrop-filter: blur(3px);
}

body.save .overlay[hidden] { display: none !important; }

/* The start / game-over cards: comfortably wide, and their buttons are
   pinned so they can never scroll out of reach. */
body.save .card {
  background: rgba(255, 248, 232, .97);
  border: 4px solid #e6c15a;
  border-radius: 22px;
  padding: 14px 18px 14px;
  max-width: 460px;
  width: min(100%, 460px);
  max-height: 100%;
  overflow: auto;
  scrollbar-width: thin;
  box-shadow: 0 14px 0 rgba(0, 0, 0, .25);
  text-align: center;
}

body.save .card h2 {
  font-family: var(--title);
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 3.4vw, 2.1rem);
  color: #c9a227;
}

body.save .card p { margin: 0 0 8px; }

body.save .card .ribbon { margin: 0 0 6px; }

body.save .card .how {
  text-align: left;
  margin: 0 0 8px;
  padding: 0 2px 0 18px;
  font-size: .92rem;
  line-height: 1.35;
}

body.save .card .how li { margin: 0 0 3px; }

body.save .scores {
  text-align: left;
  background: #fff;
  border-radius: 14px;
  padding: 7px 12px;
  margin: 8px 0 4px;
  max-height: 118px;
  overflow: auto;
}

body.save .scores h3 {
  margin: 0 0 5px;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pink-deep);
}

body.save .scores ol { margin: 0; padding-left: 22px; }
body.save .scores li { margin: 2px 0; font-size: .9rem; }
body.save .scores p { margin: 0; font-size: .9rem; }
body.save .scores .pts { float: right; font-weight: 800; color: var(--blue); }

/* Sticky button shelf. No id-level rules, so world.css's .big-play keeps
   its blue background and its padding. */
body.save .play-row {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 6px 0 0;
  padding: 8px 0 2px;
  border-radius: 14px;
  background: rgba(255, 248, 232, .98);
  box-shadow: 0 -12px 14px rgba(255, 248, 232, .98);
}

body.save .play-row .btn { flex: 0 0 auto; white-space: nowrap; }

/* The cutscene banner sits low so it never covers the wizard up top. */
body.save .overlay.magic {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 6% 7% 0;
}

body.save .banner {
  font-family: var(--title);
  font-size: clamp(1.3rem, 4vw, 2.4rem);
  background: linear-gradient(#fff1b0, #e6c15a);
  color: var(--ink);
  border: 3px solid #fff;
  border-radius: 16px;
  padding: 10px 24px;
  text-align: center;
  box-shadow: 0 10px 0 rgba(22, 49, 92, .25);
  animation: save-popin .35s ease;
}

@keyframes save-popin {
  from { transform: scale(.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

body.save .name-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 8px 0;
}

body.save .name-row input {
  min-width: 160px;
  flex: 1;
  text-align: center;
  font-weight: 800;
}

body.save .err {
  color: #c45d86;
  font-weight: 800;
  min-height: 1.1em;
  margin: 0 0 4px;
}

/* One row of five big arcade pads. */
body.save .pads {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: stretch;
  padding: 4px 12px 2px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  flex-wrap: wrap;
}

body.save .pad {
  flex: 0 0 auto;
  width: 132px;
  height: 62px;
  border: 3px solid #e6c15a;
  border-radius: 18px;
  background: linear-gradient(#fff1b0, var(--gold));
  color: var(--ink);
  font-family: inherit;
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1.05;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow: 0 6px 0 #b88928;
}

body.save .pad small { display: block; font-size: .62rem; letter-spacing: .06em; opacity: .8; }

body.save .pad:active, body.save .pad.held {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #b88928;
}

body.save .pad.jump {
  width: 150px;
  background: linear-gradient(#ffd0e6, var(--pink));
  border-color: #c45d86;
  box-shadow: 0 6px 0 #8a2d52;
}
body.save .pad.jump:active, body.save .pad.jump.held {
  box-shadow: 0 2px 0 #8a2d52;
}

body.save .pad.climb {
  background: linear-gradient(#efe0ff, #c9a0ef);
  border-color: #7b3fa0;
  box-shadow: 0 6px 0 #5a2d80;
}
body.save .pad.climb:active, body.save .pad.climb.held {
  box-shadow: 0 2px 0 #5a2d80;
}

body.save .hint {
  text-align: center;
  font-size: .82rem;
  color: #e8e2ff;
  opacity: .8;
  margin: 4px 12px 2px;
}

body.save .credit {
  text-align: center;
  font-size: .74rem;
  color: #ded7f5;
  opacity: .7;
  padding: 2px 12px 12px;
}

body.save .credit a, body.save .hint a { text-decoration: underline; }

/* Short viewports: shrink the card's chrome so Play is always on screen. */
@media (max-height: 660px) {
  body.save .card { padding: 10px 14px; }
  body.save .card h2 { font-size: 1.3rem; margin-bottom: 4px; }
  body.save .card .how { font-size: .8rem; margin-bottom: 6px; }
  body.save .card .ribbon { font-size: .72rem; padding: 4px 12px; }
  body.save .scores { max-height: 74px; padding: 6px 10px; }
  body.save .scores li { font-size: .82rem; }
  body.save .pad { height: 54px; width: 116px; font-size: 1.15rem; }
  body.save .pad.jump { width: 130px; }
}

@media (max-width: 760px) {
  body.save .stage { width: 100%; }
  body.save .hud { flex-wrap: wrap; }
  body.save .pad { height: 52px; width: 104px; font-size: 1.05rem; }
  body.save .pad.jump { width: 112px; }
}
