:root {
  color-scheme: dark;
  --grass: #0f7f4f;
  --grass-dark: #062f24;
  --pitch: #0b5a3f;
  --gold: #ffd166;
  --red: #e63946;
  --blue: #1d4ed8;
  --ink: #f6fff9;
  --muted: #b9d7c8;
  --line: rgba(255, 255, 255, 0.16);
  --panel: rgba(7, 43, 33, 0.86);
  --panel-solid: #0a382c;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 72px 72px,
    radial-gradient(circle at 20% 5%, rgba(255, 209, 102, 0.22), transparent 26rem),
    radial-gradient(circle at 82% 12%, rgba(230, 57, 70, 0.2), transparent 28rem),
    linear-gradient(135deg, #083328 0%, #0b6545 52%, #09281f 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49.5%, rgba(255, 255, 255, 0.12) 50%, transparent 50.5%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 108px);
  opacity: 0.55;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: rgba(5, 32, 25, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.logo-ball {
  display: grid;
  width: 3.2rem;
  height: 3.2rem;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background:
    conic-gradient(from 40deg, var(--red), var(--gold), #18a66d, var(--blue), var(--red));
  color: white;
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.35);
  animation: cupBounce 2.7s ease-in-out infinite;
  box-shadow: 0 0 0 5px rgba(255,255,255,0.08), 0 12px 24px rgba(0,0,0,0.35);
}

@keyframes cupBounce {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  45% { transform: translateY(-7px) rotate(10deg); }
  70% { transform: translateY(1px) rotate(4deg); }
}

.brand-copy {
  display: grid;
  line-height: 1.05;
  text-align: left;
}

.brand-copy strong {
  font-size: 1.05rem;
}

.brand-copy small {
  color: var(--gold);
  font-weight: 700;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.language-control {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  max-width: 15.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.language-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 100%;
  padding: 0 0.55rem 0 0.7rem;
  color: rgba(246, 255, 249, 0.82);
  font-size: 0.78rem;
  font-weight: 850;
  max-width: 8.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-right: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.12);
}

.language-control select {
  min-height: 2.5rem;
  width: auto;
  min-width: 5.6rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

select,
input {
  min-height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 0.8rem;
  background: rgba(255,255,255,0.1);
  color: var(--ink);
  outline: none;
}

select option {
  color: #10231c;
}

.primary,
.ghost,
.icon-button,
.predict-button {
  min-height: 2.5rem;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 0.9rem;
  cursor: pointer;
  font-weight: 800;
}

.primary,
.predict-button {
  background: var(--gold);
  color: #1f2a12;
  box-shadow: 0 10px 26px rgba(255, 209, 102, 0.22);
}

.ghost,
.icon-button {
  background: rgba(255,255,255,0.09);
  border-color: var(--line);
}

.icon-button {
  width: 2.8rem;
  padding: 0;
  font-size: 2rem;
  line-height: 1;
}

main,
.history-page {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
}

.matchday-hero {
  padding: clamp(1rem, 4vw, 2.4rem) 0 1.2rem;
}

.tournament-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.tournament-meta span {
  font-weight: 900;
  letter-spacing: 0;
}

.day-carousel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
}

.day-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(120px, 1fr);
  gap: 0.7rem;
  overflow: hidden;
}

.day-chip {
  display: grid;
  gap: 0.2rem;
  min-height: 5.3rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, background 160ms ease;
}

.day-chip strong {
  font-size: 1.1rem;
}

.day-chip span {
  color: var(--muted);
  font-size: 0.85rem;
}

.day-chip.active {
  transform: translateY(-0.35rem);
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.96), rgba(255,255,255,0.95));
  color: #11231b;
}

.day-chip.active span {
  color: #315046;
}

.content-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  align-items: start;
  padding-bottom: 2rem;
}

.ai-panel,
.match-card,
.modal {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.ai-panel {
  position: sticky;
  top: 6rem;
  padding: 1rem;
}

.ai-head {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 0.8rem;
  align-items: center;
}

.ai-avatar {
  position: relative;
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  place-items: center;
  border: 2px solid rgba(255,255,255,0.42);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, #f6fff9 0 8px, transparent 9px),
    linear-gradient(135deg, var(--gold), #18a66d);
  box-shadow: 0 0 0 5px rgba(255,255,255,0.07), 0 12px 28px rgba(0,0,0,0.28);
}

.ai-avatar::before,
.ai-avatar::after {
  content: "";
  position: absolute;
  top: 1.3rem;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #062f24;
}

.ai-avatar::before {
  left: 1.08rem;
}

.ai-avatar::after {
  right: 1.08rem;
}

.ai-avatar span {
  position: absolute;
  bottom: 0.78rem;
  width: 1.25rem;
  height: 0.28rem;
  border-radius: 999px;
  background: #062f24;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 1.1rem;
  font-weight: 900;
}

.panel-title strong {
  color: var(--gold);
}

.ai-match-name {
  display: block;
  margin-top: 0.9rem;
  color: var(--gold);
  font-size: 1rem;
}

.ai-panel p {
  color: var(--muted);
  line-height: 1.65;
}

.ai-report-button {
  width: 100%;
  margin-bottom: 0.9rem;
}

.ai-meters {
  display: grid;
  gap: 0.8rem;
}

.ai-meters label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
}

meter {
  width: 100%;
  height: 0.7rem;
}

.matches {
  display: grid;
  gap: 0.9rem;
}

.match-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 9rem 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.match-card.selected {
  border-color: rgba(255, 209, 102, 0.78);
  box-shadow: 0 24px 80px rgba(0,0,0,0.28), 0 0 0 2px rgba(255, 209, 102, 0.18) inset;
  transform: translateY(-2px);
}

.match-card.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(255, 209, 102, 0.16) 45%, transparent 70%);
  transform: translateX(-120%);
  animation: selectedSweep 1.2s ease both;
}

@keyframes selectedSweep {
  to {
    transform: translateX(120%);
  }
}

.kickoff {
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
}

.kickoff strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.flag-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.8rem;
}

.team {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 0.55rem;
  background: rgba(255,255,255,0.07);
  cursor: pointer;
  text-align: left;
}

.team img {
  width: 4.5rem;
  height: 3rem;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 7px 14px rgba(0,0,0,0.24);
}

.team b {
  display: block;
  font-size: 1.05rem;
}

.team small {
  color: var(--muted);
}

.vs {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #10231c;
  font-weight: 950;
}

.vs-wrap {
  display: grid;
  justify-items: center;
  gap: 0.42rem;
}

.match-status {
  min-width: 4.6rem;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  background: rgba(255,255,255,0.1);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.match-status.live {
  border-color: rgba(230, 57, 70, 0.55);
  background: rgba(230, 57, 70, 0.2);
  color: #fecdd3;
}

.match-status.ended {
  border-color: rgba(255, 209, 102, 0.42);
  background: rgba(255, 209, 102, 0.16);
  color: var(--gold);
}

.match-info {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.92rem;
}

.predict-button.locked {
  background: rgba(255,255,255,0.18);
  color: var(--muted);
  box-shadow: none;
}

dialog {
  width: min(560px, calc(100% - 1.4rem));
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(5px);
}

.modal {
  position: relative;
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.modal.wide {
  width: min(760px, calc(100vw - 1.4rem));
}

#predictDialog {
  width: min(1120px, calc(100% - 1.4rem));
}

#predictForm {
  width: min(1120px, calc(100vw - 1.4rem));
  max-height: min(88vh, 860px);
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  align-items: start;
  gap: 1rem 1.2rem;
  padding: 1.4rem;
}

#predictForm .modal-match,
#predictForm .tabs,
#predictForm .tab-page,
#predictForm .modal-actions {
  grid-column: 1;
}

#predictForm .charts {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: stretch;
}

#predictForm .modal-actions {
  justify-content: flex-start;
}

#teamDialog {
  width: min(1040px, calc(100% - 1.4rem));
}

#teamDialog .modal.wide {
  width: min(1040px, calc(100vw - 1.4rem));
  max-height: min(86vh, 820px);
  padding: 1.4rem;
}

#ticketDialog {
  width: min(940px, calc(100% - 1rem));
}

#ticketModal {
  width: min(940px, calc(100vw - 1rem));
  max-height: min(86vh, 820px);
  overflow: auto;
}

.close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  color: var(--ink);
  cursor: pointer;
}

.modal h2,
.modal p {
  margin: 0;
}

.modal p {
  color: var(--muted);
}

.ai-report-section {
  margin: 0.75rem 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(255,255,255,.055);
  line-height: 1.75;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
}

.auth-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d1fae5;
  font-weight: 900;
  cursor: pointer;
}

.auth-tabs button.active {
  background: var(--gold);
  color: #08251c;
}

.register-only {
  display: grid;
  gap: 0.75rem;
}

.register-only[hidden] {
  display: none !important;
}

.password-strength {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.strength-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
}

.strength-track i {
  display: block;
  width: var(--strength, 8%);
  height: 100%;
  border-radius: inherit;
  background: #fb7185;
  transition: width .2s ease, background .2s ease;
}

.strength-track i[data-level="2"] { background: #fbbf24; }
.strength-track i[data-level="3"],
.strength-track i[data-level="4"] { background: #22c55e; }

.password-strength b {
  color: #d1fae5;
  font-weight: 700;
}

.privacy-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.privacy-check input {
  width: 1rem;
  height: 1rem;
}

.modal-match {
  padding-right: 2.4rem;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.tab {
  min-height: 2.8rem;
  border: 0;
  background: rgba(255,255,255,0.07);
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.tab.active {
  background: var(--gold);
  color: #162318;
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: grid;
  gap: 0.75rem;
}

#predictForm .tab-page.active {
  min-height: 0;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 0.6rem;
}

.choice {
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  font-weight: 900;
}

.choice.selected {
  background: var(--gold);
  color: #172315;
}

.play-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.8rem;
}

.play-actions .primary:disabled {
  background: rgba(255,255,255,0.18);
  color: var(--muted);
  box-shadow: none;
  cursor: default;
}

.charts {
  display: grid;
  gap: 0.8rem;
  align-content: start;
}

.chart-group {
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  animation: chartRise 360ms ease both;
}

.bar-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr 3rem;
  align-items: center;
  gap: 0.6rem;
}

.bar-track {
  height: 0.9rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.13);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #fb7185);
  width: var(--bar-width);
  transform-origin: left center;
  animation: barGrow 720ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes chartRise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes barGrow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.history-page {
  padding: 1.5rem 0 2rem;
}

.history-page h1 {
  margin: 1rem 0;
}

.history-list {
  display: grid;
  gap: 0.8rem;
}

.user-center {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.user-center-layout {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  align-items: start;
}

.user-main-panel,
.profile-fields,
.leaderboard-list {
  display: grid;
  gap: 0.8rem;
}

.user-box {
  position: relative;
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.055);
}

.profile-card-head,
.leaderboard-row,
#profileButton {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.avatar-pick-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.avatar-pick-button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 50%;
}

#profileButton {
  padding: 0.35rem 0.7rem;
  position: relative;
}

#profileButton:hover::after,
#profileButton:focus-visible::after {
  content: "进入用户社区，更多有趣玩法";
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 20;
  width: max-content;
  max-width: 15rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-radius: 8px;
  background: rgba(2, 36, 26, 0.96);
  color: #fff8dc;
  box-shadow: 0 12px 30px rgba(0,0,0,.32);
  font-size: 0.9rem;
  white-space: normal;
}

.user-avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: linear-gradient(135deg, #0f7f4f, #ffd166);
  color: white;
  font-weight: 950;
}

.user-avatar.avatar-small {
  width: 34px;
  height: 34px;
  font-size: 0.85rem;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card-head strong {
  display: block;
  font-size: 1.25rem;
}

.profile-card-head span,
.profile-card-head small,
.profile-meta span,
.leaderboard-row em {
  color: var(--muted);
  font-style: normal;
}

.profile-card-head small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
}

.profile-fields {
  grid-template-columns: minmax(180px, 1.15fr) minmax(132px, 0.7fr) minmax(120px, 0.7fr);
  align-items: end;
}

.profile-fields-compact {
  grid-template-columns: minmax(180px, 360px) minmax(150px, 180px);
  justify-content: start;
}

.profile-fields-compact #nicknameInput {
  max-width: 360px;
}

.profile-fields label {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.avatar-upload-button {
  width: 100%;
  min-height: 40px;
  justify-content: center;
}

.gender-picks {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  gap: 0.45rem;
}

.gender-picks button {
  width: 42px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: #ecfdf5;
  font-size: 1.25rem;
  font-weight: 900;
  cursor: pointer;
}

.gender-picks button.active {
  border-color: var(--gold);
  background: var(--gold);
  color: #08251c;
}

.profile-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.profile-points {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  color: #fff8dc;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  font-weight: 950;
  text-shadow: 0 2px 12px rgba(0,0,0,.35);
}

.profile-save-message {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(34, 197, 94, 0.45);
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.16);
  color: #bbf7d0;
  font-weight: 900;
  text-align: center;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .2s ease, transform .2s ease;
}

.profile-save-message.show {
  opacity: 1;
  transform: translateY(0);
}

.leaderboard-panel {
  position: sticky;
  top: 1rem;
}

.leaderboard-top {
  margin-bottom: 0.6rem;
}

.leaderboard-row {
  min-height: 46px;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(0,0,0,.14);
}

.rank-no {
  width: 2rem;
  color: var(--gold);
  font-weight: 950;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1;
}

.leaderboard-top .leaderboard-row:nth-child(1) .rank-no,
.leaderboard-top .leaderboard-row:nth-child(2) .rank-no,
.leaderboard-top .leaderboard-row:nth-child(3) .rank-no {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.14);
  border: 1px solid rgba(255, 209, 102, 0.38);
  font-size: 1.2rem;
}

.rank-carousel {
  height: calc(46px * 5 + 0.55rem * 4);
  overflow: hidden;
}

.rank-carousel-track {
  display: grid;
  gap: 0.55rem;
  animation: rankScroll 14s linear infinite;
}

.rank-carousel:hover .rank-carousel-track {
  animation-play-state: paused;
}

@keyframes rankScroll {
  0%, 12% { transform: translateY(0); }
  100% { transform: translateY(calc(-50% - 0.275rem)); }
}

.leaderboard-row strong {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-box,
.featured-box {
  overflow: hidden;
}

.user-points {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.user-points strong {
  color: var(--gold);
  font-size: 2.4rem;
}

.user-actions,
.card-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.card-grid,
.auction-grid,
.featured-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.8rem;
}

.featured-strip {
  grid-auto-flow: column;
  grid-auto-columns: 180px;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.star-card,
.auction-item {
  position: relative;
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 3px solid #8b7355;
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
}

.star-card.bronze {
  border-color: #b7793c;
  background: linear-gradient(160deg, rgba(183, 121, 60, 0.18), rgba(255,255,255,0.06));
}

.star-card.silver {
  border-color: #e5e7eb;
  background: linear-gradient(160deg, rgba(226, 232, 240, 0.2), rgba(71, 85, 105, 0.12));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.28);
}

.star-card.gold {
  border-color: #ffd166;
  background: linear-gradient(160deg, rgba(255, 209, 102, 0.24), rgba(249, 115, 22, 0.11));
  box-shadow: 0 0 24px rgba(255,209,102,.28), inset 0 0 0 1px rgba(255,255,255,.32);
}

.star-card.diamond {
  border-color: #67e8f9;
  background: linear-gradient(160deg, rgba(103,232,249,.24), rgba(167,139,250,.16));
  box-shadow: 0 0 34px rgba(103,232,249,.38), inset 0 0 0 1px rgba(255,255,255,.44);
}

.star-card.bronze > strong { color: #f6c391; }
.star-card.silver > strong { color: #f8fafc; }
.star-card.gold > strong { color: #ffd166; }
.star-card.diamond > strong { color: #a5f3fc; }

.star-art {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(145deg, #0f7f4f, #09281f);
}

.star-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.star-card code {
  white-space: normal;
  color: var(--gold);
  font-size: 0.75rem;
}

.card-reveal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 20, 14, 0.82);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.card-reveal-overlay.is-active {
  opacity: 1;
}

.card-reveal-overlay.is-done {
  opacity: 0;
}

.card-reveal-stage {
  position: relative;
  width: min(360px, 86vw);
  height: min(560px, 76vh);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 209, 102, 0.32);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 209, 102, 0.24), transparent 32%),
    linear-gradient(155deg, rgba(4, 58, 42, 0.96), rgba(3, 32, 24, 0.96));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

.card-reveal-stage strong {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1.1rem;
  z-index: 4;
  color: #fff8dc;
  text-align: center;
  font-size: clamp(1rem, 4vw, 1.35rem);
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.55);
}

.reveal-ball {
  position: absolute;
  z-index: 3;
  width: 132px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 35% 28%, #fff 0 16%, transparent 17%),
    conic-gradient(from 18deg, #101820 0 12%, #fff 12% 24%, #101820 24% 36%, #fff 36% 52%, #101820 52% 64%, #fff 64% 78%, #101820 78% 88%, #fff 88% 100%);
  box-shadow: inset -14px -16px 24px rgba(0, 0, 0, 0.28), 0 0 0 8px rgba(255, 255, 255, 0.08), 0 0 42px rgba(255, 209, 102, 0.55);
  animation: revealBallSpin 2.55s cubic-bezier(.2,.85,.18,1) forwards;
}

.reveal-ball span {
  width: 38px;
  aspect-ratio: 1;
  border-radius: 34% 36% 40% 34%;
  background: #0b1514;
  box-shadow:
    -38px 8px 0 -8px #0b1514,
    38px 8px 0 -8px #0b1514,
    0 42px 0 -10px #0b1514,
    0 -42px 0 -10px #0b1514;
}

.reveal-burst {
  position: absolute;
  z-index: 2;
  width: 80px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #fff8dc 0 12%, #ffd166 13% 32%, rgba(255, 127, 80, 0.72) 33% 47%, transparent 48%);
  transform: scale(0);
}

.card-reveal-overlay.is-revealed .reveal-burst {
  animation: revealBurst 0.75s ease-out forwards;
}

.card-reveal-overlay.rarity-gold .reveal-burst {
  background: radial-gradient(circle, #fff7ad 0 14%, #ffd166 15% 36%, rgba(249, 115, 22, 0.82) 37% 54%, transparent 55%);
}

.card-reveal-overlay.rarity-diamond .reveal-burst {
  background: radial-gradient(circle, #ffffff 0 12%, #a5f3fc 13% 34%, rgba(167, 139, 250, 0.86) 35% 54%, transparent 55%);
}

.reveal-card-shell {
  position: absolute;
  z-index: 3;
  width: min(235px, 56vw);
  aspect-ratio: 9 / 16;
  opacity: 0;
  transform: translateY(72px) rotateY(82deg) scale(0.62);
  transform-style: preserve-3d;
}

.reveal-card-glow {
  position: absolute;
  inset: -12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.7), rgba(103, 232, 249, 0.6), rgba(248, 250, 252, 0.5));
  filter: blur(16px);
  opacity: 0.7;
}

.reveal-card-image {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  background: #06251d;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
}

.card-reveal-overlay.rarity-gold .card-reveal-stage {
  border-color: rgba(255, 209, 102, 0.72);
  box-shadow: 0 28px 90px rgba(255, 184, 77, 0.22), 0 28px 80px rgba(0, 0, 0, 0.45);
}

.card-reveal-overlay.rarity-gold .reveal-card-glow {
  background: linear-gradient(135deg, rgba(255, 244, 180, 0.95), rgba(255, 209, 102, 0.92), rgba(249, 115, 22, 0.72));
  animation: rarePulse 0.8s ease-in-out 0.2s 3;
}

.card-reveal-overlay.rarity-diamond .card-reveal-stage {
  border-color: rgba(165, 243, 252, 0.85);
  box-shadow: 0 28px 110px rgba(103, 232, 249, 0.28), 0 28px 80px rgba(0, 0, 0, 0.45);
}

.card-reveal-overlay.rarity-diamond .reveal-card-glow {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(103,232,249,0.92), rgba(167,139,250,0.88));
  animation: diamondPulse 0.55s ease-in-out 0.15s 5;
}

.card-reveal-overlay.rarity-diamond .reveal-card-shell::after,
.card-reveal-overlay.rarity-gold .reveal-card-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 8px;
  background: linear-gradient(110deg, transparent 0 34%, rgba(255,255,255,.72) 45%, transparent 56% 100%);
  transform: translateX(-130%);
  animation: rareSweep 1.05s ease-out 0.62s forwards;
  pointer-events: none;
}

.card-reveal-overlay.is-revealed .reveal-ball {
  animation: revealBallPop 0.46s ease-in forwards;
}

.card-reveal-overlay.is-revealed .reveal-card-shell {
  animation: revealCardFlip 1.05s cubic-bezier(.12,.82,.18,1) 0.22s forwards;
}

@keyframes revealBallSpin {
  0% { transform: translateY(-56px) rotate(0deg) scale(0.85); }
  45% { transform: translateY(0) rotate(520deg) scale(1.05); }
  78% { transform: translateY(0) rotate(980deg) scale(1.12); }
  100% { transform: translateY(0) rotate(1320deg) scale(1); }
}

@keyframes revealBallPop {
  0% { opacity: 1; transform: scale(1) rotate(0deg); filter: blur(0); }
  100% { opacity: 0; transform: scale(2.3) rotate(160deg); filter: blur(10px); }
}

@keyframes revealBurst {
  0% { opacity: 0.9; transform: scale(0.2); }
  68% { opacity: 0.75; transform: scale(6.8); }
  100% { opacity: 0; transform: scale(8.6); }
}

@keyframes revealCardFlip {
  0% { opacity: 0; transform: translateY(72px) rotateY(82deg) scale(0.62); }
  56% { opacity: 1; transform: translateY(-18px) rotateY(-8deg) scale(1.04); }
  100% { opacity: 1; transform: translateY(0) rotateY(0deg) scale(1); }
}

@keyframes rarePulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}

@keyframes diamondPulse {
  0%, 100% { opacity: 0.72; transform: scale(1); filter: blur(16px); }
  50% { opacity: 1; transform: scale(1.18); filter: blur(20px); }
}

@keyframes rareSweep {
  0% { transform: translateX(-130%); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateX(130%); opacity: 0; }
}

.validate-shell {
  width: min(520px, calc(100% - 2rem));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.validate-card,
.validation-result {
  display: grid;
  gap: 0.8rem;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.summary-box {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
}

.summary-box span,
.summary-box small {
  color: var(--muted);
}

.summary-box strong {
  display: block;
  margin: 0.25rem 0;
  color: var(--gold);
  font-size: 2rem;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.8rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
}

.detail-button {
  white-space: nowrap;
}

.badge {
  display: inline-grid;
  min-height: 1.8rem;
  place-items: center;
  border-radius: 999px;
  padding: 0 0.7rem;
  background: rgba(255,255,255,0.12);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.badge.hit {
  background: rgba(34, 197, 94, 0.22);
  color: #bbf7d0;
}

.team-scores {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
  margin: 0.7rem 0 1rem;
}

.score-box {
  padding: 0.8rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  text-align: center;
}

.score-box strong {
  display: block;
  color: var(--gold);
  font-size: 1.5rem;
}

.players {
  display: grid;
  gap: 0.45rem;
  max-height: min(56vh, 520px);
  overflow: auto;
}

.player-row {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) 5rem 5rem 5rem;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
}

.ticket-card {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding: 1.1rem;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.12), transparent 40%),
    rgba(255,255,255,0.07);
}

#ticketDetail {
  min-width: 0;
  overflow-x: hidden;
}

.ticket-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.ticket-logo {
  width: 3rem;
  height: 3rem;
  animation: none;
}

.ticket-head strong,
.ticket-head small {
  display: block;
}

.ticket-head small,
.ticket-card p {
  color: var(--muted);
  margin: 0;
}

.ticket-match {
  color: var(--gold);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 950;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ticket-grid {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.65rem 1rem;
  min-width: 0;
}

.ticket-grid span {
  color: var(--muted);
}

.ticket-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#aiReportDialog {
  width: min(900px, calc(100% - 1.4rem));
}

#aiReportModal {
  width: min(900px, calc(100vw - 1.4rem));
  max-height: min(86vh, 820px);
}

.report-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding-right: 2.6rem;
}

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

.ai-report-content {
  display: grid;
  gap: 0.85rem;
  max-height: min(62vh, 560px);
  overflow: auto;
  padding-right: 0.4rem;
  color: var(--muted);
  line-height: 1.75;
}

.ai-report-content p {
  margin: 0;
  padding: 0.85rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
}

.admin-shell {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0;
}

.admin-login {
  min-height: calc(100vh - 4rem);
  display: grid;
  place-items: center;
  gap: 1rem;
}

.admin-login[hidden] {
  display: none !important;
}

.admin-lang-row {
  justify-self: end;
  width: min(440px, calc(100vw - 2rem));
  text-align: right;
}

.admin-brand {
  cursor: default;
}

.admin-login-card {
  width: min(440px, calc(100vw - 2rem));
}

.admin-login-card h1,
.admin-header h1,
.admin-panel h2 {
  margin: 0;
}

.admin-dashboard {
  display: grid;
  gap: 1rem;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.admin-header p,
.admin-panel p,
#adminMessage,
#adminLoginMessage {
  color: var(--muted);
}

.admin-actions,
.password-panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-panel,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.stat-card span,
.legend {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  color: var(--gold);
  font-size: 2.4rem;
}

.pie {
  width: 11rem;
  height: 11rem;
  margin: 1rem auto;
  border-radius: 50%;
  border: 10px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2);
}

.legend {
  display: grid;
  gap: 0.45rem;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.legend i {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
}

.admin-bars {
  display: grid;
  gap: 0.6rem;
}

.admin-bar-row {
  display: grid;
  grid-template-columns: 5rem 1fr 3rem;
  align-items: center;
  gap: 0.75rem;
}

.admin-table-wrap {
  overflow: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.admin-table th {
  color: var(--gold);
}

.admin-points-input {
  width: 7rem;
  min-height: 36px;
  padding: 0.35rem 0.5rem;
}

.admin-table .danger {
  border-color: rgba(251, 113, 133, 0.55);
  color: #fecdd3;
}

.admin-table td:last-child {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .content-grid,
  .match-card,
  #predictForm {
    grid-template-columns: 1fr;
  }

  #predictForm .modal-match,
  #predictForm .tabs,
  #predictForm .tab-page,
  #predictForm .modal-actions,
  #predictForm .charts {
    grid-column: 1;
    grid-row: auto;
  }

  .ai-panel {
    position: static;
  }

  .match-info {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  main,
  .history-page {
    width: min(100% - 0.75rem, 100%);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .day-strip {
    grid-auto-columns: 82%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .day-chip {
    scroll-snap-align: center;
  }

  .flag-row,
  .team {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .team img {
    justify-self: center;
  }

  .vs {
    justify-self: center;
  }

  .player-row {
    grid-template-columns: 1fr 3rem 3rem 3rem;
    font-size: 0.86rem;
  }

  .team-scores {
    grid-template-columns: repeat(2, 1fr);
  }

  .history-summary,
  .history-item,
  .user-center-layout,
  .profile-fields,
  .profile-fields-compact,
  .admin-grid,
  .stats-grid,
  .admin-header {
    grid-template-columns: 1fr;
  }

  .ticket-grid {
    grid-template-columns: minmax(5.4rem, 34%) minmax(0, 1fr);
  }

  #ticketModal {
    padding: 0.85rem;
  }

  .ticket-card {
    padding: 0.85rem;
  }

  .ticket-match {
    font-size: 1.45rem;
  }

  .admin-header {
    display: grid;
  }

  #predictForm {
    max-height: none;
  }

  #predictForm .option-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .match-card {
    padding: 0.8rem;
  }

  .content-grid {
    gap: 0.7rem;
  }

  .profile-points {
    position: static;
    justify-self: start;
    grid-row: 2;
  }

  .card-grid,
  .auction-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .featured-strip {
    grid-auto-columns: 46%;
  }

.primary,
.ghost,
.predict-button {
  min-height: 2.8rem;
}
}

.site-disclaimer {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.4rem auto 1.8rem;
  padding: 0.75rem 1rem;
  color: rgba(246, 255, 249, 0.68);
  font-size: 0.78rem;
  line-height: 1.55;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.12);
}
