/* ═══════════════════════════════════════════════════════════
   ThermoCore — style.css
   Retro-futuristic spacecraft instrument panel aesthetic
   Palette: Deep Space Navy · Electric Amber · Ice Cyan
   Fonts: Orbitron (display) + DM Sans (body)
═══════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
  /* Colors — Dark Mode (default) */
  --bg-primary:    #080C14;
  --bg-secondary:  #0D1420;
  --bg-card:       rgba(13, 20, 32, 0.85);
  --bg-card-hover: rgba(18, 28, 46, 0.95);
  --bg-input:      rgba(255, 255, 255, 0.04);
  --bg-input-focus:rgba(255, 255, 255, 0.07);

  --text-primary:  #F0F4FF;
  --text-secondary:#8A9BB8;
  --text-muted:    #4A5A72;

  --accent-amber:  #FF9500;
  --accent-cyan:   #00D4FF;
  --accent-red:    #FF3B30;
  --accent-green:  #34C759;

  --border:        rgba(255, 255, 255, 0.07);
  --border-active: rgba(255, 149, 0, 0.4);

  --glow-amber:    0 0 20px rgba(255, 149, 0, 0.25);
  --glow-cyan:     0 0 20px rgba(0, 212, 255, 0.25);

  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --radius-xl:     28px;

  --transition:    0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.45s cubic-bezier(0.4, 0, 0.2, 1);

  --font-display:  'Orbitron', monospace;
  --font-body:     'DM Sans', sans-serif;

  --header-h:      68px;
}

/* Light mode overrides */
body.light-mode {
  --bg-primary:    #F0F4FF;
  --bg-secondary:  #E4EAF8;
  --bg-card:       rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-input:      rgba(0, 0, 0, 0.04);
  --bg-input-focus:rgba(0, 0, 0, 0.07);
  --text-primary:  #0A1020;
  --text-secondary:#3A4A62;
  --text-muted:    #8A9BB8;
  --border:        rgba(0, 0, 0, 0.08);
  --border-active: rgba(255, 149, 0, 0.5);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition-slow), color var(--transition-slow);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent-amber); border-radius: 3px; }

/* ── Scroll Progress Bar ── */
.scroll-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-amber), var(--accent-cyan));
  z-index: 9999;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px var(--accent-amber);
}

/* ── Background Layer ── */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

#gridCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.15;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  animation: orbFloat 12s ease-in-out infinite;
}
.bg-orb--1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #FF9500, transparent 70%);
  top: -200px; right: -100px;
  animation-delay: 0s;
}
.bg-orb--2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #00D4FF, transparent 70%);
  bottom: -150px; left: -100px;
  animation-delay: -4s;
}
.bg-orb--3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #FF3B30, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -8s;
  opacity: 0.06;
}

/* Temperature zone tinting */
body[data-temp-zone="cold"]   .bg-orb--2 { opacity: 0.22; }
body[data-temp-zone="hot"]    .bg-orb--1 { opacity: 0.22; }
body[data-temp-zone="extreme"].bg-orb--3 { opacity: 0.18; }

@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-30px) scale(1.05); }
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  max-width: 320px;
}
.toast.toast--success { border-color: rgba(52, 199, 89, 0.4); }
.toast.toast--error   { border-color: rgba(255, 59, 48, 0.4); }
.toast.toast--info    { border-color: rgba(0, 212, 255, 0.4); }
.toast.removing       { animation: toastOut 0.25s ease forwards; }

@keyframes toastIn  { from { opacity: 0; transform: translateX(20px) scale(0.95); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }

/* ── Header ── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 1000;
  background: rgba(8, 12, 20, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
body.light-mode .header {
  background: rgba(240, 244, 255, 0.85);
}
.header.scrolled {
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-icon { display: flex; align-items: center; }
.logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}
.logo-accent { color: var(--accent-amber); }

/* Nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-pill {
  padding: 6px 16px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.nav-pill:hover,
.nav-pill.active {
  color: var(--text-primary);
  background: rgba(255, 149, 0, 0.1);
  border-color: rgba(255, 149, 0, 0.25);
}

/* Header actions */
.header-actions { display: flex; align-items: center; gap: 8px; }

.theme-btn,
.sound-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
}
.theme-btn:hover,
.sound-btn:hover {
  border-color: var(--border-active);
  background: rgba(255, 149, 0, 0.1);
  color: var(--accent-amber);
  transform: scale(1.05);
}
.sound-btn.muted { opacity: 0.5; }

/* ── Hero ── */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: calc(var(--header-h) + 60px) 80px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-content { flex: 1; max-width: 560px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid rgba(255, 149, 0, 0.3);
  background: rgba(255, 149, 0, 0.08);
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent-amber);
  margin-bottom: 28px;
  animation: fadeUp 0.6s ease both;
}
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  animation: fadeUp 0.6s 0.1s ease both;
}
.title-line { display: block; }
.title-accent {
  background: linear-gradient(135deg, var(--accent-amber), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 440px;
  animation: fadeUp 0.6s 0.2s ease both;
}

/* Hero thermometer visual */
.hero-visual {
  flex-shrink: 0;
  animation: fadeUp 0.6s 0.3s ease both;
}
.thermo-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.thermo-svg {
  width: 100px;
  height: 250px;
  filter: drop-shadow(0 0 20px rgba(255, 149, 0, 0.3));
  animation: thermoFloat 4s ease-in-out infinite;
}
@keyframes thermoFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}
.thermo-label {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-amber);
  margin-top: 8px;
  text-shadow: 0 0 12px rgba(255, 149, 0, 0.5);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Sections ── */
.section {
  position: relative;
  z-index: 1;
  padding: 80px 24px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
  align-items: start;
}

.container-narrow {
  max-width: 860px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 48px;
}
.section-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid rgba(0, 212, 255, 0.3);
  background: rgba(0, 212, 255, 0.08);
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent-cyan);
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.section-sub {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Converter Card ── */
.converter-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  backdrop-filter: blur(24px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
  transition: border-color var(--transition);
}
.converter-card:focus-within {
  border-color: rgba(255, 149, 0, 0.2);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.card-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.reset-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.reset-btn:hover {
  border-color: rgba(255, 59, 48, 0.4);
  color: var(--accent-red);
  background: rgba(255, 59, 48, 0.08);
}

/* Input */
.input-row { margin-bottom: 24px; }
.input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.temp-input {
  width: 100%;
  padding: 14px 60px 14px 18px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  outline: none;
  transition: all var(--transition);
  -moz-appearance: textfield;
}
.temp-input::-webkit-outer-spin-button,
.temp-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.temp-input::placeholder { color: var(--text-muted); font-weight: 400; font-size: 1rem; }
.temp-input:focus {
  border-color: var(--accent-amber);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(255, 149, 0, 0.12), var(--glow-amber);
}
.temp-input.error {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

.input-unit-badge {
  position: absolute;
  right: 14px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-amber);
  pointer-events: none;
  transition: all var(--transition);
}

.input-error {
  font-size: 0.8rem;
  color: var(--accent-red);
  margin-top: 6px;
  min-height: 18px;
  transition: all var(--transition);
}

/* Unit selectors */
.unit-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.unit-group { flex: 1; }
.unit-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.unit-selector {
  display: flex;
  gap: 6px;
}
.unit-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.unit-btn:hover {
  border-color: rgba(255, 149, 0, 0.3);
  color: var(--text-primary);
  background: rgba(255, 149, 0, 0.06);
}
.unit-btn.active {
  border-color: var(--accent-amber);
  background: rgba(255, 149, 0, 0.12);
  color: var(--accent-amber);
  box-shadow: 0 0 12px rgba(255, 149, 0, 0.15);
}
.unit-symbol {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}
.unit-name {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  opacity: 0.8;
}

/* Swap button */
.swap-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  margin-top: 20px;
}
.swap-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.1);
  transform: rotate(180deg);
  box-shadow: var(--glow-cyan);
}

/* Convert button */
.convert-btn {
  position: relative;
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--accent-amber), #FF6B00);
  color: #000;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(255, 149, 0, 0.3);
  margin-bottom: 24px;
}
.convert-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255, 149, 0, 0.45);
}
.convert-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 12px rgba(255, 149, 0, 0.3);
}
.btn-icon {
  font-size: 1.1rem;
  transition: transform var(--transition);
}
.convert-btn:hover .btn-icon { transform: translateX(4px); }

.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0);
  animation: none;
  pointer-events: none;
}
.btn-ripple.animate {
  animation: ripple 0.5s ease-out forwards;
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

/* Result panel */
.result-panel {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  transition: all var(--transition);
}
.result-panel.has-result {
  border-color: rgba(255, 149, 0, 0.2);
  background: rgba(255, 149, 0, 0.04);
}

.result-idle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.result-idle-icon { font-size: 2rem; margin-bottom: 8px; }

.result-content {
  width: 100%;
}
.result-content.hidden { display: none; }

.result-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}
.result-value-from,
.result-value-to {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}
.result-value-from { color: var(--text-secondary); }
.result-value-to {
  color: var(--accent-amber);
  text-shadow: 0 0 16px rgba(255, 149, 0, 0.4);
  animation: resultPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes resultPop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.result-formula {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.result-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.copy-btn:hover {
  border-color: rgba(0, 212, 255, 0.4);
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.08);
}
.save-btn:hover {
  border-color: rgba(52, 199, 89, 0.4);
  color: var(--accent-green);
  background: rgba(52, 199, 89, 0.08);
}

/* All units panel */
.all-units-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--bg-input);
}
.all-units-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.all-units-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.unit-result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--transition);
}
.unit-result-card.active-unit {
  border-color: rgba(255, 149, 0, 0.35);
  background: rgba(255, 149, 0, 0.06);
}
.ur-symbol {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-amber);
}
.ur-name {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}
.ur-value {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 4px;
}

/* ── Gauge Panel ── */
.gauge-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  backdrop-filter: blur(24px);
  position: sticky;
  top: calc(var(--header-h) + 16px);
}
.gauge-title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-align: center;
}
.gauge-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}
.gauge-svg {
  width: 100%;
  max-width: 240px;
  filter: drop-shadow(0 0 12px rgba(255, 149, 0, 0.15));
}
.gauge-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-amber);
  text-shadow: 0 0 20px rgba(255, 149, 0, 0.4);
  margin-top: 8px;
  transition: all var(--transition);
}
.gauge-zone {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
  transition: color var(--transition);
}
.gauge-zone.cold   { color: var(--accent-cyan); }
.gauge-zone.warm   { color: var(--accent-amber); }
.gauge-zone.hot    { color: #FF6B00; }
.gauge-zone.extreme{ color: var(--accent-red); }

/* Scale reference */
.scale-reference {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.scale-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.scale-items { display: flex; flex-direction: column; gap: 6px; }
.scale-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 0.8rem;
}
.scale-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.scale-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.scale-label { flex: 1; color: var(--text-secondary); }
.scale-val {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── Formula Grid ── */
.formula-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.formula-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  backdrop-filter: blur(16px);
  transition: all var(--transition);
  cursor: default;
}
.formula-card:hover {
  border-color: rgba(0, 212, 255, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.2);
}
.formula-from {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  margin-bottom: 10px;
}
.formula-eq {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 10px;
}
.formula-example {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 4px 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  border: 1px solid var(--border);
  display: inline-block;
}

/* ── History ── */
.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.history-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  letter-spacing: 0.05em;
}
.clear-history-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
}
.clear-history-btn:hover {
  border-color: rgba(255, 59, 48, 0.4);
  color: var(--accent-red);
  background: rgba(255, 59, 48, 0.06);
}

.history-list { display: flex; flex-direction: column; gap: 8px; }

.history-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.history-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

.history-entry {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  animation: fadeUp 0.3s ease both;
}
.history-entry:hover {
  border-color: rgba(255, 149, 0, 0.3);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}
.history-num {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--text-muted);
  width: 20px;
  flex-shrink: 0;
}
.history-conversion {
  flex: 1;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.history-formula {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-display);
}
.history-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.history-delete {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  transition: all var(--transition);
  flex-shrink: 0;
}
.history-delete:hover {
  border-color: rgba(255, 59, 48, 0.4);
  color: var(--accent-red);
  background: rgba(255, 59, 48, 0.08);
}

/* ── Footer ── */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 32px 24px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-copy {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  gap: 20px;
}
.footer-links a {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--accent-amber); }

/* ── Scroll reveal ── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr;
  }
  .gauge-panel {
    position: static;
  }
  .hero {
    padding: calc(var(--header-h) + 40px) 40px 60px;
  }
}

@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    text-align: center;
    padding: calc(var(--header-h) + 32px) 24px 48px;
    gap: 32px;
  }
  .hero-sub { margin: 0 auto; }
  .hero-visual { order: -1; }
  .thermo-svg { width: 70px; height: 175px; }

  .header-nav { display: none; }

  .unit-row {
    flex-direction: column;
    gap: 12px;
  }
  .swap-btn { margin-top: 0; transform: rotate(90deg); }
  .swap-btn:hover { transform: rotate(270deg); }

  .formula-grid { grid-template-columns: repeat(2, 1fr); }

  .result-main { flex-direction: column; gap: 8px; }

  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .formula-grid { grid-template-columns: 1fr; }
  .all-units-grid { grid-template-columns: repeat(3, 1fr); }
  .converter-card { padding: 20px; }
  .hero-title { font-size: 2rem; }
  .unit-selector { gap: 4px; }
  .unit-btn { padding: 8px 4px; }
  .unit-name { display: none; }
}

/* ── Loading animation ── */
.convert-btn.loading .btn-text::after {
  content: '';
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Focus visible ── */
:focus-visible {
  outline: 2px solid var(--accent-amber);
  outline-offset: 3px;
  border-radius: 4px;
}