:root {
  --bg: #f6f1e7;
  --panel: rgba(255, 249, 240, 0.86);
  --panel-strong: rgba(255, 248, 233, 0.96);
  --line: rgba(79, 57, 39, 0.12);
  --text: #2d221a;
  --muted: #6d5a4a;
  --accent: #b85c38;
  --accent-deep: #944528;
  --accent-soft: rgba(184, 92, 56, 0.16);
  --green: #245848;
  --green-soft: rgba(36, 88, 72, 0.14);
  --gold: #e2ae57;
  --shadow: 0 18px 50px rgba(91, 58, 33, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(226, 174, 87, 0.3), transparent 28%),
    radial-gradient(circle at top right, rgba(36, 88, 72, 0.18), transparent 24%),
    linear-gradient(180deg, #fffaf0 0%, #f6f1e7 100%);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 28px 28px 30px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(184, 92, 56, 0.92), rgba(142, 74, 47, 0.92)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
  box-shadow: var(--shadow);
  color: #fff7ee;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -40px -80px auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.hero__eyebrow {
  margin-bottom: 12px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 247, 238, 0.72);
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.06;
}

.hero p {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 247, 238, 0.86);
  line-height: 1.7;
}

.layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel__head h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.panel__head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
  background: rgba(45, 34, 26, 0.08);
  color: var(--muted);
}

.pill--accent {
  background: rgba(255, 255, 255, 0.18);
  color: #fff7ee;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select,
.score-input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus,
.score-input:focus {
  border-color: rgba(184, 92, 56, 0.42);
  box-shadow: 0 0 0 4px rgba(184, 92, 56, 0.12);
  transform: translateY(-1px);
}

.pair-row,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.pair-row .field {
  flex: 1 1 220px;
}

.btn {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff8f0;
  box-shadow: 0 10px 24px rgba(184, 92, 56, 0.22);
}

.btn--ghost {
  border: 1px solid rgba(184, 92, 56, 0.2);
  background: rgba(184, 92, 56, 0.08);
  color: var(--accent-deep);
}

.btn--soft {
  background: rgba(45, 34, 26, 0.08);
  color: var(--text);
}

.hint {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.hint--error {
  color: #a13c2d;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.summary-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
}

.summary-card__label {
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-card__value {
  font-size: 24px;
  font-weight: 700;
}

.summary-card__meta {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.matches-list {
  display: grid;
  gap: 14px;
}

.match-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-strong);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.match-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(91, 58, 33, 0.08);
}

.match-card--complete {
  border-color: rgba(36, 88, 72, 0.28);
}

.match-card--invalid {
  border-color: rgba(161, 60, 45, 0.3);
}

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

.round-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(45, 34, 26, 0.08);
  font-weight: 700;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(45, 34, 26, 0.08);
  color: var(--muted);
}

.status-chip--ok {
  background: var(--green-soft);
  color: var(--green);
}

.status-chip--warn {
  background: rgba(161, 60, 45, 0.12);
  color: #a13c2d;
}

.match-card__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.team-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
}

.team-block--fixed {
  border-color: rgba(184, 92, 56, 0.26);
  background: rgba(184, 92, 56, 0.08);
}

.team-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.team-members {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.score-box {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.score-box__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.score-input {
  min-height: 52px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
}

.score-sep {
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.score-box small {
  color: var(--muted);
}

.rest-line {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.empty-state {
  padding: 18px;
  border: 1px dashed rgba(45, 34, 26, 0.18);
  border-radius: 18px;
  color: var(--muted);
  line-height: 1.7;
  background: rgba(255, 255, 255, 0.5);
}

.table-wrap {
  overflow-x: auto;
}

.ranking-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.ranking-table th,
.ranking-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.ranking-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.ranking-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.38);
}

.rank-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(45, 34, 26, 0.08);
  font-weight: 700;
}

.rank-no--top {
  background: rgba(226, 174, 87, 0.18);
  color: #9a6b1b;
}

.player-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.player-tag__fixed {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(184, 92, 56, 0.1);
  color: var(--accent-deep);
  font-size: 12px;
}

.footer {
  padding: 18px 6px 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(45, 34, 26, 0.08);
}

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

  .score-box {
    order: -1;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 16px, 1180px);
    padding-top: 16px;
  }

  .hero,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .panel__head {
    flex-direction: column;
  }

  .button-row .btn {
    flex: 1 1 100%;
  }

  .summary-card__value {
    font-size: 20px;
  }

  .team-members {
    font-size: 16px;
  }
}
