:root {
  --bg: #ffffff;
  --fg: #202124;
  --muted: #5f6368;
  --border: #dfe1e5;
  --accent: #1a73e8;
  --accent-hover: #1765cc;
  --shadow: 0 1px 6px rgba(32, 33, 36, 0.18);
  --card: #fff;
  --radius: 24px;
  --green: #188038;
  --red: #d93025;
  --max: 720px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; font-size: 14px;
}
.topbar .links a { margin-left: 18px; color: var(--muted); }
.topbar .account { display: flex; align-items: center; gap: 12px; }
.account .pill {
  background: var(--accent); color: #fff; border: 0; padding: 8px 16px;
  border-radius: 20px; font-size: 14px; cursor: pointer;
}
.account .credits { color: var(--muted); font-size: 13px; }
.account .me { color: var(--fg); font-weight: 500; font-size: 14px; }

/* Hero / search */
.hero { max-width: var(--max); margin: 0 auto; padding: 8vh 20px 40px; text-align: center; }
.logo { font-size: 64px; font-weight: 700; letter-spacing: -2px; margin: 0; }
.logo .dot { color: var(--accent); }
.tagline { color: var(--muted); font-size: 17px; margin: 6px 0 36px; }

.search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow); background: #fff;
  transition: box-shadow .2s;
}
.search:focus-within { box-shadow: 0 1px 10px rgba(32,33,36,.28); }
.search input {
  flex: 1; border: 0; outline: none; font-size: 16px; color: var(--fg); background: transparent;
}
.search .icon { color: var(--muted); }

.btn {
  border: 0; border-radius: 22px; padding: 12px 24px; font-size: 15px; cursor: pointer; font-weight: 500;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: #f1f3f4; color: var(--fg); }
.btn-ghost:hover { background: #e8eaed; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.platforms { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.platforms .chip {
  font-size: 13px; color: var(--muted); border: 1px solid var(--border);
  border-radius: 16px; padding: 5px 12px;
}

/* Result card */
.result { max-width: 760px; margin: 30px auto; padding: 0 20px; display: none; }
.result.show { display: block; }
.result .card {
  border: 1px solid var(--border); border-radius: 16px; padding: 28px;
  box-shadow: var(--shadow); background: var(--card);
}
.result h2 { margin: 0 0 4px; font-size: 22px; }
.result .sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.metrics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 18px 0; }
.metric { background: #f8f9fa; border-radius: 12px; padding: 16px; }
.metric .label { font-size: 13px; color: var(--muted); }
.metric .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.metric .value.green { color: var(--green); }
.summary { background: #e8f0fe; border-radius: 12px; padding: 16px; font-size: 15px; margin: 16px 0; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 480px;
  padding: 24px; max-height: 90vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.modal h3 { margin: 0 0 4px; font-size: 20px; }
.modal p.hint { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; color: var(--fg); background: #fff;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.field .err { color: var(--red); font-size: 12px; margin-top: 4px; display: none; }
.field.invalid input, .field.invalid select { border-color: var(--red); }
.field.invalid .err { display: block; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* Cookie banner */
.cookie {
  position: fixed; bottom: 0; left: 0; right: 0; background: #202124; color: #fff;
  padding: 14px 20px; display: none; align-items: center; justify-content: space-between; gap: 16px; z-index: 40; font-size: 14px;
}
.cookie.show { display: flex; }
.cookie a { color: #8ab4f8; }
.cookie button { background: #8ab4f8; color: #202124; border: 0; border-radius: 18px; padding: 8px 18px; cursor: pointer; font-weight: 600; }

/* Messages */
.msg { font-size: 14px; margin-top: 14px; min-height: 20px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }

/* Footer */
footer { border-top: 1px solid var(--border); margin-top: 60px; padding: 24px 20px; color: var(--muted); font-size: 13px; text-align: center; }
footer a { margin: 0 10px; color: var(--muted); }

/* Spinner */
.spinner { width: 18px; height: 18px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* Report page */
.report-wrap { max-width: 820px; margin: 0 auto; padding: 24px 20px 60px; }
.report-toolbar { display: flex; gap: 10px; justify-content: flex-end; margin-bottom: 16px; }
.report-doc { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 48px; box-shadow: var(--shadow); }
.report-doc h1 { font-size: 26px; margin: 0 0 4px; }
.report-doc .brand { color: var(--accent); }
.report-doc h2 { font-size: 18px; border-bottom: 2px solid var(--accent); padding-bottom: 6px; margin-top: 30px; }
.report-doc .val-box { background: #e8f0fe; border-radius: 12px; padding: 20px; margin: 16px 0; }
.report-doc .val-box .big { font-size: 30px; font-weight: 700; color: var(--green); }
.report-doc table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.report-doc table td { padding: 8px 10px; border-bottom: 1px solid #eee; vertical-align: top; }
.report-doc table td.k { color: var(--muted); width: 38%; }
.report-doc ul { margin: 8px 0; padding-left: 20px; }
.report-doc .impact { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.impact.High { background: #e6f4ea; color: var(--green); }
.impact.Medium { background: #fef7e0; color: #b06000; }
.impact.Low { background: #f1f3f4; color: var(--muted); }
.report-doc .pagebreak { page-break-before: always; }
.report-doc .foot-note { color: var(--muted); font-size: 12px; margin-top: 30px; border-top: 1px solid #eee; padding-top: 12px; }

@media print {
  .report-toolbar, .cookie, .topbar { display: none !important; }
  .report-doc { box-shadow: none; border: 0; padding: 0; }
  body { background: #fff; }
}
@media (max-width: 600px) {
  .logo { font-size: 48px; }
  .metrics-grid { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
}
