:root {
  --bg-1: #f2f6fb;
  --bg-2: #e7eef8;
  --bg-3: #dbe6f5;
  --ink: #142033;
  --ink-soft: #5f6f84;
  --accent: #2f6cf7;
  --accent-soft: #7ca9ff;
  --accent-deep: #224fb4;
  --ok: #1a7f4f;
  --warn: #b03030;
  --ring: #2f6cf7;
  --glass: rgba(255, 255, 255, 0.44);
  --glass-strong: rgba(255, 255, 255, 0.6);
  --line: rgba(255, 255, 255, 0.78);
  --shadow-soft: 0 14px 32px rgba(24, 48, 90, 0.14);
  --shadow-strong: 0 24px 68px rgba(24, 48, 90, 0.2);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(160, 198, 255, 0.55) 0%, rgba(160, 198, 255, 0) 35%),
    radial-gradient(circle at 82% 0%, rgba(230, 170, 190, 0.3) 0%, rgba(230, 170, 190, 0) 32%),
    linear-gradient(140deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
  min-height: 100vh;
  position: relative;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 72;
  padding: 0.6rem 1rem 0.2rem;
}

.site-nav__inner {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 0.36rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.46), rgba(235, 244, 255, 0.35));
  box-shadow: 0 10px 20px rgba(36, 61, 102, 0.11);
  backdrop-filter: blur(11px) saturate(1.16);
  -webkit-backdrop-filter: blur(11px) saturate(1.16);
}

.site-link {
  padding: 0.45rem 0.92rem;
  border-radius: 999px;
  border: 1px solid transparent;
  color: #304564;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.site-link:hover {
  transform: translateY(-1px);
  background: rgba(195, 217, 252, 0.4);
}

.site-link.is-active {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(140deg, rgba(53, 113, 255, 0.95), rgba(125, 174, 255, 0.95));
  box-shadow: 0 8px 14px rgba(47, 107, 247, 0.28);
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(56px);
  z-index: 0;
}

body::before {
  width: 320px;
  height: 320px;
  top: -80px;
  right: -80px;
  background: rgba(104, 159, 255, 0.34);
}

body::after {
  width: 300px;
  height: 300px;
  bottom: -120px;
  left: -90px;
  background: rgba(117, 204, 210, 0.34);
}

.hero,
.site-nav,
.app-tabs,
.panel,
.footer {
  position: relative;
  z-index: 1;
}

.hero {
  padding: 4.4rem 1.25rem 2rem;
}

.hero__inner {
  margin: 0 auto;
  max-width: 1080px;
  padding: 1.25rem 1.35rem;
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(227, 239, 255, 0.4));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px) saturate(1.24);
  -webkit-backdrop-filter: blur(16px) saturate(1.24);
}

.creator-logo {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  min-height: 2.3rem;
  padding: 0.32rem 0.8rem 0.32rem 0.34rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(229, 240, 255, 0.73));
  color: #12284b;
  text-decoration: none;
  letter-spacing: 0.03em;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  box-shadow: 0 12px 28px rgba(35, 65, 120, 0.24);
  backdrop-filter: blur(14px) saturate(1.22);
  -webkit-backdrop-filter: blur(14px) saturate(1.22);
  overflow: hidden;
  transition: transform 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease;
}

.logo-badge {
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 1.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(145deg, #255fd5, #6ba1ff);
  color: #f8fbff;
  font-size: 0.64rem;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 6px 13px rgba(37, 95, 213, 0.34);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.logo-text {
  display: inline-flex;
  align-items: baseline;
  gap: 0.02rem;
  line-height: 1;
}

.logo-tms {
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #163a78;
}

.logo-ent {
  color: #284f90;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: letter-spacing 0.22s ease, color 0.22s ease;
}

.creator-logo:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 16px 34px rgba(35, 65, 120, 0.32);
}

.creator-logo:hover .logo-badge {
  transform: rotate(-6deg) scale(1.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 8px 15px rgba(37, 95, 213, 0.44);
}

.creator-logo:hover .logo-ent {
  letter-spacing: 0.045em;
  color: #1f4485;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12rem;
  font-size: 0.74rem;
  color: #577199;
}

h1 {
  margin: 0.35rem 0 0.65rem;
  font-size: clamp(2rem, 5vw, 3.35rem);
  line-height: 1.07;
  letter-spacing: -0.02em;
  color: #10203f;
}

.hero__text {
  margin: 0;
  max-width: 58ch;
  color: var(--ink-soft);
}

.app-tabs {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto 1rem;
  padding: 0.42rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.42), rgba(231, 241, 255, 0.34));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}

.tab-btn {
  width: auto;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: #304564;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  padding: 0.58rem 1.05rem;
  transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.tab-btn.is-active {
  border-color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(140deg, rgba(53, 113, 255, 0.95), rgba(125, 174, 255, 0.95));
  color: #fff;
  box-shadow: 0 10px 18px rgba(47, 107, 247, 0.32);
}

.tab-btn:hover {
  transform: translateY(-1px);
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.grid {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto 2.2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.study-shell {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto 2.2rem;
  display: grid;
  gap: 1rem;
}

.study-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.study-intro p {
  max-width: 72ch;
}

.study-card h3 {
  margin: 0;
  font-size: 1rem;
  color: #16305d;
}

.study-card ul {
  margin: 0.5rem 0 0;
  padding-left: 1.05rem;
  color: #496080;
}

.study-card li + li {
  margin-top: 0.25rem;
}

.study-card--wide {
  grid-column: 1 / -1;
}

.study-links {
  list-style: none;
  padding-left: 0;
}

.study-links li + li {
  margin-top: 0.38rem;
}

.study-links a {
  color: #1f4fa5;
  text-decoration: none;
  border-bottom: 1px solid rgba(31, 79, 165, 0.28);
  transition: color 0.16s ease, border-color 0.16s ease;
}

.study-links a:hover {
  color: #0f377c;
  border-color: rgba(15, 55, 124, 0.45);
}

.card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.46), rgba(230, 241, 255, 0.32));
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 1rem;
  border: 1px solid var(--line);
  animation: reveal 420ms ease both;
  backdrop-filter: blur(16px) saturate(1.22);
  -webkit-backdrop-filter: blur(16px) saturate(1.22);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.04) 40%);
  opacity: 0.8;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-strong);
  border-color: rgba(176, 206, 252, 0.9);
}

.card:nth-child(2) {
  animation-delay: 70ms;
}

.card:nth-child(3) {
  animation-delay: 140ms;
}

.card:nth-child(4) {
  animation-delay: 210ms;
}

.card:nth-child(5) {
  animation-delay: 280ms;
}

.card:nth-child(6) {
  animation-delay: 350ms;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

h2 {
  margin: 0;
  font-size: 1.16rem;
}

.calc-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: #10203f;
}

.calc-icon {
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1f56cc;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(222, 236, 255, 0.76));
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(53, 89, 158, 0.18);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.calc-icon svg {
  width: 1rem;
  height: 1rem;
}

.card:hover .calc-icon {
  transform: translateY(-1px) rotate(-4deg);
  box-shadow: 0 10px 20px rgba(53, 89, 158, 0.26);
}

.card > p {
  margin: 0.45rem 0 0.9rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.form-row {
  margin-bottom: 0.7rem;
}

label {
  display: block;
  margin-bottom: 0.32rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: #233c63;
  letter-spacing: 0.01em;
}

input,
select,
textarea,
button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(203, 218, 243, 0.95);
  font-size: 0.95rem;
  font-family: "JetBrains Mono", monospace;
}

input,
select,
textarea {
  padding: 0.56rem 0.58rem;
  color: #10223e;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(236, 244, 255, 0.82));
  border-color: rgba(176, 198, 233, 0.95);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-weight: 600;
  line-height: 1.25;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 2px solid rgba(47, 108, 247, 0.58);
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(124, 169, 255, 0.26);
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(113, 151, 216, 0.95);
}

input::placeholder,
textarea::placeholder {
  color: #6a7e9e;
  opacity: 1;
}

input[type="number"] {
  font-variant-numeric: tabular-nums;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

button {
  margin-top: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(140deg, rgba(47, 108, 247, 0.98), rgba(124, 169, 255, 0.98));
  color: #fff;
  padding: 0.65rem 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  box-shadow: 0 12px 22px rgba(42, 97, 219, 0.28);
}

button:hover {
  transform: translateY(-1px);
  filter: saturate(1.07);
}

.result {
  margin: 0.8rem 0 0;
  min-height: 1.4rem;
  font-family: "JetBrains Mono", monospace;
  color: var(--ok);
  line-height: 1.45;
  white-space: pre-line;
}

.result.error {
  color: var(--warn);
}

.dcdc-shell {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto 2.2rem;
  display: grid;
  gap: 1rem;
}

.dcdc-intro p {
  max-width: 74ch;
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.4rem;
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.42), rgba(233, 243, 255, 0.34));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.subtab-btn {
  width: auto;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: #304564;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  padding: 0.48rem 0.95rem;
  box-shadow: none;
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.subtab-btn.is-active {
  border-color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(140deg, rgba(47, 108, 247, 0.98), rgba(124, 169, 255, 0.98));
  color: #fff;
  box-shadow: 0 10px 18px rgba(47, 107, 247, 0.26);
}

.subtab-btn:hover {
  transform: translateY(-1px);
}

.dcdc-topology {
  display: none;
}

.dcdc-topology.is-active {
  display: block;
}

.dcdc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.3rem 0.9rem;
}

.dcdc-span-all {
  grid-column: 1 / -1;
}

.dcdc-grid--nested {
  gap: 0.26rem 0.7rem;
}

.mosfet-group {
  margin-top: 0.18rem;
  padding: 0.68rem 0.72rem 0.5rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.46), rgba(229, 240, 255, 0.34));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64), 0 10px 18px rgba(52, 78, 125, 0.12);
}

.mosfet-group h3 {
  margin: 0 0 0.5rem;
  font-size: 0.83rem;
  color: #1f457f;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.action-row {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.65rem;
}

.secondary-btn {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.85), rgba(236, 243, 255, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.95);
  color: #1f3d72;
  box-shadow: 0 10px 18px rgba(54, 78, 121, 0.14);
}

.secondary-btn:hover {
  filter: brightness(1.02);
}

.result-panel {
  margin-top: 0.85rem;
  padding: 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.46), rgba(231, 242, 255, 0.34));
}

.result-panel h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #304564;
}

.loss-chart {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.5rem;
}

.loss-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 2.6fr auto;
  align-items: center;
  gap: 0.55rem;
  border-radius: 10px;
  padding: 0.08rem 0.25rem;
  transition: background-color 0.18s ease;
}

.loss-row:hover {
  background: rgba(199, 217, 245, 0.26);
}

.loss-label {
  font-size: 0.77rem;
  color: #35537f;
}

.loss-track {
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(214, 226, 245, 0.55);
  overflow: hidden;
}

.loss-fill {
  height: 100%;
  width: 0;
  min-width: 2px;
  border-radius: inherit;
  transition: width 0.35s ease, background 0.3s ease;
}

.loss-fill.state-normal {
  background: linear-gradient(135deg, #2fa562, #7bd89e);
}

.loss-fill.state-medium {
  background: linear-gradient(135deg, #d39a2f, #f3cf6f);
}

.loss-fill.state-abnormal {
  background: linear-gradient(135deg, #d53b3b, #f17b7b);
}

.loss-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: #1e3558;
  white-space: nowrap;
}

.loss-value.state-normal {
  color: #1d7a46;
}

.loss-value.state-medium {
  color: #946108;
}

.loss-value.state-abnormal {
  color: #a32d2d;
}

.loss-state {
  margin-top: 0.25rem;
  margin-bottom: 0.2rem;
  width: fit-content;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.loss-state.is-normal {
  background: rgba(78, 196, 126, 0.22);
  color: #176e3e;
}

.loss-state.is-medium {
  background: rgba(238, 186, 68, 0.24);
  color: #8f5f0a;
}

.loss-state.is-abnormal {
  background: rgba(230, 101, 101, 0.22);
  color: #8e2525;
}

.loss-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
  margin-bottom: 0.2rem;
}

.loss-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: #35537f;
}

.loss-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.86);
}

.loss-dot.normal {
  background: linear-gradient(135deg, #2fa562, #7bd89e);
}

.loss-dot.medium {
  background: linear-gradient(135deg, #d39a2f, #f3cf6f);
}

.loss-dot.abnormal {
  background: linear-gradient(135deg, #d53b3b, #f17b7b);
}

.resistor-extra.is-hidden {
  display: none;
}

.resistor-select {
  font-weight: 600;
  transition: filter 0.16s ease;
}

.resistor-select:hover {
  filter: brightness(1.03);
}

.resistor-preview {
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.resistor-lead {
  height: 2px;
  flex: 1;
  background: linear-gradient(90deg, rgba(140, 158, 182, 0.95), rgba(188, 200, 216, 0.95));
}

.resistor-body {
  min-height: 40px;
  min-width: 170px;
  padding: 0.42rem 0.68rem;
  border-radius: 999px;
  display: flex;
  align-items: stretch;
  gap: 0.22rem;
  background: linear-gradient(135deg, #f5e0bf, #e3c9a1);
  border: 1px solid rgba(168, 140, 101, 0.42);
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.38), 0 8px 14px rgba(72, 66, 48, 0.14);
}

.resistor-band {
  width: 12px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.23);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.resistor-band.is-tolerance {
  margin-left: 0.36rem;
}

.resistor-band.is-tempco {
  margin-left: 0.22rem;
}

.resistor-band.is-none {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(247, 230, 196, 1) 0 3px,
      rgba(206, 183, 142, 1) 3px 6px
    ) !important;
  border-style: dashed;
}

.footer {
  text-align: center;
  color: #5a6c84;
  font-size: 0.88rem;
  padding: 0.5rem 1rem 2rem;
  position: relative;
  z-index: 1;
}

@media (max-width: 640px) {
  .site-nav {
    padding: 0.45rem 0.7rem 0.1rem;
  }

  .site-nav__inner {
    justify-content: stretch;
  }

  .site-link {
    flex: 1 1 0;
    text-align: center;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }

  .hero {
    padding: 4.9rem 1rem 1.8rem;
  }

  .hero__inner {
    padding: 1rem;
  }

  .creator-logo {
    top: 0.7rem;
    right: 0.7rem;
    font-size: 0.7rem;
    padding: 0.28rem 0.62rem 0.28rem 0.28rem;
    min-height: 2rem;
    gap: 0.38rem;
  }

  .logo-badge {
    width: 1.38rem;
    height: 1.38rem;
    flex-basis: 1.38rem;
    font-size: 0.56rem;
  }

  .logo-ent {
    letter-spacing: 0;
  }

  .tab-btn,
  .subtab-btn {
    flex: 1 1 100%;
    text-align: center;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  .loss-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .loss-value {
    justify-self: end;
  }

  .resistor-body {
    min-width: 146px;
  }
}
