* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050507;
  font-family: "Exo 2", "Trebuchet MS", sans-serif;
  touch-action: none;
}

input,
textarea,
select,
[contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

#hint {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.35);
  font-size: 13px;
  letter-spacing: 0.04em;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

#status {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  letter-spacing: 0.04em;
  pointer-events: none;
  user-select: none;
}

#blind-overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.88) 38%, rgba(255, 252, 245, 0.72) 70%, rgba(255, 250, 240, 0.55) 100%);
  mix-blend-mode: normal;
  transition: opacity 0.07s linear;
}

#blind-overlay.is-on {
  /* opacity set inline from JS */
}

#stick {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  width: 140px;
  height: 140px;
  z-index: 20;
  touch-action: none;
  pointer-events: none;
  opacity: 0.42;
  transition: opacity 0.18s ease;
  will-change: left, top, opacity;
}

#stick.visible {
  display: block;
}

#stick.active {
  opacity: 0.95;
  transition: none;
}

#stick-base {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35);
}

#stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  border: 2px solid rgba(255, 255, 255, 0.45);
  transform: translate(0, 0);
  transition: background 0.12s ease;
  will-change: transform;
}

#stick.active #stick-knob {
  background: rgba(255, 255, 255, 0.5);
}

#aim-stick {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  width: 150px;
  height: 150px;
  z-index: 20;
  touch-action: none;
  pointer-events: none;
  opacity: 0.42;
  transition: opacity 0.18s ease;
  will-change: left, top, opacity;
}

#aim-stick.visible {
  display: block;
}

#aim-stick.active {
  opacity: 0.95;
  transition: none;
}

#aim-stick-base {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 80, 80, 0.1);
  border: 2px solid rgba(255, 120, 120, 0.35);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35);
}

#aim-auto-zone {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 220, 120, 0.55);
  background: rgba(255, 200, 80, 0.12);
  pointer-events: none;
}

#aim-stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  border-radius: 50%;
  background: rgba(255, 120, 120, 0.4);
  border: 2px solid rgba(255, 180, 180, 0.65);
  transform: translate(0, 0);
  will-change: transform;
  z-index: 2;
}

#aim-stick.active #aim-stick-knob {
  background: rgba(255, 90, 90, 0.62);
}

#aim-stick.auto-aim #aim-auto-zone {
  border-color: rgba(255, 230, 120, 0.95);
  background: rgba(255, 210, 80, 0.28);
  box-shadow: 0 0 14px rgba(255, 200, 80, 0.35);
}

#loadout {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-content: safe center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255, 190, 70, 0.08), transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(80, 140, 255, 0.05), transparent 45%),
    rgba(4, 5, 8, 0.48);
  touch-action: pan-y;
  overscroll-behavior: contain;
}

#loadout[hidden] {
  display: none !important;
}

#loadout-die {
  text-align: center;
  font-size: clamp(48px, 14vw, 96px);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #ff3b3b;
  text-shadow: 0 0 40px rgba(255, 40, 40, 0.45);
  margin: 8px 0 12px;
  flex: 0 0 auto;
}

.loadout-card {
  width: min(420px, 100%);
  margin: 12px auto;
  padding: 22px 20px 18px;
  border: 1px solid rgba(255, 210, 120, 0.22);
  background:
    linear-gradient(180deg, rgba(28, 24, 18, 0.96), rgba(12, 12, 14, 0.97));
  color: #eee;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 20px 50px rgba(0, 0, 0, 0.45);
  flex: 0 0 auto;
}

.loadout-brand {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #ffe566;
  text-shadow: 0 0 24px rgba(255, 200, 80, 0.35);
  margin-bottom: 8px;
}

.loadout-tagline {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: rgba(255, 230, 180, 0.78);
  margin: 0 0 18px;
}

.loadout-stat-hint {
  margin: -2px 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(255, 210, 120, 0.72);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.7);
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 16px;
  outline: none;
}

.field input:focus {
  border-color: rgba(255, 255, 255, 0.45);
}

.section-label {
  margin: 4px 0 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.section-label span {
  color: #ffd27b;
}

.weapons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.genders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.weapon,
.gender {
  padding: 12px;
  border: 1px solid rgba(255, 210, 120, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #ddd;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.weapon:hover,
.gender:hover {
  border-color: rgba(255, 210, 120, 0.35);
  background: rgba(255, 210, 120, 0.06);
}

.weapon.active,
.gender.active {
  border-color: rgba(255, 210, 100, 0.85);
  background: linear-gradient(180deg, rgba(180, 130, 40, 0.35), rgba(90, 60, 20, 0.35));
  color: #fff6d0;
  box-shadow: 0 0 18px rgba(255, 180, 60, 0.15);
}

.stats {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.stat-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}

.stat-row {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 8px;
  align-items: center;
}

.stat-btn {
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

.stat-btn:active {
  background: rgba(255, 255, 255, 0.16);
}

.cells {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  height: 18px;
}

.cell {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.cell.on {
  background: #6eb6ff;
  border-color: rgba(255, 255, 255, 0.25);
}

.stat[data-stat="health"] .cell.on {
  background: #7bffb2;
}

.stat[data-stat="damage"] .cell.on {
  background: #ff7b7b;
}

#loadout-go {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  border: 2px solid rgba(255, 210, 100, 0.65);
  background: linear-gradient(180deg, rgba(255, 200, 80, 0.22), rgba(140, 90, 20, 0.28));
  color: #fff6d0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.14em;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 0 24px rgba(255, 180, 60, 0.12);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.donate-credit-note {
  margin: 4px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(120, 220, 160, 0.35);
  background: rgba(40, 120, 80, 0.22);
  color: #d8ffe8;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.donate-credit-note[hidden] {
  display: none !important;
}

.disclaimer[hidden] {
  display: none !important;
}

.disclaimer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 160, 80, 0.12), transparent 45%),
    rgba(4, 5, 10, 0.88);
}

.disclaimer-panel {
  width: min(440px, 100%);
  padding: 28px 24px 22px;
  border: 1px solid rgba(255, 210, 120, 0.35);
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255, 170, 80, 0.14), transparent 55%),
    linear-gradient(180deg, rgba(28, 22, 14, 0.98), rgba(12, 11, 16, 0.98));
  color: #f5efe4;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.disclaimer-brand {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 210, 120, 0.75);
}

.disclaimer-panel h2 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.disclaimer-text {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
}

.disclaimer-mobile-note {
  display: none;
}

@media (pointer: coarse), (hover: none) {
  .disclaimer-mobile-note {
    display: inline;
  }
}

#disclaimer-accept {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(120, 220, 160, 0.5);
  background: rgba(40, 120, 80, 0.5);
  color: #d8ffe8;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

#disclaimer-accept:active {
  background: rgba(50, 150, 100, 0.65);
}

#loadout-go:active {
  background: linear-gradient(180deg, rgba(255, 200, 80, 0.35), rgba(140, 90, 20, 0.4));
}

#loadout-go:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

#loadout-go.cta-soon {
  position: relative;
  opacity: 0.55;
  cursor: not-allowed;
}

#loadout-go.cta-soon::after {
  content: "скоро";
  position: absolute;
  top: -10px;
  right: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 180, 80, 0.95);
  color: #1a1208;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.donate-modal[hidden] {
  display: none !important;
}

.donate-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
}

.donate-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 10, 0.72);
}

.donate-modal-panel {
  position: relative;
  width: min(440px, 100%);
  padding: 28px 24px 22px;
  border: 1px solid rgba(255, 210, 120, 0.35);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 170, 80, 0.12), transparent 50%),
    linear-gradient(180deg, rgba(28, 22, 14, 0.98), rgba(12, 11, 16, 0.98));
  color: #f5efe4;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.donate-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.donate-modal-panel h2 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.donate-lead,
.donate-note {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.72);
}

.donate-token-box {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(255, 210, 120, 0.35);
  background: rgba(0, 0, 0, 0.28);
}

.donate-token-box code {
  flex: 1;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffe4a0;
  word-break: break-all;
}

#donate-token-copy {
  flex-shrink: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#donate-token-copy.copied {
  border-color: rgba(120, 220, 160, 0.55);
  background: rgba(40, 140, 90, 0.55);
  color: #d8ffe8;
}

.donate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.donate-support-btn {
  flex: 1;
  min-width: 140px;
  text-align: center;
  text-decoration: none;
  padding: 14px 16px;
  border: 1px solid rgba(120, 220, 160, 0.5);
  background: rgba(40, 120, 80, 0.5);
  color: #d8ffe8;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
}

.donate-support-btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.donate-modal-status {
  min-height: 1.2em;
  margin: 12px 0 0;
  font-size: 13px;
  color: rgba(180, 255, 210, 0.85);
}

#game-disabled {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 120, 160, 0.12), transparent 45%),
    radial-gradient(ellipse at 80% 80%, rgba(80, 100, 255, 0.1), transparent 40%),
    rgba(5, 6, 10, 0.94);
}

#game-disabled[hidden] {
  display: none !important;
}

.game-disabled-card {
  max-width: 420px;
  text-align: center;
}

.game-disabled-brand {
  font-size: clamp(32px, 8vw, 52px);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #ffe9a8;
  margin-bottom: 14px;
}

.game-disabled-card p {
  font-size: 16px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.72);
}

body.game-off #loadout,
body.game-off #status,
body.game-off #hint,
body.game-off #emoji-bar,
body.game-off #dong-btn,
body.game-off #leave-btn,
body.game-off #king-chat {
  visibility: hidden;
}

body.in-game #status {
  display: none !important;
}

body.legend-mode #hint {
  display: none !important;
}

body:not(.in-game) #stick,
body:not(.in-game) #aim-stick,
body:not(.in-game) #hint,
body:not(.in-game) #status,
body:not(.in-game) #king-chat,
body:not(.in-game) #emoji-bar,
body:not(.in-game) #dong-btn {
  display: none !important;
}

#emoji-bar {
  position: fixed;
  left: 50%;
  top: max(10px, env(safe-area-inset-top));
  bottom: auto;
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 210, 120, 0.28);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, left 0.2s ease, right 0.2s ease, transform 0.2s ease;
}

.emoji-tray {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.emoji-toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 210, 120, 0.4);
  background: rgba(0, 0, 0, 0.62);
  border-radius: 12px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  place-items: center;
  backdrop-filter: blur(8px);
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.emoji-toggle:active {
  transform: scale(0.94);
}

/* legend — desktop: bottom-right, same height as king chat (top set in JS) */
body.legend-mode #emoji-bar {
  left: auto;
  right: max(16px, env(safe-area-inset-right));
  transform: none;
  height: 48px;
  padding: 4px 8px;
  gap: 5px;
  box-sizing: border-box;
}

body.legend-mode .emoji-tray {
  gap: 5px;
}

/* phone: toggle + slide-out tray */
@media (pointer: coarse), (hover: none) {
  #emoji-bar {
    left: max(10px, env(safe-area-inset-left));
    right: auto;
    top: max(10px, env(safe-area-inset-top));
    transform: none;
    z-index: 70;
    height: auto;
    padding: 0;
    gap: 6px;
    border: none;
    background: transparent;
    backdrop-filter: none;
    opacity: 1;
  }

  body.legend-mode #emoji-bar,
  body.in-game:not(.legend-mode) #emoji-bar {
    left: max(10px, env(safe-area-inset-left));
    right: auto;
    top: max(10px, env(safe-area-inset-top));
    transform: none;
    height: auto;
    padding: 0;
    border: none;
    background: transparent;
    opacity: 1;
  }

  body.in-game:not(.legend-mode) #emoji-bar:hover,
  body.in-game:not(.legend-mode) #emoji-bar:focus-within {
    opacity: 1;
    background: transparent;
  }

  .emoji-toggle {
    display: grid;
  }

  .emoji-tray {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    gap: 4px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 12px;
    box-sizing: border-box;
    transition:
      max-width 0.28s ease,
      opacity 0.2s ease,
      padding 0.28s ease,
      border-color 0.2s ease,
      background 0.2s ease;
  }

  #emoji-bar.is-open .emoji-tray {
    max-width: min(340px, calc(100vw - 70px));
    opacity: 1;
    padding: 5px 6px;
    border-color: rgba(255, 210, 120, 0.35);
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
  }

  #emoji-bar.is-open .emoji-toggle {
    border-color: rgba(255, 210, 120, 0.7);
    background: rgba(40, 30, 12, 0.85);
  }
}

body.legend-mode #emoji-bar .emoji-btn {
  width: 38px;
  height: 38px;
  font-size: 19px;
  border-radius: 8px;
}

body.legend-mode #emoji-bar .emoji-btn-img {
  padding: 2px;
}

body.legend-mode #emoji-bar .emoji-btn-img img {
  width: 26px;
  height: 26px;
}

/* during battle — keep readable but less obstructive (desktop) */
@media (pointer: fine) {
  body.in-game:not(.legend-mode) #emoji-bar {
    background: rgba(0, 0, 0, 0.18);
    border-color: rgba(255, 255, 255, 0.1);
    opacity: 0.55;
  }

  body.in-game:not(.legend-mode) #emoji-bar:hover,
  body.in-game:not(.legend-mode) #emoji-bar:focus-within {
    opacity: 0.88;
    background: rgba(0, 0, 0, 0.4);
  }
}

#emoji-bar[hidden] {
  display: none !important;
}

.emoji-btn {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  flex: 0 0 auto;
}

.emoji-btn:hover {
  background: rgba(255, 210, 120, 0.14);
  border-color: rgba(255, 210, 120, 0.45);
}

.emoji-btn:active {
  transform: scale(0.92);
}

.emoji-btn-img {
  padding: 4px;
}

.emoji-btn-img img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

@media (pointer: coarse), (hover: none) {
  #loadout {
    justify-content: flex-start;
  }
  #emoji-bar {
    top: max(8px, env(safe-area-inset-top));
    gap: 4px;
    padding: 5px 6px;
  }
  .emoji-btn {
    width: 34px;
    height: 34px;
    font-size: 18px;
    border-radius: 8px;
  }
  .emoji-btn-img {
    padding: 3px;
  }
  .emoji-btn-img img {
    width: 22px;
    height: 22px;
  }
}

#dong-btn {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 25;
  height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(255, 150, 180, 0.5);
  background: rgba(90, 24, 48, 0.72);
  color: #ffd0e0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  pointer-events: auto;
  touch-action: manipulation;
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

#dong-btn:hover {
  background: rgba(140, 40, 70, 0.85);
  border-color: rgba(255, 180, 200, 0.7);
}

#dong-btn:active {
  transform: scale(0.97);
}

#dong-btn[hidden] {
  display: none !important;
}

#leave-btn {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 60;
  height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 120, 120, 0.45);
  background: rgba(50, 14, 18, 0.72);
  color: #ffc8c8;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  pointer-events: auto;
  touch-action: manipulation;
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, opacity 0.15s ease;
}

#leave-btn:hover {
  background: rgba(110, 28, 36, 0.88);
  border-color: rgba(255, 160, 160, 0.65);
}

#leave-btn:active {
  transform: scale(0.97);
}

#leave-btn[hidden] {
  display: none !important;
}

body.in-game:not(.legend-mode) #leave-btn {
  opacity: 0.72;
}

body.in-game:not(.legend-mode) #leave-btn:hover {
  opacity: 1;
}

#dong-toast {
  position: fixed;
  z-index: 40;
  transform: translate(-50%, -100%);
  padding: 8px 14px;
  border: 1px solid rgba(255, 160, 180, 0.55);
  background: rgba(40, 10, 22, 0.92);
  color: #ffd0e0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

#dong-toast[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  #dong-btn {
    font-size: 12px;
    padding: 0 10px;
  }
}

#king-chat {
  position: fixed;
  left: 50%;
  top: 0;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: min(420px, calc(100% - 32px));
  max-width: calc(100vw - 16px);
  height: 48px;
  box-sizing: border-box;
  pointer-events: auto;
  touch-action: auto;
  min-width: 0;
}

#king-chat[hidden] {
  display: none !important;
}

#chat-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
  height: 100%;
  padding: 0 14px;
  border: 1px solid rgba(255, 215, 80, 0.45);
  background: rgba(0, 0, 0, 0.65);
  color: #ffe9a8;
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
}

#chat-send {
  flex: 0 0 48px;
  width: 48px;
  height: 100%;
  padding: 0;
  border: 1px solid rgba(255, 215, 80, 0.45);
  background: rgba(180, 130, 30, 0.35);
  color: #ffe9a8;
  cursor: pointer;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

#chat-send svg {
  display: block;
}

#chat-send:hover {
  background: rgba(200, 150, 40, 0.5);
  border-color: rgba(255, 220, 120, 0.65);
}

#chat-send:active {
  transform: scale(0.96);
}

@media (pointer: coarse), (hover: none) {
  #chat-input {
    padding: 0 12px;
    font-size: 14px;
  }

  #chat-send {
    flex-basis: 44px;
    width: 44px;
  }

  #king-chat {
    width: min(340px, calc(100vw - 16px));
    max-width: min(340px, calc(100vw - 16px));
  }
}

@media (pointer: coarse) and (orientation: landscape), (hover: none) and (orientation: landscape) {
  #king-chat {
    width: min(320px, calc(100vw - 320px));
    max-width: min(320px, calc(100vw - 320px));
  }
}

.obs-link-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.obs-link-hint {
  margin: -4px 0 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.02em;
}

.obs-link-row {
  display: flex;
  gap: 8px;
}

#obs-link {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.45);
  color: #9fd0ff;
  font-size: 12px;
  outline: none;
}

#obs-copy {
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #eee;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

#obs-copy.copied {
  border-color: rgba(61, 255, 160, 0.45);
  color: #3dffa0;
}

@media (pointer: fine) {
  body.in-game:not(.legend-mode) #hint {
    display: block;
  }
}

body.combat-cursor,
body.combat-cursor #game {
  cursor: none !important;
}

@media (pointer: coarse), (hover: none) {
  body.in-game #hint {
    display: none;
  }
  body.in-game #stick {
    display: block;
  }
  body.in-game #aim-stick {
    display: block;
  }
}
