/* MAKROTA GAME hub + mini games. Reuses Puzzle tokens: panel, buttons, brand-title, colours. */

/* ---------- start screen ---------- */
.hub-panel {
  position: relative;
  width: min(100%, 400px);
  padding: clamp(18px, 4vh, 26px) clamp(16px, 4.5vw, 24px) clamp(18px, 3.6vh, 24px);
}

/* Support button: top-left of the panel, mirroring the gear (top: 16px; right: 16px from .support-link). */
.hub-support {
  left: 16px;
  right: auto;
}

button.support-link {
  padding: 0;
  font: inherit;
}

.hub-logo {
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  font-size: inherit;
}

.hub-logo .eyebrow {
  margin: 0;
  display: block;
  white-space: nowrap;
}

/* pastel: the same small-caps sans lettering Puzzle uses for its title */
body.theme-color .hub-logo .hub-logo-main {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0.24em;
  padding-left: 0.24em;
  color: #c3ccdb;
}

body.theme-color .hub-logo .hub-logo-sub {
  margin-top: 9px;
  font-size: 12px;
  letter-spacing: 0.5em;
  padding-left: 0.5em;
  color: #aab4c8;
}

/* night: Metal Mania, exactly like the PUZZLE wordmark */
body:not(.theme-color) .hub-logo .hub-logo-main.brand-title {
  font-size: 44px;
  letter-spacing: 0.1em;
  padding-left: 0.1em;
  color: #f2eee6;
  text-shadow: 0 1px 0 #000, 0 0 18px rgba(90, 18, 18, 0.45);
}

body:not(.theme-color) .hub-logo .hub-logo-sub.brand-title {
  margin-top: 4px;
  font-size: 22px;
  letter-spacing: 0.32em;
  padding-left: 0.32em;
  color: #e4dfd6;
}

.hub-count {
  margin: 12px 0 16px;
  color: #8792a5;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hub-tile {
  --tile-bg: #0f131b;
  position: relative;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 8px;
  border: 1px solid #3f4859;
  border-radius: 16px;
  background: transparent;
  color: #e8edf5;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 120ms ease, background 120ms ease;
}

button.hub-tile:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.04);
}

button.hub-tile:focus-visible {
  outline: 2px solid #78a8d0;
  outline-offset: 2px;
}

.hub-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hub-icon .hub-icon-thin {
  stroke-width: 1.1;
  opacity: 0.75;
}

.hub-icon .hub-icon-solid {
  fill: currentColor;
}

.hub-icon .hub-icon-hollow {
  fill: var(--tile-bg);
}

.hub-tile.is-soon {
  color: #6f7a8d;
  border-style: dashed;
  border-color: #2e3542;
  cursor: default;
}

.hub-soon {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.4;
}

body.theme-color .hub-tile {
  --tile-bg: #efe6d8;
  background: #efe6d8;
  border-color: #d7c8b6;
  color: #2c3340;
}

body.theme-color button.hub-tile:active {
  background: #f7f1e8;
}

body.theme-color .hub-tile.is-soon {
  --tile-bg: transparent;
  background: transparent;
  border-color: #4a5466;
  color: #7d8799;
}

body.theme-color .hub-count {
  color: #8792a5;
}

/* ---------- shared header controls ---------- */
.round-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #485367;
  border-radius: 50%;
  background: #171d27;
  color: #dce4f0;
  transition: transform 120ms ease;
}

.round-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.round-icon:active {
  transform: scale(0.94);
}

body.theme-color .round-icon {
  background: #efe6d8;
  color: #2c3340;
  border-color: #d7c8b6;
}

.game-header .header-back {
  position: absolute;
  z-index: 7;
  top: 0;
  left: max(12px, env(safe-area-inset-left, 0px));
}

.pill-button {
  min-height: 28px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #252c38;
  color: #e8edf5;
  font-size: 12px;
  line-height: 1;
}

body.theme-color .pill-button {
  background: #efe6d8;
  color: #2c3340;
  border-color: #d7c8b6;
}

/* ---------- mini game screens (same frame as the Puzzle game screen) ---------- */
.mini-screen {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: max(20px, env(safe-area-inset-top, 0px) + 8px) 0 max(8px, env(safe-area-inset-bottom, 0px));
}

.mini-screen.screen--hidden {
  display: none;
}

body.telegram-webapp .mini-screen {
  padding-top: max(36px, env(safe-area-inset-top, 0px) + 24px);
}

.mini-header .header-side {
  min-height: 44px;
}

.mini-stage {
  position: relative;
  width: min(100%, 520px);
  min-height: 0;
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 6px;
  padding: 0 10px;
}

.mini-canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.mini-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.mini-status {
  min-height: 30px;
  margin: 0;
  color: #a5afc1;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

body.theme-color .mini-status {
  color: #4b5868;
}

#mini-over .panel p:not(.eyebrow),
#mini-pause .panel p:not(.eyebrow) {
  margin: 6px 0;
}

/* Telegram fullscreen draws its own controls over the very top: keep the hub panel below them. */
body.telegram-webapp #hub-screen {
  padding-top: max(16px, calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px) + 8px));
}

@media (max-height: 640px) {
  .hub-tile {
    min-height: 74px;
    gap: 6px;
  }


  body:not(.theme-color) .hub-logo .hub-logo-main.brand-title {
    font-size: 36px;
  }

  .hub-count {
    margin: 8px 0 12px;
  }
}

@media (max-width: 360px) {
  body:not(.theme-color) .hub-logo .hub-logo-main.brand-title {
    font-size: 36px;
  }

  body.theme-color .hub-logo .hub-logo-main {
    font-size: 21px;
  }
}

/* Mini-game statistics: Puzzle's stats screen (record cards + TOP 20), 3 × 2 cards, one board. */
.ministats-grid .record-card strong {
  font-variant-numeric: tabular-nums;
}

.ministats-grid .record-card span {
  min-height: 2.3em;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
}

.ministats-boards {
  grid-template-columns: minmax(0, 1fr);
}

.ministats-boards .leaderboard-list {
  max-height: min(34vh, 260px);
}

.ministats-grid .record-card strong.is-long {
  font-size: 20px;
  line-height: 30px;
}

.ministats-grid .record-card strong.is-xlong {
  font-size: 16px;
  line-height: 30px;
}

@media (max-width: 380px) {
  .ministats-grid .record-card strong.is-mid {
    font-size: 21px;
    line-height: 30px;
  }
}
