:root {
  --bg: #f3efe4;
  --ink: #1c1b17;
  --muted: #706b5d;
  --panel: rgba(255, 252, 242, 0.88);
  --line: #ded5be;
  --accent: #0c6b4e;
  --accent-2: #d35d2b;
  --accent-3: #f3c14b;
  --danger: #a4332a;
  --shadow: 0 24px 70px rgba(60, 45, 24, 0.16);
  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(243, 193, 75, 0.34), transparent 26rem),
    radial-gradient(circle at 88% 12%, rgba(12, 107, 78, 0.22), transparent 28rem),
    linear-gradient(135deg, #f6f1e6 0%, #e9dfca 52%, #f8f4eb 100%);
}

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

button,
.button {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.2rem;
  color: white;
  background: var(--accent);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
  box-shadow: 0 10px 24px rgba(12, 107, 78, 0.2);
}

button:hover,
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(12, 107, 78, 0.25);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.secondary {
  color: var(--ink);
  background: #eee5d0;
  box-shadow: none;
}

.danger {
  background: var(--danger);
}

.ghost {
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  padding-inline: 0.7rem;
}

.small {
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  padding: 34px;
  border: 1px solid rgba(28, 27, 23, 0.12);
  border-radius: 34px;
  background:
    linear-gradient(120deg, rgba(12, 107, 78, 0.96), rgba(16, 90, 82, 0.88)),
    url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='rgba(255,255,255,.16)' stroke-width='2'%3E%3Cpath d='M0 60h120M60 0v120M18 18l84 84M102 18L18 102'/%3E%3C/g%3E%3C/svg%3E");
  color: white;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.7rem, 8vw, 6.8rem);
  line-height: 0.88;
  letter-spacing: -0.08em;
  max-width: 760px;
}

.lead {
  max-width: 680px;
  margin: 20px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.08rem;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-2);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: var(--accent-3);
}

.hero-card {
  display: grid;
  gap: 10px;
  min-width: 190px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.hero-card span {
  display: block;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-weight: 800;
}

main {
  display: grid;
  gap: 22px;
  margin-top: 22px;
}

.panel,
.card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
  border-radius: 30px;
}

.card {
  padding: 20px;
  border-radius: 24px;
}

.section-title,
.card-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

h2,
h3 {
  margin: 0;
}

h2 {
  font-size: clamp(1.7rem, 4vw, 3rem);
  letter-spacing: -0.05em;
}

h3 {
  font-size: 1.25rem;
}

.grid {
  display: grid;
  gap: 18px;
}

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

.lists {
  margin-top: 18px;
}

.form-card {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.86rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cdbf9e;
  border-radius: 16px;
  padding: 0.9rem 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(12, 107, 78, 0.13);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.compact {
  gap: 6px;
}

.file-button input {
  display: none;
}

.list {
  display: grid;
  gap: 10px;
  max-height: 330px;
  overflow: auto;
}

.list.empty,
.groups-placeholder {
  padding: 18px;
  border: 1px dashed #cdbf9e;
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.42);
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e3d8c2;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
}

.list-item strong {
  display: block;
}

.list-item span {
  color: var(--muted);
  font-size: 0.92rem;
}

.tournament-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

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

.group-card {
  display: grid;
  gap: 16px;
}

.standings {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 16px;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.9rem;
}

.standings th,
.standings td {
  padding: 10px;
  border-bottom: 1px solid #e4d9c0;
  text-align: left;
}

.standings th {
  color: var(--muted);
  background: #f0e7d3;
}

.standings tr:last-child td {
  border-bottom: 0;
}

.matches {
  display: grid;
  gap: 10px;
}

.match {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid #e3d8c2;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.match-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-weight: 800;
}

.versus {
  color: var(--accent-2);
}

.match-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  color: #63330f;
  background: #f8dda2;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.done {
  color: #0a4b36;
  background: #bfe5d5;
}

.knockout-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.round-column {
  display: grid;
  align-content: start;
  gap: 12px;
}

dialog {
  width: min(780px, calc(100% - 28px));
  border: 0;
  border-radius: 28px;
  padding: 0;
  color: var(--ink);
  background: #fff9eb;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
}

dialog::backdrop {
  background: rgba(24, 20, 13, 0.58);
}

.match-modal {
  padding: 24px;
}

.modal-title {
  align-items: center;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
}

.question-rounds {
  display: grid;
  gap: 14px;
}

.question-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #e3d8c2;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.68);
}

.question-card p {
  margin: 0;
  line-height: 1.45;
}

.answer {
  color: var(--muted);
  font-size: 0.94rem;
}

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

.checks label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #decfad;
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--ink);
  background: #f8f0df;
}

.checks input {
  width: auto;
}

.score-preview,
.tie-breaker {
  margin: 16px 0;
  padding: 14px;
  border-radius: 16px;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-weight: 800;
  background: #efe5ce;
}

.timer {
  width: fit-content;
  margin-bottom: 10px;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  color: #0a4b36;
  background: #bfe5d5;
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-weight: 900;
}

.timer.expired {
  color: #7a211b;
  background: #f0bbb4;
}

.phase-toggle {
  margin-bottom: 16px;
}

.phase-panel {
  margin-bottom: 16px;
}

.hidden {
  display: none;
}

.compact-hero h1 {
  font-size: clamp(2.1rem, 7vw, 4.6rem);
}

.player-shell,
.screen-shell {
  max-width: 980px;
}

.editor-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.editor-table th {
  color: var(--muted);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.editor-table td {
  padding-right: 8px;
  vertical-align: top;
}

.editor-table td:last-child {
  width: 90px;
  padding-right: 0;
}

.wide td:nth-child(1) {
  width: 180px;
}

.wide td:nth-child(3),
.wide td:nth-child(4) {
  width: 240px;
}

.match-control {
  display: grid;
  gap: 16px;
}

.qr-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px;
  border: 1px solid #e3d8c2;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.qr-card img {
  width: 180px;
  max-width: 100%;
  border-radius: 14px;
  background: white;
}

.qr-card .hint {
  word-break: break-all;
}

.live-card {
  display: grid;
  gap: 14px;
}

.answer-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.options-list,
.choice-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.options-list li {
  list-style: none;
  padding: 10px 12px;
  border: 1px solid #e3d8c2;
  border-radius: 14px;
  background: #f8f0df;
}

.choice-list label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid #decfad;
  border-radius: 16px;
  padding: 14px;
  color: var(--ink);
  background: #f8f0df;
}

.choice-list input {
  width: auto;
  margin-right: 10px;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.scoreboard div {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 22px;
  border-radius: 24px;
  color: white;
  background: var(--accent);
}

.scoreboard span {
  font-family: "Trebuchet MS", Verdana, sans-serif;
  font-size: clamp(3rem, 12vw, 7rem);
  font-weight: 900;
  line-height: 0.9;
}

.champion {
  text-align: center;
}

@media (max-width: 860px) {
  .hero,
  .two,
  .groups-grid,
  .knockout-grid,
  .scoreboard {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 26px;
  }

  .panel {
    padding: 18px;
  }

  .section-title,
  .card-heading,
  .match {
    grid-template-columns: 1fr;
  }

  .section-title,
  .card-heading {
    display: grid;
  }

  .editor-table,
  .editor-table tbody,
  .editor-table tr,
  .editor-table td {
    display: block;
    width: 100%;
  }

  .editor-table thead {
    display: none;
  }

  .editor-table tr {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid #e3d8c2;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.55);
  }

  .editor-table td {
    padding: 0 0 8px;
  }
}
