/* =====================
   Botões
   ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.btn-primary:hover {
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  border: 1px solid var(--border-accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  box-shadow: 0 0 16px var(--accent-glow);
}

.btn-danger {
  border: 1px solid var(--danger);
  color: var(--danger);
  background: rgba(255, 51, 51, 0.07);
}

.btn-danger:hover {
  background: rgba(255, 51, 51, 0.14);
}

/* =====================
   Modais
   ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: var(--blur-light);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #12121a;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 24px;
}

/* =====================
   Formulários
   ===================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
}

.input::placeholder {
  color: var(--muted);
}

/* =====================
   Seletor de avatar
   ===================== */
.avatar-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.avatar-option {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.avatar-option:hover,
.avatar-option.active {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

/* =====================
   Seletor de cor
   ===================== */
.color-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.color-option:hover,
.color-option.active {
  transform: scale(1.2);
  border-color: white;
}

/* =====================
   Toast
   ===================== */
#toast-container {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--text);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
  pointer-events: all;
  max-width: 260px;
}

.toast.success {
  border-color: var(--success);
  color: var(--success);
}

.toast.danger {
  border-color: var(--danger);
  color: var(--danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(110%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(110%); }
}

/* =====================
   Home — layout
   ===================== */
.page-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

.hero {
  text-align: center;
  margin-bottom: 48px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  letter-spacing: 0.12em;
  color: var(--text);
  margin-bottom: 8px;
}

.hero-sub {
  color: var(--muted);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 20px;
}

/* =====================
   Slots de perfil
   ===================== */
.slots-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 480px) {
  .slots-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

.modal-footer {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.modal-footer-end {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.modal-footer-between {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}

/* =====================
   Jogo — layout
   ===================== */
.game-main {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.game-hud {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 16px;
}

.hud-item {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  min-width: 90px;
}

.hud-label {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
}

.hud-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 700;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 520px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-accent);
  box-shadow: 0 0 40px var(--accent-glow);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  transition: box-shadow 0.3s ease;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: var(--blur-light);
}

.overlay-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  letter-spacing: 0.15em;
  color: var(--accent);
  text-shadow: 0 0 24px var(--accent-glow);
}

.overlay-sub {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  padding: 0 16px;
}

/* Controles touch — ocultos por padrão */
.touch-controls {
  display: none;
  margin-top: 16px;
  user-select: none;
}

.touch-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.touch-btn {
  width: 56px;
  height: 56px;
  background: var(--surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.touch-btn:active {
  background: var(--accent-subtle);
  box-shadow: 0 0 12px var(--accent-glow);
}

.game-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

@media (max-width: 639px) {
  .game-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--border);
    z-index: 40;
    flex-wrap: wrap;
    gap: 8px;
  }

  .game-actions .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }

  .game-main {
    padding-bottom: 80px;
  }
}

/* =====================
   Boot Scan (transição de tela)
   ===================== */
.boot-scan {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.boot-scan.active {
  opacity: 1;
  pointer-events: all;
}

.scan-line {
  position: absolute;
  top: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow), 0 2px 40px rgba(var(--accent-rgb), 0.3);
}

.scan-text {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  opacity: 0;
  position: relative;
  z-index: 1;
}

@keyframes scan-move {
  from { transform: translateY(0); }
  to   { transform: translateY(100vh); }
}

/* =====================
   Volume Slider
   ===================== */
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
  transition: transform 0.15s;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
  border: none;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
