:root {
  --bg-ink-0: #060b18;
  --bg-ink-1: #0c1a34;
  --bg-ink-2: #17305f;
  --surface-flat: rgba(10, 20, 41, 0.78);
  --surface-soft: rgba(255, 255, 255, 0.06);
  --border: rgba(178, 197, 238, 0.26);
  --text: #f4f6ff;
  --muted: #b5c3e1;
  --accent: #ff8a3d;
  --accent-strong: #ff6a1b;
  --accent-cool: #38bdf8;
  --accent-rgb: 255, 138, 61;
  --bg-burst-warm: rgba(255, 136, 55, 0.28);
  --bg-burst-cool: rgba(56, 189, 248, 0.24);
  --grid-line: rgba(255, 255, 255, 0.12);
  --focus-ring: rgba(56, 189, 248, 0.42);
  --button-border: rgba(255, 179, 126, 0.42);
  --secondary-bg: rgba(142, 170, 255, 0.12);
  --secondary-bg-hover: rgba(168, 191, 255, 0.2);
  --secondary-border: rgba(180, 201, 255, 0.32);
  --ui-border-soft: rgba(171, 195, 246, 0.3);
  --ui-chip-bg: rgba(166, 189, 255, 0.12);
  --ui-panel-bg: rgba(10, 20, 41, 0.66);
  --ui-input-bg: rgba(7, 15, 30, 0.72);
  --ui-card-bg: rgba(12, 25, 50, 0.7);
  --ui-text-soft: #d4def5;
  --ui-text-strong: #dce5fa;
  --ui-divider: rgba(181, 195, 225, 0.34);
  --ui-header-orb: rgba(255, 138, 61, 0.54);
  --danger: #ff8181;
  --success: #2dd4bf;
  --radius: 18px;
  --shadow-soft: 0 22px 48px rgba(3, 8, 22, 0.4);
  --shadow-glow: 0 0 0 1px rgba(136, 177, 255, 0.18), 0 30px 54px rgba(8, 14, 35, 0.46);
}

:root.theme-dark,
body.theme-dark {
  --bg-ink-0: #0b0f17;
  --bg-ink-1: #111827;
  --bg-ink-2: #1f2937;
  --surface-flat: rgba(17, 24, 39, 0.8);
  --surface-soft: rgba(255, 255, 255, 0.06);
  --border: rgba(148, 163, 184, 0.3);
  --text: #f8fafc;
  --muted: #c0cad8;
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --accent-cool: #06b6d4;
  --accent-rgb: 59, 130, 246;
  --bg-burst-warm: rgba(59, 130, 246, 0.22);
  --bg-burst-cool: rgba(6, 182, 212, 0.2);
  --grid-line: rgba(255, 255, 255, 0.1);
  --focus-ring: rgba(59, 130, 246, 0.4);
  --button-border: rgba(96, 165, 250, 0.46);
  --secondary-bg: rgba(148, 163, 184, 0.14);
  --secondary-bg-hover: rgba(148, 163, 184, 0.22);
  --secondary-border: rgba(148, 163, 184, 0.34);
  --ui-border-soft: rgba(148, 163, 184, 0.32);
  --ui-chip-bg: rgba(148, 163, 184, 0.14);
  --ui-panel-bg: rgba(17, 24, 39, 0.68);
  --ui-input-bg: rgba(15, 23, 42, 0.78);
  --ui-card-bg: rgba(17, 24, 39, 0.74);
  --ui-text-soft: #dbe4f0;
  --ui-text-strong: #f1f5f9;
  --ui-divider: rgba(148, 163, 184, 0.34);
  --ui-header-orb: rgba(59, 130, 246, 0.42);
}

:root.theme-light,
body.theme-light {
  --bg-ink-0: #f7f9fc;
  --bg-ink-1: #edf2f8;
  --bg-ink-2: #dfe8f2;
  --surface-flat: rgba(255, 255, 255, 0.84);
  --surface-soft: rgba(15, 23, 42, 0.04);
  --border: rgba(148, 163, 184, 0.34);
  --text: #0f172a;
  --muted: #475569;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-cool: #0ea5e9;
  --accent-rgb: 37, 99, 235;
  --bg-burst-warm: rgba(37, 99, 235, 0.12);
  --bg-burst-cool: rgba(14, 165, 233, 0.1);
  --grid-line: rgba(15, 23, 42, 0.08);
  --focus-ring: rgba(37, 99, 235, 0.34);
  --button-border: rgba(37, 99, 235, 0.42);
  --secondary-bg: rgba(37, 99, 235, 0.1);
  --secondary-bg-hover: rgba(37, 99, 235, 0.16);
  --secondary-border: rgba(37, 99, 235, 0.24);
  --ui-border-soft: rgba(100, 116, 139, 0.26);
  --ui-chip-bg: rgba(37, 99, 235, 0.1);
  --ui-panel-bg: rgba(255, 255, 255, 0.78);
  --ui-input-bg: rgba(248, 250, 252, 0.92);
  --ui-card-bg: rgba(255, 255, 255, 0.86);
  --ui-text-soft: #334155;
  --ui-text-strong: #0f172a;
  --ui-divider: rgba(148, 163, 184, 0.3);
  --ui-header-orb: rgba(37, 99, 235, 0.22);
  --danger: #dc2626;
  --success: #059669;
  --shadow-soft: 0 18px 38px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 0 1px rgba(148, 163, 184, 0.22), 0 20px 40px rgba(15, 23, 42, 0.11);
}

:root.theme-sunset,
body.theme-sunset {
  --bg-ink-0: #241010;
  --bg-ink-1: #4a1821;
  --bg-ink-2: #713345;
  --surface-flat: rgba(54, 23, 30, 0.78);
  --surface-soft: rgba(255, 226, 196, 0.08);
  --border: rgba(255, 196, 164, 0.3);
  --text: #fff4ea;
  --muted: #f0c9ae;
  --accent: #ff7a45;
  --accent-strong: #ff5b2c;
  --accent-cool: #ffd166;
  --accent-rgb: 255, 122, 69;
  --bg-burst-warm: rgba(255, 126, 95, 0.35);
  --bg-burst-cool: rgba(255, 209, 102, 0.22);
  --grid-line: rgba(255, 226, 196, 0.16);
  --focus-ring: rgba(255, 209, 102, 0.45);
  --button-border: rgba(255, 180, 142, 0.45);
  --secondary-bg: rgba(255, 196, 164, 0.16);
  --secondary-bg-hover: rgba(255, 196, 164, 0.24);
  --secondary-border: rgba(255, 204, 176, 0.38);
  --ui-border-soft: rgba(255, 196, 164, 0.32);
  --ui-chip-bg: rgba(255, 174, 126, 0.18);
  --ui-panel-bg: rgba(49, 21, 24, 0.67);
  --ui-input-bg: rgba(38, 14, 16, 0.75);
  --ui-card-bg: rgba(60, 25, 29, 0.72);
  --ui-text-soft: #ffe5d2;
  --ui-text-strong: #fff0e5;
  --ui-divider: rgba(255, 201, 171, 0.34);
  --ui-header-orb: rgba(255, 123, 88, 0.58);
}

:root.theme-forest,
body.theme-forest {
  --bg-ink-0: #07150f;
  --bg-ink-1: #0f2a1f;
  --bg-ink-2: #1b4734;
  --surface-flat: rgba(9, 31, 22, 0.78);
  --surface-soft: rgba(202, 255, 227, 0.08);
  --border: rgba(172, 231, 193, 0.27);
  --text: #effff5;
  --muted: #b8e0c8;
  --accent: #33b87a;
  --accent-strong: #1f9961;
  --accent-cool: #7dd3fc;
  --accent-rgb: 51, 184, 122;
  --bg-burst-warm: rgba(51, 184, 122, 0.32);
  --bg-burst-cool: rgba(56, 189, 248, 0.22);
  --grid-line: rgba(196, 255, 226, 0.13);
  --focus-ring: rgba(125, 211, 252, 0.45);
  --button-border: rgba(115, 226, 173, 0.45);
  --secondary-bg: rgba(172, 231, 193, 0.14);
  --secondary-bg-hover: rgba(172, 231, 193, 0.22);
  --secondary-border: rgba(172, 231, 193, 0.33);
  --ui-border-soft: rgba(172, 231, 193, 0.3);
  --ui-chip-bg: rgba(108, 194, 150, 0.18);
  --ui-panel-bg: rgba(8, 28, 22, 0.67);
  --ui-input-bg: rgba(7, 22, 17, 0.75);
  --ui-card-bg: rgba(10, 34, 25, 0.74);
  --ui-text-soft: #d7f4e5;
  --ui-text-strong: #e8fff3;
  --ui-divider: rgba(172, 231, 193, 0.35);
  --ui-header-orb: rgba(59, 183, 132, 0.58);
}

:root.theme-lagoon,
body.theme-lagoon {
  --bg-ink-0: #071226;
  --bg-ink-1: #0d2347;
  --bg-ink-2: #123a66;
  --surface-flat: rgba(8, 24, 47, 0.79);
  --surface-soft: rgba(206, 234, 255, 0.08);
  --border: rgba(176, 218, 245, 0.27);
  --text: #f5fbff;
  --muted: #b9d6ea;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-cool: #a78bfa;
  --accent-rgb: 56, 189, 248;
  --bg-burst-warm: rgba(99, 102, 241, 0.24);
  --bg-burst-cool: rgba(56, 189, 248, 0.28);
  --grid-line: rgba(210, 237, 255, 0.13);
  --focus-ring: rgba(167, 139, 250, 0.42);
  --button-border: rgba(144, 218, 255, 0.43);
  --secondary-bg: rgba(176, 218, 245, 0.14);
  --secondary-bg-hover: rgba(176, 218, 245, 0.22);
  --secondary-border: rgba(176, 218, 245, 0.34);
  --ui-border-soft: rgba(176, 218, 245, 0.3);
  --ui-chip-bg: rgba(124, 187, 238, 0.17);
  --ui-panel-bg: rgba(7, 22, 43, 0.67);
  --ui-input-bg: rgba(6, 17, 34, 0.75);
  --ui-card-bg: rgba(9, 31, 59, 0.74);
  --ui-text-soft: #d8edfb;
  --ui-text-strong: #e8f6ff;
  --ui-divider: rgba(176, 218, 245, 0.33);
  --ui-header-orb: rgba(68, 173, 255, 0.56);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  background:
    radial-gradient(circle at 16% 8%, var(--bg-burst-warm), transparent 38%),
    radial-gradient(circle at 84% 14%, var(--bg-burst-cool), transparent 42%),
    linear-gradient(145deg, var(--bg-ink-0), var(--bg-ink-1) 42%, var(--bg-ink-2));
  background-attachment: fixed;
  overscroll-behavior-y: none;
}

body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Text",
    "SF Pro Display",
    "Helvetica Neue",
    "Arial",
    sans-serif;
  color: var(--text);
  line-height: 1.45;
  background-color: var(--bg-ink-0);
  background:
    radial-gradient(circle at 16% 8%, var(--bg-burst-warm), transparent 38%),
    radial-gradient(circle at 84% 14%, var(--bg-burst-cool), transparent 42%),
    linear-gradient(145deg, var(--bg-ink-0), var(--bg-ink-1) 42%, var(--bg-ink-2));
  background-attachment: fixed;
  overscroll-behavior-y: none;
  position: relative;
  transition:
    color 0.28s ease,
    background 0.35s ease;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

body::before {
  inset: -12% -15% auto auto;
  width: 72vmax;
  aspect-ratio: 1 / 1;
  opacity: 0.28;
  background: conic-gradient(
    from 160deg,
    rgba(var(--accent-rgb), 0.16),
    var(--bg-burst-cool),
    var(--surface-soft),
    rgba(var(--accent-rgb), 0.16)
  );
  filter: blur(6px);
  animation: halo-drift 20s ease-in-out infinite alternate;
}

body::after {
  inset: 0;
  opacity: 0.2;
  background-image:
    linear-gradient(transparent 92%, var(--grid-line) 100%),
    linear-gradient(90deg, transparent 94%, var(--grid-line) 100%);
  background-size: 24px 24px;
  animation: grid-shift 24s linear infinite;
}

h1,
h2,
h3,
h4 {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "SF Pro Text",
    "Helvetica Neue",
    "Arial",
    sans-serif;
  font-weight: 650;
  letter-spacing: 0.01em;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  border: 1px solid var(--button-border);
  border-radius: 999px;
  padding: 0.52rem 1.05rem;
  background: linear-gradient(130deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(var(--accent-rgb), 0.32);
  transition:
    transform 0.16s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(var(--accent-rgb), 0.4);
  filter: saturate(1.08);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

button.secondary {
  background: var(--secondary-bg);
  border-color: var(--secondary-border);
  box-shadow: none;
  color: var(--text);
}

button.secondary:hover {
  background: var(--secondary-bg-hover);
  box-shadow: none;
}

code {
  font-family: "SF Mono", "SFMono-Regular", Menlo, Monaco, "Courier New", monospace;
}

.page-shell {
  width: min(1080px, calc(100% - 1.3rem));
  margin-inline: auto;
  padding: 1.15rem 0 2.15rem;
  position: relative;
  z-index: 1;
}

.card-surface {
  background:
    linear-gradient(168deg, rgba(255, 255, 255, 0.08), transparent 50%),
    var(--surface-flat);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(10px);
  transition:
    background 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 0.75rem;
  transform: translateX(-50%);
  width: min(980px, calc(100% - 1rem));
  z-index: 140;
  padding: 0.82rem 0.9rem;
  border-radius: 14px;
}

.cookie-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
}

.cookie-text {
  margin: 0.42rem 0 0;
  color: var(--ui-text-soft);
  font-size: 0.84rem;
}

.cookie-actions {
  margin-top: 0.64rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.48rem;
}

.cookie-link {
  margin-left: auto;
  font-size: 0.84rem;
  text-decoration: none;
  border-bottom: 1px dashed rgba(var(--accent-rgb), 0.45);
}

.cookie-link:hover {
  border-bottom-color: rgba(var(--accent-rgb), 0.82);
}

@media (max-width: 640px) {
  .cookie-banner {
    bottom: 0.55rem;
    padding: 0.72rem 0.74rem;
  }

  .cookie-link {
    margin-left: 0;
  }
}

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

body.setting-large-text {
  font-size: 1.08rem;
}

body.setting-compact-cards .tool-card {
  padding: 0.68rem;
}

body.setting-reduced-motion *,
body.setting-reduced-motion *::before,
body.setting-reduced-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

@keyframes halo-drift {
  from {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }

  to {
    transform: translate3d(-2%, 4%, 0) rotate(12deg) scale(1.08);
  }
}

@keyframes grid-shift {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(24px);
  }
}

@media (min-width: 760px) {
  .page-shell {
    width: min(1120px, calc(100% - 2rem));
    padding-top: 1.8rem;
  }
}
