:root {
  --bg: #090909;
  --surface: #141414;
  --surface-2: #1b1b1b;
  --line: rgba(255, 232, 163, .14);
  --gold: #e2bc61;
  --gold-light: #fff0a9;
  --gold-deep: #9f7625;
  --text: #f8f5ed;
  --muted: #918e87;
  --danger: #dc6f64;
  --radius: 24px;
  --nav-height: 88px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% -10%, rgba(226, 188, 97, .16), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
.app-shell { width: min(100%, 760px); min-height: 100vh; margin: 0 auto; position: relative; }
.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 22px 10px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 45px; height: 45px; border-radius: 14px; object-fit: cover; border: 1px solid var(--line); }
.brand div { display: grid; }
.brand span { font-family: Oswald, sans-serif; font-size: 21px; font-weight: 700; letter-spacing: .12em; }
.brand small { color: var(--gold); letter-spacing: .2em; font-size: 8px; font-weight: 800; }
.icon-button { border: 0; background: var(--surface); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.icon-button svg, .nav-item svg { fill: none; stroke: currentColor; stroke-width: 1.8; width: 23px; }
main { padding: 8px 18px calc(var(--nav-height) + 38px); }
.screen { display: none; animation: reveal .28s ease both; }
.screen.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(7px); } }

.hero {
  position: relative;
  min-height: 330px;
  padding: 30px;
  border-radius: 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), transparent 32%),
    linear-gradient(145deg, #2f250e 0%, #14110a 46%, #0e0e0e 100%);
  border: 1px solid rgba(255, 224, 132, .22);
  box-shadow: inset 0 0 70px rgba(226,188,97,.08), 0 20px 60px rgba(0,0,0,.3);
}
.hero::before {
  content: "R";
  position: absolute;
  right: -12px;
  top: -72px;
  font-family: Oswald, sans-serif;
  font-size: 350px;
  font-weight: 700;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 222, 123, .13);
  transform: rotate(-8deg);
}
.hero::after {
  content: "♠";
  position: absolute;
  right: 42px;
  bottom: 18px;
  color: rgba(226, 188, 97, .09);
  font-size: 120px;
}
.eyebrow { color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.hero h1, .page-title, .section-title, .tournament-title {
  font-family: Oswald, sans-serif;
  text-transform: uppercase;
  font-weight: 700;
}
.hero h1 { max-width: 430px; margin: 12px 0 9px; font-size: clamp(44px, 12vw, 72px); line-height: .94; letter-spacing: -.03em; }
.hero p { color: #c7c0ae; font-size: 14px; max-width: 360px; margin: 0 0 23px; line-height: 1.55; }
.primary-button, .secondary-button {
  position: relative;
  z-index: 1;
  border: 0;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 16px;
  font-weight: 800;
  cursor: pointer;
}
.primary-button { color: #17130b; background: linear-gradient(135deg, var(--gold-light), var(--gold)); box-shadow: 0 9px 30px rgba(226,188,97,.18); }
.secondary-button { background: #242321; border: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 32px 2px 14px; }
.section-title, .page-title { margin: 0; font-size: 29px; letter-spacing: .01em; }
.page-title { font-size: 48px; line-height: 1; margin: 16px 2px 24px; }
.text-button { border: 0; background: none; color: var(--gold); font-weight: 700; font-size: 13px; cursor: pointer; }

.tournament-list { display: grid; gap: 14px; }
.tournament-card {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #1c1b19, #111);
}
.tournament-card::after { content: attr(data-mark); position: absolute; right: 10px; top: -34px; font-size: 180px; color: rgba(226,188,97,.055); font-family: Georgia, serif; transform: rotate(8deg); }
.tournament-card.gold { background: linear-gradient(145deg, rgba(90,67,19,.6), #17140e 58%, #111); }
.tournament-card.tournament-link { cursor: pointer; }
.tournament-title { position: relative; z-index: 1; font-size: 31px; line-height: 1; margin: 4px 0 7px; max-width: 72%; }
.tournament-subtitle { position: relative; z-index: 1; color: var(--muted); font-size: 12px; }
.chip-row { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 27px; }
.chip { display: inline-flex; align-items: center; min-height: 35px; padding: 0 12px; border-radius: 999px; background: rgba(255,255,255,.07); color: #ddd8cd; font-size: 12px; font-weight: 700; }
.chip.gold { color: #211a0d; background: var(--gold); }
.register-button { position: relative; z-index: 1; margin-top: 17px; width: 100%; }
.tournament-details { position:relative; z-index:2; margin-top:16px; border-top:1px solid rgba(255,255,255,.08); padding-top:13px; }
.tournament-details summary { color:var(--gold-light); font-size:12px; font-weight:800; cursor:pointer; }
.detail-grid { display:grid; gap:7px; margin-top:13px; }
.detail-grid span,.addon-info span { color:#c2bdb3; font-size:11px; line-height:1.45; }
.tournament-details p { color:var(--muted); font-size:11px; line-height:1.55; margin:13px 0; }
.addon-info { display:grid; gap:6px; margin-top:12px; }.addon-info b{color:var(--gold);font-size:11px;text-transform:uppercase;}

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick-card { border: 1px solid var(--line); background: var(--surface); padding: 20px; border-radius: 22px; min-height: 126px; cursor: pointer; text-align: left; }
.quick-card b { display: block; font-family: Oswald, sans-serif; font-size: 22px; text-transform: uppercase; margin-bottom: 8px; }
.quick-card span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.gold-icon { color: var(--gold); font-size: 23px; margin-bottom: 14px; display: block; }

.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.filter-pill { height: 48px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: #d5d0c5; font-weight: 700; }
.filter-pill.active { background: var(--gold); color: #18130a; }
.search { width: 100%; height: 52px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); padding: 0 18px; outline: none; margin-bottom: 16px; }
.search:focus { border-color: rgba(226,188,97,.6); }
.ranking { overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.rank-row { display: grid; grid-template-columns: 30px 44px 1fr auto; gap:10px; align-items: center; min-height: 74px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.055); }
.rank-row:last-child { border-bottom: 0; }
.rank-number { color: var(--muted); font-weight: 800; }
.rank-row:nth-child(-n+3) .rank-number { color: var(--gold); }
.rank-avatar { width:42px; height:42px; border-radius:50%; display:grid; place-items:center; overflow:hidden; background:#332c1b; color:var(--gold-light); font-size:11px; font-weight:800; }
.rank-avatar img { width:100%; height:100%; object-fit:cover; }
.rank-name { font-weight: 700; }
.achievement-badge{display:inline-block;margin-left:3px;font-size:.9em;vertical-align:baseline}
.rank-meta { color: var(--muted); font-size: 11px; margin-top: 4px; }
.rank-score { text-align: right; font-family: Oswald, sans-serif; font-size: 21px; color: var(--gold-light); }

.profile-card { border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(145deg, #1c1a15, #121212); padding: 25px; }
.profile-head { display: flex; align-items: center; gap: 17px; }
.profile-identity { min-width:0; flex:1; }
.profile-name-row { display:flex; align-items:center; gap:8px; }
.name-edit { flex:0 0 auto; width:29px; height:29px; border:1px solid var(--line); border-radius:50%; background:#242321; color:var(--gold); cursor:pointer; }
.avatar-wrap { position:relative; flex:0 0 auto; }
.avatar { width: 82px; height: 82px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold-light), var(--gold-deep)); color: #16120b; font-family: Oswald; font-size: 32px; font-weight: 700; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-edit { position:absolute; right:-3px; bottom:-3px; width:31px; height:31px; border:2px solid #171510; border-radius:50%; background:var(--gold); color:#16120b; font-weight:900; cursor:pointer; }
.profile-name { font-family: Oswald; font-size: 30px; font-weight: 700; text-transform: uppercase; }
.profile-place { color: var(--gold); font-size: 12px; font-weight: 700; margin-top: 4px; }
.registration-state { margin-top:21px; padding-top:18px; border-top:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:14px; }
.registration-state div { display:grid; gap:5px; }.registration-state b{font-size:13px}.registration-state span{color:var(--muted);font-size:10px;line-height:1.4}.registration-state .primary-button{min-height:42px;padding:0 15px;font-size:11px;white-space:nowrap}.verified-mark{display:grid!important;place-items:center;width:34px;height:34px;border-radius:50%;background:var(--gold);color:#17130a!important;font-size:18px!important;font-weight:900}
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin-top: 18px; }
.stat { min-height: 105px; border-radius: 20px; padding: 18px; background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font-family: Oswald; font-size: 29px; color: var(--gold-light); }
.stat span { color: var(--muted); font-size: 12px; }
.progress-title { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.progress { margin-top: 13px; height: 5px; background: #292929; border-radius: 10px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold-light)); }

.bottom-nav {
  position: fixed;
  z-index: 20;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 710px);
  height: var(--nav-height);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 27px;
  background: rgba(22,22,22,.92);
  backdrop-filter: blur(24px);
  box-shadow: 0 18px 55px rgba(0,0,0,.55);
}
.nav-item { border: 0; border-radius: 20px; background: transparent; color: #77746e; display: flex; flex-direction: column; gap: 5px; align-items: center; justify-content: center; cursor: pointer; }
.nav-item span { font-size: 10px; font-weight: 700; }
.nav-item.active { background: #292824; color: var(--gold-light); }
.toast { position: fixed; z-index: 40; left: 50%; top: 22px; transform: translate(-50%, -20px); max-width: calc(100% - 40px); background: var(--gold-light); color: #17120a; padding: 13px 18px; border-radius: 14px; font-size: 13px; font-weight: 800; opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-open { overflow: hidden; }
.modal-backdrop { position:fixed; z-index:50; inset:0; display:grid; place-items:center; padding:20px; background:rgba(0,0,0,.72); backdrop-filter:blur(9px); }
.modal-backdrop[hidden] { display:none; }
.app-modal { width:min(100%, 440px); padding:24px; border:1px solid rgba(255,224,132,.22); border-radius:26px; background:linear-gradient(145deg,#211d13,#121212 58%); box-shadow:0 24px 80px rgba(0,0,0,.65); animation:modal-in .2s ease both; }
.modal-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.modal-head h2 { margin:7px 0 0; font-family:Oswald,sans-serif; font-size:30px; line-height:1; text-transform:uppercase; }
.modal-close { flex:0 0 auto; width:38px; height:38px; border:1px solid var(--line); border-radius:50%; background:#292722; color:var(--muted); font-size:25px; line-height:1; cursor:pointer; }
.nickname-modal-form { display:grid; gap:10px; margin-top:25px; }
.nickname-modal-form label { color:var(--gold-light); font-size:12px; font-weight:800; }
.nickname-modal-form input { width:100%; height:54px; border:1px solid var(--line); border-radius:16px; padding:0 16px; outline:none; background:#0e0e0e; color:var(--text); font-size:16px; }
.nickname-modal-form input:focus { border-color:var(--gold); box-shadow:0 0 0 3px rgba(226,188,97,.12); }
.nickname-modal-form p { margin:0; color:var(--muted); font-size:11px; line-height:1.45; }
.results-button{margin-top:14px}.results-modal{width:min(100%,560px);max-height:min(82vh,720px);overflow:auto}.tournament-result-head,.tournament-result-row{display:grid;grid-template-columns:48px minmax(130px,1fr) minmax(58px,auto);gap:10px;align-items:center}.tournament-result-head.has-knockouts,.tournament-result-row.has-knockouts{grid-template-columns:48px minmax(110px,1fr) minmax(58px,auto) minmax(58px,auto)}.tournament-result-head{margin-top:24px;padding:0 10px 9px;color:var(--muted);font-size:9px;font-weight:800;text-transform:uppercase}.tournament-result-list{overflow:hidden;border:1px solid var(--line);border-radius:18px}.tournament-result-row{min-height:66px;padding:9px 10px;border-bottom:1px solid rgba(255,255,255,.06)}.tournament-result-row:last-child{border:0}.result-place{font:700 22px Oswald;color:var(--gold)}.result-player{display:flex;align-items:center;gap:9px;min-width:0}.result-player>span{width:36px;height:36px;flex:0 0 auto;display:grid;place-items:center;overflow:hidden;border-radius:50%;background:#332c1b;color:var(--gold-light);font-size:10px;font-weight:800}.result-player img{width:100%;height:100%;object-fit:cover}.result-player b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.tournament-result-row>span{text-align:center;color:#d5d0c5}.tournament-result-row>strong{text-align:right;color:var(--gold-light)}.results-close-button{width:100%;margin-top:16px}
.player-link{cursor:pointer}.rank-row.player-link{width:100%;border:0;color:inherit;text-align:left}.result-player.player-link{border:0;padding:0;background:transparent;color:inherit;text-align:left}.player-modal{width:min(100%,520px);max-height:min(82vh,720px);overflow:auto}.public-player-head{display:flex;align-items:center;gap:14px;margin-top:24px;padding:16px;border:1px solid var(--line);border-radius:18px;background:rgba(255,255,255,.025)}.public-player-head>div:last-child>b{font:700 24px Oswald;text-transform:uppercase}.public-player-avatar{width:64px;height:64px;font-size:17px}.public-player-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:12px}.public-player-stats div{padding:15px 8px;border:1px solid var(--line);border-radius:16px;text-align:center;background:#121212}.public-player-stats b{display:block;color:var(--gold-light);font:700 24px Oswald}.public-player-stats span{color:var(--muted);font-size:9px}.public-achievements{margin-top:22px}.public-achievements h3{font:700 20px Oswald;text-transform:uppercase}.public-achievements>div{display:flex;align-items:center;gap:10px;margin-top:8px;padding:12px;border:1px solid var(--line);border-radius:14px}.public-achievements>div span{font-size:22px}.public-achievements p{color:var(--muted)}
.player-link{font:inherit}
.modal-actions { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:12px; }
@keyframes modal-in { from { opacity:0; transform:translateY(14px) scale(.98); } }
.empty, .loading { color: var(--muted); padding: 40px 10px; text-align: center; }
.skeleton { height: 200px; border-radius: 24px; background: linear-gradient(90deg, #151515 25%, #202020 50%, #151515 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (min-width: 620px) {
  .tournament-list.full { grid-template-columns: 1fr 1fr; }
  .hero { min-height: 390px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 390px) {
  main { padding-inline: 12px; }
  .hero { padding: 24px; min-height: 305px; }
  .tournament-title { font-size: 27px; }
  .nav-item span { display: none; }
  .modal-backdrop { place-items:end center; padding:0; }
  .app-modal { width:100%; padding:24px 18px max(22px,env(safe-area-inset-bottom)); border-radius:26px 26px 0 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
