* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #050509;
  --surface: #111117;
  --surface-2: #191923;
  --surface-3: #242431;
  --line: #30303b;
  --line-strong: #565668;
  --text: #fbf9ff;
  --muted: #b9b6c3;
  --soft: #e9dff5;
  --gold: #ffd777;
  --green: #78e8ad;
  --pink: #f3bedc;
  --violet: #cbbcff;
  --danger: #ff9eae;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% -8%, rgba(255, 215, 119, 0.12), transparent 30rem),
    radial-gradient(circle at 88% 0%, rgba(203, 188, 255, 0.12), transparent 30rem),
    linear-gradient(180deg, #0b0b10 0%, var(--bg) 46%, #020204 100%);
  color: var(--text);
  font-family: "Microsoft JhengHei", "Noto Sans TC", "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 7, 11, 0.9);
  backdrop-filter: blur(18px);
}

.brand,
.account-box,
.login-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(243, 201, 107, 0.55);
  border-radius: 12px;
  color: var(--gold);
  background: linear-gradient(145deg, #1d160b, #232029);
  font-weight: 900;
}

.brand strong,
.brand small,
.account-box span,
.account-box strong {
  display: block;
}

.brand small,
.account-box span {
  color: var(--muted);
  font-size: 12px;
}

.login-inline input {
  width: 142px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(3, 4, 8, 0.86);
}

.login-inline button,
.account-box button,
.panel-head button,
.bet-form button {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 16px;
  color: #101116;
  background: linear-gradient(180deg, #ffe2ef, #c9b8ff);
  font-weight: 800;
}

.login-inline button:disabled,
.bet-form button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.account-box button,
.panel-head button {
  color: var(--text);
  background: linear-gradient(180deg, #242833, #171a22);
}

#loginMessage {
  min-width: 120px;
  color: var(--danger);
  font-size: 13px;
}

.layout {
  width: min(1580px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.hero-panel,
.player-strip,
.events-panel,
.bet-slip,
.bets-panel,
.character-panel {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(24, 24, 33, 0.94), rgba(9, 9, 13, 0.96));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  min-height: 178px;
  padding: 30px;
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto 28px 0 auto;
  width: 300px;
  height: 120px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 119, 0.14), rgba(243, 190, 220, 0.12));
  filter: blur(22px);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-panel h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.05;
}

.hero-panel p {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
}

.quota-card {
  align-self: center;
  min-width: 190px;
  border: 1px solid rgba(243, 201, 107, 0.25);
  border-radius: 10px;
  padding: 16px;
  background: rgba(243, 201, 107, 0.06);
}

.quota-card span,
.quota-card small {
  display: block;
  color: var(--muted);
}

.quota-card strong {
  display: block;
  margin: 6px 0;
  color: var(--gold);
  font-size: 24px;
}

.player-strip {
  margin-top: 16px;
  padding: 0;
}

.character-panel {
  border: 0;
  border-radius: 10px;
  box-shadow: none;
}

.panel-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-head.compact {
  min-height: 48px;
}

.panel-head h2,
.panel-head p {
  margin: 0;
}

.panel-head h2 {
  font-size: 18px;
}

.panel-head p,
.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.character-model {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 18px;
}

.model-stage {
  position: relative;
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 18%, rgba(198, 183, 255, 0.16), transparent 7rem), #0b0d12;
  overflow: hidden;
}

.avatar-placeholder {
  color: var(--line-strong);
  font-size: 64px;
  font-weight: 900;
}

.avatar-figure {
  position: relative;
  width: 72px;
  height: 118px;
  transform: translateY(6px);
}

.avatar-head {
  position: absolute;
  left: 14px;
  top: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffd7b2;
  box-shadow: inset -8px -4px 0 rgba(180, 118, 77, 0.25), 0 0 0 3px #1a1110;
}

.avatar-head::before,
.avatar-head::after {
  content: "";
  position: absolute;
  top: 23px;
  width: 7px;
  height: 4px;
  border-radius: 50%;
  background: #21151a;
}

.avatar-head::before {
  left: 10px;
}

.avatar-head::after {
  right: 10px;
}

.avatar-body {
  position: absolute;
  left: 21px;
  top: 43px;
  width: 30px;
  height: 42px;
  border-radius: 12px 12px 9px 9px;
  background: linear-gradient(180deg, #eff4ff, #4f2a56);
  box-shadow: 0 0 0 3px #14151d;
}

.avatar-arm,
.avatar-leg {
  position: absolute;
  background: #ffd7b2;
  box-shadow: 0 0 0 3px #14151d;
}

.avatar-arm {
  top: 50px;
  width: 16px;
  height: 38px;
  border-radius: 10px;
}

.avatar-arm.left {
  left: 6px;
  transform: rotate(16deg);
}

.avatar-arm.right {
  right: 6px;
  transform: rotate(-16deg);
}

.avatar-leg {
  top: 83px;
  width: 16px;
  height: 34px;
  border-radius: 9px;
}

.avatar-leg.left {
  left: 22px;
}

.avatar-leg.right {
  right: 22px;
}

.equipped-tags {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
}

.equipped-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 10px;
}

.model-shadow {
  position: absolute;
  bottom: 16px;
  width: 120px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.38);
  filter: blur(4px);
}

.character-avatar-stage {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 74%, rgba(255, 218, 246, 0.12), transparent 32%),
    radial-gradient(circle at 48% 18%, rgba(203, 188, 255, 0.1), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.22)),
    rgba(8, 8, 12, 0.72);
}

.character-avatar-stage::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 30px;
  width: 130px;
  height: 18px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  filter: blur(2px);
}

.character-avatar-sprite {
  position: absolute;
  left: 50%;
  bottom: 34px;
  width: 340px;
  height: 300px;
  transform: translateX(-50%);
}

.character-avatar-frame {
  position: absolute;
  inset: 0;
}

.character-avatar-sprite.has-idle .character-avatar-frame {
  animation: maple-idle-frame 1.08s steps(1, end) infinite;
}

.character-avatar-sprite.has-idle .frame-1 {
  opacity: 0;
  animation-delay: 0.54s;
}

@keyframes maple-idle-frame {
  0%,
  49.99% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

.character-layer {
  position: absolute;
  display: block;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  pointer-events: none;
}

.empty-avatar {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  font-weight: 900;
}

.character-model strong {
  font-size: 24px;
}

.character-model p {
  margin: 8px 0 12px;
  color: var(--muted);
}

.character-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.character-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--soft);
  background: #0b0d12;
  font-size: 12px;
}

.sports-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  margin-top: 16px;
}

.event-list {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.event-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(255, 215, 119, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(29, 29, 39, 0.98), rgba(8, 8, 12, 0.98));
  overflow: hidden;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.24);
}

.event-main {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.event-time span,
.event-time small {
  display: block;
}

.event-time span {
  color: var(--gold);
  font-weight: 800;
}

.event-time small {
  display: inline-flex;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.04);
}

.teams {
  display: grid;
  gap: 7px;
}

.teams div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.teams span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #111116;
  background: linear-gradient(180deg, #fff1b8, #f4c85e);
  font-size: 12px;
  font-weight: 900;
}

.teams strong {
  font-size: 20px;
}

.score-pill {
  min-width: 98px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--soft);
  text-align: center;
  background: rgba(0, 0, 0, 0.28);
  font-weight: 800;
}

.markets {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.market-group {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.market-group > span {
  color: var(--gold);
  padding-top: 11px;
  font-weight: 800;
}

.market-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.odds-button {
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(72px, auto);
  align-items: center;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent),
    linear-gradient(180deg, #20202a, #101016);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.odds-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 215, 119, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 215, 119, 0.08), 0 12px 28px rgba(0, 0, 0, 0.24);
}

.odds-button.parlay-only {
  border-color: rgba(203, 188, 255, 0.28);
}

.odds-button span {
  min-width: 0;
  color: var(--soft);
  text-align: left;
  font-size: 15px;
  font-weight: 800;
}

.odds-label {
  display: grid;
  gap: 7px;
}

.odds-label b {
  overflow-wrap: anywhere;
  line-height: 1.28;
}

.odds-button span small,
.odds-label small {
  display: inline-flex;
  width: fit-content;
  margin-top: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 800;
}

.odds-button.parlay-only span small {
  color: var(--violet);
  border-color: rgba(203, 188, 255, 0.28);
  background: rgba(203, 188, 255, 0.08);
}

.odds-button strong {
  color: var(--green);
  text-align: right;
  font-size: 25px;
  line-height: 1;
}

.bet-slip {
  position: sticky;
  top: 86px;
  align-self: start;
}

.empty-box {
  margin: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
}

.bet-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.selected-bet {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(255, 215, 119, 0.25);
  border-radius: 12px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 215, 119, 0.07), rgba(255, 255, 255, 0.02));
}

.selected-bet span {
  color: var(--muted);
  font-size: 13px;
}

.selected-bet b {
  color: var(--soft);
}

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

.selected-bet i {
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--violet);
  background: rgba(203, 188, 255, 0.08);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.bet-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.bet-form input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 11px;
  color: var(--text);
  background: #050609;
}

.payout-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.payout-row span {
  color: var(--muted);
}

.payout-row strong {
  color: var(--gold);
}

#betMessage {
  min-height: 22px;
  margin: 0;
  color: var(--soft);
}

.bets-panel {
  margin-top: 16px;
}

.my-bets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
  padding: 16px;
}

.bet-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(28, 28, 37, 0.95), rgba(9, 9, 13, 0.95));
}

.bet-card div {
  display: grid;
  gap: 3px;
}

.bet-card span {
  color: var(--muted);
  font-size: 13px;
}

.bet-card b {
  color: var(--gold);
}

.status-won {
  border-color: rgba(113, 230, 163, 0.45);
}

.status-lost {
  border-color: rgba(255, 158, 158, 0.35);
}

.status-void {
  border-color: rgba(198, 183, 255, 0.4);
}

@media (max-width: 980px) {
  .topbar,
  .hero-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .sports-grid {
    grid-template-columns: 1fr;
  }

  .bet-slip {
    position: static;
  }

  .character-model {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .layout {
    padding: 12px;
  }

  .login-inline {
    align-items: stretch;
    flex-direction: column;
  }

  .login-inline input {
    width: 100%;
  }

  .event-main,
  .market-group {
    grid-template-columns: 1fr;
  }
}
