:root {
   --bg: #07080d;
   --bg-soft: #0e1119;
   --card: #121722;
   --card-2: #171d2b;
   --line: #232c3d;
   --text: #eef2ff;
   --muted: #8b97b1;
   --gold: #f5b53d;
   --gold-2: #ffd980;
   --green: #22c55e;
   --red: #ef4444;
   --radius: 16px;
}

* {
   box-sizing: border-box;
}

html,
body {
   margin: 0;
   padding: 0;
}

body {
   min-height: 100vh;
   background:
      radial-gradient(900px 500px at 15% -10%, rgba(245, 181, 61, 0.12), transparent 60%),
      radial-gradient(700px 450px at 90% 0%, rgba(99, 102, 241, 0.14), transparent 60%),
      var(--bg);
   color: var(--text);
   font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
   -webkit-font-smoothing: antialiased;
}

[hidden] {
   display: none !important;
}

/* ------------------------------- topbar ------------------------------- */
.topbar {
   position: sticky;
   top: 0;
   z-index: 20;
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 12px;
   padding: 12px 18px;
   background: rgba(7, 8, 13, 0.82);
   backdrop-filter: blur(12px);
   border-bottom: 1px solid var(--line);
}

.brand {
   display: flex;
   align-items: baseline;
   gap: 8px;
}

.brand-mark {
   font-size: 22px;
   font-weight: 900;
   letter-spacing: -1px;
   background: linear-gradient(180deg, var(--gold-2), var(--gold));
   -webkit-background-clip: text;
   background-clip: text;
   color: transparent;
}

.brand-name {
   font-size: 13px;
   color: var(--muted);
   letter-spacing: 2px;
   text-transform: uppercase;
}

.topbar-right {
   display: flex;
   align-items: center;
   gap: 8px;
}

.balance {
   display: flex;
   flex-direction: column;
   align-items: flex-end;
   line-height: 1.1;
   padding: 6px 14px;
   border-radius: 999px;
   background: linear-gradient(180deg, rgba(245, 181, 61, 0.16), rgba(245, 181, 61, 0.06));
   border: 1px solid rgba(245, 181, 61, 0.35);
}

.balance-label {
   font-size: 10px;
   text-transform: uppercase;
   letter-spacing: 1px;
   color: var(--gold-2);
}

.balance strong {
   font-size: 15px;
   color: #fff;
}

/* ------------------------------- botões ------------------------------- */
.btn-primary {
   width: 100%;
   padding: 13px 18px;
   border: 0;
   border-radius: 12px;
   font-size: 15px;
   font-weight: 700;
   color: #1a1206;
   cursor: pointer;
   background: linear-gradient(180deg, var(--gold-2), var(--gold));
   transition: transform 0.12s ease, filter 0.12s ease;
}

.btn-primary:hover {
   filter: brightness(1.06);
}

.btn-primary:active {
   transform: translateY(1px);
}

.btn-primary:disabled {
   filter: grayscale(0.5) brightness(0.8);
   cursor: not-allowed;
}

.btn-ghost {
   padding: 8px 12px;
   border-radius: 10px;
   border: 1px solid var(--line);
   background: var(--card);
   color: var(--text);
   font-size: 13px;
   cursor: pointer;
}

.btn-ghost:hover {
   border-color: #35415a;
   background: var(--card-2);
}

.btn-close {
   width: 36px;
   height: 36px;
   border-radius: 10px;
   border: 1px solid var(--line);
   background: var(--card);
   color: var(--text);
   font-size: 15px;
   cursor: pointer;
}

.btn-close:hover {
   background: var(--red);
   border-color: var(--red);
   color: #fff;
}

/* ------------------------------- layout ------------------------------- */
.wrap {
   max-width: 1100px;
   margin: 0 auto;
   padding: 26px 18px 60px;
}

.muted {
   color: var(--muted);
   font-size: 14px;
}

/* -------------------------------- auth -------------------------------- */
.auth {
   display: flex;
   justify-content: center;
   padding-top: 4vh;
}

.auth-card {
   width: 100%;
   max-width: 400px;
   padding: 28px 24px;
   border-radius: 22px;
   background: linear-gradient(180deg, var(--card-2), var(--card));
   border: 1px solid var(--line);
   box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
   text-align: center;
}

.auth-logo {
   width: 64px;
   height: 64px;
   margin: 0 auto 10px;
   display: grid;
   place-items: center;
   border-radius: 20px;
   font-weight: 900;
   font-size: 20px;
   color: #1a1206;
   background: linear-gradient(180deg, var(--gold-2), var(--gold));
   box-shadow: 0 10px 30px rgba(245, 181, 61, 0.3);
}

.auth-card h1 {
   margin: 6px 0 2px;
   font-size: 22px;
}

.auth-card > .muted {
   margin: 0 0 18px;
}

.tabs {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 6px;
   padding: 5px;
   margin-bottom: 18px;
   border-radius: 12px;
   background: #0b0e15;
   border: 1px solid var(--line);
}

.tab {
   padding: 9px;
   border: 0;
   border-radius: 9px;
   background: transparent;
   color: var(--muted);
   font-size: 14px;
   font-weight: 600;
   cursor: pointer;
}

.tab.active {
   background: var(--card-2);
   color: var(--text);
   box-shadow: inset 0 0 0 1px var(--line);
}

label {
   display: block;
   text-align: left;
   font-size: 12px;
   font-weight: 600;
   letter-spacing: 0.4px;
   text-transform: uppercase;
   color: var(--muted);
   margin-bottom: 12px;
}

input {
   width: 100%;
   margin-top: 6px;
   padding: 12px 13px;
   border-radius: 11px;
   border: 1px solid var(--line);
   background: #0b0e15;
   color: var(--text);
   font-size: 15px;
   font-family: inherit;
   outline: none;
   transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
   border-color: rgba(245, 181, 61, 0.6);
   box-shadow: 0 0 0 3px rgba(245, 181, 61, 0.12);
}

.form-msg {
   min-height: 18px;
   margin: 12px 0 0;
   font-size: 13px;
   color: var(--red);
   text-align: center;
}

.form-msg.ok {
   color: var(--green);
}

/* ----------------------------- dashboard ------------------------------ */
.hello {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 12px;
   margin-bottom: 16px;
}

.hello h2 {
   margin: 0;
   font-size: 20px;
   font-weight: 600;
}

.hello h2 span {
   color: var(--gold);
}

.stats {
   display: grid;
   grid-template-columns: repeat(3, 1fr);
   gap: 10px;
   margin-bottom: 26px;
}

.stat {
   padding: 12px 14px;
   border-radius: 13px;
   background: var(--card);
   border: 1px solid var(--line);
   display: flex;
   flex-direction: column;
   gap: 2px;
}

.stat span {
   font-size: 11px;
   text-transform: uppercase;
   letter-spacing: 0.8px;
   color: var(--muted);
}

.stat strong {
   font-size: 16px;
}

.section-title {
   font-size: 13px;
   text-transform: uppercase;
   letter-spacing: 1.4px;
   color: var(--muted);
   margin: 0 0 14px;
}

/* -------------------------------- jogos ------------------------------- */
.games {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
   gap: 12px;
}

.game {
   position: relative;
   overflow: hidden;
   padding: 18px 14px 14px;
   border-radius: var(--radius);
   border: 1px solid var(--line);
   background: linear-gradient(160deg, var(--card-2), var(--card));
   cursor: pointer;
   text-align: left;
   color: var(--text);
   font-family: inherit;
   transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.game::after {
   content: "";
   position: absolute;
   inset: -40% 40% 55% -35%;
   background: var(--game-color, #f5b53d);
   filter: blur(38px);
   opacity: 0.22;
   pointer-events: none;
}

.game:hover {
   transform: translateY(-3px);
   border-color: rgba(245, 181, 61, 0.5);
   box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.game .emoji {
   font-size: 28px;
   display: block;
   margin-bottom: 10px;
}

.game .name {
   display: block;
   font-size: 14px;
   font-weight: 700;
}

.game .play {
   margin-top: 6px;
   display: inline-block;
   font-size: 11px;
   letter-spacing: 0.8px;
   text-transform: uppercase;
   color: var(--gold-2);
}

/* -------------------------------- modal ------------------------------- */
.modal {
   position: fixed;
   inset: 0;
   z-index: 50;
   display: flex;
   flex-direction: column;
   background: #05060a;
}

.modal-head {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 10px;
   padding: 10px 14px;
   border-bottom: 1px solid var(--line);
   background: rgba(7, 8, 13, 0.9);
}

.modal-head strong {
   font-size: 14px;
}

.modal-actions {
   display: flex;
   gap: 8px;
}

#gameFrame {
   flex: 1;
   width: 100%;
   border: 0;
   background: #000;
}

/* admin */
.card-modal {
   inset: 50% auto auto 50%;
   transform: translate(-50%, -50%);
   width: min(560px, 94vw);
   max-height: 88vh;
   border-radius: 18px;
   border: 1px solid var(--line);
   background: linear-gradient(180deg, var(--card-2), var(--card));
   box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
   overflow: hidden;
}

/* fundo escuro atras do painel (o inset do .card-modal tira o overlay) */
.card-modal::before {
   content: "";
   position: fixed;
   inset: 0;
   z-index: -1;
   background: rgba(3, 4, 8, 0.75);
   backdrop-filter: blur(3px);
}

.admin-body {
   padding: 18px;
   overflow-y: auto;
   max-height: calc(88vh - 56px);
}

.admin-body h4 {
   margin: 0 0 12px;
   font-size: 13px;
   text-transform: uppercase;
   letter-spacing: 1px;
   color: var(--muted);
}

.divider {
   height: 1px;
   background: var(--line);
   margin: 18px 0;
}

.row {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: 10px;
}

.table-wrap {
   margin-top: 12px;
   max-height: 240px;
   overflow-y: auto;
   border-radius: 12px;
   border: 1px solid var(--line);
}

table {
   width: 100%;
   border-collapse: collapse;
   font-size: 13px;
}

th,
td {
   padding: 9px 12px;
   text-align: left;
   border-bottom: 1px solid var(--line);
}

th {
   position: sticky;
   top: 0;
   background: #0b0e15;
   font-size: 11px;
   text-transform: uppercase;
   letter-spacing: 0.6px;
   color: var(--muted);
}

tbody tr:last-child td {
   border-bottom: 0;
}

/* ------------------------------ responsivo ---------------------------- */
@media (max-width: 560px) {
   .stats {
      grid-template-columns: 1fr;
   }

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

   .brand-name {
      display: none;
   }

   .balance strong {
      font-size: 13px;
   }

   .wrap {
      padding: 18px 12px 50px;
   }

   .games {
      grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
   }
}
