/* HTTC Lottery — Material Design 3 inspired theme (red accent, light/dark) */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ----- Design tokens (M3-style naming) ----- */
:root {
  color-scheme: light;
  --md-sys-color-primary: #b3261e;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eaeaea;
  --md-sys-color-on-primary-container: #1c1b1b;

  --md-sys-color-secondary: #5f5f5f;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #e5e5e5;
  --md-sys-color-on-secondary-container: #1c1b1b;

  --md-sys-color-surface: #fdfcfd;
  --md-sys-color-on-surface: #1c1b1b;
  --md-sys-color-surface-variant: #e3e2e6;
  --md-sys-color-on-surface-variant: #46464f;
  --md-sys-color-outline: #787680;
  --md-sys-color-outline-variant: #c6c5d0;

  --md-sys-color-surface-container-low: #f7f7f8;
  --md-sys-color-surface-container: #f0f0f2;
  --md-sys-color-surface-container-high: #eaeaec;

  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #ffe8e6;
  --md-sys-color-on-error-container: #601410;

  --md-sys-color-inverse-surface: #313030;
  --md-sys-color-inverse-on-surface: #f4f0ef;

  --md-sys-color-success: #146c2e;
  --md-sys-color-on-success: #ffffff;
  --md-sys-color-success-container: #adf2a3;
  --md-sys-color-on-success-container: #04210a;

  --md-sys-color-tertiary-container: #e5e5e5;
  --md-sys-color-on-tertiary-container: #1c1b1b;

  --md-sys-elevation-1: 0 1px 2px rgba(28, 27, 27, 0.12), 0 1px 3px 1px rgba(28, 27, 27, 0.08);
  --md-sys-elevation-2: 0 1px 2px rgba(28, 27, 27, 0.14), 0 2px 6px 2px rgba(28, 27, 27, 0.1);
  --md-sys-elevation-3: 0 2px 4px rgba(28, 27, 27, 0.16), 0 4px 8px 3px rgba(28, 27, 27, 0.12);

  --md-shape-corner-small: 8px;
  --md-shape-corner-medium: 16px;
  --md-shape-corner-large: 24px;
  --md-shape-corner-full: 9999px;

  --md-sys-state-hover: 0.08;
  --md-sys-state-focus: 0.12;
  --md-sys-state-pressed: 0.12;

  --md-font-family: "Roboto", system-ui, -apple-system, sans-serif;
  --theme-color-meta: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --md-sys-color-primary: #e53935;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #3a3a3a;
    --md-sys-color-on-primary-container: #e8e8e8;

    --md-sys-color-secondary: #c4c4c4;
    --md-sys-color-on-secondary: #2b2b2b;
    --md-sys-color-secondary-container: #454545;
    --md-sys-color-on-secondary-container: #e8e8e8;

    --md-sys-color-surface: #1c1b1b;
    --md-sys-color-on-surface: #e6e1e0;
    --md-sys-color-surface-variant: #3e3e3e;
    --md-sys-color-on-surface-variant: #cac4c0;
    --md-sys-color-outline: #8f8f8f;
    --md-sys-color-outline-variant: #444444;

    --md-sys-color-surface-container-low: #181211;
    --md-sys-color-surface-container: #211e1e;
    --md-sys-color-surface-container-high: #2b2828;

    --md-sys-color-error: #ffb4a9;
    --md-sys-color-on-error: #680003;
    --md-sys-color-error-container: #930009;
    --md-sys-color-on-error-container: #ffdad4;

    --md-sys-color-inverse-surface: #e6e1e0;
    --md-sys-color-inverse-on-surface: #1c1b1b;

    --md-sys-color-success: #7ee08a;
    --md-sys-color-on-success: #003911;
    --md-sys-color-success-container: #0f5223;
    --md-sys-color-on-success-container: #97f69f;

    --md-sys-color-tertiary-container: #454545;
    --md-sys-color-on-tertiary-container: #e8e8e8;

    --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.22), 0 1px 3px 1px rgba(0, 0, 0, 0.18);
    --md-sys-elevation-2: 0 1px 2px rgba(0, 0, 0, 0.24), 0 2px 6px 2px rgba(0, 0, 0, 0.2);
    --md-sys-elevation-3: 0 2px 4px rgba(0, 0, 0, 0.26), 0 4px 8px 3px rgba(0, 0, 0, 0.22);

    --theme-color-meta: #211e1e;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --md-sys-color-primary: #b3261e;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eaeaea;
  --md-sys-color-on-primary-container: #1c1b1b;
  --md-sys-color-secondary: #5f5f5f;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #e5e5e5;
  --md-sys-color-on-secondary-container: #1c1b1b;
  --md-sys-color-surface: #fdfcfd;
  --md-sys-color-on-surface: #1c1b1b;
  --md-sys-color-surface-variant: #e3e2e6;
  --md-sys-color-on-surface-variant: #46464f;
  --md-sys-color-outline: #787680;
  --md-sys-color-outline-variant: #c6c5d0;
  --md-sys-color-surface-container-low: #f7f7f8;
  --md-sys-color-surface-container: #f0f0f2;
  --md-sys-color-surface-container-high: #eaeaec;
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #ffe8e6;
  --md-sys-color-on-error-container: #601410;
  --md-sys-color-inverse-surface: #313030;
  --md-sys-color-inverse-on-surface: #f4f0ef;
  --md-sys-color-success: #146c2e;
  --md-sys-color-on-success: #ffffff;
  --md-sys-color-success-container: #adf2a3;
  --md-sys-color-on-success-container: #04210a;
  --md-sys-color-tertiary-container: #e5e5e5;
  --md-sys-color-on-tertiary-container: #1c1b1b;
  --md-sys-elevation-1: 0 1px 2px rgba(28, 27, 27, 0.12), 0 1px 3px 1px rgba(28, 27, 27, 0.08);
  --md-sys-elevation-2: 0 1px 2px rgba(28, 27, 27, 0.14), 0 2px 6px 2px rgba(28, 27, 27, 0.1);
  --md-sys-elevation-3: 0 2px 4px rgba(28, 27, 27, 0.16), 0 4px 8px 3px rgba(28, 27, 27, 0.12);
  --theme-color-meta: #b3261e;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --md-sys-color-primary: #e53935;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #3a3a3a;
  --md-sys-color-on-primary-container: #e8e8e8;
  --md-sys-color-secondary: #c4c4c4;
  --md-sys-color-on-secondary: #2b2b2b;
  --md-sys-color-secondary-container: #454545;
  --md-sys-color-on-secondary-container: #e8e8e8;
  --md-sys-color-surface: #1c1b1b;
  --md-sys-color-on-surface: #e6e1e0;
  --md-sys-color-surface-variant: #3e3e3e;
  --md-sys-color-on-surface-variant: #cac4c0;
  --md-sys-color-outline: #8f8f8f;
  --md-sys-color-outline-variant: #444444;
  --md-sys-color-surface-container-low: #181211;
  --md-sys-color-surface-container: #211e1e;
  --md-sys-color-surface-container-high: #2b2828;
  --md-sys-color-error: #ffb4a9;
  --md-sys-color-on-error: #680003;
  --md-sys-color-error-container: #930009;
  --md-sys-color-on-error-container: #ffdad4;
  --md-sys-color-inverse-surface: #e6e1e0;
  --md-sys-color-inverse-on-surface: #1c1b1b;
  --md-sys-color-success: #7ee08a;
  --md-sys-color-on-success: #003911;
  --md-sys-color-success-container: #0f5223;
  --md-sys-color-on-success-container: #97f69f;
  --md-sys-color-tertiary-container: #454545;
  --md-sys-color-on-tertiary-container: #e8e8e8;
  --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.22), 0 1px 3px 1px rgba(0, 0, 0, 0.18);
  --md-sys-elevation-2: 0 1px 2px rgba(0, 0, 0, 0.24), 0 2px 6px 2px rgba(0, 0, 0, 0.2);
  --md-sys-elevation-3: 0 2px 4px rgba(0, 0, 0, 0.26), 0 4px 8px 3px rgba(0, 0, 0, 0.22);
  --theme-color-meta: #211e1e;
}

html {
  height: 100%;
}

body.m3-body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--md-font-family);
  font-size: 1rem;
  line-height: 1.5;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.m3-main {
  flex: 1 1 auto;
}

.m3-container {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 1.5rem);
  padding-block: 2rem;
}

.m3-page {
  min-height: calc(100vh - 4rem - 8rem);
}

.m3-page--center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Draw page: large tap target, centered CTA, readable amount */
.m3-draw-card {
  display: flex;
  flex-direction: column;
  min-height: min(72vh, 40rem);
  width: 100%;
}

.m3-draw-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.m3-draw-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.m3-draw-header .m3-page-head {
  margin-bottom: 0.75rem;
}

.m3-draw-cta {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2.5rem) 0.5rem;
  min-height: 12rem;
}

.m3-draw-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.25rem, 4vw, 2rem);
  width: 100%;
}

.m3-draw-spinner {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: min(14rem, 40vw);
}

.m3-draw-winner {
  width: 100%;
  max-width: 24rem;
  margin-inline: auto;
}

.m3-btn.m3-btn--draw {
  width: min(19.5rem, 64vw);
  height: min(19.5rem, 64vw);
  aspect-ratio: 1;
  max-width: none;
  min-height: unset;
  padding: 1.35rem 1.1rem;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
  border-radius: 50%;
  font-size: clamp(1.3rem, 5.5vw, 1.85rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-align: center;
  box-shadow: var(--md-sys-elevation-2);
}

.m3-btn.m3-btn--draw:hover {
  box-shadow: var(--md-sys-elevation-3);
}

.m3-btn.m3-btn--draw .fas {
  font-size: clamp(2.75rem, 11vw, 4.25rem);
  line-height: 1;
}

.m3-btn--draw__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.m3-btn--draw__line {
  display: block;
}

.m3-draw-amount {
  text-align: center;
  max-width: 22rem;
}

.m3-draw-amount__label {
  display: block;
  font-size: clamp(1rem, 3.2vw, 1.2rem);
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 0.35rem;
}

.m3-draw-amount__value {
  display: block;
  font-size: clamp(1.5rem, 6vw, 2.25rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--md-sys-color-on-surface);
  line-height: 1.15;
}

.m3-hero-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 8rem;
  height: 8rem;
  margin-inline: auto;
  padding: 0.5rem;
  border-radius: var(--md-shape-corner-large);
  background: var(--md-sys-color-surface-container);
  box-shadow: var(--md-sys-elevation-1);
}

.m3-hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Top app bar */
.m3-top-app-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--md-sys-color-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--md-sys-elevation-1);
}

.m3-top-app-bar__inner {
  max-width: 72rem;
  margin-inline: auto;
  padding: 0 clamp(1rem, 4vw, 1.5rem);
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.m3-top-app-bar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--md-sys-color-on-surface);
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.m3-top-app-bar__brand img {
  width: 2rem;
  height: 2rem;
  border-radius: var(--md-shape-corner-small);
}

.m3-top-app-bar__brand span {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .m3-top-app-bar__brand span {
    max-width: none;
  }
}

.m3-top-app-bar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Buttons */
.m3-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  border-radius: var(--md-shape-corner-full);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.m3-icon-button:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}

.m3-icon-button:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.m3-icon-button svg {
  width: 1.25rem;
  height: 1.25rem;
}

.m3-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: var(--md-shape-corner-full);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.00625em;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.2s ease, background-color 0.2s ease, transform 0.1s ease;
}

.m3-btn--filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-1);
}

.m3-btn--filled:hover {
  box-shadow: var(--md-sys-elevation-2);
  background: color-mix(in srgb, var(--md-sys-color-primary) 92%, var(--md-sys-color-on-primary));
}

.m3-btn--filled:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.m3-btn--tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.m3-btn--tonal:hover {
  background: color-mix(in srgb, var(--md-sys-color-secondary-container) 88%, var(--md-sys-color-on-secondary-container));
}

.m3-btn--outlined {
  background: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}

.m3-btn--outlined:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent);
}

.m3-btn--success {
  background: var(--md-sys-color-success);
  color: var(--md-sys-color-on-success);
  box-shadow: var(--md-sys-elevation-1);
}

.m3-btn--success:hover {
  box-shadow: var(--md-sys-elevation-2);
}

.m3-btn--danger {
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  box-shadow: var(--md-sys-elevation-1);
}

.m3-btn--danger:hover {
  box-shadow: var(--md-sys-elevation-2);
}

.m3-btn--lg {
  min-height: 3rem;
  padding: 0.625rem 1.5rem;
  font-size: 1rem;
}

.m3-btn--block {
  width: 100%;
}

.m3-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .m3-btn-group--split > * {
    flex: 1 1 0;
  }
}

/* Typography */
.m3-display-sm {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

.m3-headline-md {
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

.m3-title-lg {
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.3;
  margin: 0 0 0.25rem;
}

.m3-title-md {
  font-size: 1.125rem;
  font-weight: 500;
  margin: 0;
}

.m3-body-md {
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
}

.m3-body-sm {
  font-size: 0.875rem;
  line-height: 1.43;
  color: var(--md-sys-color-on-surface-variant);
}

/* Body / icons: use surface text; keep red for links (.m3-link) and filled actions */
.m3-text-primary {
  color: var(--md-sys-color-on-surface);
}

.m3-text-center {
  text-align: center;
}

.m3-stack-sm > * + * {
  margin-top: 0.5rem;
}

.m3-stack-md > * + * {
  margin-top: 1rem;
}

.m3-stack-lg > * + * {
  margin-top: 1.5rem;
}

/* Page header */
.m3-page-head {
  text-align: center;
  margin-bottom: 2rem;
}

.m3-avatar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: var(--md-shape-corner-full);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--md-sys-elevation-1);
}

.m3-avatar-icon--lg {
  width: 5rem;
  height: 5rem;
  font-size: 1.75rem;
}

.m3-avatar-icon--secondary {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-surface-variant);
}

/* Cards */
.m3-card {
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-shape-corner-large);
  box-shadow: var(--md-sys-elevation-1);
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 55%, transparent);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.m3-card:hover {
  box-shadow: var(--md-sys-elevation-2);
}

.m3-card__header {
  padding: 1rem 1.25rem;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.m3-card__header--tonal {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border-bottom: 3px solid var(--md-sys-color-primary);
}

.m3-card__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 500;
}

.m3-card__body {
  padding: 1.25rem;
}

.m3-card__body--flush {
  padding: 0;
}

.m3-card__click {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.m3-card__click .m3-card__body {
  padding: 2rem;
  text-align: center;
}

.m3-card-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .m3-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .m3-card-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.m3-feature-tile__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.25rem;
  border-radius: var(--md-shape-corner-medium);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
  font-size: 1.5rem;
}

/* Stats row */
.m3-stats-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .m3-stats-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.m3-stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-shape-corner-medium);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--md-sys-elevation-1);
}

.m3-stat-card__icon {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--md-shape-corner-small);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
  font-size: 1.25rem;
}

.m3-stat-card__value {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0;
  color: var(--md-sys-color-on-surface);
}

.m3-stat-card__label {
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}

/* Tables */
.m3-table-wrap {
  overflow-x: auto;
}

.m3-table {
  width: 100%;
  border-collapse: collapse;
}

.m3-table thead {
  background: var(--md-sys-color-surface-container);
}

.m3-th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.m3-th--center {
  text-align: center;
}

.m3-td {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface);
}

.m3-td--center {
  text-align: center;
}

.m3-table tbody tr {
  transition: background-color 0.15s ease;
}

.m3-table tbody tr:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 4%, transparent);
}

.m3-th-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.m3-th-inner--center {
  justify-content: center;
  width: 100%;
}

/* Chips & badges */
.m3-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--md-shape-corner-full);
  font-size: 0.8125rem;
  font-weight: 500;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.m3-chip--primary {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-primary);
  border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 28%, var(--md-sys-color-outline-variant));
}

.m3-chip--success {
  background: var(--md-sys-color-success-container);
  color: var(--md-sys-color-on-success-container);
  border-color: transparent;
}

/* Forms */
.m3-field {
  margin-bottom: 1.25rem;
}

.m3-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--md-sys-color-on-surface);
}

.m3-input,
.m3-select,
.m3-textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border-radius: var(--md-shape-corner-small);
  border: 1px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.m3-input:focus,
.m3-select:focus,
.m3-textarea:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--md-sys-color-primary) 35%, transparent);
}

.m3-input-wrap {
  position: relative;
}

.m3-input-wrap .m3-input {
  padding-right: 2.5rem;
}

.m3-input-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-sys-color-on-surface-variant);
  pointer-events: none;
}

.m3-textarea {
  min-height: 6rem;
  resize: vertical;
}

/* Banner / flash */
.m3-banner {
  padding: 1rem 1.25rem;
  border-radius: var(--md-shape-corner-medium);
  margin-bottom: 1rem;
  background: var(--md-sys-color-success-container);
  color: var(--md-sys-color-on-success-container);
  border: 1px solid color-mix(in srgb, var(--md-sys-color-success) 25%, transparent);
}

.m3-banner--error {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  border-color: color-mix(in srgb, var(--md-sys-color-error) 25%, transparent);
}

.m3-banner__inner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.m3-banner__inner i {
  margin-top: 0.125rem;
}

/* Callout */
.m3-callout {
  padding: 1rem;
  border-radius: var(--md-shape-corner-medium);
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.m3-callout__title {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0 0 0.25rem;
}

/* Snackbar (toast) */
.m3-snackbar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  padding: 0.875rem 1rem;
  border-radius: var(--md-shape-corner-small);
  box-shadow: var(--md-sys-elevation-3);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: m3-snackbar-in 0.2s ease;
}

@keyframes m3-snackbar-in {
  from {
    opacity: 0;
    transform: translateY(-0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.m3-snackbar--success {
  background: var(--md-sys-color-success);
  color: var(--md-sys-color-on-success);
}

.m3-snackbar--error {
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
}

/* Empty state */
.m3-empty {
  text-align: center;
  padding: 3rem 1.5rem;
}

.m3-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: var(--md-shape-corner-full);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

/* Pills / highlights */
.m3-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--md-shape-corner-full);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  font-weight: 500;
  border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 22%, var(--md-sys-color-outline-variant));
}

/* Winner result box */
.m3-result-panel {
  padding: 1.5rem;
  border-radius: var(--md-shape-corner-medium);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: inset 3px 0 0 0 var(--md-sys-color-primary);
}

.m3-result-panel__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Spinner */
.m3-spinner {
  width: 4rem;
  height: 4rem;
  border: 4px solid var(--md-sys-color-primary-container);
  border-top-color: var(--md-sys-color-primary);
  border-radius: 50%;
  animation: m3-spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes m3-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Grid helpers */
.m3-grid-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .m3-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.m3-grid-3 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .m3-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.m3-loser-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-shape-corner-small);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.m3-loser-cell__av {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--md-shape-corner-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
}

/* Win tiles */
.m3-win-tile {
  padding: 1.5rem;
  border-radius: var(--md-shape-corner-medium);
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  text-align: center;
  box-shadow: var(--md-sys-elevation-1);
}

.m3-win-tile__icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: var(--md-shape-corner-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-primary);
}

/* Summary band */
.m3-summary-band {
  margin-top: 2rem;
  padding: 1.5rem;
  border-radius: var(--md-shape-corner-medium);
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.m3-summary-band__grid {
  display: grid;
  gap: 1.5rem;
  text-align: center;
}

@media (min-width: 768px) {
  .m3-summary-band__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.m3-summary-val {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

.m3-summary-label {
  font-size: 0.8125rem;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0.25rem 0 0;
}

/* Links in tables */
.m3-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--md-sys-color-primary);
  text-decoration: none;
  font-weight: 500;
}

.m3-link:hover {
  text-decoration: underline;
}

.m3-link .fa-external-link-alt {
  font-size: 0.7rem;
  opacity: 0.7;
}

/* Footer */
.m3-footer {
  border-top: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-low);
  padding: 1rem clamp(1rem, 4vw, 1.5rem);
}

.m3-footer__inner {
  max-width: 72rem;
  margin-inline: auto;
  text-align: center;
}

.m3-footer a {
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
}

.m3-footer a:hover {
  color: var(--md-sys-color-primary);
}

/* Utility */
.m3-sr-shortcut {
  margin-left: 0.25rem;
}

.m3-spacer-mobile {
  height: 5rem;
}

@media (min-width: 768px) {
  .m3-spacer-mobile {
    display: none;
  }
}

.m3-max-w-sm {
  max-width: 28rem;
  margin-inline: auto;
}

.m3-max-w-2xl {
  max-width: 42rem;
  margin-inline: auto;
}

.m3-max-w-3xl {
  max-width: 48rem;
  margin-inline: auto;
}

.m3-narrow-form .m3-form-actions {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .m3-narrow-form .m3-form-actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* ----- Home ----- */
.m3-home {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 4vw, 2.25rem);
  padding-bottom: 1rem;
  max-width: 56rem;
  margin-inline: auto;
}

.m3-home-hero {
  text-align: center;
  padding: clamp(0.25rem, 2vw, 0.5rem) 0 clamp(0.5rem, 3vw, 1rem);
  background: none;
  border: none;
  box-shadow: none;
}

.m3-home-hero__logo {
  display: inline-flex;
  margin-bottom: 0.75rem;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.m3-home-hero__logo img {
  display: block;
  width: clamp(4rem, 14vw, 5.5rem);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.m3-home-hero__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.625rem, 5vw, 2.5rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--md-sys-color-on-surface);
}

.m3-home-hero__accent {
  display: block;
  color: var(--md-sys-color-primary);
  font-weight: 500;
}

.m3-home-hero__subtitle {
  display: block;
  margin-top: 0.25em;
  font-size: 0.55em;
  font-weight: 400;
  color: var(--md-sys-color-on-surface-variant);
}

.m3-home-hero__tagline {
  margin: 0 auto;
  max-width: 26rem;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--md-sys-color-on-surface-variant);
}

.m3-home-section-title {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

.m3-home-highlight {
  border-radius: var(--md-shape-corner-large);
  overflow: hidden;
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--md-sys-elevation-2);
  background: var(--md-sys-color-surface-container-low);
}

.m3-home-highlight__inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: clamp(1.25rem, 4vw, 1.75rem);
}

@media (min-width: 640px) {
  .m3-home-highlight__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
  }
}

.m3-home-highlight__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}

.m3-home-highlight__name {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 5.5vw, 2.125rem);
  font-weight: 500;
  line-height: 1.2;
  color: var(--md-sys-color-on-surface);
  word-break: break-word;
}

.m3-home-highlight__meta {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--md-sys-color-on-surface-variant);
}

.m3-home-highlight__prize {
  margin: 0.75rem 0 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.375rem 0.875rem;
  border-radius: var(--md-shape-corner-full);
  font-size: 0.9375rem;
  font-weight: 500;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-surface);
}

.m3-home-highlight__number {
  flex-shrink: 0;
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  align-self: center;
  min-width: min(5.5rem, 100%);
  padding: 1rem 1.25rem;
  border-radius: var(--md-shape-corner-medium);
  text-align: center;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-1);
}

.m3-home-highlight__number-label {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
}

.m3-home-highlight__number-value {
  margin: 0.2rem 0 0;
  font-size: clamp(2rem, 8vw, 2.75rem);
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.m3-home-highlight--rollover .m3-home-highlight__number {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-primary);
  border: 2px solid var(--md-sys-color-primary);
  box-shadow: none;
}

.m3-home-nav__icon--tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-surface-variant);
}

.m3-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.m3-home-prior-note {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--md-sys-color-on-surface-variant);
  font-style: italic;
}

.m3-home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.m3-home-recent {
  border-radius: var(--md-shape-corner-medium);
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container);
  overflow: hidden;
}

.m3-home-recent ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.m3-home-recent li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.875rem;
}

.m3-home-recent li:first-child {
  border-top: none;
}

.m3-home-recent__name {
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.m3-home-recent__side {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--md-sys-color-on-surface-variant);
  font-variant-numeric: tabular-nums;
}

.m3-home-nav-title {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.m3-home-nav {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 720px) {
  .m3-home-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .m3-home-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.m3-home-nav__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 100%;
  padding: 1rem 0.75rem;
  text-decoration: none;
  color: inherit;
  border-radius: var(--md-shape-corner-medium);
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-low);
  box-shadow: var(--md-sys-elevation-1);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.m3-home-nav__card:hover {
  box-shadow: var(--md-sys-elevation-2);
  border-color: color-mix(in srgb, var(--md-sys-color-primary) 35%, var(--md-sys-color-outline-variant));
}

.m3-home-nav__card:active {
  transform: scale(0.98);
}

.m3-home-nav__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 0.625rem;
  border-radius: var(--md-shape-corner-full);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
  font-size: 1.125rem;
}

.m3-home-nav__label {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--md-sys-color-on-surface);
}

.m3-home-nav__hint {
  margin: 0.25rem 0 0;
  font-size: 0.6875rem;
  line-height: 1.35;
  color: var(--md-sys-color-on-surface-variant);
  display: none;
}

@media (min-width: 720px) {
  .m3-home-nav__hint {
    display: block;
  }
}

.m3-home-empty {
  text-align: center;
  padding: 2rem 1.25rem;
  border-radius: var(--md-shape-corner-large);
  border: 1px dashed var(--md-sys-color-outline);
  background: var(--md-sys-color-surface-container);
}

.m3-home-empty .m3-body-md {
  max-width: 22rem;
  margin-inline: auto;
}
