/* NuvemPlay — site do jogador e player */
:root {
  --bg: #0b1020;
  --bg-2: #10162b;
  --card: #151c35;
  --card-2: #1b2342;
  --line: #26305a;
  --text: #e8ecff;
  --muted: #8f99c4;
  --accent: #3ee6c1;
  --accent-2: #4f7cff;
  --warn: #ffbf47;
  --danger: #ff5c7a;
  --ok: #3ee67a;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(11, 16, 32, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 20px; letter-spacing: .2px; }
.brand img { width: 34px; height: 34px; }
.brand b { color: var(--accent); font-weight: 800; }
.topbar .spacer { flex: 1; }
.pill { font-size: 12px; color: var(--muted); border: 1px solid var(--line); padding: 5px 10px; border-radius: 999px; }

/* ---------- herói ---------- */
.hero {
  padding: clamp(28px, 6vw, 64px) clamp(16px, 4vw, 48px) 18px;
  background: radial-gradient(1200px 300px at 20% -10%, rgba(79,124,255,.25), transparent),
              radial-gradient(900px 260px at 90% 0%, rgba(62,230,193,.14), transparent);
}
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 4.5vw, 44px); line-height: 1.1; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: var(--muted); max-width: 720px; font-size: 16px; }

/* ---------- catálogo ---------- */
main { padding: 12px clamp(16px, 4vw, 48px) 60px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 14px; }
.section-title h2 { margin: 0; font-size: 20px; }
.section-title small { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card:hover, .card:focus-visible { transform: translateY(-3px); border-color: var(--accent-2); box-shadow: 0 10px 30px rgba(0,0,0,.35); outline: none; }
.card .cover { aspect-ratio: 16/9; background: var(--card-2) center/cover no-repeat; position: relative; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 16px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--muted); width: fit-content;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.ready { color: var(--ok); background: rgba(62,230,122,.12); }
.badge.starting, .badge.stopped { color: var(--warn); background: rgba(255,191,71,.12); }
.badge.full, .badge.busy { color: #ff9a5c; background: rgba(255,154,92,.12); }
.badge.offline, .badge.no_host, .badge.error, .badge.disabled { color: var(--danger); background: rgba(255,92,122,.12); }
.cover .badge { position: absolute; left: 10px; top: 10px; background: rgba(11,16,32,.8); }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- página do jogo ---------- */
.game-page { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px; margin-top: 10px; }
@media (max-width: 860px) { .game-page { grid-template-columns: 1fr; } }
.game-page .big-cover { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16/9; background: var(--card-2); }
.game-page .big-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-page h1 { margin: 0 0 10px; font-size: clamp(24px, 3.5vw, 36px); }
.game-page .desc { color: var(--muted); line-height: 1.6; white-space: pre-wrap; }
.back { display: inline-flex; gap: 6px; color: var(--muted); margin-top: 6px; cursor: pointer; background: none; border: 0; padding: 0; }
.back:hover { color: var(--text); }
.info-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
.info-list b { color: var(--text); font-weight: 600; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 13px 22px; font-weight: 700; cursor: pointer;
  background: linear-gradient(90deg, var(--accent), #35d0e6); color: #04201a; font-size: 16px;
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn[disabled] { background: var(--card-2); color: var(--muted); cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.notice { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255,191,71,.08); border: 1px solid rgba(255,191,71,.25); color: #ffd98a; font-size: 14px; }
.howto { margin-top: 26px; padding: 16px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line); font-size: 14px; color: var(--muted); line-height: 1.6; }
.howto h3 { color: var(--text); margin: 0 0 6px; font-size: 15px; }
.nick { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-size: 13px; color: var(--muted); max-width: 320px; }
.nick input { background: var(--bg-2); border: 1px solid var(--line); color: var(--text); padding: 10px 12px; border-radius: 10px; font-size: 15px; }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 24px; border-top: 1px solid var(--line); }

/* ======================================================= PLAYER ===== */
body.player { overflow: hidden; height: 100dvh; background: #000; touch-action: none; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#stage { position: fixed; inset: 0; background: #000; }
#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#video.fill { object-fit: cover; }

/* barra superior do player */
.hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(0,0,0,.65), transparent);
  transition: opacity .3s;
}
.hud.dim { opacity: .25; }
.hud .title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.hud .spacer { flex: 1; }
.hud-btn {
  border: 1px solid rgba(255,255,255,.18); background: rgba(20,26,50,.7); color: #fff;
  border-radius: 10px; height: 36px; min-width: 36px; padding: 0 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600;
}
.hud-btn:hover { background: rgba(40,50,90,.9); }
.hud-btn.exit { border-color: rgba(255,92,122,.6); }
.hud-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.net { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-variant-numeric: tabular-nums;
  padding: 0 10px; height: 36px; border-radius: 10px; background: rgba(20,26,50,.7); border: 1px solid rgba(255,255,255,.12); }
.net .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.net.good .dot { background: var(--ok); }
.net.fair .dot { background: var(--warn); }
.net.bad .dot { background: var(--danger); }
.stats-panel { position: absolute; top: 56px; right: 10px; z-index: 31; background: rgba(10,14,30,.88); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px; font-size: 12px; font-variant-numeric: tabular-nums; line-height: 1.7; min-width: 200px; }
.stats-panel div { display: flex; justify-content: space-between; gap: 16px; }
.stats-panel span:first-child { color: var(--muted); }

/* telas de carregamento / erro */
.overlay { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(800px 400px at 50% 30%, rgba(79,124,255,.18), rgba(5,8,18,.96)); padding: 20px; }
.overlay .box { width: min(460px, 100%); text-align: center; }
.overlay h2 { margin: 12px 0 6px; font-size: 22px; }
.overlay p { color: var(--muted); margin: 0 0 16px; line-height: 1.5; }
.spinner { width: 54px; height: 54px; border-radius: 50%; margin: 0 auto; border: 4px solid rgba(255,255,255,.12); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { list-style: none; padding: 0; margin: 18px auto; text-align: left; display: grid; gap: 8px; width: fit-content; font-size: 14px; color: var(--muted); }
.steps li::before { content: "○"; display: inline-block; width: 22px; color: var(--muted); }
.steps li.active { color: var(--text); }
.steps li.active::before { content: "◐"; color: var(--accent); }
.steps li.done { color: var(--ok); }
.steps li.done::before { content: "●"; color: var(--ok); }
.overlay .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.err-icon { width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: rgba(255,92,122,.15); color: var(--danger); font-size: 28px; font-weight: 800; }

.toast { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); z-index: 50; background: rgba(20,26,50,.95);
  border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; text-align: center;
  transition: opacity .3s; }
.toast.warn { border-color: rgba(255,191,71,.5); }
.toast.error { border-color: rgba(255,92,122,.6); }
.tap-unmute { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 32; }
.rotate-hint { position: absolute; inset: 0; z-index: 45; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 10px;
  background: rgba(5,8,18,.92); color: var(--text); text-align: center; padding: 30px; }
@media (orientation: portrait) and (pointer: coarse) { body.touch .rotate-hint.enabled { display: flex; } }
.rotate-hint .phone { width: 46px; height: 76px; border: 4px solid var(--accent); border-radius: 10px; animation: rot 2s ease-in-out infinite; }
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(90deg); } }

/* ---------------------------------------------- controles virtuais --- */
#controls { position: absolute; inset: 0; z-index: 20; pointer-events: none; touch-action: none; }
#controls .ctl { position: absolute; pointer-events: auto; transform: translate(-50%, -50%); touch-action: none; }
#controls.editing .ctl { outline: 2px dashed rgba(62,230,193,.75); outline-offset: 4px; cursor: move; }
#controls.editing .ctl.selected { outline-color: var(--warn); }
.ctl-btn {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center;
  background: rgba(30,38,70,.55); border: 2px solid rgba(255,255,255,.35); color: #fff;
  font-weight: 800; font-size: calc(var(--s, 60px) * .36); text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.ctl-btn.pressed { background: rgba(62,230,193,.55); border-color: #fff; transform: scale(.94); }
.ctl-btn.pill { border-radius: 999px; font-size: calc(var(--s, 60px) * .22); letter-spacing: .5px; }
.ctl-btn.shoulder { border-radius: 14px; }
.ctl-btn.a { color: #7dffb2; } .ctl-btn.b { color: #ff8a9e; } .ctl-btn.x { color: #8fb8ff; } .ctl-btn.y { color: #ffe27a; }
.abxy { position: relative; }
.abxy .ctl-btn { position: absolute; width: 38%; height: 38%; font-size: calc(var(--s, 120px) * .15); }
.abxy .y { left: 31%; top: 0; } .abxy .x { left: 0; top: 31%; } .abxy .b { right: 0; top: 31%; } .abxy .a { left: 31%; bottom: 0; }
.stick-base { width: 100%; height: 100%; border-radius: 50%; background: rgba(30,38,70,.4); border: 2px solid rgba(255,255,255,.28); position: relative; }
.stick-knob { position: absolute; left: 50%; top: 50%; width: 44%; height: 44%; border-radius: 50%; transform: translate(-50%, -50%);
  background: rgba(220,230,255,.55); border: 2px solid rgba(255,255,255,.7); box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.stick-base.active { border-color: rgba(62,230,193,.8); }
.dpad { position: relative; }
.dpad .arm { position: absolute; background: rgba(30,38,70,.55); border: 2px solid rgba(255,255,255,.32); }
.dpad .arm.on { background: rgba(62,230,193,.55); }
.dpad .up { left: 33%; top: 0; width: 34%; height: 38%; border-radius: 8px 8px 2px 2px; }
.dpad .down { left: 33%; bottom: 0; width: 34%; height: 38%; border-radius: 2px 2px 8px 8px; }
.dpad .left { top: 33%; left: 0; width: 38%; height: 34%; border-radius: 8px 2px 2px 8px; }
.dpad .right { top: 33%; right: 0; width: 38%; height: 34%; border-radius: 2px 8px 8px 2px; }
.dpad .center { position: absolute; left: 33%; top: 33%; width: 34%; height: 34%; background: rgba(30,38,70,.55); }

/* painel de ajustes */
.panel { position: absolute; z-index: 35; right: 10px; top: 56px; width: min(330px, calc(100vw - 20px)); max-height: calc(100dvh - 70px); overflow: auto;
  background: rgba(12,16,34,.96); border: 1px solid var(--line); border-radius: 14px; padding: 14px; font-size: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 15px; }
.panel label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; color: var(--muted); }
.panel label input[type=range] { flex: 1; max-width: 160px; }
.panel select { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.panel .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.panel hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.panel .keys { font-size: 12px; color: var(--muted); line-height: 1.6; }
.edit-bar { position: absolute; z-index: 36; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center;
  background: rgba(12,16,34,.95); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; font-size: 13px; flex-wrap: wrap; justify-content: center; max-width: 96vw; }
.edit-bar input[type=range] { width: 110px; }
