* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0f1115;
  color: #e6e8ee;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: #161922;
  border-bottom: 1px solid #232838;
  position: sticky; top: 0; z-index: 10;
}
header h1 { font-size: 18px; margin: 0; letter-spacing: .3px; }
nav button {
  background: transparent; color: #aab2c5;
  border: 1px solid #2a3144; padding: 6px 12px; border-radius: 6px;
  margin-left: 8px; cursor: pointer;
}
nav button.active, nav button:hover { color: #fff; border-color: #4a5577; }

main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.view h2 { margin-top: 0; }

/* --- list --- */
.t-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.t-list li {
  background: #161922; border: 1px solid #232838; border-radius: 8px;
  padding: 12px 16px; display: flex; justify-content: space-between; align-items: center;
  cursor: pointer;
}
.t-list li:hover { border-color: #3a4666; }
.t-list .meta { color: #8a93a8; font-size: 13px; }
.empty { color: #8a93a8; }

/* --- form --- */
form { display: grid; gap: 14px; max-width: 520px; }
form label { display: grid; gap: 6px; font-size: 14px; color: #c0c6d6; }
form label.row { grid-auto-flow: column; justify-content: start; align-items: center; gap: 8px; }
input[type=text], input[type=number], textarea, input:not([type]) {
  background: #0f1320; color: #e6e8ee;
  border: 1px solid #2a3144; border-radius: 6px; padding: 8px 10px;
  font: inherit;
}
textarea { resize: vertical; }
button {
  background: #3b6df0; color: #fff; border: 0; padding: 9px 16px;
  border-radius: 6px; cursor: pointer; font-weight: 600;
}
button:hover { background: #4f7ef5; }
button.danger { background: #c23b3b; }
button.danger:hover { background: #d94a4a; }
button.ghost { background: transparent; color: #aab2c5; border: 1px solid #2a3144; }
button.ghost:hover { color: #fff; border-color: #4a5577; }

/* --- bracket --- */
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #c23b3b; margin: 0 6px 0 12px;
  transition: background .3s;
}
.live-dot.on { background: #3ec26d; box-shadow: 0 0 6px #3ec26d; }

button.small { padding: 3px 10px; font-size: 12px; font-weight: 500; }

.share { font-size: 13px; color: #8a93a8; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.share a { color: #7aa6ff; text-decoration: none; font-family: ui-monospace, Menlo, monospace; }
.share a:hover { text-decoration: underline; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #161922; border: 1px solid #2a3144; border-radius: 10px;
  padding: 20px; min-width: 320px; max-width: 90vw;
}
.modal h3 { margin-top: 0; }
.modal form { gap: 10px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

.bracket-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; gap: 16px; }
.bracket-header h2 { margin: 0; }
.status {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; background: #243154; color: #aac1ff; margin-right: 12px;
  text-transform: uppercase; letter-spacing: .5px;
}
.status.finished { background: #1d4d2c; color: #9be3ad; }
.status.setup { background: #3b3320; color: #f0d28a; }

.bracket {
  display: flex; gap: 28px; overflow-x: auto;
  padding-bottom: 12px;
}
.round {
  flex: 0 0 240px;
  display: flex; flex-direction: column; gap: 16px;
  justify-content: space-around;
}
.round h3 {
  margin: 0 0 6px; font-size: 13px; color: #8a93a8;
  text-transform: uppercase; letter-spacing: 1px;
}
.match {
  background: #161922; border: 1px solid #232838; border-radius: 8px;
  overflow: hidden;
}
.match.completed { border-color: #2f5b3a; }
.match-header {
  font-size: 11px; color: #6b7287; padding: 4px 10px;
  background: #11141d; border-bottom: 1px solid #232838;
  display: flex; justify-content: space-between; align-items: center;
}
.match-header button.reset {
  background: transparent; color: #8a93a8; border: 0; cursor: pointer;
  font-size: 11px; padding: 0;
}
.match-header button.reset:hover { color: #fff; }

.slot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-top: 1px solid #1d2230;
  font-size: 14px;
}
.slot:first-child { border-top: 0; }
.slot.empty { color: #4f5567; font-style: italic; }
.slot.winner { background: #1d3a25; color: #b9e9c4; font-weight: 600; }
.slot.eliminated .name { color: #6b7287; text-decoration: line-through; }
.slot button.win {
  background: #2a3144; color: #c0c6d6; border: 0;
  padding: 3px 8px; border-radius: 4px; font-size: 11px; cursor: pointer;
}
.slot button.win:hover { background: #3b6df0; color: #fff; }

.champion-banner {
  background: linear-gradient(90deg, #1f3d22, #2a5a30);
  border: 1px solid #3d7044; padding: 14px 18px; border-radius: 8px;
  margin-bottom: 18px; font-size: 16px;
}
