:root {
  /* ToolKraken — premium black + gold (matches the logo) */
  --bg: #0f1014;
  --bg2: #1b1c22;
  --primary: #9a7613;        /* readable dark gold — links, accents, prices */
  --primary-deep: #7c5e0c;
  --gold: #caa23f;           /* bright gold — buttons, highlights */
  --accent: #caa23f;
  --ink: #17181e;
  --paper: #f7f6f2;
  --muted: #6f6e77;
  --line: #e7e2d6;
  --ok: #1c8a4d;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink); line-height: 1.6;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 920px; margin: 0 auto; padding: 0 1.1rem; }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 1.1rem; background: rgba(255,255,255,0.85); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; flex: none; }
.brand-logo { display: block; flex: none; width: 34px; height: 34px; object-fit: contain; }

/* Intro splash */
.splash {
  position: fixed; inset: 0; z-index: 9999; background: #0d0d11;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .45s ease;
}
.splash.hide { opacity: 0; }
.splash-vid { max-width: 92%; max-height: 82%; border-radius: 14px; }
.splash-skip {
  position: absolute; top: 1rem; right: 1rem; background: rgba(255,255,255,0.14);
  color: #fff; border: 1px solid rgba(255,255,255,0.25); border-radius: 999px;
  padding: 0.4rem 0.9rem; font-weight: 700; cursor: pointer; font-size: 0.9rem;
}
.site-header nav { display: flex; gap: 1.25rem; align-items: center; }
.site-header nav a { color: var(--muted); font-weight: 600; font-size: 0.95rem; }
.site-header nav a:hover { color: var(--ink); text-decoration: none; }

main { min-height: 70vh; padding-bottom: 2rem; }

/* Hero */
.hero {
  background:
    radial-gradient(90% 120% at 50% -10%, rgba(202,162,63,0.22) 0%, rgba(202,162,63,0) 55%),
    linear-gradient(160deg, #23242c 0%, #16171d 45%, #0d0d11 100%);
  color: #fff; padding: 3rem 1.1rem 2.6rem; margin-bottom: 1.75rem; text-align: center;
  border-bottom: 1px solid rgba(202,162,63,0.25);
}
.hero h1 { margin: 0 0 0.5rem; font-size: 2.5rem; font-weight: 800; letter-spacing: -0.03em; color: #fff; }
.hero p { margin: 0 auto; max-width: 56ch; color: #d8d2c4; font-size: 1.05rem; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1.4rem; }
.badges span {
  background: rgba(202,162,63,0.14); border: 1px solid rgba(202,162,63,0.45);
  color: #f0e6cf; font-size: 0.82rem; font-weight: 600; padding: 0.3rem 0.7rem; border-radius: 999px;
}

/* Tool cards / grid */
.cat-title { margin: 1.6rem 0 0.8rem; font-size: 1.15rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.cat-title a { color: inherit; }
.cat-title a:hover { color: var(--primary); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.card {
  display: flex; flex-direction: column; gap: 0.3rem; background: #fff;
  border: 1px solid var(--line); border-radius: 16px; padding: 1.2rem; color: var(--ink);
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(124,94,12,0.18); border-color: var(--primary); text-decoration: none; }
.card-icon {
  width: 46px; height: 46px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: linear-gradient(135deg, #20212a, #121318);
  border: 1px solid rgba(202,162,63,0.38); box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.card-icon .ic { width: 24px; height: 24px; color: var(--gold); }
.h1-icon { display: inline-flex; vertical-align: -5px; margin-right: 9px; }
.h1-icon .ic { width: 27px; height: 27px; color: var(--primary); }
.embed-title .h1-icon .ic { color: var(--gold); }
.card-title { font-weight: 700; letter-spacing: -0.01em; }
.card-blurb { color: var(--muted); font-size: 0.9rem; }

/* Tool page */
.tool-page { padding-top: 1.2rem; }
.crumb { margin: 0 0 0.5rem; }
.tool-page h1 { margin: 0.2rem 0; font-size: 1.7rem; }
.lede { color: var(--muted); margin-top: 0; }
.tool-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem; margin: 1rem 0 1.5rem; }
.tool { display: grid; gap: 1rem; }

/* Inputs / buttons */
input, textarea, select { font: inherit; padding: 0.65rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; width: 100%; background: #fff; color: var(--ink); }
input[type="range"] { padding: 0; }
input[type="checkbox"] { width: auto; }
label { font-weight: 600; display: grid; gap: 0.35rem; }
textarea.big-area { min-height: 160px; resize: vertical; }
.big-output { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; }
.output-row { display: flex; gap: 0.5rem; }
.output-row .big-output { flex: 1; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 0.4rem; }
.checks label { flex-direction: row; align-items: center; gap: 0.4rem; font-weight: 500; }
.inline-fields { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.inline-fields label { flex: 1; min-width: 120px; }
.btn {
  display: inline-block; background: var(--gold); color: #1a1408; border: none; cursor: pointer;
  padding: 0.7rem 1.2rem; border-radius: 10px; font-weight: 800; font-size: 1rem;
}
.btn:hover { filter: brightness(0.95); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { border-color: var(--primary); background: #faf6ea; }
.btn.block { width: 100%; }
.btn-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Stats (word counter) */
.stat-row { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.stat { flex: 1; min-width: 90px; background: #f3f0e7; border-radius: 12px; padding: 0.7rem; text-align: center; }
.stat .num { font-size: 1.5rem; font-weight: 900; color: var(--primary); }
.stat .lbl { color: var(--muted); font-size: 0.8rem; }

/* QR */
.qr-out { display: flex; justify-content: center; padding: 0.5rem; }
.qr-out img, .qr-out canvas { border: 1px solid var(--line); border-radius: 8px; }

/* FAQ + prose */
.faq { margin-top: 1.5rem; }
.faq-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1.1rem; margin-bottom: 0.6rem; }
.faq-item h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.faq-item p { margin: 0; color: var(--muted); }
.howto { margin-top: 1.5rem; }
.howto ol { padding-left: 1.2rem; }
.howto li { margin: 0.3rem 0; }
.more { margin-top: 2rem; }
.prose { padding-top: 1.5rem; max-width: 720px; }
.prose h2 { margin-top: 1.4rem; }

/* Homepage tool search */
.tool-search {
  margin: 1.25rem 0 0.25rem; font-size: 1.05rem; padding: 0.8rem 1rem;
  border: 2px solid var(--line); border-radius: 12px;
}
.tool-search:focus { outline: none; border-color: var(--primary); }

/* Calculator results & misc tool bits */
.result { background: #f3f0e7; border-radius: 12px; padding: 1rem; text-align: center; min-height: 1rem; }
.result:empty { display: none; }
.big-num { font-size: 2rem; font-weight: 900; color: var(--primary); }
.big-num .per { font-size: 1rem; color: var(--muted); font-weight: 600; }
.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 10px; padding: 0.6rem 0.8rem; font-size: 0.9rem; }
.calc-line { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.calc-line strong { color: var(--primary); font-size: 1.1rem; }
input.mini { width: 90px; }

/* Image compressor + markdown preview */
.ic-preview { max-width: 100%; border: 1px solid var(--line); border-radius: 10px; margin-top: 0.5rem; }
.md-preview { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; min-height: 120px; overflow-wrap: anywhere; }
.md-preview h1, .md-preview h2 { margin-top: 0.6rem; }
.md-preview pre { background: #f3f0e7; padding: 0.7rem; border-radius: 8px; overflow: auto; }
.md-preview code { background: #f3f0e7; padding: 0.1rem 0.3rem; border-radius: 4px; }
.md-preview blockquote { border-left: 3px solid var(--primary); margin: 0.6rem 0; padding-left: 0.8rem; color: var(--muted); }

/* Theme toggle */
.theme-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; line-height: 1; padding: 0.2rem; }

/* Password strength meter */
.meter { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.meter-bar { height: 100%; width: 0; transition: width .2s, background .2s; }

/* Text diff */
.diff-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.diff-cols label { display: grid; gap: 0.3rem; }
.diff-out { font-family: ui-monospace, Menlo, monospace; font-size: 0.88rem; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.diff-out:empty { display: none; }
.diff-line { padding: 0.1rem 0.6rem; white-space: pre-wrap; }
.diff-line.add { background: #dcfce7; color: #166534; }
.diff-line.del { background: #fee2e2; color: #991b1b; }
.diff-line.same { color: var(--muted); }
@media (max-width: 600px) { .diff-cols { grid-template-columns: 1fr; } }

/* Color palette */
.palette { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; margin: 0.5rem 0; }
.swatch { height: 110px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 0.5rem; }
.swatch span { background: rgba(255,255,255,0.85); color: #111; font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.4rem; border-radius: 6px; font-family: ui-monospace, monospace; }
@media (max-width: 600px) { .palette { grid-template-columns: repeat(5, 1fr); gap: 0.3rem; } .swatch { height: 80px; } }

/* Amortization table */
.amort { width: 100%; border-collapse: collapse; margin-top: 0.8rem; font-size: 0.9rem; }
.amort th, .amort td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); text-align: right; }
.amort th:first-child, .amort td:first-child { text-align: left; }
.amort th { color: var(--muted); font-weight: 700; }

/* GPA + timezone rows */
.gpa-row { align-items: center; }
.tz-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line); }
.match-list { margin-top: 0.4rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.match-list code { background: var(--line); padding: 0.1rem 0.4rem; border-radius: 5px; }

/* Embed widget + embed boxes */
body.embed { background: transparent; }
body.embed .container { padding: 0.75rem; max-width: 640px; }
.embed-title { margin: 0 0 0.75rem; font-size: 1.2rem; }
.embed-credit { text-align: center; font-size: 0.8rem; margin: 0.6rem 0 0; }
.embed-box { margin-top: 1.5rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.3rem; }
.embed-code { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 0.82rem; margin: 0.3rem 0 0.8rem; }
.embed-box label.small { display: block; margin-top: 0.4rem; font-weight: 700; color: var(--muted); }

/* API docs */
.api-ep { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1.1rem; margin-bottom: 0.7rem; }
.api-ep code { background: var(--line); padding: 0.1rem 0.4rem; border-radius: 5px; word-break: break-all; }
.api-ep .meth { background: var(--accent); color: #fff; font-weight: 800; font-size: 0.72rem; padding: 0.1rem 0.45rem; border-radius: 5px; }

/* Ads */
.ad-slot { display: block; margin: 1.25rem 0; min-height: 90px; }

/* ---- Dark mode ---- */
[data-theme="dark"] {
  --paper: #0d0d11; --ink: #ece9e0; --muted: #9a978c; --line: #2a2b31;
}
[data-theme="dark"] .card-icon { background: linear-gradient(135deg, #26252b, #1a1a1f); border-color: #3a3526; }
[data-theme="dark"] body { background: var(--paper); color: var(--ink); }
[data-theme="dark"] .site-header,
[data-theme="dark"] .card,
[data-theme="dark"] .tool-card,
[data-theme="dark"] .md-preview,
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select,
[data-theme="dark"] .btn.secondary { background: #1a1b21; color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .result,
[data-theme="dark"] .stat,
[data-theme="dark"] .calc-line,
[data-theme="dark"] .faq-item { background: #1a1b21; }
[data-theme="dark"] .brand,
[data-theme="dark"] .site-header nav a { color: var(--ink); }
[data-theme="dark"] .tool-search { background: #1a1b21; color: var(--ink); }
[data-theme="dark"] .err { background: #3f1d1d; color: #fca5a5; border-color: #7f1d1d; }
[data-theme="dark"] .diff-line.add { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .diff-line.del { background: #7f1d1d; color: #fecaca; }
[data-theme="dark"] .match-list code { background: #2a2b31; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 2rem; padding: 1.6rem 1.1rem; text-align: center; color: var(--muted); }
.foot-nav { display: flex; gap: 1rem; justify-content: center; margin: 0.5rem 0; flex-wrap: wrap; }
.small { font-size: 0.85rem; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 3rem 1rem; }

@media (max-width: 600px) {
  .site-header { padding: 0.6rem 0.9rem; }
  .brand { font-size: 1.1rem; }
  .site-header nav { gap: 0.9rem; }
  .site-header nav a { font-size: 0.9rem; }
  .hero { padding: 2.2rem 1rem 2rem; border-radius: 0; }
  .hero h1 { font-size: 1.85rem; }
  .hero p { font-size: 0.98rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; }
  .card { padding: 1rem; border-radius: 14px; }
  .container { padding: 0 0.9rem; }
  .tool-page h1 { font-size: 1.45rem; }
  .inline-fields label { min-width: 0; flex: 1 1 100%; }
  .cat-title { font-size: 1rem; }
}
