/* =========================
   RESET BÁSICO
   ========================= */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

/* Sem scroll (se não couber, encolhe) */
body { overflow: hidden; }


/* =========================
   GLOBAL VISUAL
   ========================= */

body {
  background: url("../images/fundo-QuickDraw-jogo.png") center center / cover no-repeat fixed;
}

/* =========================
   HOME
   ========================= */

.logo {
  font-size: 42px;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 16px;
  color: #555;
}

.hint {
  font-size: 13px;
  color: #666;
  margin-top: 12px;
}

/* =========================
   LOBBY
   ========================= */

.lobby h2 {
  font-size: 22px;
}

.lobby h3 {
  font-size: 16px;
}

.player-name {
  font-weight: 600;
}

/* =========================
   HERO
   ========================= */
.hero{
  min-height: 100svh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: clamp(26px, 4vh, 44px) 16px 16px;

  /* ✅ FUNDO COM IMAGEM */
  background:
    linear-gradient(rgba(255,255,255,0.25), rgba(255,255,255,0.25)),
    url("../assets/images/fundo-QuickDraw-jogo.png") center / cover no-repeat;
}



/* Background blobs */
.hero-bg::before,
.hero-bg::after {
  content: "";
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle at center, #fbbf24 0%, transparent 70%);
  opacity: 0.2;
  border-radius: 50%;
  pointer-events: none;
}

.hero-bg::before { top: -220px; left: -220px; }
.hero-bg::after  { bottom: -220px; right: -220px; }

/* =========================
   CARD
   ========================= */
.hero-card{
  position: relative;
  width: min(520px, 92vw);
  border-radius: 24px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 30px 60px rgba(0,0,0,0.15);
  text-align: center;
  .hero-card { overflow: visible; }


  /* MAIS IMPORTANTE: dá espaço REAL para o logo “ficar fora” do card */
  padding: clamp(56px, 8vh, 78px) clamp(22px, 3vw, 40px) clamp(18px, 4vh, 40px);

  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.6vh, 16px);
}

/* logo pendurado em cima da aresta superior */
.hero-logo{
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;                 /* fica na aresta */
  translate: 0 -55%;      /* puxa para fora para cima */
  z-index: 2;
}

.hero-logo img{
  width: clamp(96px, 12vw, 140px);
  filter: drop-shadow(0 18px 26px rgba(0,0,0,0.22));
}


/* Título / subtítulo */
.hero-title {
  font-size: clamp(28px, 3.2vw, 36px);
  font-weight: 900;
  margin: 0;
  color: #0f172a;
}

.hero-subtitle {
  font-size: 16px;
  color: #334155;
  margin: 0 0 clamp(6px, 1.2vh, 12px);
}

/* Hint */
.hint {
  font-size: 13px;
  color: #64748b;
  margin: 0;
}

/* =========================
   INPUTS
   ========================= */
.field input,
.code-row input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 999px;
  border: none;
  background: #f1f5f9;
  outline: none;

  box-shadow:
    inset 0 4px 8px rgba(0, 0, 0, 0.08),
    inset 0 -2px 4px rgba(255, 255, 255, 0.6);

  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.field input:focus,
.code-row input:focus {
  box-shadow:
    inset 0 4px 8px rgba(0, 0, 0, 0.10),
    0 0 0 4px rgba(34, 211, 238, 0.18);
}

/* =========================
   BOTÕES
   ========================= */
.btn {
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary,
.btn-secondary {
  border-radius: 999px;
  padding: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, #22d3ee, #06b6d4);
  color: #0b1220;
  box-shadow: 0 10px 20px rgba(6, 182, 212, 0.30);
}

.btn-secondary {
  background: linear-gradient(135deg, #a855f7, #9333ea);
  color: #fff;
  box-shadow: 0 10px 20px rgba(147, 51, 234, 0.30);
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-small:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.btn-primary:active,
.btn-secondary:active,
.btn-small:active {
  transform: translateY(1px);
  filter: brightness(0.98);
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: clamp(8px, 1.6vh, 18px) 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #cbd5e1;
}

.divider span {
  font-size: 14px;
  color: #64748b;
}

/* Code row */
.code-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.code-row input {
  flex: 1;
  padding: 12px 16px;
}

/* Botão pequeno (NÃO 999px para não virar bola) */
.btn-small {
  padding: 12px 22px;
  border-radius: 18px;
  background: #22d3ee;
  color: #fff;
  box-shadow: 0 10px 20px rgba(6, 182, 212, 0.28);
}

/* =========================
   EM ECRÃS MUITO BAIXOS: SCALE LEVE (último recurso)
   ========================= */
@media (max-height: 640px) {
  .hero-card {
    transform: scale(0.92);
    transform-origin: center;
  }
}

/* =========================
   MOBILE FIX (sem cortar)
   mantém salas lado a lado
   ========================= */

/* 1) garantir que a row de botões não empurra tudo */
.btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;            /* se ficar apertado, quebra (em vez de aumentar altura por compressão estranha) */
}

.btn-row .btn {
  flex: 1 1 140px;            /* tenta lado a lado; se não couber, quebra */
  max-width: 220px;
  white-space: nowrap;
}

/* 2) em mobile: emagrecer o card e reduzir espaços */
@media (max-width: 520px) {
  .hero {
    padding: 12px;            /* menos margem */
  }

  .hero-card {
    padding-top: 66px;        /* menos espaço para o logo */
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 16px;
    gap: 10px;                /* menos espaço vertical */
  }

  .hero-title {
    font-size: 28px;
  }

  .hero-subtitle {
    margin-bottom: 6px;
    font-size: 14px;
  }

  .field input,
  .code-row input {
    padding: 12px 14px;
  }

  .btn-primary,
  .btn-secondary {
    padding: 13px 12px;
    font-size: 14px;
  }

  .divider {
    margin: 10px 0;
  }

  .hint {
    margin-top: 2px;
  }
}

/* 3) em alturas mesmo baixas (landscape/teclado): scale leve */
@media (max-width: 520px) and (max-height: 650px) {
  .hero-card {
    transform: scale(0.92);
    transform-origin: center;
  }
}

/* 4) caso extremo: ainda mais baixo */
@media (max-width: 520px) and (max-height: 580px) {
  .hero-card {
    transform: scale(0.86);
  }
}


@media (max-width: 520px) {
  .hero { padding: 10px; }

  .hero-card{
    gap: 8px;
    padding: 56px 14px 14px;   /* mais curto */
    border-radius: 20px;
    transform: scale(0.90);
    transform-origin: top center;
  }

  .hero-logo{
    translate: 0 -60%;         /* sobe mais */
  }

  .hero-title{ font-size: 24px; }
  .hero-subtitle{ font-size: 13px; margin-bottom: 4px; }

  .field input, .code-row input{ padding: 11px 12px; }
  .btn-primary, .btn-secondary{ padding: 12px 10px; font-size: 13px; }

  .divider{ margin: 8px 0; }
  .hint{ display: none; }      /* em mobile baixa, tira o hint */
}

/* alturas muito baixas (ex: landscape com barras): escala mais */
@media (max-width: 520px) and (max-height: 520px) {
  .hero-card{ transform: scale(0.84); }
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden !important;  /* mata scroll vertical/horizontal */
}

body {
  overscroll-behavior: none;
}



/* MOBILE: garantir que cabe em altura */
@media (max-width: 520px) {
  .hero-card{
    /* nunca mais alto do que o ecrã (com uma margem) */
    max-height: calc(100svh - 18px);
    box-sizing: border-box;

    /* emagrece um pouco */
    padding-bottom: 12px;
    gap: 8px;
  }

  /* reduz espaços que costumam rebentar o fundo */
  .divider{ margin: 8px 0; }
  .hint{ font-size: 12px; margin-top: 0; }
  .btn-primary, .btn-secondary{ padding: 12px 10px; }
}

/* Se o ecrã for mesmo baixo (landscape), encolhe card */
@media (max-width: 520px) and (max-height: 520px) {
  .hero-card{
    transform: scale(0.86);
    transform-origin: top center;
  }
}

.hero-card{
  transform-origin: center top;
}

/* LANDSCAPE MOBILE BAIXO (tipo 740x360) */
@media (max-width: 200px) and (max-height: 200px) {
  .hero-card{
    transform: scale(0.80);
    transform-origin: top center;
  }
}

/* EXTREMAMENTE BAIXO */
@media (max-width: 200px) and (max-height: 200px) {
  .hero-card{
    transform: scale(0.80);
  }
}

/* =========================
   CANVAS TOOLBAR (fix cores a desaparecer)
   ========================= */

/* a linha do header tem de permitir encolher e não cortar */
.canvasPanel .panelHeader.toolsRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-width:0;
  overflow: visible; /* <- importante */
}

/* bloco do "A desenhar" não deve esticar */
.canvasPanel .drawerBlock{
  flex: 0 0 auto;
  min-width: 0;
}

/* o container das ferramentas pode partir em 2 linhas */
.canvasPanel .tools{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;

  flex: 1 1 auto;
  min-width: 0;

  flex-wrap: wrap;     /* <- deixa ir para 2 linhas */
  overflow: visible;   /* <- não cortar cores */
}

/* as cores nunca devem “sumir”: se não couber, faz scroll horizontal */
.canvasPanel .tools .colors{
  display:flex;
  align-items:center;
  gap:8px;

  flex: 0 1 auto;
  min-width: 120px;      /* garante espaço mínimo */
  overflow-x: auto;      /* <- se apertar, scroll em vez de desaparecer */
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;

  padding-bottom: 2px;   /* evita cortar sombras/bordas */
}

/* cada bolinha não encolhe */
.canvasPanel .tools .colors .colorDot{
  flex: 0 0 auto;
}

/* slider também pode encolher */
.canvasPanel .tools .thickness{
  flex: 1 1 140px;
  min-width: 110px;
}

/* botão Limpar nunca quebra feio */
.canvasPanel .tools #btnClear{
  flex: 0 0 auto;
  white-space: nowrap;
}

/* em ecrãs mais estreitos: reduz gaps e deixa tudo mais compacto */
@media (max-width: 900px){
  .canvasPanel .panelHeader.toolsRow{ gap: 10px; }
  .canvasPanel .tools{ gap: 8px; }
  .canvasPanel .tools .thickness{ flex-basis: 120px; }
}

/* ===== BACKGROUND DO JOGO ===== */
html, body { height: 100%; }

body{
  background: url("../assets/images/fundo-QuickDraw-jogo.png") center / cover no-repeat fixed !important;
}
