:root {
  color-scheme: dark;
  --bg: #100604;
  --panel: #1a0a07;
  --panel-2: #260d08;
  --panel-3: #351109;
  --line: #5c2013;
  --line-soft: rgba(255, 244, 232, 0.14);
  --text: #fff4e8;
  --muted: #d9aa91;
  --ember: #ea5104;
  --red: #a40e04;
  --deep-red: #740a04;
  --gold: #fca204;
  --green: #8fd86f;
  --shadow: 0 18px 46px rgba(30, 4, 0, 0.44);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(164, 14, 4, 0.28), transparent 30rem),
    linear-gradient(225deg, rgba(252, 162, 4, 0.13), transparent 34rem),
    linear-gradient(180deg, rgba(71, 11, 4, 0.72), rgba(16, 6, 4, 0.96) 22rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}

button,
select,
input {
  min-height: 2.55rem;
}

button {
  cursor: pointer;
  font-weight: 900;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.sticky-head {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 8, 6, 0.96);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
}

.brand,
nav,
.panel-head,
.totals-panel,
.row-actions,
.status-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand {
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(252, 162, 4, 0.5);
  background: linear-gradient(180deg, rgba(234, 81, 4, 0.38), rgba(116, 10, 4, 0.82));
  color: #ffe7af;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.intro-band p,
.status-card span,
.board-id,
.totals-panel span,
.empty-cell {
  color: var(--muted);
}

nav {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 0.8rem;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.nav-link.active {
  border-color: rgba(252, 162, 4, 0.72);
  background: rgba(203, 32, 4, 0.32);
  color: #ffe7af;
}

.app-shell {
  width: min(1440px, 100%);
  display: grid;
  gap: 1rem;
  padding: 1rem;
  margin: 0 auto;
}

.intro-band,
.add-panel,
.board-panel,
.totals-panel article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 10, 7, 0.95);
  box-shadow: var(--shadow);
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14rem;
  gap: 1rem;
  align-items: stretch;
  padding: 1.1rem;
}

.intro-band h1 {
  max-width: 58rem;
  margin-bottom: 0.4rem;
  font-size: clamp(1.6rem, 4vw, 3.3rem);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-card {
  display: grid;
  align-content: center;
  justify-items: start;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(53, 17, 9, 0.72);
  padding: 1rem;
}

.status-card strong {
  color: var(--green);
  font-size: 1.75rem;
  line-height: 1;
}

.add-panel,
.board-panel {
  padding: 1rem;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.panel-head h2 {
  font-size: 1.2rem;
}

.add-form {
  display: grid;
  grid-template-columns: minmax(15rem, 1.45fr) minmax(11rem, 0.8fr) repeat(2, minmax(8rem, 0.55fr)) auto;
  gap: 0.75rem;
  align-items: end;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  padding: 0.55rem 0.7rem;
}

input[readonly] {
  color: #ffe7af;
  background: rgba(53, 17, 9, 0.76);
}

.primary-button,
.utility-button,
.status-button,
.edit-button,
.save-button {
  padding: 0 0.85rem;
}

.primary-button,
.save-button {
  border-color: rgba(252, 162, 4, 0.72);
  background: linear-gradient(180deg, #fb7604, #c93204);
  color: #fff8ef;
  box-shadow: inset 0 1px 0 rgba(255, 226, 170, 0.2);
}

.utility-button,
.edit-button {
  border-color: var(--line);
  background: var(--panel-3);
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  background: rgba(14, 8, 6, 0.82);
}

th,
td {
  padding: 0.72rem 0.6rem;
  border-bottom: 1px solid rgba(92, 32, 19, 0.72);
  text-align: left;
  vertical-align: middle;
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

.game-cell strong {
  display: block;
  color: var(--text);
}

.game-cell span {
  color: var(--muted);
  font-size: 0.8rem;
}

.money-input {
  max-width: 7.5rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  color: #ffe7af;
  font-size: 0.78rem;
  font-weight: 900;
}

.status-open {
  background: rgba(252, 162, 4, 0.12);
}

.status-played {
  background: rgba(143, 216, 111, 0.12);
}

.status-finished {
  background: rgba(82, 214, 210, 0.12);
}

.row-actions,
.status-actions {
  flex-wrap: wrap;
}

.status-button {
  min-height: 2.05rem;
  border-color: rgba(252, 162, 4, 0.52);
  background: rgba(234, 81, 4, 0.22);
  color: var(--text);
  font-size: 0.78rem;
}

.status-button.active {
  background: var(--gold);
  color: #1a0a07;
}

.empty-cell {
  padding: 2rem;
  text-align: center;
}

.totals-panel {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
  padding: 0;
  background: rgba(16, 6, 4, 0.88);
  backdrop-filter: blur(10px);
}

.totals-panel article {
  display: grid;
  gap: 0.2rem;
  padding: 1rem;
}

.totals-panel strong {
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  line-height: 1;
}

.profit-positive {
  color: var(--green);
}

.profit-negative {
  color: #ff9b86;
}

@media (max-width: 1040px) {
  .intro-band,
  .add-form,
  .totals-panel {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .topbar,
  nav,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  nav,
  .nav-link,
  .utility-button {
    width: 100%;
  }

  .nav-link {
    justify-content: flex-start;
  }

  .app-shell {
    padding: 0.75rem;
  }
}
