:root {
  --bg: #e7e2d8;
  --panel: rgba(248, 245, 239, 0.88);
  --panel-strong: #fcfaf6;
  --line: rgba(44, 43, 40, 0.12);
  --text: #171614;
  --muted: #5c5852;
  --accent: #2b3137;
  --accent-dark: #111417;
  --accent-soft: rgba(43, 49, 55, 0.08);
  --ink-soft: #ece7de;
  --shadow: 0 22px 60px rgba(27, 28, 31, 0.08);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Times New Roman", Georgia, serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(98, 102, 107, 0.08), transparent 26%),
    linear-gradient(180deg, #f1eee8 0%, #e3ddd2 100%);
}

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.018) 1px, transparent 1px);
  background-size: 28px 28px;
}

.page-shell {
  position: relative;
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.hero {
  position: relative;
  margin-bottom: 24px;
  padding: 42px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.68), rgba(243, 239, 232, 0.92)),
    var(--panel);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: 34px;
  top: 34px;
  width: 180px;
  height: calc(100% - 68px);
  border-left: 1px solid rgba(44, 43, 40, 0.08);
  pointer-events: none;
}

.hero-layout {
  align-items: stretch;
}

.hero-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.hero-topline-actions {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-kicker {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.language-switcher {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.language-switcher select {
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.ad-banner,
.ad-inline,
.ad-panel {
  background: rgba(255, 255, 255, 0.72);
}

.ad-banner .card-body,
.ad-inline .card-body,
.ad-panel .card-body {
  padding: 1.15rem 1.25rem;
}

.adblock-notice {
  margin-bottom: 1rem;
  background: rgba(176, 125, 39, 0.12);
  color: #6a4d12;
}

.adblock-locked {
  overflow: hidden;
}

.adblock-locked .page-shell,
.adblock-locked .cookie-banner {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

.adblock-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(25, 28, 32, 0.68);
  backdrop-filter: blur(10px);
}

.adblock-gate-card {
  width: min(560px, 100%);
  background: rgba(252, 250, 246, 0.98);
}

.adblock-gate-label {
  display: inline-block;
  margin-bottom: 0.85rem;
  color: #8e6f2c;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.adblock-gate-title {
  margin-bottom: 0.9rem;
}

.adblock-gate-message {
  margin-bottom: 1.25rem;
  color: var(--muted);
  line-height: 1.7;
}

.ad-label {
  letter-spacing: 0.12em;
}

.ad-slot {
  position: relative;
  width: 100%;
  min-height: 120px;
  border: 1px dashed rgba(44, 43, 40, 0.18);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(243, 239, 232, 0.9));
  overflow: hidden;
}

.ad-slot-horizontal {
  min-height: 110px;
}

.ad-slot-rectangle {
  min-height: 260px;
}

.ad-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.adblock-bait {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
}

.cookie-banner {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1050;
  width: min(460px, calc(100vw - 24px));
  background: rgba(252, 250, 246, 0.98);
  border: 1px solid rgba(44, 43, 40, 0.12);
}

.cookie-banner .card-body {
  display: grid;
  gap: 1rem;
}

.cookie-banner-title {
  display: block;
  margin-bottom: 0.5rem;
}

.cookie-banner-copy p {
  color: var(--muted);
  line-height: 1.6;
}

.cookie-banner-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.print-summary {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(44, 43, 40, 0.12);
}

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

.print-summary-grid p {
  margin: 0;
  color: var(--muted);
}

.hero-badge {
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, #191c20 0%, #2d3339 100%);
  color: #f3efe8;
}

.hero-badge-label {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 244, 235, 0.68);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
}

.hero-badge p {
  margin: 12px 0 0;
  color: rgba(243, 239, 232, 0.72);
}

.hero-badge-line {
  width: 100%;
  height: 1px;
  margin: 18px 0 14px;
  background: rgba(255, 255, 255, 0.12);
}

.hero-badge-meta {
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(243, 239, 232, 0.52);
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.74rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 10ch;
  margin-bottom: 18px;
  font-size: clamp(3.1rem, 5vw, 6rem);
  line-height: 0.88;
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.intro,
.panel-header p,
.result-header p,
.note {
  color: var(--muted);
}

.intro {
  max-width: 56ch;
  font-size: 1.03rem;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.stat-chip {
  padding: 11px 15px;
  border-radius: 999px;
  border: 1px solid rgba(44, 43, 40, 0.1);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.88rem;
  color: var(--accent);
}

.panel {
  background: var(--panel);
  border-color: var(--line) !important;
  backdrop-filter: blur(8px);
}

.workspace-grid {
  align-items: start;
  margin-bottom: 20px;
}

.calculator-panel,
.result-panel,
.comparison-panel,
.notes-panel {
  margin-bottom: 1rem;
}

.panel-header,
.layer-card-header,
.result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #f5f2eb;
  border-color: rgba(17, 20, 23, 0.9);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.6);
  color: var(--accent-dark);
  border-color: rgba(44, 43, 40, 0.1);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.layers {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.layer-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 243, 236, 0.98));
}

.layer-grid {
  margin-top: 16px;
}

.comparison-controls {
  align-items: end;
}

.comparison-picker {
  padding: 1rem;
  border: 1px solid rgba(44, 43, 40, 0.08);
  background: rgba(255, 255, 255, 0.55);
}

.comparison-picker-header {
  margin-bottom: 0.85rem;
  color: var(--accent);
}

.comparison-material-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.comparison-choice {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(44, 43, 40, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.95rem;
  color: var(--text);
}

.comparison-choice input {
  width: auto;
  margin: 0;
}

.comparison-choice small {
  color: var(--muted);
}

.surface-settings {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

input,
select {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid rgba(72, 49, 28, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(43, 49, 55, 0.32);
  box-shadow: 0 0 0 4px rgba(43, 49, 55, 0.08);
}

input:disabled {
  background: #f1ede8;
  color: #887666;
}

.layer-meta {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pill {
  background: var(--ink-soft);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 400;
}

.sidebar-panel {
  background:
    linear-gradient(180deg, rgba(19, 22, 25, 0.98), rgba(38, 44, 49, 0.96));
  color: #f3efe8;
}

.ad-panel {
  border: 1px solid rgba(44, 43, 40, 0.08);
}

.sidebar-panel h2 {
  margin-bottom: 18px;
}

.sidebar-stack {
  display: grid;
  gap: 14px;
}

.sidebar-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.sidebar-step {
  color: #d5cbc0;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}

.sidebar-card p,
.sidebar-panel code {
  color: rgba(247, 239, 227, 0.82);
}

.result-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(245, 241, 234, 0.96));
}

.result-card.accent {
  background: linear-gradient(145deg, #1b2025 0%, #313840 100%);
  color: #fff;
}

.result-card.accent .result-label,
.result-card.accent .result-unit {
  color: rgba(255, 255, 255, 0.82);
}

.result-label,
.result-unit {
  display: block;
  color: var(--muted);
}

.result-value {
  display: block;
  margin: 10px 0 4px;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1;
}

.table-wrapper {
  margin-top: 26px;
  border: 1px solid rgba(44, 43, 40, 0.08);
  background: rgba(255, 255, 255, 0.7);
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table > :not(caption) > * > * {
  background: transparent;
  box-shadow: none;
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

tbody tr:hover {
  background: rgba(43, 49, 55, 0.04);
}

code {
  font-family: "Courier New", monospace;
  font-size: 0.96rem;
  color: inherit;
}

@media (max-width: 900px) {
  .hero::after {
    display: none;
  }
}

@media (max-width: 760px) {
  .hero {
    padding: 24px;
  }

  .hero-topline {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-topline-actions {
    width: 100%;
    justify-content: space-between;
  }

  .panel-header,
  .layer-card-header,
  .result-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .cookie-banner {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .adblock-gate {
    padding: 1rem;
  }
}

@media print {
  body {
    background: #fff;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }

  .panel {
    box-shadow: none;
    backdrop-filter: none;
    border: 1px solid #ccc;
  }

  .primary-button,
  .ghost-button,
  .ad-banner,
  .ad-panel,
  .ad-inline,
  .cookie-banner,
  .adblock-notice,
  .adblock-gate {
    display: none;
  }

  .page-noise,
  .hero::after {
    display: none;
  }

  .print-summary {
    display: block !important;
  }
}
