:root {
  --ink: #f8fbff;
  --dark-ink: #132016;
  --muted: #b7c4b8;
  --line: rgba(255, 255, 255, .16);
  --panel: rgba(11, 31, 24, .9);
  --soft: #07140f;
  --brand: #ffbf2f;
  --brand-dark: #7a3f00;
  --green: #2bed91;
  --gold: #ffd76a;
  --red: #ff4261;
  --cyan: #49d5ff;
  --danger: #ff6b73;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 191, 47, .18) 0 12%, transparent 12% 100%),
    linear-gradient(225deg, rgba(255, 66, 97, .13) 0 10%, transparent 10% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 86px),
    linear-gradient(180deg, #0d2d22 0%, #07140f 58%, #040807 100%);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

a {
  color: var(--brand);
}

.app-header {
  background: linear-gradient(90deg, #07120d, #143c2d 50%, #461322);
  border-bottom: 1px solid rgba(255, 215, 106, .28);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .34);
}

.navbar {
  min-height: 64px;
}

.navbar-brand {
  letter-spacing: 0;
  color: var(--gold) !important;
  text-shadow: 0 0 18px rgba(255, 215, 106, .45);
}

.nav-link {
  color: rgba(255, 255, 255, .8) !important;
  border-radius: 8px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--gold) !important;
  background: rgba(255, 215, 106, .1);
}

.app-shell {
  padding-top: 24px;
  padding-bottom: 48px;
}

.footer {
  padding: 18px 0;
  color: var(--muted);
}

.top-strip,
.status-panel,
.panel,
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .07);
  backdrop-filter: blur(10px);
}

.top-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  margin-bottom: 16px;
  border-color: rgba(255, 215, 106, .28);
}

.top-strip h1,
.section-heading h1,
.section-heading h2,
.status-panel h2,
.login-card h1 {
  margin: 0;
  letter-spacing: 0;
}

.top-strip h1 {
  font-size: clamp(1.35rem, 2.5vw, 2rem);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.balance-pill {
  display: grid;
  justify-items: end;
  min-width: 124px;
  padding: 10px 14px;
  color: #2b1700;
  background: linear-gradient(135deg, #ffe28a, #ffb323 52%, #ff6b35);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(255, 179, 35, .25);
}

.balance-pill span,
.countdown-box span,
.preview-box span {
  color: rgba(255, 255, 255, .72);
  font-size: .8rem;
  font-weight: 700;
}

.balance-pill strong {
  color: #2a1600;
  font-size: 1.3rem;
}

.status-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  margin-bottom: 16px;
}

.countdown-box {
  display: grid;
  min-width: 164px;
  justify-items: end;
}

.countdown-box strong {
  font-variant-numeric: tabular-nums;
  font-size: 1.55rem;
  color: var(--green);
  text-shadow: 0 0 18px rgba(43, 237, 145, .32);
}

.result-banner {
  margin-bottom: 16px;
  padding: 12px 16px;
  color: #2b1700;
  background: linear-gradient(135deg, #fff1ad, #ffbf2f);
  border: 1px solid rgba(255, 255, 255, .48);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(255, 191, 47, .22);
}

.winner-glow {
  animation: winnerPulse 1.6s ease-in-out infinite;
}

.play-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.bet-controls {
  display: contents;
  border: 0;
  margin: 0;
  padding: 0;
}

.panel {
  padding: 18px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading h1 {
  font-size: 1.7rem;
}

.section-heading h2 {
  font-size: 1.25rem;
}

.cow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cow-card {
  position: relative;
  min-height: 238px;
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 16px;
  overflow: hidden;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .035));
  border: 2px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.cow-bet-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: none;
  max-width: calc(100% - 20px);
  min-height: 30px;
  padding: 5px 10px;
  color: #2b1700;
  background: linear-gradient(135deg, #d8ff71, #35f49b);
  border: 1px solid rgba(255, 255, 255, .64);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(43, 237, 145, .24);
  font-size: .78rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cow-card.has-bet .cow-bet-badge {
  display: inline-flex;
  align-items: center;
}

.winner-cow-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: none;
  min-height: 30px;
  padding: 5px 11px;
  color: #2b1700;
  background: linear-gradient(135deg, #fff6b8, #ffbf2f 52%, #ff7a3d);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(255, 191, 47, .34);
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.cow-card.winner-cow {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 246, 184, .32), transparent 42%),
    linear-gradient(180deg, rgba(255, 215, 106, .3), rgba(43, 237, 145, .12));
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 215, 106, .18), 0 0 36px rgba(255, 191, 47, .3), 0 18px 36px rgba(0, 0, 0, .34);
  animation: cowWinnerGlow 1.4s ease-in-out infinite;
}

.cow-card.winner-cow .winner-cow-badge {
  display: inline-flex;
  align-items: center;
}

.cow-card.winner-cow .cow-img {
  animation: cowWinnerPop 1.25s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(255, 215, 106, .75));
}

.cow-card.loser-cow {
  opacity: .62;
  filter: saturate(.65);
}

.cow-card:hover:not(:disabled),
.cow-card.selected {
  background: linear-gradient(180deg, rgba(255, 215, 106, .22), rgba(43, 237, 145, .08));
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 215, 106, .14), 0 18px 32px rgba(0, 0, 0, .28);
  transform: translateY(-2px);
}

.cow-card:disabled {
  opacity: .55;
}

.cow-img {
  width: 160px;
  height: 160px;
  display: block;
  object-fit: contain;
}

.points-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.point-chip {
  min-height: 48px;
  padding: 8px;
  color: #281600;
  background: linear-gradient(135deg, #fff4c4, #ffc13b);
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 8px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 18px rgba(255, 191, 47, .14);
}

.point-chip:hover:not(:disabled),
.point-chip.selected {
  color: #fff;
  background: linear-gradient(135deg, #ff3157, #8d1eff);
  border-color: rgba(255, 255, 255, .55);
  box-shadow: 0 0 0 4px rgba(255, 49, 87, .16), 0 14px 26px rgba(141, 30, 255, .24);
}

.preview-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.selected-bet-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(255, 215, 106, .12);
  border: 1px solid rgba(255, 215, 106, .3);
  border-radius: 8px;
}

.selected-bet-box div {
  display: grid;
  gap: 2px;
}

.selected-bet-box span {
  color: rgba(255, 255, 255, .72);
  font-size: .8rem;
  font-weight: 700;
}

.selected-bet-box strong {
  color: var(--gold);
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

.preview-box strong {
  font-size: 1.2rem;
  color: var(--green);
}

.btn-primary {
  color: #2b1700;
  background: linear-gradient(135deg, #ffe28a, #ffb323 45%, #ff5a3d);
  border-color: rgba(255, 255, 255, .46);
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(255, 179, 35, .24);
}

.btn-primary:hover,
.btn-primary:focus {
  color: #fff;
  background: linear-gradient(135deg, #ff3157, #8d1eff);
  border-color: rgba(255, 255, 255, .58);
}

.app-table {
  margin-bottom: 0;
  min-width: 680px;
  color: #f8fbff;
  --bs-table-color: #f8fbff;
  --bs-table-bg: transparent;
  --bs-table-border-color: rgba(255, 255, 255, .14);
  --bs-table-striped-color: #f8fbff;
  --bs-table-hover-color: #ffffff;
}

.app-table thead th {
  color: var(--gold);
  font-size: .78rem;
  text-transform: uppercase;
}

.app-table tbody td {
  color: #f8fbff;
  border-color: rgba(255, 255, 255, .12);
  font-weight: 650;
}

.app-table tbody tr {
  background: rgba(255, 255, 255, .035);
}

.app-table tbody tr:hover {
  background: rgba(255, 215, 106, .08);
}

.app-table tbody tr.winner-row {
  background: linear-gradient(90deg, rgba(255, 215, 106, .18), rgba(43, 237, 145, .1));
  box-shadow: inset 4px 0 0 var(--gold);
}

.app-table tbody tr.winner-row td {
  color: #fff7d6;
  font-weight: 800;
}

.app-table tbody tr.winner-row .status-chip {
  color: #123019;
  background: linear-gradient(135deg, #fff6b8, #4bf29a);
  box-shadow: 0 0 18px rgba(43, 237, 145, .18);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  background: rgba(73, 213, 255, .14);
  color: #b8efff;
  border-radius: 999px;
  font-weight: 700;
  font-size: .82rem;
}

.login-wrap {
  min-height: calc(100vh - 180px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(100%, 440px);
  padding: 26px;
}

.login-card h1 {
  margin-bottom: 22px;
  font-size: 2rem;
}

.form-control {
  color: var(--ink);
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .18);
}

.form-control:focus {
  color: var(--ink);
  background: rgba(255, 255, 255, .12);
  border-color: var(--gold);
  box-shadow: 0 0 0 .25rem rgba(255, 215, 106, .18);
}

.form-control::placeholder {
  color: rgba(255, 255, 255, .48);
}

.password-field {
  position: relative;
}

.password-field .form-control {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: rgba(255, 255, 255, .72);
  background: transparent;
  border: 0;
  border-radius: 8px;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus {
  color: var(--gold);
  background: rgba(255, 255, 255, .08);
}

.password-eye {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.password-eye-closed,
.password-toggle.is-visible .password-eye-open {
  display: none;
}

.password-toggle.is-visible .password-eye-closed {
  display: block;
}

.win-celebration {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: grid;
  place-items: center;
  pointer-events: none;
  overflow: hidden;
  background: rgba(4, 8, 7, .22);
}

.win-card {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: min(92vw, 440px);
  padding: 26px 22px;
  color: #2b1700;
  text-align: center;
  background: linear-gradient(135deg, #fff4bf, #ffc233 54%, #ff7a3d);
  border: 2px solid rgba(255, 255, 255, .7);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .42), 0 0 60px rgba(255, 191, 47, .35);
  animation: winCardPop .6s ease-out both;
}

.win-card strong {
  font-size: clamp(1.55rem, 6vw, 2.4rem);
  line-height: 1.05;
}

.win-card small {
  font-weight: 800;
}

.win-kicker {
  min-height: 28px;
  padding: 5px 12px;
  color: #fff;
  background: linear-gradient(135deg, #ff3157, #8d1eff);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.money-note {
  position: absolute;
  top: -64px;
  min-width: 70px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  color: #08351f;
  background:
    radial-gradient(circle at 18% 50%, rgba(255, 255, 255, .78) 0 9px, transparent 10px),
    linear-gradient(135deg, #eaffc2, #47e98d 48%, #16b86a);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 6px;
  font-weight: 900;
  font-size: .92rem;
  letter-spacing: 0;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .24), inset 0 0 0 1px rgba(6, 59, 35, .12);
  animation: moneyRain linear forwards;
}

.money-note::before,
.money-note::after {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  width: 1px;
  background: rgba(6, 59, 35, .18);
}

.money-note::before {
  left: 18px;
}

.money-note::after {
  right: 18px;
}

.note-1 {
  background:
    radial-gradient(circle at 18% 50%, rgba(255, 255, 255, .78) 0 9px, transparent 10px),
    linear-gradient(135deg, #fff0b8, #ffca45 48%, #f28b2d);
}

.note-2 {
  background:
    radial-gradient(circle at 18% 50%, rgba(255, 255, 255, .78) 0 9px, transparent 10px),
    linear-gradient(135deg, #dff7ff, #57d8ff 48%, #3583e8);
}

.note-3 {
  background:
    radial-gradient(circle at 18% 50%, rgba(255, 255, 255, .78) 0 9px, transparent 10px),
    linear-gradient(135deg, #ffd5e3, #ff7ba8 48%, #cc4bc2);
}

.money-burst {
  top: 50%;
  left: 50%;
  z-index: 1;
  animation: moneyBurst 1.45s cubic-bezier(.16, .86, .28, 1) forwards;
}

.fade-out {
  animation: celebrationFade .9s ease forwards;
}

@keyframes moneyRain {
  0% {
    translate: 0 -80px;
    rotate: -18deg;
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  55% {
    translate: calc(var(--drift) * .45) 55vh;
    rotate: calc(var(--spin) * .45);
  }
  100% {
    translate: var(--drift) 112vh;
    rotate: var(--spin);
    opacity: .96;
  }
}

@keyframes moneyBurst {
  0% {
    translate: -50% -50%;
    rotate: 0deg;
    scale: .4;
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  100% {
    translate: calc(-50% + var(--burst-x)) calc(-50% + var(--burst-y));
    rotate: var(--spin);
    scale: .92;
    opacity: 0;
  }
}

@keyframes winCardPop {
  0% {
    transform: scale(.82);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes celebrationFade {
  to {
    opacity: 0;
  }
}

@keyframes winnerPulse {
  0%, 100% {
    box-shadow: 0 12px 28px rgba(255, 191, 47, .22);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(255, 215, 106, .16), 0 18px 40px rgba(255, 191, 47, .4);
  }
}

@keyframes cowWinnerGlow {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(255, 215, 106, .16), 0 0 30px rgba(255, 191, 47, .24), 0 18px 36px rgba(0, 0, 0, .34);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 215, 106, .24), 0 0 48px rgba(255, 191, 47, .45), 0 22px 42px rgba(0, 0, 0, .38);
  }
}

@keyframes cowWinnerPop {
  0%, 100% {
    transform: scale(1) rotate(-1deg);
  }
  50% {
    transform: scale(1.07) rotate(1deg);
  }
}

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

@media (max-width: 640px) {
  .app-shell {
    padding-top: 14px;
  }

  .top-strip,
  .status-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .balance-pill,
  .countdown-box {
    justify-items: start;
  }

  .cow-grid,
  .points-grid {
    grid-template-columns: 1fr 1fr;
  }

  .cow-card {
    min-height: 204px;
  }

  .cow-bet-badge {
    top: 8px;
    right: 8px;
    min-height: 26px;
    padding: 4px 8px;
    font-size: .7rem;
  }

  .cow-img {
    width: 138px;
    height: 138px;
  }
}
