* { box-sizing: border-box; }

:root {
  color-scheme: light;
  font-family: ui-rounded, 'Trebuchet MS', system-ui, sans-serif;
  color: #1d1430;
  background: #fff4fb;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 14px;
  overflow-x: hidden;
  background:
    radial-gradient(rgba(255, 95, 168, 0.22) 1.6px, transparent 1.8px) 0 0 / 14px 14px,
    linear-gradient(160deg, #e6dcff, #fff3e3 50%, #ffd9ec);
}

main { width: min(100%, 980px); margin: 0 auto; }
.tagasi { color: #4b287e; font-weight: 900; }
header { text-align: center; margin: 0 auto 12px; max-width: 760px; }
.kulm { margin: 0; color: #de2f85; font-size: 0.78rem; font-weight: 1000; letter-spacing: 0.22em; }
h1 { margin: 0; font-size: clamp(2.1rem, 9vw, 4.8rem); line-height: 0.95; font-style: italic; text-transform: uppercase; color: #ff4f9a; -webkit-text-stroke: 2px #1d1430; text-shadow: 4px 4px 0 #fff, 7px 7px 0 #ffc92f, 10px 10px 0 #1d1430; }
header > p:last-child { margin: 0.8rem auto; font-weight: 700; }

button { border: 3px solid #1d1430; color: #1d1430; font: inherit; font-weight: 1000; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:active, button.vajutatud { transform: translateY(3px); filter: brightness(0.9); }

.valik { display: flex; justify-content: center; gap: 12px; margin: 0 0 14px; }
.tegelane { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 108px; padding: 6px 6px 8px; border-radius: 18px; background: #fff; box-shadow: 0 5px #1d1430; }
.tegelane img { height: 88px; }
.tegelane[aria-pressed='true'] { background: #ffe96b; outline: 3px solid #ff4f9a; outline-offset: 2px; }

.manguala { position: relative; overflow: hidden; border: 4px solid #1d1430; border-radius: 24px; background: #f6d6a2; box-shadow: 8px 10px 0 #1d1430; }
.hud { min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: #1d1430; color: white; font-size: 0.82rem; font-weight: 900; }
.eluriba { width: min(28vw, 220px); height: 20px; overflow: hidden; border: 2px solid #fff; border-radius: 999px; background: #5b426e; }
.eluriba span { display: block; height: 100%; background: linear-gradient(90deg, #39df8f, #f4ed4f); transition: width 0.2s; }
#olek { flex: 1; text-align: center; }
#voitja { white-space: nowrap; }
.suur { padding: 3px 10px; border: 2px solid #fff; border-radius: 999px; background: #ff4f9a; color: #fff; font-size: inherit; white-space: nowrap; }
#areen { display: block; width: min(100%, 92vh); aspect-ratio: 4 / 3; margin: 0 auto; touch-action: none; }
.teade { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); max-width: 92%; padding: 7px 14px; border: 2px solid #1d1430; border-radius: 999px; background: #fff8ac; font-weight: 1000; text-align: center; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.teade.nahtav { opacity: 1; }

.juhised { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 10px; }
.juhised div { padding: 10px 14px; border: 3px solid #1d1430; border-radius: 18px; background: #ffffffcc; }
h2 { margin: 0 0 4px; font-size: 1rem; }
.juhised p { margin: 0; font-size: 0.9rem; }
kbd { padding: 2px 6px; border: 2px solid #1d1430; border-radius: 6px; background: white; box-shadow: 0 2px #1d1430; }

.puutenupud { display: flex; justify-content: space-between; align-items: center; width: min(100%, 560px); margin: 12px auto 4px; touch-action: none; user-select: none; -webkit-user-select: none; }
.rist { position: relative; width: 164px; height: 164px; }
.suund { position: absolute; width: 58px; height: 58px; border-radius: 16px; background: #7ee8ff; box-shadow: 0 5px #1d1430; }
.yles { left: 53px; top: 0; }
.alla { left: 53px; bottom: 0; }
.vasak { left: 0; top: 53px; }
.parem { right: 0; top: 53px; }
.runnak { width: 118px; height: 118px; border-radius: 50%; color: white; background: linear-gradient(145deg, #ff5f92, #d92a8a); box-shadow: 0 8px #1d1430; font-size: 1.35rem; }
.super { width: 84px; height: 84px; border-radius: 50%; background: linear-gradient(145deg, #ffe45c, #ff7a2e); box-shadow: 0 6px #1d1430; font-size: 0.95rem; }
.super[hidden] { display: none; }
.ultra { color: white; background: linear-gradient(145deg, #ff6b6b, #c4102a); }
.super.laeb { background: #d8d0e6; color: #5b426e; }

/* Big screen mode: the arena covers the whole window, the picture keeps its 4:3 shape. */
body.taisekraan { overflow: hidden; }
body.taisekraan .manguala {
  position: fixed; inset: 0; z-index: 10;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  border: 0; border-radius: 0; box-shadow: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background:
    radial-gradient(rgba(255, 95, 168, 0.22) 1.6px, transparent 1.8px) 0 0 / 14px 14px,
    linear-gradient(160deg, #e6dcff, #fff3e3 50%, #ffd9ec);
}
body.taisekraan #areen { width: 100%; height: 100%; aspect-ratio: auto; object-fit: contain; }
body.taisekraan .teade { top: 76px; }
body.taisekraan .puutenupud {
  position: fixed; z-index: 11; left: 0; right: 0; bottom: 0;
  width: auto; margin: 0;
  padding: 0 max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  pointer-events: none;
}
body.taisekraan .puutenupud > * { pointer-events: auto; opacity: 0.85; }
/* With a mouse and keyboard the touch buttons are not needed on the big screen. */
@media (hover: hover) and (pointer: fine) {
  body.taisekraan .puutenupud { display: none; }
}
/* A phone held upright: keep the buttons under the arena, not on top of it. */
@media (pointer: coarse) and (orientation: portrait) {
  body.taisekraan .manguala { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
}

@media (max-width: 600px) {
  body { padding: 8px; }
  .tagasi { font-size: 0.86rem; }
  header > p:last-child { font-size: 0.9rem; }
  .valik { gap: 8px; }
  .tegelane { width: 96px; }
  .tegelane img { height: 72px; }
  .manguala { border-width: 3px; border-radius: 18px; box-shadow: 5px 7px 0 #1d1430; }
  .hud { flex-wrap: wrap; gap: 4px 7px; font-size: 0.7rem; }
  #olek { order: 3; flex-basis: 100%; }
  .juhised { grid-template-columns: 1fr; gap: 7px; }
  .juhised div:first-child { display: none; }
  .rist { transform: scale(0.84); transform-origin: left center; }
  .runnak { width: 98px; height: 98px; }
  .super { width: 66px; height: 66px; font-size: 0.8rem; }
}
