:root {
  --bg: #110907;
  --panel: #21130f;
  --text: #f9e8d2;
  --muted: #d8b99a;
  --border: #5b3022;
  --accent: #ff8c2b;
  --accent-strong: #ffb347;
  --ember: #ff5b21;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(900px 520px at 18% -8%, rgba(255, 140, 43, 0.25) 0%, rgba(17, 9, 7, 0) 55%),
    radial-gradient(1000px 560px at 82% -16%, rgba(255, 91, 33, 0.22) 0%, rgba(17, 9, 7, 0) 52%),
    linear-gradient(180deg, #1a0d09 0%, var(--bg) 38%, #080505 100%);
  color: var(--text);
  font-family: "Manrope", system-ui, sans-serif;
}

.wrap {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 20px 18px 34px;
}

.header h1 {
  margin: 0 0 8px;
  font-size: 2.1rem;
  letter-spacing: 0.01em;
  color: #ffd39a;
  text-shadow: 0 0 18px rgba(255, 140, 43, 0.35);
}

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

.panel {
  margin-top: 12px;
  background: linear-gradient(180deg, rgba(58, 29, 20, 0.92), rgba(33, 19, 15, 0.98));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(255, 140, 43, 0.08);
}

.controls {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.controls input#days-count {
  width: 96px;
}

.controls label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

input {
  background: #1a0f0c;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 8px;
  width: 100%;
  font: inherit;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 140, 43, 0.18);
}

button {
  border: 1px solid var(--accent);
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #2a1208;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

button.ghost {
  background: rgba(255, 140, 43, 0.08);
  border-color: #7f4a33;
  color: #ffd8aa;
}

button:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 14px rgba(255, 140, 43, 0.35);
}

button:active {
  transform: translateY(1px);
}

.table-shell {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

th,
td {
  border: 1px solid var(--border);
  padding: 7px 6px;
  text-align: center;
  font-size: 0.86rem;
}

th {
  background: linear-gradient(180deg, rgba(108, 52, 30, 0.95), rgba(62, 31, 21, 0.95));
  color: #ffe4be;
  position: sticky;
  top: 0;
  z-index: 1;
}

td:first-child {
  color: var(--muted);
}

tbody tr:nth-child(even) td {
  background: rgba(255, 140, 43, 0.05);
}

.daily-cell,
.total-cell {
  font-weight: 700;
}

h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.summary {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.summary-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 145, 61, 0.2), rgba(42, 22, 15, 0.95));
  padding: 10px 12px;
}

.summary-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.08rem;
}

.ranking {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.ranking li {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1.8fr 1fr 0.8fr;
  gap: 8px;
  background: rgba(255, 140, 43, 0.05);
}

.ranking li:nth-child(1) {
  border-color: rgba(255, 193, 92, 0.7);
  box-shadow: inset 0 0 0 1px rgba(255, 193, 92, 0.2);
}

.ranking li:nth-child(2) {
  border-color: rgba(250, 161, 85, 0.6);
}

.ranking li:nth-child(3) {
  border-color: rgba(222, 120, 66, 0.55);
}

.rank-name {
  font-weight: 600;
}

.rank-score {
  text-align: right;
  font-weight: 800;
  color: #ffd18f;
}

.rank-diff {
  text-align: right;
  color: var(--muted);
}

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

  .header h1 {
    font-size: 1.8rem;
  }

  .controls {
    align-items: stretch;
  }

  .controls label {
    width: 100%;
  }

  .controls input#days-count {
    width: 100%;
  }

  .ranking li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .rank-score,
  .rank-diff {
    text-align: left;
  }
}
