:root {
  --ink: #17202a;
  --muted: #687386;
  --line: #dfe5ee;
  --surface: #ffffff;
  --surface-soft: #f5f7fb;
  --accent: #e23d35;
  --accent-dark: #b92b25;
  --nav: #111927;
  --gold: #f1b84b;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(226, 61, 53, .11), transparent 32rem),
    linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-navbar {
  background: var(--nav);
  box-shadow: 0 10px 30px rgba(17, 25, 39, .18);
}

.app-navbar .nav-link,
.app-navbar .navbar-brand {
  color: rgba(255, 255, 255, .82);
}

.app-navbar .nav-link.active,
.app-navbar .nav-link:hover,
.app-navbar .navbar-brand:hover {
  color: #fff;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  padding-block: .2rem;
  font-weight: 850;
}

.brand-logo {
  width: 2.85rem;
  height: 2.85rem;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .28));
}

.brand-wordmark {
  color: #fff;
  font-size: 1.22rem;
  letter-spacing: .01em;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .22);
}

.navbar-toggler {
  border-color: rgba(255, 255, 255, .35);
}

.navbar-toggler-icon {
  filter: invert(1);
}

.app-main {
  min-height: calc(100vh - 64px);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .7fr);
  gap: 2rem;
  align-items: stretch;
}

.login-hero,
.login-card,
.soft-panel,
.match-card,
.next-match {
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(223, 229, 238, .95);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(28, 40, 64, .08);
}

.login-hero {
  min-height: 520px;
  display: flex;
  align-items: flex-end;
  padding: clamp(2rem, 5vw, 4rem);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(17, 25, 39, .92), rgba(17, 25, 39, .66)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .08) 0 2px, transparent 2px 16px),
    var(--nav);
}

.hero-copy {
  max-width: 660px;
}

.hero-copy h1,
.page-head h1 {
  font-weight: 850;
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-copy h1 {
  font-size: clamp(2.4rem, 6vw, 5.4rem);
}

.hero-copy p,
.page-head p {
  color: rgba(255, 255, 255, .74);
  font-size: 1.08rem;
  margin: .8rem 0 0;
}

.login-card {
  padding: clamp(1.4rem, 4vw, 2.4rem);
}

.login-card h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 1.4rem;
}

.stack-form {
  display: grid;
  gap: .85rem;
}

.login-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .25rem .85rem;
}

.utility-link {
  margin-top: .35rem;
  padding: .25rem .5rem;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.utility-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.imprint-content {
  color: var(--ink);
  line-height: 1.6;
}

.imprint-content h1,
.imprint-content h2,
.imprint-content h3 {
  margin-top: 1rem;
  font-weight: 850;
}

.note-editor.note-frame {
  border-color: var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.note-editor .note-toolbar {
  background: var(--surface-soft);
}

.btn-accent {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--accent-dark);
  --bs-btn-hover-border-color: var(--accent-dark);
  --bs-btn-focus-shadow-rgb: 226, 61, 53;
  font-weight: 750;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.6rem;
  color: #fff;
  background: linear-gradient(135deg, var(--nav), #273348);
  border-radius: 8px;
}

.page-head h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin: 0;
}

.next-match {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem;
  margin-bottom: 2rem;
  overflow: hidden;
  position: relative;
}

.next-match::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: .45rem;
  background: var(--accent);
}

.mini-label {
  display: block;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 850;
  text-transform: uppercase;
}

.next-match h2 {
  margin: .3rem 0;
  font-weight: 850;
}

.next-match h2 span,
.match-card h3 span {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
  margin: 0 .45rem;
}

.match-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1rem;
  color: var(--muted);
}

.countdown {
  min-width: 11rem;
  padding: 1rem;
  text-align: center;
  color: #fff;
  background: var(--nav);
  border-radius: 8px;
}

.countdown-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 850;
}

.countdown-label {
  display: block;
  color: rgba(255, 255, 255, .68);
  font-size: .85rem;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 1rem 0;
}

.section-title h2 {
  font-size: 1.35rem;
  font-weight: 850;
  margin: 0;
}

.section-title span {
  color: var(--muted);
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.match-card {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  padding: 1.2rem;
}

.match-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: .9rem;
}

.match-card h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .15rem;
  min-height: 4.8rem;
  margin: 0;
  font-size: 1.4rem;
  font-weight: 850;
}

.match-card h3 span {
  width: 100%;
  margin: .2rem 0;
}

.venue-line {
  color: var(--muted);
}

.tip-state {
  padding: .72rem .85rem;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 8px;
}

.tip-state.good {
  color: #17613a;
  background: #e8f7ef;
}

.soft-panel {
  padding: 1rem;
}

.edit-form {
  padding: 1.25rem;
}

.ranking-podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.podium-card {
  min-height: 8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.25rem;
  color: #fff;
  background: var(--nav);
  border-radius: 8px;
}

.podium-card span {
  color: var(--gold);
  font-weight: 850;
}

.podium-card strong {
  font-size: 1.35rem;
}

.podium-card em {
  color: rgba(255, 255, 255, .72);
  font-style: normal;
}

.place-1 {
  background: linear-gradient(135deg, #202b3f, #6f4f12);
}

.rank-number,
.score-pill {
  display: inline-grid;
  place-items: center;
  min-width: 2.15rem;
  height: 2.15rem;
  color: #fff;
  background: var(--nav);
  border-radius: 999px;
  font-weight: 850;
}

.score-pill {
  background: var(--accent);
}

.tip-input-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .75rem;
}

.tip-input-row input {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 850;
}

.tip-input-row span {
  font-size: 2rem;
  font-weight: 850;
}

.tip-admin-form {
  display: inline-grid;
  grid-template-columns: 4.5rem auto 4.5rem auto;
  gap: .35rem;
  align-items: center;
}

.compact-filter {
  max-width: 760px;
}

.import-stat {
  display: grid;
  gap: .15rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}

.import-stat strong {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1;
}

.import-stat span {
  color: var(--muted);
  font-size: .9rem;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, .74);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.form-control,
.form-select,
.btn {
  border-radius: 8px;
}

.table {
  --bs-table-bg: transparent;
}

@media (max-width: 900px) {
  .login-shell,
  .ranking-podium {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: 360px;
  }

  .next-match,
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .countdown {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .match-grid {
    grid-template-columns: 1fr;
  }

  .tip-admin-form {
    grid-template-columns: 4rem auto 4rem;
  }

  .tip-admin-form button {
    grid-column: 1 / -1;
  }
}
