/* ===== Layout ===== */
.app {
  position: relative;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px);
}

.screen {
  padding: 8px var(--gutter) 0;
  animation: screen-in 0.28s steps(4) both;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 14px;
}

.section-head__meta {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--muted);
}

/* ===== Buttons ===== */
.btn {
  --btn-bg: var(--coin);
  --btn-ink: #1a1033;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin: 4px;
  padding: 10px 14px;
  border: 0;
  border-radius: 0;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-family: var(--font-pixel);
  font-size: 10px;
  line-height: 1.2;
  text-transform: uppercase;
  box-shadow:
    0 -4px 0 0 var(--line),
    0 4px 0 0 var(--line),
    -4px 0 0 0 var(--line),
    4px 0 0 0 var(--line),
    inset -4px -4px 0 0 rgba(0, 0, 0, 0.3),
    inset 4px 4px 0 0 rgba(255, 255, 255, 0.35);
  transition: transform 60ms steps(1);
}

.btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow:
    0 -4px 0 0 var(--line),
    0 4px 0 0 var(--line),
    -4px 0 0 0 var(--line),
    4px 0 0 0 var(--line),
    inset 4px 4px 0 0 rgba(0, 0, 0, 0.3);
}

.btn:disabled {
  filter: grayscale(0.7) brightness(0.7);
}

.btn--clear,
.btn--start {
  --btn-bg: var(--pc);
  --btn-ink: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
}

.btn--cleared {
  --btn-bg: var(--panel-3);
  --btn-ink: var(--pc-light);
}

.btn--ghost {
  --btn-bg: var(--panel-2);
  --btn-ink: var(--ink);
}

.btn--danger {
  --btn-bg: var(--bad);
  --btn-ink: #fff;
}

.btn--sm {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 9px;
}

.btn--big {
  width: calc(100% - 8px);
  min-height: 58px;
  font-size: 13px;
}

.btn--sq {
  width: 52px;
  min-height: 52px;
  padding: 0;
  font-size: 18px;
}

.btn--dice {
  --btn-bg: var(--coin);
  width: 48px;
  padding: 0;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  opacity: 0.55;
}

.icon-btn:active {
  opacity: 1;
  transform: scale(0.9);
}

/* ===== Chips ===== */
.chips {
  display: flex;
  gap: 6px;
}

.chips--wrap {
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip {
  min-height: 36px;
  margin: 4px;
  padding: 8px 10px;
  border: 0;
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: 9px;
  box-shadow: 0 -3px 0 0 var(--line), 0 3px 0 0 var(--line), -3px 0 0 0 var(--line), 3px 0 0 0 var(--line);
}

.chip.is-active {
  background: var(--pc);
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}

/* ===== HUD ===== */
.hud {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(10px + var(--safe-t)) var(--gutter) 12px;
  background: linear-gradient(to bottom, var(--bg) 78%, rgba(12, 10, 31, 0));
}

.hud__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 4px;
}

.hud__vs {
  font-family: var(--font-pixel);
  font-size: 16px;
  color: var(--coin);
  text-shadow: 3px 3px 0 var(--blanka-dark), -2px -2px 0 var(--simon-dark);
  animation: vs-pulse 1.2s steps(2) infinite;
}

button.hud__vs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  padding: 2px;
  border: 0;
  background: none;
  -webkit-touch-callout: none;
}

.hud__vs.is-golden {
  font-size: 8px;
  text-shadow: 2px 2px 0 var(--line);
  animation: golden-glow 1.2s steps(2) infinite;
}

.app.is-golden .tug {
  box-shadow:
    0 -3px 0 0 var(--coin),
    0 3px 0 0 var(--coin),
    -3px 0 0 0 var(--coin),
    3px 0 0 0 var(--coin),
    0 0 14px rgba(255, 210, 63, 0.55);
}

.app.is-golden .tug__simon,
.app.is-golden .tug__blanka {
  background-image: repeating-linear-gradient(90deg, rgba(255, 210, 63, 0.5) 0 4px, transparent 4px 8px);
}

.hud__offline {
  margin-top: 8px;
  font-family: var(--font-pixel);
  font-size: 8px;
  text-align: center;
  color: var(--bad);
  animation: blink 1s steps(2) infinite;
}

.fighter {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}

.fighter--right {
  flex-direction: row-reverse;
  text-align: right;
}

.fighter__avatar {
  position: relative;
  padding-top: 14px;
}

.fighter__avatar.is-jumping {
  animation: jump 0.65s steps(6);
}

.fighter__crown {
  position: absolute;
  top: -2px;
  left: 50%;
  translate: -50% 0;
  animation: crown-bob 0.8s steps(2) infinite;
}

.fighter__info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.fighter__tag {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--pc-light);
}

.fighter.is-you .fighter__tag {
  color: var(--coin);
  animation: blink 1.4s steps(2) infinite;
}

.fighter__name {
  font-family: var(--font-pixel);
  font-size: 9px;
}

.fighter__pts {
  font-family: var(--font-pixel);
  font-size: 18px;
  color: var(--pc);
  text-shadow: 2px 2px 0 var(--line);
}

.fighter__lv {
  font-size: 17px;
  color: var(--muted);
}

/* tug-of-war bar */
.tug {
  position: relative;
  display: flex;
  height: 14px;
  margin: 12px 4px 0;
  background: var(--line);
  box-shadow: 0 -3px 0 0 var(--line), 0 3px 0 0 var(--line), -3px 0 0 0 var(--line), 3px 0 0 0 var(--line);
}

.tug__simon,
.tug__blanka {
  height: 100%;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 4px, transparent 4px 8px);
  animation: bar-slide 0.6s linear infinite;
}

.tug__simon {
  width: var(--share);
  background-color: var(--simon);
  transition: width 0.7s steps(10);
}

.tug__blanka {
  flex: 1;
  background-color: var(--blanka);
  animation-direction: reverse;
}

.tug__spark {
  position: relative;
  width: 0;
}

.tug__spark::after {
  content: '';
  position: absolute;
  top: -5px;
  left: -4px;
  width: 8px;
  height: 24px;
  background: #fff;
  box-shadow: 0 0 10px #fff, 0 0 18px var(--coin);
  animation: blink 0.4s steps(2) infinite;
}

/* ===== Bottom navigation ===== */
.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: min(480px, 100%);
  padding: 10px var(--gutter) calc(10px + var(--safe-b));
  background: var(--bg-2);
  border-top: 4px solid var(--line);
  translate: -50% 0;
  box-shadow: 0 -8px 0 0 rgba(12, 10, 31, 0.6);
}

.nav__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 3px;
  padding: 8px 4px 7px;
  border: 0;
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-pixel);
  font-size: 8px;
  box-shadow: 0 -3px 0 0 var(--line), 0 3px 0 0 var(--line), -3px 0 0 0 var(--line), 3px 0 0 0 var(--line);
  transition: transform 0.12s steps(2);
}

.nav__btn.is-active {
  background: var(--pc);
  color: #fff;
  transform: translateY(-5px);
  box-shadow:
    0 -3px 0 0 var(--line),
    0 3px 0 0 var(--line),
    -3px 0 0 0 var(--line),
    3px 0 0 0 var(--line),
    0 8px 0 0 var(--pc-dark);
}

/* ===== Inputs ===== */
.field {
  display: block;
  margin-bottom: 22px;
}

.field__label {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--pc-light);
}

.field__hint {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 17px;
  color: var(--dim);
}

.input {
  display: block;
  width: calc(100% - 8px);
  padding: 12px;
  border: 0;
  border-radius: 0;
  background: var(--bg-2);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 24px;
  line-height: 1.05;
  resize: none;
  -webkit-appearance: none;
  appearance: none;
}

.input:focus {
  outline: none;
  --bc: var(--pc);
}

.input.has-error {
  --bc: var(--bad);
}

.input::placeholder {
  color: var(--dim);
}

/* ===== Toasts & banner ===== */
.toasts {
  position: fixed;
  top: calc(8px + var(--safe-t));
  left: 50%;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(456px, calc(100% - 2 * var(--gutter)));
  translate: -50% 0;
  pointer-events: none;
}

.toast {
  --bc: var(--pc);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel);
  animation: toast-in 0.3s steps(4) both, toast-out 0.3s steps(3) 3.3s forwards;
}

.toast--achievement {
  --bc: var(--coin);
  background: #2b2108;
}

.toast--error {
  --bc: var(--bad);
}

.toast__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.toast__body strong {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--pc-light);
}

.toast--achievement strong {
  color: var(--coin);
}

.toast__body span {
  overflow: hidden;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast__pts {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--coin);
}

.banner {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: rgba(5, 3, 13, 0.45);
  animation: fade-in-out 2s steps(8) both;
}

.banner__stripe {
  width: 100%;
  padding: 22px 16px;
  background: var(--pc);
  text-align: center;
  box-shadow: 0 -6px 0 0 var(--line), 0 6px 0 0 var(--line), 0 -12px 0 0 var(--pc-dark), 0 12px 0 0 var(--pc-dark);
  animation: stripe-in 2s steps(10) both;
}

.banner__title {
  font-family: var(--font-pixel);
  font-size: 26px;
  color: #fff;
  text-shadow: 4px 4px 0 var(--line);
  animation: title-pop 0.5s steps(5) both 0.15s;
}

.banner__sub {
  margin-top: 12px;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--line);
}

/* ===== Overlays ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: calc(24px + var(--safe-t)) var(--gutter) calc(24px + var(--safe-b));
  background: rgba(8, 6, 22, 0.94);
  animation: screen-in 0.25s steps(4) both;
  overflow-y: auto;
}
