:root {
  --bg: #0b0a12;
  --card: #191630;
  --card-2: #211d3d;
  --line: #2e2952;
  --txt: #eceafd;
  --muted: #9c96c4;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --danger: #f43f5e;
  --ficha: #a99fd8;          /* gênero · ano · desenvolvedora */
  --radius: 14px;
  --gap-card: clamp(12px, 2.4vh, 20px);
}

* { box-sizing: border-box; }

/* Regras com display explícito venceriam o atributo [hidden] */
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(1000px 600px at 12% -10%, #3b1d7a55, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #0e749046, transparent 55%),
    var(--bg);
  color: var(--txt);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

/* ================= Topbar ================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: #0b0a12cc;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { font-size: 30px; line-height: 1; }
.brand h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: .3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand p { margin: 0; font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #12102a;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-ok { color: #4ade80; border-color: #14532d; background: #0c2417; }

/* ================= Botões ================= */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--txt);
  padding: 9px 15px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: #2b2653; border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-danger { color: var(--danger); border-color: #4a1f33; }
.btn-danger:hover { background: #3a1626; border-color: var(--danger); }

/* ================= Layout ================= */
.wrap {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.panel-label { display: block; font-size: 14px; font-weight: 700; }
.panel-help { margin: 4px 0 12px; font-size: 12.5px; color: var(--muted); }
.panel-help code, .aviso code {
  background: #2a2550;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12px;
}

.base-row { display: flex; gap: 8px; }
.base-row input {
  flex: 1;
  min-width: 0;
  background: #12102a;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--txt);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
}
.base-row input:focus { outline: none; border-color: var(--accent); }

.aviso {
  background: #2a1f0a;
  border: 1px solid #6b4a12;
  color: #fbbf24;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13.5px;
  margin: 0 0 18px;
}

/* ================= Dropzone ================= */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #1c1836, #12102590);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.dropzone:hover,
.dropzone:focus-visible { border-color: var(--accent); outline: none; }
.dropzone.dragging { border-color: var(--accent-2); background: #16233a; }
.dz-icon { font-size: 38px; }
.dropzone h2 { margin: 6px 0 4px; font-size: 18px; }
.dropzone p { margin: 2px 0; color: var(--muted); font-size: 13.5px; }
.dz-formats { margin-top: 10px !important; font-size: 12px; }
.dz-formats code {
  background: #2a2550;
  padding: 2px 7px;
  border-radius: 6px;
  margin: 0 1px;
}
.upload-status {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--accent-2);
  text-align: center;
}

/* ================= Lista de jogos ================= */
.library { margin-top: 26px; }
.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.library-head h2 {
  font-size: 17px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.busca {
  background: #12102a;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--txt);
  padding: 7px 12px;
  font: inherit;
  font-size: 13.5px;
  min-width: 180px;
}
.busca:focus { outline: none; border-color: var(--accent); }

.library-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.rom {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color .15s, background .15s;
}
.rom:hover { border-color: var(--accent); background: var(--card-2); }
.rom-cart {
  flex: 0 0 auto;
  width: 46px;
  height: 62px;
  display: grid;
  place-items: center;
  font-size: 22px;
  border-radius: 6px;
  background: #12102a;
  box-shadow: 0 0 0 1px var(--line);
}
.rom-info { flex: 1; min-width: 0; }
.rom-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rom-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rom-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}
.rom-link code {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  color: var(--accent-2);
  background: #12102a;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rom-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.vazio {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

/* ================= Modal do QR ================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #05040acc;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
  max-width: 320px;
  width: 100%;
}
.modal-card h3 { margin: 0 0 14px; font-size: 16px; }
.qr-box {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  display: inline-flex;
  min-height: 60px;
  align-items: center;
  justify-content: center;
}
.qr-box img, .qr-box canvas { display: block; }
.qr-erro { color: #b91c1c; font-size: 12.5px; margin: 0; max-width: 200px; }
.qr-url {
  display: block;
  margin: 14px 0 16px;
  font-size: 11.5px;
  color: var(--accent-2);
  word-break: break-all;
}
.modal-actions { display: flex; gap: 8px; justify-content: center; }

/* ================= Footer ================= */
.footer {
  border-top: 1px solid var(--line);
  padding: 16px 20px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}
.footer p { margin: 0; }

/* ================= Quiosque (index.html) ================= */
body.kiosk {
  overflow: hidden;
  height: 100%;
  background: #000;
}
body.kiosk .stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000;
}
body.kiosk .stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ================= Tela de toque (abertura do jogo) ================= */

.kiosk-overlay {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, #08060f 0%, #0b0917 55%, #05040b 100%);
}

/* --- cenário atrás do card --- */
.kiosk-bg { position: absolute; inset: 0; z-index: -1; }

.kiosk-halo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(78vh, 92vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #8b5cf63d 0%, #22d3ee1a 45%, transparent 70%);
  filter: blur(26px);
  animation: k-halo 7s ease-in-out infinite;
}
@keyframes k-halo {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    opacity: .8; }
  50%      { transform: translate(-50%, -50%) scale(1.14); opacity: 1; }
}

.kiosk-floor {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 320vw;
  height: 42vh;
  transform: translateX(-50%) rotateX(78deg);
  transform-origin: 50% 100%;
  background:
    repeating-linear-gradient(90deg, #a78bfa40 0 2px, transparent 2px 84px),
    repeating-linear-gradient(0deg,  #22d3ee4d 0 2px, transparent 2px 84px);
  mask-image: linear-gradient(0deg, #000 0%, #000c 40%, transparent 88%);
  -webkit-mask-image: linear-gradient(0deg, #000 0%, #000c 40%, transparent 88%);
  animation: k-floor 6s linear infinite;
}
@keyframes k-floor {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 0, 0 84px; }
}

/* varredura de CRT bem discreta sobre tudo */
.kiosk-scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, #0000 0 3px, #ffffff06 3px 4px);
}

/* --- card central --- */
.kiosk-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-card);
  text-align: center;
  max-width: 460px;
  animation: k-in 1s cubic-bezier(.16, 1, .3, 1) both;
}
/* Os filhos não têm margem própria: o espaçamento vem só do gap, então
   esconder um elemento (o carregamento, por exemplo) não deixa buraco. */
.kiosk-card > * { margin: 0; }
@keyframes k-in {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* cartucho de SNES desenhado em CSS */
.cart {
  position: relative;
  width: clamp(72px, 16vh, 104px);
  aspect-ratio: 1 / 1.06;
  border-radius: 12px 12px 7px 7px;
  background: linear-gradient(160deg, #4a4270 0%, #322a5c 46%, #221c42 100%);
  box-shadow:
    0 0 0 1px #6b5fae inset,
    0 10px 26px #000a,
    0 0 30px #8b5cf644;
  animation: k-float 4.5s ease-in-out infinite;
}
@keyframes k-float {
  0%, 100% { transform: translateY(0)    rotate(-1.2deg); }
  50%      { transform: translateY(-7px) rotate(1.2deg); }
}
/* chanfros do topo do cartucho */
.cart::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 13%;
  border-radius: 0 0 6px 6px;
  background: #1c1738;
  box-shadow: 0 1px 0 #6b5fae55;
}
/* etiqueta */
.cart-label {
  position: absolute;
  top: 20%;
  left: 12%;
  right: 12%;
  height: 46%;
  border-radius: 5px;
  background: linear-gradient(150deg, #efeaff, #cfc4f7);
  box-shadow: 0 2px 8px #0007 inset, 0 0 0 1px #ffffff33;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 13%;
  padding: 0 14%;
}
.cart-label i {
  display: block;
  height: 8%;
  min-height: 3px;
  border-radius: 2px;
  background: #6d28d9;
  opacity: .55;
}
.cart-label i:nth-child(1) { width: 100%; background: #8b5cf6; opacity: .9; }
.cart-label i:nth-child(2) { width: 72%; }
.cart-label i:nth-child(3) { width: 48%; background: #0891b2; }
/* estrias da parte de baixo */
.cart-grip {
  position: absolute;
  bottom: 8%;
  left: 16%;
  right: 16%;
  height: 18%;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, #00000055 0 3px, transparent 3px 7px);
}

.kiosk-card h2 {
  font-size: clamp(19px, 3.4vh, 27px);
  font-weight: 800;
  line-height: 1.15;
  color: #f4f1ff;
  text-shadow: 0 0 18px #8b5cf655, 0 2px 10px #000a;
}

.kiosk-sub {
  color: var(--muted);
  font-size: 13.5px;
}

/* barra de carregamento em blocos, estilo retrô */
.kiosk-loader {
  display: flex;
  justify-content: center;
  gap: 6px;
}
.kiosk-loader i {
  display: block;
  width: 26px;
  height: 8px;
  border-radius: 2px;
  background: #2a2550;
  box-shadow: 0 0 0 1px #3d3670 inset;
  animation: k-blocks 1.4s ease-in-out infinite;
}
.kiosk-loader i:nth-child(1) { animation-delay: 0s; }
.kiosk-loader i:nth-child(2) { animation-delay: .12s; }
.kiosk-loader i:nth-child(3) { animation-delay: .24s; }
.kiosk-loader i:nth-child(4) { animation-delay: .36s; }
.kiosk-loader i:nth-child(5) { animation-delay: .48s; }
.kiosk-loader i:nth-child(6) { animation-delay: .60s; }
@keyframes k-blocks {
  0%, 100% { background: #2a2550; box-shadow: 0 0 0 1px #3d3670 inset; }
  40%      { background: linear-gradient(180deg, #a78bfa, #6d28d9);
             box-shadow: 0 0 12px #8b5cf6aa; }
}

/* botão principal */
.kiosk-btn {
  position: relative;
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: clamp(14px, 2.6vh, 20px) clamp(30px, 6vw, 48px);
  min-width: clamp(160px, 30vw, 200px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: inherit;
  font-size: clamp(15px, 2.4vh, 19px);
  font-weight: 800;
  letter-spacing: 1.4px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #a855f7 0%, #8b5cf6 45%, #d946ef 100%);
  box-shadow:
    0 0 0 1px #ffffff2e inset,
    0 10px 28px #8b5cf655,
    0 0 40px #8b5cf633;
  overflow: hidden;
  transition: transform .12s, box-shadow .2s;
}
.kiosk-btn:hover {
  box-shadow:
    0 0 0 1px #ffffff44 inset,
    0 12px 34px #8b5cf677,
    0 0 60px #8b5cf655;
}
.kiosk-btn:active { transform: scale(.97); }
.kiosk-btn:disabled { opacity: .65; cursor: default; }

/* anel que pulsa em volta do botão */
.kiosk-btn::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid #c4b5fd66;
  animation: k-ring 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes k-ring {
  0%   { transform: scale(1);    opacity: .85; }
  70%  { transform: scale(1.14); opacity: 0; }
  100% { transform: scale(1.14); opacity: 0; }
}

/* brilho que atravessa o botão */
.kiosk-btn::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 42%;
  left: -60%;
  background: linear-gradient(100deg, transparent, #ffffff4d, transparent);
  animation: k-shine 3.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes k-shine {
  0%       { left: -60%; }
  55%, 100% { left: 130%; }
}

/* triângulo de play desenhado */
.btn-play {
  width: 0;
  height: 0;
  flex: 0 0 auto;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #fff;
  filter: drop-shadow(0 0 6px #ffffff88);
}
.btn-text { position: relative; }

.kiosk-note {
  margin: clamp(12px, 2.4vh, 20px) 0 0;
  font-size: 12px;
  color: #6d668f;
}

/* celular deitado: tudo mais compacto */
@media (max-height: 430px) {
  .kiosk-card { --gap-card: 10px; }
  .cart { width: clamp(48px, 13vh, 68px); }
  .kiosk-card h2 { font-size: 17px; }
  .kiosk-sub { font-size: 12px; }
  .kiosk-loader i { width: 20px; height: 6px; }
  .kiosk-btn { padding: 12px 26px; font-size: 14.5px; letter-spacing: 1px; min-width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  .kiosk-card, .kiosk-halo, .kiosk-floor, .cart,
  .kiosk-loader i, .kiosk-btn::after, .kiosk-btn::before { animation: none; }
}

@media (max-width: 700px) {
  .brand p { display: none; }
  .wrap { padding: 18px 14px 36px; }
  .rom { flex-wrap: wrap; }
  .rom-actions { width: 100%; justify-content: flex-start; }
}


/* cartucho em estado de erro */
.cart.cart-erro {
  background: linear-gradient(160deg, #6b2338 0%, #4a1728 46%, #2e0f1c 100%);
  box-shadow: 0 0 0 1px #a13b58 inset, 0 10px 26px #000a, 0 0 30px #f43f5e44;
  animation: none;
}
.cart.cart-erro .cart-label { background: linear-gradient(150deg, #ffe4e6, #fecdd3); }
.cart.cart-erro .cart-label i:nth-child(1) { background: #f43f5e; }
.cart.cart-erro .cart-label i:nth-child(3) { background: #be123c; }

/* capa do jogo na tela de toque */
.kiosk-cover {
  display: block;
  width: auto;
  height: clamp(96px, 26vh, 210px);
  max-width: min(72vw, 300px);
  object-fit: contain;
  border-radius: 10px;
  box-shadow:
    0 0 0 1px #ffffff1f,
    0 14px 34px #000b,
    0 0 44px #8b5cf644;
  animation: k-float 4.5s ease-in-out infinite;
}

.kiosk-meta {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--ficha);
}

@media (max-height: 430px) {
  .kiosk-cover { height: clamp(64px, 22vh, 110px); }
  .kiosk-meta { font-size: 11.5px; }
}

/* capa e ficha na lista do painel */
.rom-cover {
  flex: 0 0 auto;
  width: 46px;
  height: 62px;
  object-fit: cover;
  border-radius: 6px;
  background: #12102a;
  box-shadow: 0 0 0 1px #ffffff1a, 0 4px 12px #0008;
}
.rom-ficha {
  font-size: 12px;
  font-weight: 600;
  color: var(--ficha);
  margin-top: 1px;
}

/* ações extras da área de envio */
.upload-acoes {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
