/* =====================================================================
   MK-GUERREIROS - moldura do jogo (canvas 16:9 com letterbox)
   ===================================================================== */
:root {
  --gold: #e8c264;
  --gold-soft: rgba(232, 194, 100, 0.5);
  --ink: #07040c;
  --ink-2: #120b1c;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #04030a;
  color: #f4e8cc;
  font-family: 'Segoe UI', Tahoma, Verdana, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 700px at 50% 8%, rgba(120, 70, 22, 0.22), transparent 60%),
    radial-gradient(900px 600px at 50% 110%, rgba(60, 20, 60, 0.24), transparent 62%),
    #04030a;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

#shell {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
}

#frame {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: 100vh;
  background: #05030b;
  box-shadow:
    0 0 0 2px rgba(232, 194, 100, 0.28),
    0 0 0 8px rgba(10, 6, 18, 0.9),
    0 30px 90px rgba(0, 0, 0, 0.85),
    0 0 80px rgba(232, 160, 60, 0.08);
  overflow: hidden;
}

#frame:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  aspect-ratio: auto;
  box-shadow: none;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#frame:fullscreen canvas {
  width: min(100vw, calc(100vh * 16 / 9));
  height: auto;
  aspect-ratio: 16 / 9;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  cursor: default;
  image-rendering: auto;
}

/* --------------------------------------------------------- cortina inicial */
#loading-veil {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    radial-gradient(700px 420px at 50% 42%, rgba(120, 68, 18, 0.25), transparent 70%),
    #06040d;
  z-index: 5;
  transition: opacity 600ms ease;
}

#loading-veil.gone {
  opacity: 0;
  pointer-events: none;
}

.veil-logo {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  letter-spacing: 4px;
  font-size: clamp(18px, 3.2vw, 42px);
  color: #ffe9a8;
  text-shadow:
    0 0 22px rgba(255, 150, 50, 0.55),
    0 4px 0 #3a1606,
    0 0 3px #000;
}

.veil-sub {
  font-size: clamp(10px, 1.1vw, 14px);
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(200, 180, 160, 0.7);
  animation: veilPulse 1.6s ease-in-out infinite;
}

@keyframes veilPulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* --------------------------------------------------------- barra de dicas */
#hint {
  width: min(100vw, calc(100vh * 16 / 9));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 18px;
  padding: 8px 14px 10px;
  font-size: clamp(9px, 0.95vw, 12px);
  color: rgba(214, 200, 226, 0.62);
  letter-spacing: 0.2px;
  background: linear-gradient(180deg, rgba(8, 5, 14, 0.0), rgba(8, 5, 14, 0.9));
  border-top: 1px solid rgba(232, 194, 100, 0.12);
}

#hint b {
  color: #e8c264;
  font-weight: 700;
}

#btn-full {
  margin-left: 6px;
  padding: 5px 12px;
  font-size: clamp(9px, 0.9vw, 11px);
  font-weight: 700;
  letter-spacing: 1px;
  color: #ffe9a8;
  background: linear-gradient(180deg, #2a2138, #151019);
  border: 1px solid rgba(232, 194, 100, 0.45);
  border-radius: 6px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 120ms ease;
}

#btn-full:hover {
  background: linear-gradient(180deg, #45231f, #24100f);
  border-color: #fff0b8;
  transform: translateY(-1px);
}

#btn-full:active {
  transform: translateY(0);
}

@media (max-width: 720px) {
  #hint span:nth-child(2) { display: none; }
}

@media (max-height: 520px) {
  #hint { display: none; }
  #frame { width: min(100vw, calc(100vh * 16 / 9)); }
}

/* ---------------------------------------------------------------- account overlay */
#account-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 8;
  font-family: 'Segoe UI', Tahoma, Verdana, sans-serif;
}
#account-overlay.hidden { display: none; }
.account-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 520px at 50% 20%, rgba(255,170,60,0.12), transparent 60%),
    radial-gradient(700px 420px at 20% 80%, rgba(120,80,255,0.10), transparent 60%),
    linear-gradient(180deg, rgba(8,5,16,0.82), rgba(4,3,10,0.94));
  backdrop-filter: blur(6px);
}
.account-card {
  position: relative;
  width: min(560px, 100%);
  background:
    linear-gradient(180deg, rgba(255,240,200,0.06), rgba(255,240,200,0.0) 30%),
    linear-gradient(180deg, rgba(28,20,44,0.98), rgba(12,9,20,0.985));
  border: 1px solid rgba(232,194,100,0.35);
  border-radius: 18px;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.75),
    0 0 0 1px rgba(255,240,184,0.06) inset,
    0 1px 0 rgba(255,255,255,0.06) inset;
  padding: 26px 28px 20px;
  color: #f4e8cc;
  overflow: hidden;
  animation: accountIn 420ms cubic-bezier(.2,.8,.2,1);
}
.account-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 18px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,230,160,0.35), rgba(232,194,100,0.05) 40%, rgba(120,200,255,0.12));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
@keyframes accountIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.account-header { margin-bottom: 14px; }
.account-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 2.2px; text-transform: uppercase;
  color: #f7dc8c; background: rgba(232,194,100,0.10);
  border: 1px solid rgba(232,194,100,0.28); border-radius: 999px;
  padding: 5px 11px; margin-bottom: 10px;
}
.account-card h2 {
  margin: 0 0 6px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 32px; line-height: 1.1; color: #fff4c9;
  letter-spacing: .5px; text-shadow: 0 2px 18px rgba(232,194,100,0.18);
}
.account-subtitle { margin: 0; color: #cfc3e6; font-size: 14px; line-height: 1.45; }
#account-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: #e9d9a8; letter-spacing: .4px; font-weight: 600; }
.field input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid rgba(232,194,100,0.22);
  background: linear-gradient(180deg, rgba(10,8,18,0.9), rgba(16,12,24,0.9));
  color: #fff7e3;
  font-size: 14px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.field input::placeholder { color: rgba(210,195,230,0.45); }
.field input:hover { border-color: rgba(232,194,100,0.38); }
.field input:focus { border-color: rgba(232,194,100,0.7); box-shadow: 0 0 0 3px rgba(232,194,100,0.14), 0 8px 24px rgba(0,0,0,0.25) inset; }
#account-error {
  grid-column: 1 / -1; min-height: 20px; color: #ff9fb0; font-size: 13px;
  padding: 2px 2px 0; font-weight: 500;
}
.account-actions { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; justify-content: stretch; margin-top: 2px; }
#account-submit {
  width: 100%;
  appearance: none; border: 1px solid rgba(255,230,160,0.45); border-radius: 12px;
  background: linear-gradient(180deg, #f6d57a 0%, #e3b24a 55%, #c9892e 100%);
  color: #2a1404;
  font-weight: 800; letter-spacing: .6px; font-size: 15px;
  padding: 12px 18px; cursor: pointer;
  box-shadow: 0 10px 24px rgba(201,137,46,0.25), 0 1px 0 rgba(255,255,255,0.35) inset;
  transition: transform 120ms ease, filter 140ms ease, box-shadow 140ms ease;
}
#account-submit:hover { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 14px 28px rgba(201,137,46,0.28), 0 1px 0 rgba(255,255,255,0.35) inset; }
#account-submit:active { transform: translateY(0); filter: brightness(.99); }
.account-guest-btn {
  width: 100%;
  appearance: none; border: 1px solid rgba(74, 222, 128, 0.45); border-radius: 12px;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.25) 0%, rgba(21, 128, 61, 0.35) 100%);
  color: #86efac;
  font-weight: 700; letter-spacing: .4px; font-size: 14px;
  padding: 10px 16px; cursor: pointer;
  transition: all 140ms ease;
}
.account-guest-btn:hover { background: rgba(34, 197, 94, 0.45); color: #ffffff; border-color: #86efac; transform: translateY(-1px); }
.account-guest-btn:active { transform: translateY(0); }
.account-footer { margin-top: 14px; border-top: 1px solid rgba(232,194,100,0.12); padding-top: 10px; }
.account-note { margin: 8px 0 0; font-size: 11.5px; color: #a99ab8; line-height: 1.4; text-align: center; }
.account-switch-wrap { margin-top: 2px; text-align: center; }
.account-switch {
  appearance: none; border: none; background: transparent; color: #8fd6ff;
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; padding: 6px 10px;
  border-radius: 8px; transition: color 120ms ease, background 120ms ease;
}
.account-switch:hover { color: #fff0b8; background: rgba(143,214,255,0.08); }
@media (max-width: 640px) {
  #account-form { grid-template-columns: 1fr; }
  .account-card { padding: 22px 18px 16px; }
  .account-card h2 { font-size: 28px; }
}

/* --------------------------------------------------------- abertura em video */
#intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: #000;
  overflow: hidden;
  opacity: 1;
  transition: opacity 480ms ease;
}
#intro-overlay.gone {
  opacity: 0;
  pointer-events: none;
}

#intro-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.intro-btn {
  position: absolute;
  bottom: 16px;
  z-index: 2;
  appearance: none;
  border: 1px solid rgba(232, 194, 100, 0.5);
  border-radius: 999px;
  padding: 9px 18px;
  background: rgba(10, 7, 16, 0.72);
  color: #f4e8cc;
  font: 700 12px/1 'Segoe UI', Tahoma, Verdana, sans-serif;
  letter-spacing: 0.12em;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.intro-btn:hover,
.intro-btn:focus-visible {
  background: rgba(232, 194, 100, 0.2);
  color: #fff2c4;
  border-color: rgba(232, 194, 100, 0.85);
  outline: none;
}
#intro-skip { right: 16px; }
#intro-sound { left: 16px; }
#intro-sound.on {
  color: #ffe9a8;
  border-color: rgba(232, 194, 100, 0.9);
}

#intro-hint {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 3, 9, 0.55);
}
#intro-hint.hidden { display: none; }
#intro-play {
  appearance: none;
  border: 2px solid rgba(232, 194, 100, 0.8);
  border-radius: 999px;
  padding: 16px 30px;
  background: rgba(12, 9, 20, 0.85);
  color: #ffe9a8;
  font: 700 15px/1 'Segoe UI', Tahoma, Verdana, sans-serif;
  letter-spacing: 0.14em;
  cursor: pointer;
}
#intro-play:hover,
#intro-play:focus-visible {
  background: rgba(232, 194, 100, 0.22);
  color: #fff;
  outline: none;
}

@media (max-width: 640px) {
  .intro-btn { bottom: 10px; padding: 7px 12px; font-size: 10px; }
  #intro-skip { right: 10px; }
  #intro-sound { left: 10px; }
  #intro-play { padding: 12px 20px; font-size: 12px; }
}

/* ------------------------------------------------------- história / cinemática */
#cinematic-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: #05040a;
}
#cinematic-overlay.hidden { display: none; }
#cinematic-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #05040a;
}
#cinematic-close {
  position: absolute;
  left: 12px;
  bottom: 14px;
  z-index: 2;
  appearance: none;
  border: 1px solid rgba(232,194,100,0.45);
  border-radius: 999px;
  padding: 7px 14px;
  background: rgba(12,9,20,0.72);
  color: #f4e8cc;
  font: 600 11px/1 'Segoe UI', Tahoma, Verdana, sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 140ms ease, background 140ms ease, color 140ms ease;
}
#cinematic-close:hover,
#cinematic-close:focus-visible {
  opacity: 1;
  background: rgba(232,194,100,0.18);
  color: #fff0b8;
  outline: none;
}
