:root {
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --border: rgba(255, 255, 255, 0.12);
  --accent: #7c3aed;
  --accent-2: #22c55e;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --nav-bg: rgba(11, 16, 32, 0.75);
  --nav-border: rgba(255, 255, 255, 0.12);
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  --card-border: rgba(255, 255, 255, 0.12);
  --card-shadow: var(--shadow);
  --display-bg: rgba(0, 0, 0, 0.3);
  --display-border: rgba(255, 255, 255, 0.22);
  --input-bg: rgba(0, 0, 0, 0.22);
  --input-border: rgba(255, 255, 255, 0.14);
  --button-bg: rgba(255, 255, 255, 0.06);
  --button-border: rgba(255, 255, 255, 0.12);
  --button-hover: rgba(255, 255, 255, 0.1);
  --surface-soft: rgba(255, 255, 255, 0.05);
  --footer-bg: #0a0e1a;
  --footer-border: rgba(255, 255, 255, 0.08);
  --section-gap: 32px;
  color-scheme: dark;
}

.tool-launcher {
  background: var(--nav-bg);
}

.tool-launcher-inner {
  width: min(1024px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
  justify-content: center;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: none;
  transition: transform 100ms ease, box-shadow 120ms ease;
}

.tool-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.tool-chip--purple,
.tool-chip--blue,
.tool-chip--green,
.tool-chip--teal,
.tool-chip--amber,
.tool-chip--pink,
.tool-chip--lime,
.tool-chip--indigo {
  background: rgba(15, 23, 42, 0.9);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  transition: background 0.35s ease, color 0.35s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

main {
  flex: 1 0 auto;
  padding-bottom: 32px;
}

.container {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 64px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-link {
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--border);
}

.nav-link.is-active {
  color: var(--text);
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.35);
}

.hero {
  padding: 34px 0 18px;
}

.hero-title {
  margin: 0;
  font-size: 36px;
  line-height: 1.1;
}

.hero-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 18px;
}

.card + .card {
  margin-top: var(--section-gap);
}

.converter-section {
  margin-top: 40px;
  margin-bottom: 16px;
}

.section-heading {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.section-title {
  margin: 0 0 12px;
  font-size: 18px;
}

.list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.about-text {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
}

.about-text:last-child {
  margin-bottom: 0;
}

/* Scientific Calculator */
.sci-calc {
  display: grid;
  gap: 14px;
}

.sci-calc-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.sci-calc-grid .btn {
  font-size: 14px;
  padding: 14px 8px;
}

.sci-calc-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
}

.sci-history-panel {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  height: 100%;
  max-height: 520px;
}

.sci-history-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sci-history-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.btn-clear-history {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-clear-history:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.sci-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sci-history-item {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-align: right;
}

.sci-history-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
}

.sci-history-expr {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  word-break: break-all;
}

.sci-history-res {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.sci-history-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
}

.sci-equals {
  grid-column: span 2;
}

@media (max-width: 768px) {
  .sci-calc-layout {
    grid-template-columns: 1fr;
  }
  
  .sci-history-panel {
    max-height: 350px;
  }
}

/* Graphing Calculator */
.graph-calc {
  display: grid;
  gap: 24px;
}

.graph-desc {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

.graph-controls {
  display: grid;
  gap: 18px;
}

.graph-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.graph-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  flex: 1;
}

.graph-label span {
  font-weight: 600;
}

.graph-function {
  font-family: monospace;
  font-size: 16px;
}

.graph-options {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.graph-option-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.graph-label-sm {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.input-sm {
  width: 70px;
  padding: 8px 10px;
  font-size: 13px;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 12px;
}

.graph-zoom-btns {
  display: flex;
  gap: 6px;
}

.graph-toggles {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.graph-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.graph-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
  cursor: pointer;
}

.graph-container {
  background: #0a0a14;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  display: flex;
  justify-content: center;
}

#graphCanvas {
  width: 100%;
  max-width: 600px;
  height: auto;
}

.graph-analysis {
  background: rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 14px;
}

.graph-analysis-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
}

.graph-analysis-content {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.graph-help {
  background: rgba(59, 130, 246, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  padding: 14px;
}

.graph-help-title {
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 14px;
  color: rgba(59, 130, 246, 0.9);
}

.graph-help-content {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.graph-tag {
  background: rgba(59, 130, 246, 0.15);
  color: rgba(147, 197, 253, 0.9);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 13px;
}

.benefit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.benefit-card {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 16px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: grid;
  gap: 10px;
}

.benefit-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.18);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.benefit-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.benefit-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.featured-cards {
  display: grid;
  gap: 18px;
}

.featured-headline {
  text-align: center;
  display: grid;
  gap: 6px;
}

.section-subhead {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.featured-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 18px;
  background: rgba(0, 0, 0, 0.25);
  display: grid;
  gap: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.featured-card-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.featured-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: rgba(124, 58, 237, 0.18);
  border: 1px solid rgba(124, 58, 237, 0.35);
}

.featured-card-top h3 {
  margin: 0;
  font-size: 17px;
}

.featured-card-top p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.featured-card-link {
  font-weight: 600;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.featured-card-link::after {
  content: '→';
  font-size: 12px;
}

/* Financial Calculator */
.financial-calc {
  display: grid;
  gap: 20px;
}

.fin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.fin-tab {
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.fin-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.fin-tab.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}

.fin-panel {
  display: none;
}

.fin-panel.active {
  display: grid;
  gap: 16px;
}

.fin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.fin-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.fin-label span {
  font-weight: 500;
}

.fin-calc-btn {
  justify-self: start;
}

.fin-result {
  padding: 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}

.fin-result strong {
  color: var(--text);
}

.percent-calc {
  display: grid;
  gap: 18px;
}

.percent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.percent-box {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.percent-box h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}

.percent-label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.percent-result {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  color: var(--muted);
  min-height: 46px;
}

.percent-result strong {
  color: var(--text);
}

.bmi-calc {
  display: grid;
  gap: 16px;
}

.bmi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.bmi-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.bmi-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.bmi-result {
  padding: 16px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}

.bmi-result strong {
  color: var(--text);
}

.bmi-scale {
  display: grid;
  gap: 10px;
}

.bmi-scale-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.bmi-scale-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.bmi-pill {
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  text-align: center;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.bmi-pill--low {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
}

.bmi-pill--normal {
  background: linear-gradient(135deg, #34d399, #10b981);
}

.bmi-pill--high {
  background: linear-gradient(135deg, #facc15, #f97316);
}

.bmi-pill--higher {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.quick-links {
  margin: 24px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.quick-link {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.quick-link:hover {
  color: var(--text);
  border-color: rgba(124, 58, 237, 0.5);
  background: rgba(124, 58, 237, 0.18);
}

.calc {
  display: grid;
  gap: 14px;
}

.calc-display {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  background: var(--display-bg);
  border: 1px solid var(--display-border);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.calc-expression {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.2px;
}

.calc-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 32px;
  font-weight: 700;
  text-align: right;
  padding: 0;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.btn {
  appearance: none;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 12px;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 80ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.btn:hover {
  background: var(--button-hover);
  border-color: var(--border);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  color: #ffffff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.3);
}

.btn-accent {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #065f46;
}

.btn-accent:hover {
  background: rgba(34, 197, 94, 0.22);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

kbd {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.25);
  font-size: 12px;
  margin: 0 3px;
}

.form {
  display: grid;
  gap: 12px;
}

.label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.input,
.textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 12px;
  outline: none;
}

.input:focus,
.textarea:focus {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form-note {
  color: var(--muted);
  font-size: 13px;
}

.footer {
  margin-top: auto;
  padding: 22px 0 28px;
  background: #0a0e1a;
  border-top: 1px solid var(--border);
}

.footer-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.2fr 1fr 1fr;
  padding-top: 18px;
}

.footer-brand {
  display: grid;
  gap: 6px;
}

.footer-title {
  font-weight: 800;
  letter-spacing: 0.3px;
}

.footer-meta {
  color: var(--muted);
  font-size: 13px;
}

.footer-col {
  display: grid;
  gap: 10px;
}

.footer-heading {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.72);
}

.footer-links {
  display: grid;
  gap: 8px;
}

.footer-link {
  color: var(--muted);
  padding: 6px 0;
}

.footer-link:hover {
  color: var(--text);
}

.footer-placeholder {
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
}

.converter {
  display: grid;
  gap: 16px;
}

.converter-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.converter-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.converter-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.converter-label select,
.fin-label select {
  cursor: pointer;
  appearance: none;
  background-color: rgba(0, 0, 0, 0.22);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.6)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.converter-label select:hover,
.fin-label select:hover {
  background-color: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.4);
}

.converter-label select:focus,
.fin-label select:focus {
  background-color: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.converter-label select option,
.fin-label select option {
  background: #1a1a2e;
  color: var(--text);
}

.converter-label select optgroup,
.fin-label select optgroup {
  background: #0d1225;
  color: #ffffff;
  font-weight: 700;
  font-style: normal;
}

.converter-result {
  padding: 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}

.converter-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 520px) {
  .hero-title {
    font-size: 30px;
  }

  .nav {
    flex-wrap: wrap;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .converter-row {
    grid-template-columns: 1fr;
  }
}
