:root {
  --ink: #0b1933; --muted: #65748b; --subtle: #8b98aa;
  --primary: #4f46e5; --primary-2: #635bff; --primary-soft: #eef0ff;
  --success: #10a37f; --success-soft: #e8f8f3; --danger: #e5484d; --danger-soft: #ffe8e9; --warning: #e9a23b;
  --canvas: #f5f7fb; --surface: #fff; --line: #e6eaf0; --line-strong: #d9dee8;
  --shadow-sm: 0 1px 2px rgba(20, 31, 54, .05), 0 4px 12px rgba(20, 31, 54, .04);
  --shadow-lg: 0 22px 70px rgba(24, 35, 61, .18), 0 4px 16px rgba(24, 35, 61, .08);
  --radius: 16px; --radius-sm: 11px;
}
[data-theme="escuro"] { color-scheme: dark; --ink: #eef2f8; --muted: #9ba8bb; --subtle: #7f8da3; --primary: #8b83ff; --primary-2: #9b95ff; --primary-soft: #29274c; --success: #38cda3; --success-soft: #173d35; --danger: #ff7278; --danger-soft: #4b292f; --canvas: #11151d; --surface: #1a202b; --line: #2c3543; --line-strong: #3a4555; --shadow-sm: 0 1px 2px rgba(0,0,0,.2), 0 5px 16px rgba(0,0,0,.15); --shadow-lg: 0 24px 70px rgba(0,0,0,.5); }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--canvas); font-size: 14px; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: var(--primary); }
[hidden] { display: none !important; }

/* Barra superior */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 68px; padding: 0 clamp(14px, 3vw, 34px); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.3px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(135deg, var(--primary), #db4f73); color: white; font-size: 19px; }
.nav { display: flex; gap: 4px; margin-left: 18px; }
.nav-item { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 650; cursor: pointer; }
.nav-item:hover { background: var(--canvas); color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item svg, .button svg, .icon-button svg { width: 18px; height: 18px; stroke-width: 1.9; flex: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip { font-size: 12px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.view-root { padding: clamp(18px, 2.4vw, 30px) clamp(14px, 2.7vw, 34px) 48px; }
.page { max-width: 1240px; margin: 0 auto; animation: pageIn .25s ease; }
@keyframes pageIn { from { opacity: .3; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 25px; flex-wrap: wrap; }
.eyebrow { color: var(--primary); font-weight: 750; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 7px; }
.page-heading h2 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -.7px; }
.page-heading p { margin: 7px 0 0; color: var(--muted); }
.heading-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Botões e campos */
.button { height: 42px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 11px; font-weight: 700; cursor: pointer; transition: .16s ease; white-space: nowrap; text-decoration: none; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: none; }
.button:disabled { opacity: .48; cursor: not-allowed; box-shadow: none; transform: none; }
.button.primary { color: white; background: linear-gradient(135deg, var(--primary), #6258f7); box-shadow: 0 7px 18px rgba(79, 70, 229, .2); }
.button.secondary { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.button.ghost { background: transparent; color: var(--muted); }
.button.danger { background: var(--danger-soft); color: var(--danger); }
.button.small { height: 36px; padding: 0 12px; font-size: 12px; }
.button.block { width: 100%; }
.icon-button { width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-button:hover { color: var(--primary); }
.field { height: 42px; width: 100%; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); padding: 0 12px; outline: 0; min-width: 0; color: var(--ink); }
.field:focus { border-color: #a9afff; box-shadow: 0 0 0 3px rgba(79, 70, 229, .09); }
.select-wrap { position: relative; }
.select-wrap select { width: 100%; appearance: none; padding-right: 42px; cursor: pointer; }
.select-wrap::after { content: ""; position: absolute; right: 17px; top: 15px; width: 7px; height: 7px; border-right: 1.5px solid #748197; border-bottom: 1.5px solid #748197; transform: rotate(45deg); pointer-events: none; }
.form-group { display: grid; gap: 7px; }
.form-group label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .03em; }
kbd { background: var(--canvas); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 2px 6px; color: var(--muted); font-size: 10px; }
:is(button, input, select, textarea, a):focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }

/* Painéis */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-header { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-header h3 { margin: 0; font-size: 15px; }
.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.panel-body { padding: 18px 20px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 18px; }
.progress { height: 6px; flex: 1; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #7c72ff); }
.empty { padding: 38px 20px; text-align: center; color: var(--muted); }
.empty-inline { display: grid; justify-items: center; gap: 6px; padding: 22px 12px; text-align: center; color: var(--muted); }
.empty-inline .empty-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.empty-inline .empty-icon svg { width: 22px; height: 22px; }
.empty-inline strong { color: var(--ink); }
.empty-inline span { font-size: 12px; }

/* Avisos */
.toast-root { position: fixed; right: 24px; bottom: 24px; z-index: 100; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 48px)); }
.toast { background: #13233e; color: white; border-radius: 12px; padding: 12px 15px; box-shadow: var(--shadow-lg); animation: pageIn .22s ease; font-weight: 620; }
.toast.success { background: #0a725b; }
.toast.error { background: #aa3034; }

/* Janela de confirmação */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(9, 18, 37, .45); backdrop-filter: blur(4px); }
.modal { width: min(460px, 100%); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 22px; display: grid; gap: 14px; }
.modal h3 { margin: 0; }
.modal p { margin: 0; color: var(--muted); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Página pública: apresentação, planos e acesso */
.landing { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 34px; align-items: start; }
.landing-hero { padding: 36px 34px; border-radius: 22px; color: white; background: linear-gradient(125deg, #25235e 0%, #453fa8 54%, #665ef6 100%); box-shadow: 0 16px 42px rgba(47, 42, 126, .18); position: relative; overflow: hidden; }
.landing-hero::after { content: ""; position: absolute; width: 330px; height: 330px; border: 70px solid rgba(255, 255, 255, .07); border-radius: 50%; right: -120px; top: -160px; }
.landing-hero > * { position: relative; }
.landing-hero .eyebrow { color: #c7c5ff; }
.landing-hero h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: -1px; }
.landing-hero p { color: #dcdbfb; line-height: 1.6; max-width: 620px; }
.feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.feature { display: flex; gap: 10px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .08); }
.feature i { font-style: normal; font-size: 22px; }
.feature strong { display: block; font-size: 13px; }
.feature span { display: block; font-size: 12px; color: #d4d2fa; margin-top: 2px; line-height: 1.4; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.plan { position: relative; display: grid; gap: 6px; padding: 18px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); }
.plan.featured { border-color: var(--primary); box-shadow: 0 10px 30px rgba(79, 70, 229, .15); }
.plan h3 { margin: 0; font-size: 15px; }
.plan .price { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.plan .price small { font-size: 13px; color: var(--muted); font-weight: 600; }
.plan p { margin: 0; font-size: 12px; color: var(--muted); }
.plan .tag { position: absolute; top: -10px; right: 14px; padding: 3px 9px; border-radius: 99px; background: var(--primary); color: white; font-size: 11px; font-weight: 800; }
.plan .button { margin-top: 8px; }
.auth-card { padding: 24px; display: grid; gap: 14px; }
.auth-card h2 { margin: 0; font-size: 20px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--canvas); }
.auth-tabs button { height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.auth-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.auth-card form { display: grid; gap: 12px; }
.auth-note { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.link-button { border: 0; background: none; padding: 0; color: var(--primary); font-weight: 650; cursor: pointer; font-size: 12px; justify-self: start; }
.legal { max-width: 1180px; margin: 28px auto 0; font-size: 11px; color: var(--subtle); text-align: center; }

/* Assinatura necessária */
.paywall { max-width: 760px; margin: 0 auto; }
.paywall .panel-body { display: grid; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 750; background: var(--canvas); color: var(--muted); }
.status-pill.ok { background: var(--success-soft); color: var(--success); }
.status-pill.warn { background: #fff1e6; color: #c2410c; }
[data-theme="escuro"] .status-pill.warn { background: #47301d; color: #fdba74; }

/* Banco de questões */
.import-box { display: grid; gap: 12px; }
.dropzone { display: grid; place-items: center; gap: 8px; padding: 28px 16px; border: 2px dashed var(--line-strong); border-radius: 14px; text-align: center; color: var(--muted); cursor: pointer; transition: .16s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.dropzone strong { color: var(--ink); }
.import-progress { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.import-progress .progress { height: 8px; }
.bank-list { display: grid; gap: 10px; }
.bank-discipline { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.bank-discipline > header { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--canvas); font-weight: 750; }
.bank-discipline > header span { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.bank-topic { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 74px) 34px; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; }
.bank-topic > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-topic small { color: var(--muted); text-align: right; }
.bank-topic .icon-button { width: 30px; height: 30px; border: 0; }
.bank-topic .icon-button:hover { color: var(--danger); }
.format-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.format-table td { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.format-table td:first-child { font-weight: 700; white-space: nowrap; padding-right: 12px; }

/* Conta */
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.account-list { display: grid; gap: 10px; margin: 0; }
.account-list div { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.account-list dt { color: var(--muted); }
.account-list dd { margin: 0; font-weight: 700; text-align: right; }

.loading-screen { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .landing, .account-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { backdrop-filter: none; background: var(--surface); }
  .nav { margin-left: 0; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; padding: 6px; background: var(--surface); border-top: 1px solid var(--line); }
  .nav-item { flex-direction: column; height: auto; padding: 6px 8px; gap: 2px; font-size: 11px; }
  .view-root { padding-bottom: 90px; }
  .user-chip { display: none; }
  .feature-list, .plans { grid-template-columns: 1fr; }
  .bank-topic { grid-template-columns: minmax(0, 1fr) 60px 34px; }
  .bank-topic small.opt { display: none; }
  .game-options-ce { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .game-confetti, .game-float { display: none; }
}
.bank-side { display: grid; gap: 18px; align-content: start; }
