:root {
  --coffee: #171717;
  --ink: #252323;
  --paper: #f8f7f4;
  --cream: #eadbd4;
  --red: #874246;
  --teal: #28716c;
  --muted: #7f6b67;
  --line: rgba(29, 27, 25, 0.14);
  --shadow: 0 24px 60px rgba(29, 27, 25, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.game-page {
  background:
    linear-gradient(90deg, rgba(248, 247, 244, 0.97) 0%, rgba(248, 247, 244, 0.92) 42%, rgba(248, 247, 244, 0.1) 100%),
    url("/assets/cartel-coffee-hero.png") center right / cover no-repeat;
}
.site-header {
  position: relative;
  z-index: 2;
}
.site-nav {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0 clamp(18px, 4vw, 38px);
  background: var(--coffee);
  color: white;
}
.logo-link {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
.logo-link img, .admin-logo img {
  display: block;
  width: min(310px, 44vw);
  height: auto;
}
.site-nav nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 4vw, 54px);
  color: rgba(255, 255, 255, 0.88);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
}
.game-shell {
  min-height: calc(100vh - 74px);
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 500px);
  align-items: stretch;
}
.hero-panel {
  padding: clamp(24px, 5vw, 76px);
  display: flex;
  align-items: end;
}
.brand-mark {
  color: var(--paper);
  background: var(--coffee);
  padding: 10px 14px;
  border-radius: 6px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}
.promo-copy {
  max-width: 560px;
  padding: clamp(22px, 4vw, 36px);
  border-radius: 8px;
  background: var(--red);
  color: white;
  box-shadow: var(--shadow);
}
.promo-copy h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.3rem);
  line-height: 1.08;
  font-weight: 500;
}
.promo-copy .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}
.form-panel {
  min-height: calc(100vh - 74px);
  padding: clamp(24px, 5vw, 56px);
  background: rgba(248, 247, 244, 0.94);
  backdrop-filter: blur(18px);
  border-left: 1px solid rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.thank-you-page {
  background:
    linear-gradient(90deg, rgba(248, 247, 244, 0.98) 0%, rgba(248, 247, 244, 0.9) 50%, rgba(248, 247, 244, 0.16) 100%),
    url("/assets/cartel-coffee-hero.png") center right / cover no-repeat;
}
.thank-you-shell {
  min-height: calc(100vh - 74px);
  display: grid;
  align-items: center;
  padding: clamp(24px, 6vw, 76px);
}
.thank-you-card {
  width: min(760px, 100%);
  padding: clamp(28px, 5vw, 54px);
  border-radius: 8px;
  background: rgba(248, 247, 244, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.thank-you-card h1 {
  max-width: 680px;
  color: var(--red);
}
.thank-you-card p {
  max-width: 650px;
  margin: 20px 0 0;
  color: var(--ink);
  font-size: clamp(1.05rem, 2vw, 1.38rem);
  line-height: 1.55;
}
.thank-you-card .primary-button {
  margin-top: 28px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.98;
  letter-spacing: 0;
}
h2 {
  margin: 28px 0 14px;
  font-size: 1.1rem;
}
.registration-form, .login-card, .settings-card {
  margin-top: 28px;
  display: grid;
  gap: 14px;
}
label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}
small { color: var(--red); font-weight: 700; }
input, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}
input:focus, select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(40, 113, 108, 0.16);
}
.file-field {
  cursor: pointer;
}
.file-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.file-button {
  min-height: 52px;
  margin: 0;
  border-radius: 8px;
  background: var(--red);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 14px 26px rgba(135, 66, 70, 0.22);
}
.file-field strong {
  display: block;
  margin-top: 7px;
  color: var(--teal);
  font-size: 0.84rem;
}
.check-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
}
.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}
.check-row span { margin: 0; font-weight: 600; color: var(--ink); }
.primary-button, .ghost-button, .actions button, .admin-sidebar button, .link-button {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.primary-button {
  background: var(--red);
  color: white;
  box-shadow: 0 14px 26px rgba(135, 66, 70, 0.25);
}
.primary-button:disabled { opacity: 0.7; cursor: wait; }
.ghost-button, .actions button, .link-button {
  background: rgba(58, 33, 24, 0.08);
  color: var(--coffee);
}
.form-message {
  min-height: 22px;
  margin: 0;
  font-weight: 800;
}
.form-message.success { color: var(--teal); }
.form-message.error { color: var(--red); }

.admin-page { background: #f7f3ed; }
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}
.admin-sidebar {
  background: var(--coffee);
  color: white;
  padding: 22px;
  min-width: 0;
  overflow: hidden;
}
.admin-logo {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
  min-height: 56px;
}
.admin-logo img {
  width: min(205px, 100%);
}
.admin-sidebar nav {
  display: grid;
  gap: 8px;
}
.admin-sidebar button {
  justify-content: flex-start;
  color: rgba(255,255,255,0.78);
  background: transparent;
}
.admin-sidebar button.active {
  color: white;
  background: rgba(255,255,255,0.12);
}
.admin-content {
  padding: clamp(20px, 4vw, 44px);
  overflow: auto;
  min-width: 0;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}
.admin-header h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
.login-card, .settings-card, .draw-card {
  max-width: 520px;
  padding: 24px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.stats-grid article, .compact-list article {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.stats-grid span, .compact-list span {
  display: block;
  color: var(--muted);
  font-weight: 700;
}
.stats-grid strong {
  display: block;
  margin-top: 10px;
  font-size: 2.3rem;
}
.compact-list {
  display: grid;
  gap: 10px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.toolbar input, .toolbar select { width: auto; min-width: 190px; }
.table-wrap {
  overflow-x: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}
.status {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}
.status.pending { background: #fff2c6; color: #73570f; }
.status.approved { background: #dff4ee; color: #16605a; }
.status.rejected { background: #ffe0dd; color: #8d2623; }
.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}
.winner-result {
  min-height: 60px;
  display: grid;
  align-content: center;
  color: var(--teal);
}
.winner-result strong {
  font-size: 1.6rem;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(18, 14, 12, 0.82);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px;
}
.modal img {
  max-width: 100%;
  max-height: 100%;
  justify-self: center;
  align-self: center;
  object-fit: contain;
  background: white;
}
.modal-close {
  justify-self: end;
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 800;
}
.modal .primary-button {
  justify-self: center;
}

@media (max-width: 820px) {
  .game-page {
    background:
      linear-gradient(180deg, rgba(23, 23, 23, 0.14), rgba(248, 247, 244, 0.96) 36%),
      url("/assets/cartel-coffee-hero.png") top center / 100% auto no-repeat,
      var(--paper);
  }
  .site-nav {
    min-height: 62px;
  }
  .logo-link img {
    width: min(210px, 62vw);
  }
  .site-nav nav {
    display: none;
  }
  .game-shell {
    display: block;
    min-height: calc(100vh - 62px);
  }
  .hero-panel {
    min-height: 28vh;
    align-items: end;
  }
  .promo-copy {
    display: none;
  }
  .form-panel {
    min-height: 72vh;
    border-left: 0;
    border-top: 1px solid rgba(255,255,255,0.7);
    border-radius: 8px 8px 0 0;
  }
  .thank-you-page {
    background:
      linear-gradient(180deg, rgba(23, 23, 23, 0.12), rgba(248, 247, 244, 0.97) 30%),
      url("/assets/cartel-coffee-hero.png") top center / 100% auto no-repeat,
      var(--paper);
  }
  .thank-you-shell {
    min-height: calc(100vh - 62px);
    align-items: end;
    padding: 28vh 16px 24px;
  }
  .thank-you-card {
    padding: 24px;
  }
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px;
  }
  .admin-logo { margin-bottom: 10px; min-height: 42px; }
  .admin-logo img { width: 180px; }
  .admin-sidebar nav {
    display: flex;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 2px;
  }
  .admin-sidebar button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .toolbar {
    display: grid;
  }
  .toolbar input, .toolbar select, .toolbar .ghost-button, .toolbar label { width: 100%; }
}
