:root {
  color-scheme: light;
  --felt: #0f6b4d;
  --felt-dark: #0b3d31;
  --chalk: #f6f1e7;
  --paper: #fffbf2;
  --ink: #18231f;
  --muted: #6e746c;
  --line: #ded6c7;
  --accent: #d98f2f;
  --danger: #a33a2f;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 107, 77, 0.11), rgba(246, 241, 231, 0) 34%),
    var(--chalk);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(116px + env(safe-area-inset-bottom));
}

.auth-view {
  min-height: calc(100vh - 40px);
  display: grid;
  align-content: center;
  gap: 18px;
}

.brand-mark {
  width: 52px;
  aspect-ratio: 1;
  border: 9px solid var(--felt);
  border-radius: 50%;
  background: radial-gradient(circle at 62% 38%, var(--accent) 0 16%, transparent 17%);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

h2 span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.panel,
.match-card,
.date-strip,
.stats {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.auth-panel,
.match-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: #ece3d3;
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segmented button.active {
  background: var(--paper);
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--felt);
  box-shadow: 0 0 0 3px rgba(15, 107, 77, 0.14);
}

.primary-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--felt);
  color: #fffaf0;
  font-weight: 800;
}

.toast {
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.dashboard {
  display: grid;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--felt);
  font-size: 12px;
  font-weight: 800;
}

.icon-button,
.remove-button {
  min-width: 44px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 251, 242, 0.72);
  color: var(--ink);
  font-weight: 800;
}

.date-strip {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.date-strip span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
}

.player-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.7fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--felt);
  border-radius: 8px;
  background: var(--felt);
}

.player-card div {
  display: grid;
  gap: 5px;
  background: #eef6ed;
  padding: 12px;
}

.player-card span {
  color: var(--felt-dark);
  font-size: 12px;
  font-weight: 800;
}

.player-card strong {
  font-size: 20px;
  line-height: 1;
}

.player-card .positive {
  color: var(--felt);
}

.player-card .negative {
  color: var(--danger);
}

.stats div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.stats div:last-child {
  border-right: 0;
}

.stats strong {
  font-size: 24px;
  line-height: 1;
}

.stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.versus-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 8px;
}

.versus-row b {
  padding-bottom: 13px;
  color: var(--accent);
  font-size: 12px;
}

.match-list {
  display: grid;
  gap: 10px;
  padding-bottom: 18px;
}

.match-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
}

.match-card.expanded {
  border-color: var(--felt);
}

.match-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px;
}

.match-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.winner {
  color: var(--felt);
  font-weight: 800;
}

.pending {
  color: var(--accent);
  font-weight: 800;
}

.remove-button {
  color: var(--danger);
  font-size: 22px;
  line-height: 1;
}

.match-actions {
  display: flex;
  align-items: start;
  gap: 6px;
}

.small-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--felt-dark);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.stake-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 7px;
  background: #e3efe6;
  padding: 9px 10px;
  font-size: 13px;
}

.stake-note span {
  color: var(--felt-dark);
  font-weight: 800;
}

.stake-note strong {
  color: var(--ink);
}

.bet-list {
  display: grid;
  gap: 7px;
}

.bet-line {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border-radius: 7px;
  background: #f2eadb;
  padding: 7px 9px;
  font-size: 13px;
}

.bet-line b {
  color: var(--felt-dark);
}

.bet-line em {
  color: var(--ink);
  font-style: normal;
  font-weight: 800;
}

.muted,
.empty-state {
  color: var(--muted);
  font-size: 14px;
}

.bet-form {
  display: grid;
  grid-template-columns: 1fr 1fr 64px 56px 44px;
  gap: 7px;
}

.bet-form input,
.bet-form select {
  min-height: 40px;
  padding: 0 8px;
  font-size: 14px;
}

.bet-form button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #2b1d08;
  font-weight: 900;
}

.settle-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.settle-actions button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--felt-dark);
  color: #fffaf0;
  font-weight: 800;
}

.settlement {
  display: grid;
  gap: 6px;
  border-radius: 8px;
  background: #e9ddc7;
  padding: 10px;
  font-size: 13px;
}

.settlement p {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.settlement strong {
  color: var(--felt-dark);
}

.empty-state {
  display: grid;
  min-height: 92px;
  place-items: center;
  border: 1px dashed #c9bdab;
  border-radius: 8px;
}

.floating-message {
  border-radius: 8px;
  background: #fff2e6;
  padding: 10px 12px;
}

.fab-stack {
  position: fixed;
  z-index: 20;
  right: max(16px, calc((100vw - 480px) / 2 + 16px));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: auto auto;
  gap: 10px;
}

.fab-button {
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  box-shadow: 0 12px 28px rgba(24, 35, 31, 0.22);
  font-weight: 900;
}

.fab-button.primary {
  min-width: 118px;
  background: var(--felt);
  color: #fffaf0;
}

.fab-button.secondary {
  background: var(--accent);
  color: #2b1d08;
}

.fab-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  align-items: end;
  justify-items: center;
  background: rgba(24, 35, 31, 0.32);
  padding: 16px;
}

.bet-modal {
  width: min(100%, 448px);
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--paper);
  padding: 14px;
  box-shadow: 0 -18px 40px rgba(24, 35, 31, 0.22);
}

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

.modal-head button {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
}

.quick-bet-form {
  display: grid;
  gap: 12px;
}

.stake-grid {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
}

.confirm-copy {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.confirm-copy strong {
  color: var(--felt-dark);
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
}

.confirm-actions button {
  min-height: 46px;
  border-radius: 8px;
  font-weight: 800;
}

.confirm-actions button:first-child {
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink);
}

@media (max-width: 360px) {
  .bet-form {
    grid-template-columns: 1fr 1fr;
  }

  .bet-form button {
    grid-column: span 2;
  }

  .settlement p {
    display: grid;
  }

  .fab-stack {
    left: 16px;
    right: 16px;
    grid-template-columns: 0.8fr 1.2fr;
  }

  .fab-button {
    width: 100%;
    padding: 0 10px;
  }
}
