/* Tail Run — game page only. Sits on top of world.css. */

body.run {
  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.run .topbar {
  background: rgba(18, 22, 42, .78);
  border-bottom: 3px solid #e6c15a;
  color: #fff6e8;
}
body.run .topbar a.back {
  color: #16315c !important;
  background: #fff;
}

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

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

body.run .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.run .chip:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(22, 49, 92, .1); }

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

/* Landscape playfield: 1120 x 700 */
body.run .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.run .stage canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1120 / 700;
  vertical-align: top;
}

body.run .hud[hidden] { display: none !important; }
body.run .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.run .hud .stat {
  color: #16315c;
  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.run .hud .num { font-size: 1.12em; color: var(--blue); }

body.run .heart {
  color: #e23b6d;
  font-size: 1.35em;
  line-height: 1;
  margin-right: 2px;
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
}
body.run .heart.gone {
  color: rgba(22, 49, 92, .22);
  text-shadow: none;
}

body.run .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.run .overlay[hidden] { display: none !important; }

body.run .card {
  color: #16315c;
  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.run .card h2 {
  font-family: var(--title);
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 3.4vw, 2.1rem);
  color: #c9a227;
}

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

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

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

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

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

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

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

body.run .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.run .play-row .btn { flex: 0 0 auto; white-space: nowrap; }

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

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

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

/* Single big Jump pad */
body.run .pads {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: stretch;
  padding: 4px 10px 2px;
  width: min(100%, 360px);
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

body.run .pad {
  flex: 1 1 0;
  min-width: 0;
  height: 68px;
  border: 3px solid #c45d86;
  border-radius: 18px;
  background: linear-gradient(#ffd0e6, var(--pink));
  color: #5a1838;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  line-height: 1.05;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow: 0 6px 0 #8a2d52;
  padding: 4px 6px;
}

body.run .pad small {
  display: block;
  font-size: .62rem;
  letter-spacing: .04em;
  opacity: .8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

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

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

@media (max-height: 660px) {
  body.run .card { padding: 10px 14px; }
  body.run .card h2 { font-size: 1.3rem; margin-bottom: 4px; }
  body.run .card .how { font-size: .8rem; margin-bottom: 6px; }
  body.run .card .ribbon { font-size: .72rem; padding: 4px 12px; }
  body.run .scores { max-height: 74px; padding: 6px 10px; }
  body.run .scores li { font-size: .82rem; }
  body.run .pad { height: 56px; font-size: 1.15rem; }
}

@media (max-width: 760px) {
  body.run .stage { width: 100%; }
  body.run .hud { flex-wrap: wrap; }
  body.run .pads { gap: 6px; padding: 4px 8px 2px; }
  body.run .pad { height: 58px; font-size: 1.1rem; border-radius: 14px; }
  body.run .pad small { font-size: .55rem; }
}
