:root {
  --ink: #2a1b3d;
  --pink: #ff3d8b;
  --gold: #ffd34d;
  --teal: #38d6c0;
  --purple: #2d2466;
  --font: Fredoka, "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: #1c1640;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--font);
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#wrap {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  overflow: hidden;
}

canvas {
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 1.2em 0.8em 1.4em;
}

/* --- title --------------------------------------------------------------- */
.title-top { text-align: center; margin-top: 4.5em; }
.logo { display: flex; flex-direction: column; align-items: center; line-height: 0.95; }
.logo-name {
  font-size: 3.4em;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #fff 10%, #ffd0e4 55%, #ff7fb4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0.08em 0 var(--ink)) drop-shadow(0 0 0.25em rgba(255, 61, 139, 0.6));
  transform: rotate(-4deg);
}
.logo-sub {
  margin-top: 0.35em;
  font-size: 1.25em;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.03em;
  text-shadow: 0 0.12em 0 var(--ink);
}
.best { margin-top: 0.7em; font-size: 0.95em; color: #fff; text-shadow: 0 0.1em 0 var(--ink); }

.title-bottom { display: flex; flex-direction: column; align-items: center; gap: 0.5em; margin-bottom: 0.4em; }

.btn {
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.1em;
  color: var(--ink);
  background: var(--gold);
  border: 0.14em solid var(--ink);
  border-radius: 999px;
  padding: 0.45em 1.4em;
  box-shadow: 0 0.18em 0 var(--ink);
  cursor: pointer;
}
.btn:active { transform: translateY(0.12em); box-shadow: 0 0.06em 0 var(--ink); }
.btn.big { font-size: 1.5em; background: linear-gradient(180deg, #ff7fb4, var(--pink)); color: #fff; text-shadow: 0 0.08em 0 var(--ink); }
.btn.ghost { background: rgba(255, 255, 255, 0.9); font-size: 0.95em; }

.icon-btn {
  position: absolute;
  top: 0.6em;
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  border: 0.1em solid rgba(255, 255, 255, 0.6);
  background: rgba(20, 10, 50, 0.45);
  color: #fff;
  font-size: 1em;
  line-height: 1;
  cursor: pointer;
}
#btn-quit { left: 0.6em; }
.icon-btn.mute { right: 0.6em; }

/* --- modals --------------------------------------------------------------- */
.modal {
  justify-content: center;
  background: rgba(20, 10, 50, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.card {
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  background: #fff8fc;
  color: var(--ink);
  border: 0.14em solid var(--ink);
  border-radius: 1em;
  box-shadow: 0 0.25em 0 var(--ink);
  padding: 0.9em 1em 1em;
  text-align: center;
  animation: pop 0.35s cubic-bezier(.2, 1.6, .5, 1);
}
.card h2 { margin: 0.1em 0 0.3em; font-size: 1.6em; color: var(--pink); }
.how-list { list-style: none; padding: 0; margin: 0 0 0.8em; text-align: left; font-size: 0.82em; font-weight: 500; }
.how-list li { display: flex; gap: 0.6em; align-items: center; padding: 0.35em 0; border-bottom: 1px dashed #e8d6ec; }
.how-list .ic { font-size: 1.5em; width: 1.4em; text-align: center; flex: none; }

#res-sub { margin: 0 0 0.6em; font-size: 0.85em; font-weight: 500; }
.scores { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.35em; margin: 0.6em 0; }
.scores div { background: #f2e8ff; border-radius: 0.5em; padding: 0.3em 0.4em; display: flex; flex-direction: column; }
.scores span { font-size: 0.65em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.75; }
.scores b { font-size: 1.3em; }
.scores b { font-size: 1.1em; }
.scores .total { grid-column: span 3; background: linear-gradient(90deg, #ffd0e4, #ffe9a8); }
.scores .total b { font-size: 2em; color: var(--pink); }
.results-card .best { color: var(--pink); text-shadow: none; font-weight: 700; margin: 0.2em 0 0.4em; }
.skill-list { text-align: left; font-size: 0.75em; margin: 0 0 0.8em; padding-left: 1.6em; columns: 2; column-gap: 1.2em; }
.skill-list li { padding: 0.1em 0; break-inside: avoid; }
.skill-list li span { display: inline-block; }
.skill-list .dd { margin-left: 0.4em; color: #8c6bff; font-weight: 600; }
.row { display: flex; gap: 0.5em; justify-content: center; align-items: center; flex-wrap: wrap; }

/* judges */
.judges { display: flex; justify-content: center; gap: 1.1em; margin: 0.3em 0 0.2em; }
.judge { display: flex; flex-direction: column; align-items: center; opacity: 0; animation: judge 0.45s ease-out forwards; }
.jcard {
  background: #fff; border: 0.1em solid var(--ink); border-radius: 0.25em;
  font-weight: 700; font-size: 1.15em; padding: 0.05em 0.35em; margin-bottom: 0.15em;
  box-shadow: 0 0.1em 0 var(--ink);
}
.jhead { width: 1.5em; height: 1.5em; border-radius: 50%; background: #f7d6c1; border: 0.1em solid var(--ink); position: relative; }
.jhead::after { content: ""; position: absolute; left: 0.3em; right: 0.3em; top: 0.55em; height: 0.18em; border-top: 0.12em dotted var(--ink); }
.jbody { width: 2.1em; height: 0.9em; border-radius: 0.8em 0.8em 0 0; background: var(--c); border: 0.1em solid var(--ink); border-bottom: none; margin-top: -0.1em; }

@keyframes pop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes judge { from { transform: translateY(0.8em); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- portrait only ---------------------------------------------------------- */
#rotate {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--purple);
  color: #fff;
  font-size: 1.6rem;
  text-align: center;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
@media (orientation: landscape) and (max-height: 520px) {
  #rotate { display: flex; }
}
