:root {
  color-scheme: dark;
  --bg: #080a0d;
  --surface: #101318;
  --surface-raised: #161a20;
  --surface-soft: #1b2027;
  --text: #f5f3ef;
  --muted: #8e949d;
  --line: #282d35;
  --signal: #f05a32;
  --signal-soft: #3a1c16;
  --success: #5ed6a1;
  --danger: #e66363;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--text); background: var(--bg); overflow-x: hidden; }
button, input, textarea, select { font: inherit; }
button { margin: 0; border-radius: 0; appearance: none; -webkit-appearance: none; -webkit-tap-highlight-color: transparent; }
.signal-glow { position: fixed; inset: -140px -120px auto auto; width: 280px; height: 280px; border-radius: 50%; background: #9b2c16; filter: blur(110px); opacity: .16; pointer-events: none; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: max(12px, var(--tg-content-safe-area-inset-top, 0px)) max(18px, var(--tg-content-safe-area-inset-right, 0px)) 10px max(18px, var(--tg-content-safe-area-inset-left, 0px));
  background: linear-gradient(#080a0df2 72%, #080a0d00);
  backdrop-filter: blur(18px);
}
.brand { display: flex; gap: 11px; align-items: center; padding: 0; border: 0; color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid #744333; border-radius: 10px; background: linear-gradient(145deg, #2a1712, #15171b); color: var(--signal); box-shadow: inset 0 1px #ffffff0a, 0 7px 20px #0005; font-size: 15px; font-weight: 900; }
.brand-copy { min-width: 0; }
.brand b, .brand small { display: block; line-height: 1; letter-spacing: .13em; }
.brand b { font-size: 11px; }
.brand small { margin-top: 5px; color: #777e88; font-size: 7px; }
.round-button { display: grid; width: 40px; height: 40px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(145deg, #171b20, #0f1216); color: #c8cbd0; box-shadow: inset 0 1px #ffffff08; cursor: pointer; }
.round-button svg { width: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }

.shell { position: relative; z-index: 2; width: min(100%, 760px); min-height: calc(100vh - 150px); min-height: calc(100dvh - 150px); margin: auto; padding: 8px max(18px, var(--tg-content-safe-area-inset-right, 0px)) calc(96px + max(var(--tg-safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px))) max(18px, var(--tg-content-safe-area-inset-left, 0px)); }
.bottom-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-flow: column; align-items: stretch; min-height: 70px; padding: 6px max(6px, var(--tg-safe-area-inset-right, 0px)) calc(6px + max(var(--tg-safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px))) max(6px, var(--tg-safe-area-inset-left, 0px)); overflow: hidden; border-top: 1px solid #262b32; background: #0b0e12f7; box-shadow: 0 -12px 32px #0008; backdrop-filter: blur(22px); }
.bottom-nav .nav-item { position: relative; display: flex; min-width: 0; min-height: 56px; flex-direction: column; flex-wrap: nowrap; gap: 4px; align-items: center; justify-content: center; padding: 5px 1px 4px; overflow: hidden; border: 0; border-radius: 11px; outline: 0; background: transparent; color: #747b86; font-size: 9px; font-weight: 700; line-height: 1; white-space: nowrap; cursor: pointer; }
.bottom-nav .nav-item::before { position: absolute; top: 0; width: 24px; height: 2px; border-radius: 0 0 3px 3px; background: transparent; content: ""; }
.bottom-nav svg { display: block; width: 21px; height: 21px; flex: 0 0 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.bottom-nav [data-route="play"] svg { fill: currentColor; stroke: none; }
.bottom-nav .nav-item > span { display: block; width: 100%; overflow: hidden; text-align: center; text-overflow: ellipsis; }
.bottom-nav .nav-item.active { background: linear-gradient(180deg, #f05a320e, transparent); color: #f1eee9; }
.bottom-nav .nav-item.active::before { background: var(--signal); box-shadow: 0 0 12px #f05a3288; }
.bottom-nav .nav-item.active svg { color: #ff704c; filter: drop-shadow(0 0 6px #f05a3244); }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(28px, 8vw, 48px); line-height: .98; letter-spacing: -.045em; }
h2 { margin: 4px 0 0; font-size: 21px; letter-spacing: -.025em; }
h3 { margin-bottom: 7px; font-size: 17px; letter-spacing: -.015em; }
.kicker { color: var(--signal); font-size: 9px; font-weight: 900; letter-spacing: .19em; }
.quiet, .club-description, .form-note { color: var(--muted); font-size: 13px; line-height: 1.55; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.content-section { margin-top: 30px; }

.competitive-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 22px 0 20px; }
.hero-identity { min-width: 0; }
.hero-identity h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-identity p { margin: 0; color: var(--muted); font-size: 12px; }
.avatar { display: grid; flex: 0 0 auto; width: 42px; height: 42px; place-items: center; overflow: hidden; border: 1px solid #4d342d; border-radius: 13px; background: linear-gradient(145deg, #382018, #16191e); color: #ffd8cb; font-size: 13px; font-weight: 900; }
.avatar-large { width: 68px; height: 68px; border-radius: 20px; font-size: 20px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.level-badge { min-width: 58px; padding-left: 14px; border-left: 1px solid var(--line); text-align: center; }
.level-badge small { display: block; color: var(--muted); font-size: 7px; letter-spacing: .12em; }
.level-badge strong { color: var(--signal); font-size: 30px; }
.context-chip { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: #0e1115; color: var(--muted); text-align: left; font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.metric { min-width: 0; padding: 15px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.metric span, .metric small { display: block; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.metric strong { display: block; margin: 8px 0 5px; overflow: hidden; font-size: 23px; letter-spacing: -.04em; text-overflow: ellipsis; }
.metric-accent { border-color: #593326; background: linear-gradient(145deg, #23140f, #111419); }
.metric-accent strong { color: #ff7954; }

.feature-card, .competition-card, .rule-card, .rating-banner { position: relative; width: 100%; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); text-align: left; }
.event-feature { min-height: 150px; background: linear-gradient(125deg, #21130f, #12151a 58%); }
.feature-card h3 { width: 78%; margin: 20px 0 6px; font-size: 21px; }
.feature-card p, .competition-card p, .rule-card p { margin: 0; color: var(--muted); font-size: 12px; }
.capacity { position: absolute; right: 18px; bottom: 18px; color: var(--signal); font-size: 20px; }
.status-pill { display: inline-flex; padding: 5px 8px; border: 1px solid #563326; border-radius: 7px; background: var(--signal-soft); color: #ff9a7c; font-size: 8px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.form-strip { display: flex; gap: 8px; }
.form-strip span { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; font-size: 12px; font-weight: 900; }
.form-strip .win { border: 1px solid #285e4a; background: #102c23; color: var(--success); }
.form-strip .loss { border: 1px solid #5d2d2d; background: #2b1414; color: var(--danger); }
.badge-track { display: grid; grid-auto-columns: minmax(145px, 1fr); grid-auto-flow: column; gap: 9px; overflow-x: auto; scrollbar-width: none; }
.achievement { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.achievement-icon { display: block; margin-bottom: 20px; color: var(--signal); }
.achievement b, .achievement small { display: block; }
.achievement small { margin-top: 5px; color: var(--muted); font-size: 10px; }

.segmented { display: flex; gap: 3px; margin: 15px 0 18px; padding: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: #0d1014; scrollbar-width: none; }
.segmented button { flex: 1 0 auto; padding: 9px 12px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 11px; font-weight: 800; }
.segmented button.active { background: var(--surface-soft); color: var(--text); box-shadow: 0 2px 8px #0006; }
.competition-card { margin-bottom: 10px; }
.competition-card h3 { margin: 16px 0 6px; font-size: 19px; }
.card-top { display: flex; justify-content: space-between; }
.slot-count { color: var(--text); font-size: 12px; font-weight: 800; }
.detail-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.detail-list span { padding: 6px 8px; border-radius: 7px; background: #1b2026; color: #aeb3bb; font-size: 9px; }
.registration-state { display: block; margin-top: 14px; color: var(--success); font-size: 11px; font-weight: 800; }

.rating-banner { margin: 15px 0 12px; background: linear-gradient(125deg, #21140f, #111419); }
.rating-banner h3 { margin: 10px 0 3px; font-size: 22px; }
.rating-banner p { margin: 0; color: var(--muted); font-size: 11px; }
.leaderboard { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.leader-row { display: grid; grid-template-columns: 28px 42px 1fr auto; gap: 10px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); }
.leader-row:last-child { border-bottom: 0; }
.leader-row.current { background: #291811; box-shadow: inset 3px 0 var(--signal); }
.rank { color: var(--muted); text-align: center; font-size: 12px; }
.player-cell { min-width: 0; }
.player-cell b, .player-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-cell b { font-size: 13px; }
.player-cell small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.rating-value { color: var(--signal); font-size: 15px; }

.search-input { width: 100%; padding: 14px 15px; border: 1px solid var(--line); outline: none; border-radius: 13px; background: var(--surface); color: var(--text); }
.search-input:focus { border-color: #70402f; box-shadow: 0 0 0 3px #f05a3214; }
.search-large { margin-top: 12px; font-size: 16px; }
.club-list { margin-top: 13px; }
.club-card { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; width: 100%; margin-bottom: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); text-align: left; }
.club-card-copy { min-width: 0; }
.club-card h3 { margin: 0; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.club-card p, .club-card small { display: block; margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.chevron { color: var(--muted); font-size: 25px; }

.club-hero { display: grid; grid-template-columns: auto 1fr; gap: 15px; align-items: center; padding: 22px 0 12px; }
.club-title h1 { margin-top: 5px; }
.club-title p { margin: 0; color: var(--muted); font-size: 11px; }
.club-description { margin: 10px 0 24px; }
.club-metrics { margin-bottom: 28px; }
.rule-card { margin-bottom: 9px; }
.rule-card h3 { margin: 13px 0 4px; }
.secondary-button, .primary-button { padding: 11px 14px; border-radius: 11px; font-size: 11px; font-weight: 800; }
.secondary-button { margin-top: 14px; border: 1px solid var(--line); background: var(--surface-soft); color: var(--text); }
.primary-button { border: 1px solid #d54b28; background: var(--signal); color: #fff; }
.full-button { width: 100%; margin-top: 18px; padding: 14px; }
.primary-button:disabled { opacity: .45; }
.event-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.event-actions .secondary-button { margin-top: 0; }
.event-actions .text-button { grid-column: 1 / -1; border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.onboarding-success { padding: 28px 20px; text-align: center; }
.onboarding-success h1 { margin: 14px 0 8px; }
.onboarding-success p { margin: 0 0 24px; color: var(--muted); }
.onboarding-success button + button { margin-top: 10px; }

.profile-hero { display: flex; flex-direction: column; align-items: center; padding: 24px 0 13px; text-align: center; }
.profile-hero .avatar { margin-bottom: 15px; }
.profile-hero h1 { margin-top: 7px; }
.profile-hero > p { max-width: 440px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.identity-lines { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.identity-lines span { padding: 6px 8px; border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 9px; }
.profile-metrics { margin-top: 18px; }
.role-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.role-grid article { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.role-grid span, .role-grid small { display: block; color: var(--muted); font-size: 9px; }
.role-grid strong { display: block; margin: 6px 0 3px; font-size: 19px; }

.edit-form { max-width: 560px; margin: auto; }
.form-field { display: block; margin-bottom: 13px; }
.form-field > span { display: block; margin-bottom: 7px; color: #b7bbc1; font-size: 10px; font-weight: 700; }
.form-field input:not([type="checkbox"]), .form-field textarea, .form-field select { width: 100%; padding: 13px 14px; border: 1px solid var(--line); outline: none; border-radius: 11px; background: var(--surface); color: var(--text); }
.form-field textarea { min-height: 105px; resize: vertical; }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: #70402f; }
.form-field input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--signal); }
.form-note { margin: 16px 0; }

.empty-state { display: flex; min-height: 150px; flex-direction: column; align-items: center; justify-content: center; padding: 24px; border: 1px dashed #30363f; border-radius: 17px; background: #0d1014; text-align: center; }
.empty-state h3 { margin: 10px 0 5px; }
.empty-state p { max-width: 330px; margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.empty-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #5f3427; border-radius: 10px; color: var(--signal); font-weight: 900; }
.error-state { margin-top: 12vh; }
.error-state .primary-button { margin-top: 18px; }
.loading-state { padding-top: 15px; }
.skeleton { position: relative; overflow: hidden; border-radius: 16px; background: #15191e; }
.skeleton::after { position: absolute; inset: 0; background: linear-gradient(100deg, transparent, #ffffff08, transparent); content: ""; animation: shimmer 1.3s infinite; transform: translateX(-100%); }
.hero-skeleton { height: 110px; }
.line-skeleton { width: 55%; height: 20px; margin: 24px 0 12px; }
.card-skeleton { height: 120px; margin-top: 10px; }
.search-results { margin-top: 18px; }
.search-result { width: 100%; padding: 13px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--text); text-align: left; }

@keyframes shimmer { to { transform: translateX(100%); } }
@media(max-width:520px) {
  .shell { padding-right: 14px; padding-left: 14px; }
  .topbar { padding-right: 14px; padding-left: 14px; }
  .competitive-hero { gap: 11px; }
  .avatar-large { width: 61px; height: 61px; }
  .metric { padding: 13px 9px; }
  .metric strong { font-size: 20px; }
  .bottom-nav .nav-item { font-size: 9px; }
}
@media(min-width:760px) {
  .shell { padding-top: 22px; }
  .bottom-nav { right: 50%; left: auto; width: 580px; transform: translateX(50%); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; }
}
@media(prefers-reduced-motion:reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
