:root {
  color-scheme: light;
  --ink: #12312a;
  --muted: #5e756b;
  --line: rgba(24, 83, 61, 0.18);
  --panel: rgba(255, 255, 255, 0.84);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --green: #087548;
  --green-dark: #075236;
  --yellow: #ffd91f;
  --yellow-soft: #fff3a6;
  --red: #c64235;
  --shadow: 0 18px 50px rgba(4, 60, 40, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.72) 48%, rgba(255, 255, 255, 0.58)),
    url("/assets/bd-games-background.png") center / cover fixed no-repeat;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 18% 10%, rgba(255, 217, 31, 0.34), transparent 28%);
}

button,
input,
textarea {
  font: inherit;
}

button,
.file-button,
.screen-link {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel-strong);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

button:hover,
.file-button:hover,
.screen-link:hover {
  border-color: var(--green);
}

.screen-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.primary,
.add-button {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.finals-ready {
  border-color: #c7a600;
  background: #f4d21f;
  color: var(--green-dark);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  min-height: 150px;
  padding: 12px 0 26px;
}

.brand-lockup {
  min-width: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 28px);
}

.brand-logo {
  width: clamp(74px, 10vw, 132px);
  aspect-ratio: 1;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(4, 60, 40, 0.18);
}

.kicker,
.panel-label {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(46px, 7vw, 96px);
  line-height: 0.88;
  color: var(--green-dark);
}

h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
}

.hero-actions,
.clock-actions,
.inline-actions,
.team-actions,
.match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.team-actions {
  justify-content: flex-end;
}

.team-search {
  width: min(260px, 100%);
  min-height: 38px;
  background: rgba(255, 255, 255, 0.9);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(290px, 360px) 1fr;
  gap: 16px;
  align-items: start;
}

.left-rail,
.workbench {
  display: grid;
  gap: 16px;
}

.workbench {
  grid-template-columns: minmax(320px, 430px) 1fr;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.timer-panel {
  background: linear-gradient(145deg, rgba(8, 117, 72, 0.94), rgba(15, 84, 59, 0.94));
  color: #fff;
}

.timer-panel .panel-label {
  color: var(--yellow);
}

.clock {
  width: 100%;
  min-height: 126px;
  display: grid;
  place-items: center;
  margin: 8px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(1, 30, 22, 0.42);
  color: #fff;
  font-size: clamp(50px, 7vw, 82px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: center;
  outline: none;
}

.clock:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 4px rgba(255, 217, 31, 0.18);
}

.timer-panel button {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.team-form {
  display: grid;
  grid-template-columns: 1fr 56px;
  gap: 8px;
  margin-bottom: 12px;
}

.field {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(8, 117, 72, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.field span {
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.players-field {
  grid-column: 1 / -1;
}

.team-form textarea {
  min-height: 76px;
  resize: vertical;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(8, 117, 72, 0.14);
  border-radius: 7px;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
}

.add-button {
  min-height: 58px;
  padding: 0;
  font-size: 32px;
  align-self: stretch;
}

.file-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
}

.danger-button {
  border-color: rgba(198, 66, 53, 0.28);
  background: rgba(255, 239, 236, 0.92);
  color: var(--red);
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.team-list,
.phases,
.phase-matches,
.ranking-list {
  display: grid;
  gap: 10px;
}

.team-row {
  display: grid;
  grid-template-columns: 98px 1fr auto;
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(8, 117, 72, 0.16);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 249, 202, 0.58));
  box-shadow: 0 8px 22px rgba(4, 60, 40, 0.08);
}

.team-row.absent {
  border-color: rgba(112, 124, 118, 0.28);
  background: rgba(245, 247, 246, 0.9);
}

.presence {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 98px;
  min-height: 34px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  text-transform: uppercase;
}

.team-row.absent .presence {
  background: #6a746e;
}

.presence-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22);
}

.team-name {
  font-weight: 900;
  font-size: 16px;
}

.team-edit-form {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 6px;
  align-items: center;
}

.team-name-input {
  min-height: 34px;
  padding: 6px 9px;
  border-color: rgba(8, 117, 72, 0.12);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 900;
  font-size: 16px;
}

.team-edit-form button {
  min-height: 34px;
  padding: 0;
  background: rgba(255, 217, 31, 0.46);
  color: var(--green-dark);
}

.team-players {
  display: grid;
  gap: 3px;
  margin-top: 6px;
  color: #315d4b;
  font-size: 13px;
}

.player-line {
  width: fit-content;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(8, 117, 72, 0.08);
  overflow-wrap: anywhere;
}

.delete-team {
  width: 34px;
  min-height: 34px;
  padding: 0;
  color: var(--red);
}

.rank-card {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
}

.rank-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--green-dark);
  font-weight: 900;
}

.rank-points {
  font-weight: 900;
  color: var(--green);
}

.phase-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  overflow: hidden;
}

.phase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 217, 31, 0.34);
}

.phase-title {
  font-weight: 900;
}

.match-card {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.phase-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.advance-button {
  border-color: var(--green);
  background: linear-gradient(135deg, var(--green), #0a8f59);
  color: #fff;
}

.match-meta {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.score-form {
  display: grid;
  grid-template-columns: 1fr 66px 66px;
  gap: 8px;
  align-items: center;
}

.match-teams {
  min-width: 0;
  font-weight: 900;
}

.score-form input {
  min-height: 38px;
  padding: 8px;
  text-align: center;
  font-weight: 900;
}

.empty {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1160px) {
  .dashboard-grid,
  .workbench {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 1500px);
    padding-top: 18px;
  }

  .hero,
  .brand-row,
  .section-title,
  .score-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 120px;
    align-items: start;
  }

  .brand-logo {
    width: 88px;
  }

  .score-form input,
  .score-form button {
    width: 100%;
  }
}
