:root {
  color-scheme: light;
  --bg: #eef8fa;
  --bg-2: #f4f2ff;
  --surface: rgba(255, 255, 255, 0.68);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --text: #243037;
  --muted: #6c7982;
  --line: rgba(54, 74, 84, 0.14);
  --accent: #19b9c8;
  --accent-2: #7668e8;
  --warn: #d88522;
  --shadow: 0 18px 45px rgba(44, 68, 88, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 8%, rgba(25, 185, 200, 0.18), transparent 34%),
    radial-gradient(circle at 86% 18%, rgba(118, 104, 232, 0.18), transparent 32%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  padding: 22px 16px;
  background: rgba(255, 255, 255, 0.48);
  border-inline-end: 1px solid var(--line);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--accent);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.18;
}

.nav-section {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: center;
  text-align: start;
  color: var(--text);
  background: transparent;
  border-radius: var(--radius);
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.54);
}

.nav-button.active {
  color: white;
  background: linear-gradient(135deg, #128fba, #3568df);
}

.nav-button svg {
  width: 22px;
  height: 22px;
}

.nav-title {
  display: block;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-button.active .nav-subtitle {
  color: rgba(255, 255, 255, 0.78);
}

.main {
  min-width: 0;
  padding: 24px 28px 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search,
.language {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
}

.search {
  width: min(360px, 42vw);
  padding: 0 14px;
}

.language {
  padding: 0 12px;
}

.hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
}

.hero h2 {
  margin: 0;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.03;
  letter-spacing: 0;
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.status-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  min-width: 112px;
  padding: 10px 12px;
  text-align: center;
  background: rgba(255, 255, 255, 0.56);
  border-radius: var(--radius);
}

.status-pill span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-pill strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(420px, 1.1fr);
  gap: 22px;
  align-items: start;
}

.panel {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 21px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.segment {
  padding: 8px 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.54);
  border-radius: var(--radius);
}

.segment.active {
  color: white;
  background: linear-gradient(135deg, #159fd0, #3569df);
}

.shape-preview {
  min-height: 320px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
}

.shape-preview svg {
  width: min(100%, 390px);
  height: 280px;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
}

.field-row label,
.unit-label {
  color: var(--muted);
}

.field-row input,
.field-row select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

.result-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 6px 0 14px;
}

.result-value strong {
  font-size: clamp(38px, 5vw, 56px);
  line-height: 1;
}

.muted {
  color: var(--muted);
}

.details {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.formula {
  margin-top: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.converter-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 22px;
}

.fluid-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 22px;
}

.side-actions {
  display: grid;
  gap: 10px;
}

.side-actions button {
  min-height: 48px;
  padding: 10px 12px;
  text-align: start;
  color: var(--text);
  background: rgba(255, 255, 255, 0.58);
  border-radius: var(--radius);
}

.side-actions button.active {
  color: white;
  background: linear-gradient(135deg, #159fd0, #3569df);
}

.angle-layout {
  display: grid;
  grid-template-columns: minmax(480px, 1fr) minmax(420px, 0.9fr);
  gap: 22px;
  align-items: start;
}

.angle-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  display: block;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
}

.instruction-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.big-chip {
  padding: 14px;
  background: rgba(255, 255, 255, 0.56);
  border-radius: var(--radius);
}

.big-chip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.big-chip strong {
  display: block;
  margin-top: 6px;
  font-size: 34px;
  line-height: 1;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.primary-action {
  min-height: 42px;
  padding: 0 14px;
  color: white;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #159fd0, #3569df);
}

.secondary-action {
  min-height: 42px;
  padding: 0 14px;
  color: var(--text);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.warning {
  padding: 14px;
  color: #8a540f;
  background: rgba(255, 185, 92, 0.18);
  border-radius: var(--radius);
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .hero,
  .content-grid,
  .converter-grid,
  .fluid-layout,
  .angle-layout {
    grid-template-columns: 1fr;
  }

  .search {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .toolbar,
  .status-pills {
    align-items: stretch;
    flex-direction: column;
  }

  .nav {
    grid-template-columns: 1fr;
  }

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

  .instruction-pair {
    grid-template-columns: 1fr;
  }
}
