/* spell.propelldir.no - the hub's own parts; the look is resorted-ui (ui/ui.css), laid out like the
   resorted.dev hub: the logo big in the middle (here the penguin, its propeller spinning), the games
   below it, two by two. */
body {
  background: radial-gradient(760px 420px at 50% 240px, rgba(61, 139, 255, 0.16), transparent 70%), var(--bg);
}
.hub {
  width: min(100% - 48px, 1320px);
  margin: 0 auto;
  font-size: 16px;
}
.hub-top {
  min-height: 56px;
}

/* ---------- the penguin ---------- */
.hub-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  text-align: center;
}
.hub-logo {
  position: relative;
  margin-bottom: 30px;
}
.hub-penguin {
  position: relative;
  display: block;
  width: 200px;
  aspect-ratio: 1;
  animation: hub-float 3.2s ease-in-out infinite;
}
.hub-penguin img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* The blades turn round the cap's knob (x 209 of 396, their middle at y 22): seen from the front a
   spinning propeller narrows to a line and comes back the other way round, so it's a squeeze, not a turn.
   Each quarter eases like a sine, so the speed looks even all the way round. */
.hub-blades {
  transform-origin: 52.8% 5.6%;
  animation: hub-prop 0.46s infinite;
}
@keyframes hub-prop {
  0% { transform: scaleX(1); filter: brightness(1); animation-timing-function: cubic-bezier(0.12, 0, 0.39, 0); }
  25% { transform: scaleX(0); animation-timing-function: cubic-bezier(0.61, 1, 0.88, 1); }
  50% { transform: scaleX(-1); filter: brightness(0.82); animation-timing-function: cubic-bezier(0.12, 0, 0.39, 0); }
  75% { transform: scaleX(0); animation-timing-function: cubic-bezier(0.61, 1, 0.88, 1); }
  100% { transform: scaleX(1); filter: brightness(1); }
}
.hub-logo:hover .hub-blades { animation-duration: 0.2s; }
@keyframes hub-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.hub-floor {
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 210px;
  height: 26px;
  margin-left: -105px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(61, 139, 255, 0.32), transparent);
  filter: blur(6px);
  animation: hub-shadow 3.2s ease-in-out infinite;
}
@keyframes hub-shadow {
  0%, 100% { transform: scaleX(1); opacity: 1; }
  50% { transform: scaleX(0.86); opacity: 0.7; }
}
.hub h1 {
  margin: 0 0 10px;
  font: 600 clamp(32px, 3.2vw, 48px) / 1.15 var(--font-display);
}
.hub-lead {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

/* ---------- the games: two by two (one column on phones); light runs round the one under the pointer ---------- */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 44px;
}
.hub-game {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: stretch;
  gap: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  color: var(--text);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.hub-game::before {
  content: '';
  position: absolute;
  z-index: -2;
  left: 50%;
  top: 50%;
  width: 150%;
  aspect-ratio: 1;
  background: conic-gradient(transparent 0 72%, rgba(79, 220, 255, 0.9) 86%, rgba(61, 139, 255, 0.95) 95%, transparent 100%);
  transform: translate(-50%, -50%) rotate(0deg);
  opacity: 0;
  transition: opacity 0.3s;
  animation: hub-trace 4s linear infinite;
}
.hub-game::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 1px;
  border-radius: 19px;
  background: var(--card);
}
.hub-game:hover,
.hub-game:focus-within {
  transform: translateY(-3px);
  border-color: transparent;
  box-shadow: 0 22px 44px -26px rgba(0, 0, 0, 0.95), 0 0 34px -16px rgba(79, 220, 255, 0.6);
}
.hub-game:hover::after {
  background: radial-gradient(300px circle at var(--mx) var(--my), rgba(79, 220, 255, 0.12), transparent 70%), var(--card);
}
.hub-game:hover::before,
.hub-game:focus-within::before {
  opacity: 1;
}
@keyframes hub-trace {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
/* The game playing itself */
.hub-shot {
  flex: none;
  width: 170px;
  aspect-ratio: 9 / 16;
  border: 3px solid #140b0e;
  border-radius: 14px;
  overflow: hidden;
  background: #1b9fc4;
  box-shadow: 0 0 0 1px var(--line2), 0 14px 30px -14px rgba(0, 0, 0, 0.9);
}
.hub-shot iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}
.hub-game-text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}
.hub-game h2 {
  margin: 0;
  font: 600 24px var(--font-display);
}
/* The name is the link; it covers the whole card. */
.hub-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
}
.hub-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 20px;
}
.hub-link:hover { color: var(--text); }
.hub-link:focus-visible { outline: none; }
.hub-game:has(.hub-link:focus-visible) { outline: 2px solid var(--c1); outline-offset: 3px; }
.hub-link .ic {
  color: var(--faint);
  transition: transform 0.2s, color 0.2s;
}
.hub-game:hover .hub-link .ic {
  color: var(--c1);
  transform: translateX(3px);
}
.hub-desc {
  margin: 0;
  color: var(--muted);
  font-size: 15.5px;
}
.hub-top3 {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--field);
}
.hub-top3-title {
  color: var(--faint);
  font: 600 12px var(--font);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.hub-top3 ol {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hub-top3 li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
}
.hub-top3 .who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hub-top3 .pts {
  font: 600 16px var(--font-display);
}
.hub-medal {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #140b0e;
  font: 700 12px var(--font);
}
.hub-medal.m1 { background: #ffd84a; }
.hub-medal.m2 { background: #d9dde4; }
.hub-medal.m3 { background: #e7a46a; }
.hub-top3 .empty-row {
  display: block;
  color: var(--muted);
}
.hub-play {
  align-self: flex-start;
  margin-top: auto;
  min-width: 150px;
  pointer-events: none;
}

/* The place for the next game */
.hub-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px;
  border: 1px dashed var(--line2);
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
}
.hub-soon b {
  color: var(--text);
  font: 600 20px var(--font-display);
}
.hub-soon-icon svg {
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- the footer: language in the middle, Admin at the bottom right ---------- */
.hub .rui-foot.hub-foot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding-top: 56px;
}
.hub-lang {
  grid-column: 2;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
}
.hub-lang button {
  padding: 5px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font: 500 13.5px var(--font);
  cursor: pointer;
}
.hub-lang button[aria-pressed='true'] {
  background: var(--card2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line2);
}
.btn.hub-admin {
  grid-column: 3;
  justify-self: end;
  border-color: var(--line);
  background: rgba(20, 27, 37, 0.6);
  color: var(--faint);
}
.btn.hub-admin:hover { color: var(--text); }

@media (max-width: 860px) {
  .hub { width: min(100% - 32px, 1320px); }
  .hub-grid { grid-template-columns: 1fr; }
  .hub-penguin { width: 150px; }
  .hub-floor { width: 160px; margin-left: -80px; }
}
@media (max-width: 520px) {
  .hub-game { flex-direction: column; align-items: center; text-align: center; }
  .hub-shot { width: min(62vw, 220px); }
  .hub-link, .hub-play { align-self: center; justify-content: center; }
  .hub-top3 { width: 100%; text-align: left; }
  .hub .rui-foot.hub-foot { grid-template-columns: 1fr; justify-items: center; }
  .hub-lang, .btn.hub-admin { grid-column: 1; justify-self: center; }
}
@media (prefers-reduced-motion: reduce) {
  .hub-penguin, .hub-blades, .hub-floor, .hub-game::before { animation: none; }
}
