/* AI All The World styles. Colors are tokens on :root. */
:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f0f0f7;
  --text: #16162a;
  --muted: #5b5b74;
  --border: #e2e2ee;
  --brand: #4338ca;
  --brand-2: #0e9f8e;
  --brand-ink: #ffffff;
  --link: #3730a3;
  --free: #0b7a5c;
  --free-bg: #dff5ec;
  --warn: #8a5300;
  --warn-bg: #fff1d6;
  --focus: #f59e0b;
  --shadow: 0 1px 2px rgba(20, 20, 50, .06), 0 4px 16px rgba(20, 20, 50, .06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f1a; --surface: #171728; --surface-2: #1f1f35; --text: #ececf6; --muted: #a3a3bd;
    --border: #2c2c47; --brand: #8b85ff; --brand-2: #3dd6c3; --brand-ink: #0f0f1a; --link: #a9a4ff;
    --free: #5fe0b4; --free-bg: #12382d; --warn: #ffc56b; --warn-bg: #3a2a0c;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f1a; --surface: #171728; --surface-2: #1f1f35; --text: #ececf6; --muted: #a3a3bd;
  --border: #2c2c47; --brand: #8b85ff; --brand-2: #3dd6c3; --brand-ink: #0f0f1a; --link: #a9a4ff;
  --free: #5fe0b4; --free-bg: #12382d; --warn: #ffc56b; --warn-bg: #3a2a0c;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; font-size: 17px; overflow-x: hidden; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: .3em 0 .4em; }
h2 { font-size: clamp(1.25rem, 2.5vw, 1.55rem); margin: 1.4em 0 .6em; }
h3 { font-size: 1.08rem; margin: 0 0 .3em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.narrow-col { max-width: 820px; }
.section { padding-top: 8px; padding-bottom: 24px; }
.wrap.section { padding-top: 16px; padding-bottom: 32px; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 68ch; }
.fine { font-size: .85rem; color: var(--muted); }
.note { background: var(--surface-2); border-left: 4px solid var(--brand-2); padding: 10px 14px; border-radius: 8px; font-size: .95rem; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); text-decoration: none; font-size: 1.15rem; letter-spacing: -0.02em; }
.logo b { color: var(--brand); }
.logo.small { margin: 0 0 6px; }
.header-search { flex: 1; min-width: 200px; position: relative; }
.header-search input { width: 100%; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: .95rem; }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; color: var(--text); padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--surface-2); color: var(--brand); }
.menu-btn { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; font-size: 1.2rem; padding: 4px 10px; cursor: pointer; }
@media (max-width: 860px) {
  .header-inner { gap: 10px; padding-top: 8px; padding-bottom: 8px; }
  .header-search { order: 3; flex-basis: 100%; }
  .menu-btn { display: block; margin-left: auto; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; order: 4; padding-bottom: 8px; }
  .nav.open { display: flex; }
}

/* search suggestions */
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); list-style: none; margin: 0; padding: 6px; z-index: 30; text-align: left; }
.suggest li a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.suggest li a small { color: var(--muted); white-space: nowrap; }
.suggest li a:hover, .suggest li a[aria-selected="true"] { background: var(--surface-2); }

/* hero */
.hero { background: radial-gradient(1200px 400px at 50% -100px, color-mix(in srgb, var(--brand) 18%, transparent), transparent), var(--bg); padding: 48px 0 32px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.2rem); }
.hero .lead { margin: 0 auto 24px; }
.big-search { display: flex; gap: 8px; position: relative; background: var(--surface); border: 2px solid var(--border); border-radius: 999px; padding: 6px; box-shadow: var(--shadow); }
.big-search:focus-within { border-color: var(--brand); }
.big-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 1.08rem; padding: 10px 14px; color: var(--text); outline: none; }
.big-search button, .btn.primary { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 999px; padding: 10px 22px; font: inherit; font-weight: 700; cursor: pointer; }
.quick { font-size: .95rem; color: var(--muted); margin-top: 14px; }
.stats { color: var(--muted); font-size: .95rem; }
.stats b { color: var(--text); }

/* grids and cards */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); border-color: var(--brand); }
.card .stretch { display: block; padding: 16px; color: inherit; text-decoration: none; height: 100%; }
.card p { margin: .4em 0 .8em; color: var(--muted); font-size: .95rem; }
.card-top { display: flex; gap: 12px; align-items: center; }
.maker { margin: 0; color: var(--muted); font-size: .9rem; }
.avatar { --h: 250; flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, hsl(var(--h) 65% 48%), hsl(calc(var(--h) + 40) 65% 40%)); font-size: .95rem; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.badge.free { background: var(--free-bg); color: var(--free); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.muted { color: var(--muted); }
.badge.cat { color: var(--brand); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 45%), 1fr)); gap: 12px; }
.cat-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.cat-tile:hover { border-color: var(--brand); }
.cat-tile .emoji { font-size: 1.5rem; }
.cat-tile small { color: var(--muted); }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 32px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.panel h2 { margin-top: 0; font-size: 1.15rem; }
.cheap { list-style: none; padding: 0; margin: 0 0 14px; }
.cheap li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cheap li span { font-weight: 700; white-space: nowrap; }
.btn { display: inline-block; text-decoration: none; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-weight: 600; }
.btn.primary { text-decoration: none; }

.news-list { display: grid; gap: 4px; }
.news-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.news-item h3 { margin: 0 0 4px; }
.news-item h3 a { color: var(--text); text-decoration: none; }
.news-item h3 a:hover { color: var(--link); text-decoration: underline; }
.news-item p { margin: 0; color: var(--muted); }
.news-item .meta { font-size: .85rem; }

/* breadcrumbs */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 8px; font-size: .88rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin: 12px 0; }
.filters input[type="search"], .filters select { font: inherit; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.filters label { display: inline-flex; gap: 8px; align-items: center; font-size: .95rem; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { font: inherit; font-size: .9rem; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.empty { padding: 24px; text-align: center; color: var(--muted); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table thead th { background: var(--surface-2); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table .num { white-space: nowrap; }
.panel .table th, .panel .table td { padding: 8px 6px; overflow-wrap: break-word; hyphens: auto; }
.panel .table th[scope="row"] { min-width: 7.5em; }
.two-col > * { min-width: 0; }
@media (max-width: 700px) {
  .prices thead { display: none; }
  .prices tr { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .prices td { border: 0; padding: 0; }
  .prices td:nth-child(1) { grid-row: span 2; font-size: 1.05rem; }
  .prices td:nth-child(4), .prices td:nth-child(5), .prices td:nth-child(6) { grid-column: 2; font-size: .85rem; color: var(--muted); }
  .table-wrap { overflow: visible; }
}

/* tool page */
.tool-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.tool-head .avatar { width: 64px; height: 64px; font-size: 1.3rem; border-radius: 16px; }
.tool-head h1 { margin: 0; }
.tool-head .btn { margin-left: auto; }
@media (max-width: 600px) { .tool-head .btn { margin-left: 0; width: 100%; text-align: center; } }
.ticks { padding-left: 0; list-style: none; }
.ticks li { padding-left: 28px; position: relative; margin: 6px 0; }
.ticks li::before { content: "✓"; position: absolute; left: 4px; color: var(--brand-2); font-weight: 800; }
.tag { display: inline-block; margin: 0 6px 6px 0; font-size: .85rem; text-decoration: none; }
.sources { font-size: .85rem; padding-left: 18px; }

/* guides */
.guide h1 { margin-top: 0; }
.meta { color: var(--muted); font-size: .9rem; margin: 0; }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 18px; margin: 16px 0; }
.toc ol { margin: 6px 0 0; padding-left: 20px; }
.prose { max-width: 70ch; }
.prose li { margin: 4px 0; }
.prompt { position: relative; background: var(--surface); border: 1px dashed var(--brand); border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; white-space: pre-wrap; padding-right: 92px; }
.copy-btn { position: absolute; top: 8px; right: 8px; font: inherit; font-family: var(--font); font-size: .8rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }

/* search results */
.result { padding: 14px 0; border-bottom: 1px solid var(--border); }
.result h2 { font-size: 1.15rem; margin: 2px 0; }
.result p { margin: 2px 0; color: var(--muted); }
.result .kind { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-2); font-weight: 700; }
mark { background: color-mix(in srgb, var(--focus) 35%, transparent); color: inherit; border-radius: 3px; }

/* footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 32px; padding: 28px 0 18px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.site-footer h2 { font-size: .95rem; margin: 0 0 8px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; font-size: .92rem; }
.site-footer li { margin: 4px 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }

/* cookie notice */
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,.25); padding: 16px 18px; z-index: 50; }
.consent p { margin: 0 0 12px; font-size: .95rem; }
.consent .row { display: flex; gap: 8px; flex-wrap: wrap; }
.consent button { font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.consent button.accept { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* small-screen fixes */
.filters select { max-width: 100%; }
.filters label { max-width: 100%; flex-wrap: wrap; }
.panel .table .num { white-space: normal; }
@media (max-width: 480px) {
  .panel .table th[scope="row"] { min-width: 0; }
  .panel .table { font-size: .88rem; }
}
