:root {
  --bg: #0b0d14;
  --bg-elev: #12151f;
  --bg-card: #161a26;
  --border: #262b3a;
  --text: #e9ebf3;
  --text-dim: #9aa0b4;
  --accent: #ffb020;
  --accent-2: #ff4d6d;
  --blue: #4d8bff;
  --green: #35d68a;
  --red: #ff5c6c;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}

#root { display: flex; flex-direction: column; min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, .btn {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  background: var(--accent);
  color: #14100a;
  font-weight: 600;
  transition: transform 0.1s ease, opacity 0.15s ease;
  display: inline-block;
}
button:hover, .btn:hover { opacity: 0.9; text-decoration: none; }
button:active, .btn:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--red); color: #200; }
.btn-block { display: block; width: 100%; text-align: center; }

input, select {
  font: inherit;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}
input:focus, select:focus { outline: 1px solid var(--accent); }

label { display: block; margin: 14px 0 6px; font-size: 0.9rem; color: var(--text-dim); }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 10px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: "Anton", "Segoe UI", system-ui, sans-serif; font-weight: 400; text-transform: uppercase; letter-spacing: 1px; font-size: 1.35rem; color: var(--text); }
.brand img { width: 32px; height: 32px; border-radius: 6px; }
.nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; row-gap: 10px; justify-content: flex-end; }

@media (max-width: 640px) {
  .header { padding: 12px 16px; }
  .nav { gap: 12px; width: 100%; justify-content: space-between; }
}
.nav a.navlink { color: var(--text-dim); font-weight: 600; }
.nav a.navlink.active { color: var(--text); }
.balance-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  color: var(--green);
}

main#page { flex: 1; }

.container { max-width: 1080px; margin: 0 auto; padding: 32px 24px; }
.container-narrow { max-width: 460px; margin: 0 auto; padding: 48px 24px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.hero {
  text-align: center;
  padding: 96px 24px 64px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 176, 32, 0.12), transparent 60%),
    var(--bg);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 16px; letter-spacing: -0.02em; }
.hero h1 .accent { color: var(--accent); }
.hero p.lead { font-size: 1.15rem; color: var(--text-dim); max-width: 640px; margin: 0 auto 32px; line-height: 1.6; }
.hero .cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero .cta-row .btn { padding: 12px 26px; font-size: 1.02rem; }

.section { padding: 56px 24px; border-top: 1px solid var(--border); }
.section h2 { text-align: center; font-size: 1.7rem; margin-bottom: 40px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; max-width: 960px; margin: 0 auto; }
.step { text-align: center; }
.step .num {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #14100a;
  display: flex; align-items: center; justify-content: center; font-weight: 800; margin: 0 auto 14px;
}
.step h3 { margin: 0 0 8px; }
.step p { color: var(--text-dim); margin: 0; line-height: 1.5; }

.faq-list { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 20px;
}
.faq-item summary { padding: 14px 0; cursor: pointer; font-weight: 600; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+"; display: inline-block; width: 18px; color: var(--accent); font-weight: 800; }
.faq-item[open] summary::before { content: "\2212"; }
.faq-item p { color: var(--text-dim); line-height: 1.6; margin: 0 0 16px; }

.disclaimer {
  max-width: 760px;
  margin: 0 auto;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
  text-align: center;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  background: var(--bg-elev);
}

.error-box {
  background: rgba(255, 92, 108, 0.12);
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 14px 0;
  font-size: 0.9rem;
}
.info-box {
  background: rgba(77, 139, 255, 0.12);
  border: 1px solid var(--blue);
  color: var(--blue);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 14px 0;
  font-size: 0.9rem;
}
.success-box {
  background: rgba(53, 214, 138, 0.12);
  border: 1px solid var(--green);
  color: var(--green);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 14px 0;
  font-size: 0.9rem;
}

.page-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title h1 { margin: 0; font-size: 1.6rem; }

.battle-list { display: flex; flex-direction: column; gap: 12px; }
.battle-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px;
  flex-wrap: wrap; gap: 12px;
}
.battle-row .stake { font-weight: 800; color: var(--accent); font-size: 1.1rem; }
.battle-row .creator { color: var(--text-dim); }

.status-badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-dim);
}
.status-badge.open { color: var(--blue); border-color: var(--blue); }
.status-badge.awaiting_ready, .status-badge.matching { color: var(--accent); border-color: var(--accent); }
.status-badge.awaiting_battle { color: var(--accent); border-color: var(--accent); }
.status-badge.completed { color: var(--green); border-color: var(--green); }
.status-badge.cancelled { color: var(--text-dim); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.stat-card .label { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 6px; }
.stat-card .value { font-size: 1.5rem; font-weight: 800; }

.empty-state { text-align: center; padding: 48px 24px; color: var(--text-dim); }

.history-table { width: 100%; border-collapse: collapse; }
.history-table th, .history-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.history-table th { color: var(--text-dim); font-weight: 600; }

.qr-box {
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  width: 180px;
  margin: 12px auto;
}
.qr-box svg, .qr-box img { display: block; width: 100%; height: 100%; }

.code-box {
  font-family: "Cascadia Code", Consolas, monospace;
  background: var(--bg-elev);
  border: 1px dashed var(--accent);
  color: var(--accent);
  padding: 14px;
  border-radius: 8px;
  font-size: 1.2rem;
  text-align: center;
  letter-spacing: 0.05em;
  word-break: break-all;
  margin: 12px 0;
}

.lang-switcher { position: relative; list-style: none; }
.lang-switcher summary {
  list-style: none;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  user-select: none;
}
.lang-switcher summary::-webkit-details-marker { display: none; }
.lang-switcher .lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 20;
}
.lang-menu button {
  background: transparent;
  color: var(--text);
  font-weight: 500;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
}
.lang-menu button:hover { background: var(--bg-elev); opacity: 1; }
.lang-menu button.active { color: var(--accent); font-weight: 700; }

.muted { color: var(--text-dim); }
.center { text-align: center; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.spacer { flex: 1; }

.announcement-item { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.announcement-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.chat-messages { display: flex; flex-direction: column; gap: 10px; }
.chat-row { display: flex; flex-direction: column; }
.chat-row.mine { align-items: flex-end; }
.chat-row.admin { align-items: flex-start; }
.chat-bubble {
  max-width: 80%; padding: 8px 12px; border-radius: 10px; font-size: 0.9rem;
  word-break: break-word; white-space: pre-wrap;
}
.chat-row.mine .chat-bubble { background: var(--accent); color: #14100a; }
.chat-row.admin .chat-bubble { background: var(--bg-elev); border: 1px solid var(--border); }
