/* Always dark, whatever the Telegram theme: the arena, its effects and the pale skill names are drawn for it. */
:root {
  color-scheme: dark;
  --bg: #11141b;
  --text: #f2f2f2;
  --hint: #9aa3b2;
  --button: #5ea0ef;
  --button-text: #ffffff;
  --secondary-bg: #1b1f2a;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.page {
  position: relative;
  height: 100vh;
  height: var(--tg-viewport-stable-height, 100dvh);
  overflow: hidden;
}

/* The header and the footer float over the arena; the scene keeps the fight clear of them. */
.header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: calc(10px + env(safe-area-inset-top)) 12px 18px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 85%, transparent) 55%, transparent);
  pointer-events: none;
}

.title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.badge {
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--secondary-bg);
  color: var(--hint);
  font-size: 12px;
  border: 1px solid var(--hint);
}

.stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--secondary-bg);
}

/* Out of the flow, so the canvas never props the stage open and resizes feed back on themselves. */
.stage canvas {
  position: absolute;
  inset: 0;
  display: block;
}

.badge--live {
  background: #c62828;
  color: #fff;
}

/* Keeps its height while the buttons are hidden, so the fight does not jump when they appear. */
.footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  min-height: calc(80px + env(safe-area-inset-bottom));
  padding: 24px 12px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, color-mix(in srgb, var(--bg) 85%, transparent) 55%, transparent);
}

.controls {
  display: flex;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}

.button {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--button);
  color: var(--button-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.button--secondary {
  background: var(--secondary-bg);
  color: var(--text);
}

.button:disabled {
  opacity: 0.45;
  cursor: default;
}

.status {
  max-width: 560px;
  margin: 0 auto;
  color: var(--hint);
  font-size: 14px;
  text-align: center;
}

.status:empty {
  display: none;
}

.status--error {
  color: var(--text);
  padding: 12px;
  border-radius: 10px;
  background: var(--secondary-bg);
}
