/* ===== O Laboratório de Max — página inicial ===== */
:root {
    --ink: #0f1b2d;
    --ink-soft: #3d4b60;
    --bg: #f4f7f6;
    --surface: #ffffff;
    --line: #dbe3e0;
    --teal: #0e8f7e;
    --teal-dark: #0a6b5e;
    --amber: #f2b134;
    --radius: 14px;
    --shadow: 0 6px 20px rgba(15, 27, 45, .08);
    --max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    line-height: 1.6;
}

h1, h2, h3 {
    font-family: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
    line-height: 1.2;
    margin: 0;
}

a { color: var(--teal-dark); }
img { max-width: 100%; display: block; }

:focus-visible {
    outline: 3px solid var(--amber);
    outline-offset: 2px;
}

.wrap { width: min(100% - 32px, var(--max)); margin-inline: auto; }

/* ----- Topo ----- */
.topbar { background: var(--ink); color: #fff; }
.topbar .wrap {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding-block: 14px; flex-wrap: wrap;
}
.brand {
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700; font-size: 1.25rem; color: #fff; text-decoration: none;
}
.topbar nav { display: flex; gap: 20px; }
.topbar nav a { color: #cfe3dd; text-decoration: none; font-weight: 500; }
.topbar nav a:hover { color: #fff; }

/* ----- Hero ----- */
.hero {
    background:
        linear-gradient(rgba(15, 27, 45, .82), rgba(15, 27, 45, .92)),
        url("../images/laboratorio.png") center / cover no-repeat;
    color: #fff;
    padding: 72px 0 80px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); max-width: 18ch; }
.hero p { max-width: 58ch; margin: 18px 0 28px; font-size: 1.1rem; color: #dbe8e4; }
.hero p a { color: var(--amber); }

.btn {
    display: inline-block; padding: 12px 22px; border-radius: 10px;
    font-weight: 700; text-decoration: none; border: 2px solid transparent;
    cursor: pointer; font-size: 1rem; font-family: inherit;
}
.btn-primary { background: var(--amber); color: var(--ink); }
.btn-primary:hover { background: #ffc75a; }
.btn-ghost { border-color: rgba(255, 255, 255, .5); color: #fff; margin-left: 8px; }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); }

/* ----- Seções ----- */
section { padding: 64px 0; }
.section-head { margin-bottom: 28px; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.section-head p { margin: 8px 0 0; color: var(--ink-soft); max-width: 60ch; }

/* ----- Destaque: Cristal War ----- */
.featured {
    display: grid; grid-template-columns: 1fr 1.1fr; gap: 0;
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line);
    margin-top: -48px; position: relative;
}
.featured-media { background: var(--ink); display: grid; place-items: center; padding: 24px; }
.featured-media img { max-height: 280px; width: auto; object-fit: contain; }
.featured-body { padding: 36px; align-self: center; }
.featured-body h2 { font-size: 1.8rem; margin-bottom: 10px; }
.featured-body p { color: var(--ink-soft); margin: 0 0 20px; }
.featured-body .btn-primary { background: var(--teal); color: #fff; }
.featured-body .btn-primary:hover { background: var(--teal-dark); }

/* ----- Grade de jogos ----- */
.grid {
    display: grid; gap: 24px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    display: flex; flex-direction: column; overflow: hidden;
}
.card-media { aspect-ratio: 16 / 10; background: #e6edea; display: block; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { font-size: 1.15rem; }
.card-body p {
    margin: 0; color: var(--ink-soft); font-size: .95rem;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.card-link { margin-top: auto; padding-top: 8px; font-weight: 700; text-decoration: none; }
.card-link:hover { text-decoration: underline; }

/* ----- Controle Orçamentário (login) ----- */
.login-section { background: var(--surface); border-block: 1px solid var(--line); }
.login-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.login-grid .section-head { margin-bottom: 0; }
.login-grid ul { padding-left: 20px; color: var(--ink-soft); }

.container { max-width: 420px; width: 100%; }
.container form {
    background: var(--bg); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 28px;
}
.form-field { margin-bottom: 16px; }
.form-field label { font-weight: 600; display: block; margin-bottom: 6px; }
input[type="email"], input[type="password"] {
    width: 100%; padding: 12px; font-size: 1rem; font-family: inherit;
    border: 1px solid #b9c6c1; border-radius: 8px; background: #fff;
}
input[type="email"]:focus, input[type="password"]:focus { border-color: var(--teal); }

.error {
    display: none; margin-top: 6px; padding: 6px 10px; font-size: .9rem;
    color: #8a1c1c; background: #fdeaea; border-left: 4px solid #c0392b; border-radius: 4px;
}

.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.form-actions button { flex: 1; }
button { font-family: inherit; font-size: 1rem; border-radius: 10px; padding: 12px 16px; cursor: pointer; }
button.solid { background: var(--teal); color: #fff; border: none; font-weight: 700; }
button.solid:hover:not([disabled]) { background: var(--teal-dark); }
button.clear { background: transparent; border: 1px solid var(--line); color: var(--ink); }
button.outline { background: transparent; border: 2px solid var(--teal); color: var(--teal-dark); font-weight: 700; padding: 6px 14px; }
button[disabled] { opacity: .5; cursor: not-allowed; }
button:active:not([disabled]) { opacity: .85; }

.register-link { margin-top: 20px; text-align: center; }
.register-link p { margin: 0; }
.terms { display: flex; gap: 8px; align-items: flex-start; margin-top: 16px; font-size: .92rem; }
.terms input { margin-top: 4px; }

.loading {
    background: rgba(0, 0, 0, .5); position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center; color: #fff; z-index: 100;
}
.loading label { font-size: 24px; }

/* ----- Rodapé ----- */
footer { background: var(--ink); color: #cfe3dd; padding: 48px 0 24px; }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; }
footer h3 { color: #fff; font-size: 1.05rem; margin-bottom: 12px; }
footer ul { list-style: none; margin: 0; padding: 0; }
footer li { margin-bottom: 8px; }
footer a { color: #cfe3dd; text-decoration: none; }
footer a:hover { color: #fff; text-decoration: underline; }
footer p { margin: 0 0 8px; }
.footer-bottom {
    margin-top: 32px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .15);
    font-size: .85rem; color: #9db5ad;
}

/* ----- Celular ----- */
@media (max-width: 800px) {
    .featured, .login-grid { grid-template-columns: 1fr; }
    .featured-body { padding: 24px; }
    .login-grid { gap: 28px; }
    .container { max-width: none; }
    section { padding: 48px 0; }
    .hero { padding: 48px 0 72px; }
    .btn-ghost { margin: 10px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
