:root {
  color-scheme: dark;
  --bg: #050607;
  --screen: #090b0d;
  --panel: #121518;
  --panel-2: #181c20;
  --line: #252a30;
  --line-soft: #1c2024;
  --ink: #f6f7f8;
  --muted: #8e969f;
  --soft: #c4c9ce;
  --red: #f01625;
  --red-2: #bd101d;
  --green: #13c269;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

button,
input,
select,
textarea {
  color: var(--ink);
}

.app-frame {
  width: min(100%, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--screen);
}

.screen {
  min-height: 100vh;
  padding: 20px 14px 92px;
}

.view-stack {
  display: grid;
  gap: 16px;
}

.app-header,
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.app-header h1,
.detail-header h1 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.2;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.icon-button,
.back-button,
.text-link,
.room-arrow {
  border: 0;
  background: transparent;
  color: var(--ink);
}

.icon-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 0.84rem;
  font-weight: 800;
}

.back-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  font-size: 1.7rem;
  line-height: 1;
}

.search-mark {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.search-mark::after {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 8px;
  height: 2px;
  border-radius: 99px;
  background: var(--ink);
  content: "";
  transform: rotate(45deg);
}

.league-rail {
  display: grid;
  grid-auto-columns: 76px;
  grid-auto-flow: column;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 7px;
  scrollbar-width: none;
}

.league-rail::-webkit-scrollbar {
  display: none;
}

.league-pill {
  display: grid;
  gap: 7px;
  justify-items: center;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 4px 0 9px;
  font-size: 0.68rem;
  font-weight: 800;
}

.league-pill.is-active {
  border-bottom-color: var(--red);
  color: var(--ink);
}

.league-logo {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #343a40;
  border-radius: 50%;
  background: #191e22;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 950;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.section-row h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-row.compact h2 {
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
}

.section-row span,
.text-link {
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 850;
}

.match-list,
.room-list,
.comment-list,
.goal-list,
.admin-list {
  display: grid;
  gap: 10px;
}

.live-card,
.compact-card,
.room-card,
.dark-panel,
.profile-card,
.admin-card,
.poll-hero {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)), var(--panel);
  box-shadow: var(--shadow);
}

.live-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  padding: 13px;
}

.teams-block {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.team-score {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.team-score strong {
  overflow: hidden;
  font-size: 0.96rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-score span:last-child {
  font-size: 1.35rem;
  font-weight: 950;
}

.match-side {
  display: grid;
  align-content: center;
  gap: 12px;
  min-width: 64px;
  text-align: right;
}

.minute-badge {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 950;
}

.minute-badge.is-live {
  color: var(--red);
}

.chat-link {
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 950;
}

.debate-card {
  min-height: 150px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background:
    linear-gradient(110deg, rgba(10, 12, 14, 0.96) 0 45%, rgba(240, 22, 37, 0.28)),
    linear-gradient(45deg, #181114, #101315);
  box-shadow: var(--shadow);
}

.debate-card.is-large {
  min-height: 174px;
}

.debate-content {
  display: grid;
  align-content: center;
  gap: 10px;
  width: min(78%, 360px);
  min-height: inherit;
  padding: 18px;
}

.debate-content span,
.tiny-label {
  color: var(--soft);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.debate-content h2 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.red-button,
.ghost-button,
.wide-action {
  min-height: 42px;
  border-radius: var(--radius);
  padding: 0 14px;
  font-weight: 900;
}

.red-button {
  width: fit-content;
  min-width: 94px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
}

.red-button:hover {
  background: var(--red-2);
}

.ghost-button,
.wide-action {
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.wide-action {
  width: 100%;
}

.wide-action.danger,
.danger {
  border-color: rgba(240, 22, 37, 0.38);
  color: #ff6670;
}

.compact-card,
.room-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.compact-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.compact-card div,
.room-card div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.compact-card strong,
.room-card strong {
  overflow-wrap: anywhere;
  font-size: 0.95rem;
}

.compact-card span,
.room-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.room-arrow {
  min-width: 30px;
  color: var(--soft);
  font-size: 1.5rem;
}

.detail-screen {
  gap: 12px;
}

.detail-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.detail-header h1 {
  text-align: center;
  font-size: 0.92rem;
}

.score-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 0 6px;
}

.hero-team,
.hero-score {
  display: grid;
  gap: 7px;
  justify-items: center;
  min-width: 0;
}

.hero-team strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-score strong {
  font-size: 1.45rem;
  letter-spacing: 0;
}

.hero-score span {
  min-height: 20px;
  border-radius: 999px;
  background: var(--red);
  padding: 2px 9px;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 950;
}

.live-dot {
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.58;
  }
}

.detail-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-soft);
}

.detail-tabs button {
  min-height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.detail-tabs button.is-active {
  border-bottom-color: var(--red);
  color: var(--ink);
}

.dark-panel,
.poll-hero,
.profile-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.dark-panel h2,
.profile-card h2,
.poll-hero h1 {
  margin: 0;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.poll-panel {
  gap: 9px;
}

.poll-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101316;
  padding: 9px;
  text-align: left;
}

.poll-option.is-selected {
  border-color: rgba(240, 22, 37, 0.8);
  background: rgba(240, 22, 37, 0.08);
}

.poll-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 900;
}

.poll-stats {
  display: grid;
  gap: 5px;
  min-width: 82px;
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: right;
}

.poll-stats i {
  display: block;
  justify-self: end;
  height: 4px;
  max-width: 82px;
  border-radius: 99px;
  background: var(--red);
}

.goal-card {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  border: 1px solid rgba(240, 22, 37, 0.22);
  border-radius: var(--radius);
  background: rgba(240, 22, 37, 0.06);
  padding: 10px;
}

.goal-card strong {
  color: #ff616b;
}

.chat-panel {
  display: grid;
  gap: 12px;
}

.comment-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 0;
}

.comment-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.comment-head,
.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.comment-head span,
.comment-meta {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.comment-card p {
  margin: 0;
  color: #e7eaed;
  line-height: 1.38;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-box {
  position: sticky;
  bottom: 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 21, 24, 0.96);
  padding: 8px;
  backdrop-filter: blur(14px);
}

.message-box textarea {
  min-height: 42px;
  max-height: 120px;
  resize: vertical;
}

.message-box button {
  border: 0;
  border-radius: var(--radius);
  background: var(--red);
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.form-grid,
.auth-grid,
.action-list {
  display: grid;
  gap: 10px;
}

.split-grid,
.button-row,
.goal-form {
  display: grid;
  gap: 8px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 850;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d1013;
  padding: 10px;
  outline: 0;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(240, 22, 37, 0.74);
}

.check-row {
  display: flex;
  flex-direction: row;
  gap: 9px;
  align-items: center;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.team-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d1013;
  padding: 8px;
  text-align: left;
}

.team-choice span {
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  font-weight: 850;
}

.team-choice.is-selected {
  border-color: var(--red);
  background: rgba(240, 22, 37, 0.08);
}

.step-line {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.step-line i {
  height: 5px;
  border-radius: 99px;
  background: var(--line);
}

.step-line i.is-active {
  background: var(--red);
}

.profile-card {
  justify-items: center;
  text-align: center;
}

.profile-card p {
  margin: 0;
  color: var(--soft);
}

.profile-card span {
  color: var(--muted);
  font-weight: 800;
}

.admin-screen {
  padding-bottom: 20px;
}

.admin-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.admin-card-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.admin-card-head strong {
  overflow-wrap: anywhere;
}

.live-tag,
.muted-tag {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 950;
}

.live-tag {
  background: rgba(19, 194, 105, 0.14);
  color: var(--green);
}

.muted-tag {
  background: #24282d;
  color: var(--muted);
}

.goal-form {
  grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr) 64px;
}

.goal-form .red-button {
  min-width: 0;
  width: 100%;
  padding: 0 8px;
}

.soft-note,
.empty-dark {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.empty-dark {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.mini-user {
  display: inline-flex;
  max-width: 142px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0d1013;
  padding: 5px 8px 5px 5px;
}

.mini-user span:last-child {
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.username {
  font-weight: 950;
}

.crest {
  --team-a: #333;
  --team-b: #eee;
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--team-a) 0 49%, var(--team-b) 49% 100%);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 950;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.62);
}

.crest img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.crest.tiny {
  width: 28px;
  height: 28px;
  font-size: 0.56rem;
}

.crest.small {
  width: 36px;
  height: 36px;
}

.crest.medium {
  width: 54px;
  height: 54px;
  font-size: 0.82rem;
}

.crest.large {
  width: 82px;
  height: 82px;
  font-size: 1rem;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 1180px);
  margin: 0 auto;
  border-top: 1px solid var(--line-soft);
  background: rgba(9, 11, 13, 0.94);
  padding: 8px max(12px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom));
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  display: grid;
  gap: 3px;
  justify-items: center;
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.bottom-nav span {
  font-size: 1.1rem;
  line-height: 1;
}

.bottom-nav button.is-active {
  color: var(--red);
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 88px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 28px));
  transform: translateY(12px);
  border: 1px solid rgba(240, 22, 37, 0.5);
  border-radius: var(--radius);
  background: #1a0d10;
  color: #fff;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (min-width: 700px) {
  .screen {
    padding: 28px 24px 102px;
  }

  .view-stack {
    max-width: 620px;
    margin: 0 auto;
  }

  .auth-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .split-grid {
    grid-template-columns: 1fr 1fr;
  }

  .split-grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .button-row {
    grid-template-columns: 1fr 1fr;
  }

  .team-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 980px) {
  .app-frame {
    background:
      linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.02)),
      var(--screen);
  }

  .view-stack {
    max-width: 720px;
  }

  .admin-screen {
    max-width: 960px;
  }
}

@media (max-width: 380px) {
  .team-score strong {
    font-size: 0.86rem;
  }

  .goal-form {
    grid-template-columns: 1fr 54px;
  }

  .goal-form select,
  .goal-form input[name="scorer"] {
    grid-column: 1 / -1;
  }
}
