:root {
  --vp-bg-0: #001017;
  --vp-bg-1: #00141D;
  --vp-bg-2: #001E2B;
  --vp-wine-1: rgba(0, 39, 56, .92);
  --vp-wine-2: rgba(0, 30, 43, .76);
  --vp-wine-3: rgba(0, 16, 23, .74);
  --vp-gold-1: #00FF88;
  --vp-gold-2: #00DA6D;
  --vp-gold-3: #00FF88;
  --vp-orange-1: #00FF88;
  --vp-orange-2: #00DA6D;
  --vp-text: #E1F6FF;
  --vp-muted: #A1E3FF;
  --vp-border: rgba(255, 255, 255, .08);
  --vp-border-strong: #004461;
  --vp-shadow: 0 22px 58px rgba(0, 16, 23, .34);
  --vp-shadow-soft: 0 14px 34px rgba(0, 16, 23, .24);
}

html {
  scrollbar-color: rgba(0, 255, 136, .44) rgba(0, 16, 23, .8);
}

body {
  position: relative;
  background:
    linear-gradient(90deg,
      rgba(0, 16, 23, .98) 0%,
      rgba(0, 16, 23, .86) 10%,
      rgba(0, 30, 43, 0) 34%,
      rgba(0, 30, 43, 0) 66%,
      rgba(0, 16, 23, .86) 90%,
      rgba(0, 16, 23, .98) 100%),
    radial-gradient(circle at 50% 8%, rgba(0, 255, 136, .05) 0%, rgba(0, 255, 136, .025) 16%, rgba(0, 16, 23, 0) 33%),
    radial-gradient(ellipse at 50% 18%, rgba(0, 39, 56, .30) 0%, rgba(0, 39, 56, .22) 25%, rgba(0, 16, 23, 0) 70%),
    radial-gradient(circle at 50% 42%, #001E2B 0%, #00141D 25%, #001017 54%, #001017 77%, #001017 100%) !important;
  color: var(--vp-text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle, rgba(0, 255, 136, .16) 0 2px, transparent 2.8px),
    radial-gradient(circle, rgba(0, 255, 136, .08) 0 1.7px, transparent 2.6px);
  background-size: 34px 34px, 34px 34px;
  background-position: 0 0, 17px 17px;
  opacity: .34;
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 16, 23, .35) 18%, rgba(0, 16, 23, .8) 35%, rgba(0, 16, 23, .8) 65%, rgba(0, 16, 23, .35) 82%, transparent 100%);
}

.topbar, .page-wrap, .page, .modal, .modal-overlay, .modal-backdrop, .auth-overlay {
  position: relative;
}

.topbar {
  z-index: 90 !important;
  background: linear-gradient(180deg, rgba(18, 18, 18, .98), rgba(0, 39, 56, .94)) !important;
  border-bottom: 1px solid rgba(0, 255, 136, .18) !important;
  box-shadow: 0 14px 34px rgba(0, 16, 23, .30), inset 0 1px 0 rgba(255, 255, 255, .04) !important;
  backdrop-filter: blur(12px);
}

.topbar-inner {
  max-width: 1240px !important;
  min-height: 62px;
}

.brand {
  color: var(--vp-gold-1) !important;
  font-size: 24px !important;
  font-weight: 950 !important;
  letter-spacing: .01em;
  text-shadow: 0 0 18px rgba(0, 255, 136, .12), 0 2px 0 rgba(0, 16, 23, .20);
}

.menu {
  align-items: center;
}

.menu a, .menu button,
.rank-btn,
.btn,
.refresh-btn,
.participants-toggle,
.close-btn,
button.primary,
button.secondary,
.btn-link {
  border-radius: 999px !important;
  border: 1px solid rgba(0, 255, 136, .18) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 10px 24px rgba(0, 16, 23, .14);
  transition: transform .14s ease, filter .14s ease, border-color .14s ease, background .14s ease;
}

.menu a, .menu button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018)) !important;
}

.menu a:hover, .menu button:hover,
.rank-btn:hover,
.btn:hover,
.refresh-btn:hover,
.participants-toggle:hover,
.close-btn:hover,
button:hover,
.btn-link:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 255, 136, .32) !important;
  filter: brightness(1.05);
}

.menu a.active, .menu button.active,
.rank-btn.active {
  background: linear-gradient(180deg, var(--vp-gold-1), var(--vp-gold-2)) !important;
  color: #001017 !important;
  border-color: rgba(255, 255, 255, .42) !important;
}

.page {
  position: relative;
  z-index: 1;
}

.hero,
.ranking-controls,
.twitch-connect,
.ranking-table,
.panel,
.user-card,
.giveaway-card,
.detail-card,
.login-box,
.error-box,
.card,
.modal-card {
  border: 1px solid var(--vp-border) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 28%),
    linear-gradient(180deg, rgba(0, 30, 43, .86) 0%, rgba(0, 16, 23, .86) 100%) !important;
  box-shadow: var(--vp-shadow-soft), inset 0 1px 0 rgba(0, 255, 136, .025) !important;
  backdrop-filter: blur(8px);
}

.hero,
.ranking-controls,
.twitch-connect,
.ranking-table,
.panel,
.user-card,
.giveaway-card,
.detail-card,
.login-box,
.error-box,
.card {
  border-radius: 24px !important;
}

.hero h1,
.card h1,
.panel h2,
.detail-card h2,
.product-info h2,
.ranking-table h2 {
  color: var(--vp-text) !important;
  text-shadow: 0 0 18px rgba(0, 255, 136, .08);
}

.hero p,
.card p,
.panel p,
.meta,
.notice,
.stat-label,
.battle-meta,
.status-label,
.message,
.small,
label,
.slot-chance,
.twitch-status {
  color: var(--vp-muted) !important;
}

input, select, textarea {
  border: 1px solid rgba(0, 255, 136, .18) !important;
  background: rgba(0, 16, 23, .52) !important;
  color: #FFFFFF !important;
  border-radius: 16px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04) !important;
}

input:focus, select:focus, textarea:focus {
  outline: none !important;
  border-color: rgba(0, 255, 136, .42) !important;
  box-shadow: 0 0 0 3px rgba(0, 255, 136, .08), inset 0 1px 0 rgba(255, 255, 255, .04) !important;
}

.btn, button.primary, .btn-link.primary, .refresh-btn, .rank-btn.twitch-btn {
  background: linear-gradient(180deg, var(--vp-orange-1), var(--vp-orange-2)) !important;
  color: #001017 !important;
  border-color: rgba(255, 255, 255, .18) !important;
}

.btn.secondary,
button.secondary,
.btn-link.secondary,
.rank-btn:not(.active):not(.twitch-btn),
.close-btn,
.participants-toggle {
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .025)) !important;
  color: var(--vp-gold-1) !important;
}

.btn.danger,
button.danger {
  background: linear-gradient(180deg, #00FF88, #00FF88) !important;
  color: #FFFFFF !important;
}

.empty,
.notice,
.error-box,
.login-box {
  border-color: rgba(0, 255, 136, .14) !important;
}

.notice.ok,
.message[data-type="success"] {
  color: #FFFFFF !important;
  border-color: rgba(0, 255, 136, .24) !important;
  background: rgba(0, 255, 136, .07) !important;
}

.notice.error,
.message[data-type="error"] {
  color: #FFFFFF !important;
  border-color: rgba(0, 255, 136, .25) !important;
  background: rgba(0, 255, 136, .07) !important;
}

/* Ranking */
.ranking-controls {
  padding: 14px !important;
  align-items: center;
}

.control-group {
  padding: 5px;
  border-radius: 999px;
  background: rgba(0, 16, 23, .18);
  border: 1px solid rgba(0, 255, 136, .10);
}

.twitch-connect {
  padding: 14px 16px !important;
  align-items: center;
}

.twitch-avatar-mini {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(0, 255, 136, .18);
}

.ranking-table {
  overflow: hidden;
}

.table-head, .rank-row {
  grid-template-columns: 72px 1fr minmax(130px, .55fr) minmax(150px, .6fr) !important;
}

.table-head {
  color: rgba(0, 255, 136, .82) !important;
  border-bottom: 1px solid rgba(0, 255, 136, .12);
}

.rank-row {
  border: 1px solid rgba(0, 255, 136, .10) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .015)) !important;
  box-shadow: 0 10px 24px rgba(0, 16, 23, .14);
}

.rank-row:hover,
.battle-card:hover,
.giveaway-card:hover,
.user-card:hover {
  border-color: rgba(0, 255, 136, .24) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018)) !important;
}

.rank-number {
  color: var(--vp-gold-1) !important;
  background: rgba(0, 16, 23, .24);
  border: 1px solid rgba(0, 255, 136, .12);
}

.small-avatar,
.participant img,
.slot img,
.product-img,
.user-card .avatar,
.hero-user .avatar {
  box-shadow: 0 0 0 2px rgba(0, 255, 136, .16), 0 12px 30px rgba(0, 16, 23, .26) !important;
}

.reward,
.prize,
.stat,
.stat-card,
.status-card,
.detail-box,
.mini-stat {
  border: 1px solid rgba(0, 255, 136, .12) !important;
  background: rgba(0, 16, 23, .20) !important;
}

/* Histórico */
.history-list,
.battle-list,
.message-list,
.user-list,
.giveaway-list {
  gap: 12px !important;
}

.battle-card,
.participant-row,
.message,
.msg,
.participant,
.slot {
  border: 1px solid rgba(0, 255, 136, .10) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .015)) !important;
  box-shadow: 0 8px 20px rgba(0, 16, 23, .14);
}

.battle-title,
.user-name,
.card-title,
.slot-name {
  color: #FFFFFF !important;
}

.status,
.badge,
.admin-badge {
  border: 1px solid rgba(0, 255, 136, .18) !important;
  background: rgba(0, 255, 136, .08) !important;
  color: var(--vp-gold-1) !important;
}

/* Perfil / Admin */
.grid,
.stats,
.status-grid {
  gap: 12px !important;
}

.stat-card,
.stat,
.status-card {
  border-radius: 18px !important;
  padding: 14px !important;
}

.stat-value,
.status-value {
  color: #FFFFFF !important;
}

.actions,
.form-actions,
.admin-actions {
  gap: 10px !important;
}

/* Sorteios */
.giveaway-card.active {
  border-color: rgba(0, 255, 136, .42) !important;
  box-shadow: 0 0 0 2px rgba(0, 255, 136, .08), var(--vp-shadow-soft) !important;
}

.product {
  gap: 18px !important;
}

.product-img {
  border-radius: 22px !important;
  border: 1px solid rgba(0, 255, 136, .14);
  background: rgba(0, 16, 23, .24);
}

.roulette-wrap {
  border: 1px solid rgba(0, 255, 136, .14) !important;
  background: linear-gradient(180deg, rgba(0, 16, 23, .70), rgba(0, 16, 23, .42)) !important;
  box-shadow: inset 0 1px 0 rgba(0, 255, 136, .05), 0 18px 44px rgba(0, 16, 23, .22);
}

.roulette {
  border: 1px solid rgba(0, 255, 136, .12) !important;
  background:
    linear-gradient(90deg, rgba(0, 16, 23, .55), rgba(0, 16, 23, 0) 22%, rgba(0, 16, 23, 0) 78%, rgba(0, 16, 23, .55)),
    rgba(0, 16, 23, .24) !important;
}

.roulette::before {
  background: linear-gradient(180deg, transparent, var(--vp-gold-1) 18%, var(--vp-orange-1) 50%, var(--vp-gold-1) 82%, transparent) !important;
  box-shadow: 0 0 24px rgba(0, 255, 136, .52) !important;
  border-radius: 999px;
}

.slot.winner {
  border-color: rgba(0, 255, 136, .55) !important;
  background: linear-gradient(180deg, rgba(0, 255, 136, .18), rgba(0, 255, 136, .12)) !important;
}

.winner-box {
  border: 1px solid rgba(0, 255, 136, .18) !important;
  background: rgba(0, 255, 136, .08) !important;
  color: var(--vp-gold-1) !important;
}

.modal,
.modal-overlay,
.modal-backdrop {
  background: rgba(0, 16, 23, .72) !important;
  backdrop-filter: blur(8px);
}

.modal-card,
.modal > div,
.modal-backdrop > .modal {
  box-shadow: var(--vp-shadow) !important;
}

@media (max-width: 860px) {
  .topbar-inner {
    justify-content: center !important;
  }

  .brand {
    width: 100%;
    text-align: center;
  }

  .menu {
    justify-content: center;
  }

  .page {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .layout {
    grid-template-columns: 1fr !important;
  }

  .table-head, .rank-row {
    grid-template-columns: 52px 1fr !important;
  }

  .table-head span:nth-child(3),
  .table-head span:nth-child(4),
  .rank-row > div:nth-child(3),
  .rank-row > div:nth-child(4) {
    grid-column: 2;
  }
}

@media (max-width: 560px) {
  .menu a, .menu button {
    min-height: 34px;
    padding: 8px 11px !important;
    font-size: 12px !important;
  }

  .hero,
  .ranking-controls,
  .twitch-connect,
  .ranking-table,
  .panel,
  .detail-card,
  .card {
    border-radius: 20px !important;
  }

  .control-group {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }

  .control-group .rank-btn {
    width: 100%;
  }
}

/* Oreia green theme v2: força painéis e superfícies antigas vinho/terrosas para verde escuro. */
:root {
  --oreia-green-deep: #001017;
  --oreia-green-base: #001E2B;
  --oreia-green-panel: #001E2B;
  --oreia-green-panel-2: #001E2B;
  --oreia-green-strong: #002738;
  --oreia-green-glow: rgba(0, 255, 136, .16);
}

body:not(.keep-red-theme) .hero,
body:not(.keep-red-theme) .ranking-controls,
body:not(.keep-red-theme) .twitch-connect,
body:not(.keep-red-theme) .ranking-table,
body:not(.keep-red-theme) .panel,
body:not(.keep-red-theme) .user-card,
body:not(.keep-red-theme) .giveaway-card,
body:not(.keep-red-theme) .detail-card,
body:not(.keep-red-theme) .login-box,
body:not(.keep-red-theme) .error-box,
body:not(.keep-red-theme) .card,
body:not(.keep-red-theme) .modal-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 28%),
    linear-gradient(180deg, rgba(0, 30, 43, .88) 0%, rgba(0, 16, 23, .84) 100%) !important;
  border-color: rgba(0, 255, 136, .16) !important;
}

body:not(.keep-red-theme) input,
body:not(.keep-red-theme) select,
body:not(.keep-red-theme) textarea {
  background: rgba(0, 16, 23, .56) !important;
  border-color: rgba(0, 255, 136, .16) !important;
}
