:root {
  color-scheme: dark;
  --bg: #111316;
  --panel: #1a1d21;
  --panel-strong: #22262b;
  --line: #343a42;
  --text: #f4f0e8;
  --muted: #b3ada2;
  --quiet: #7f8b93;
  --accent: #f4f0e8;
  --accent-strong: #f59e0b;
  --danger: #fb7185;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f5f5f5;
  --panel-strong: #eeeeee;
  --line: #cfcfcf;
  --text: #111111;
  --muted: #555555;
  --quiet: #6b6b6b;
  --accent: #111111;
  --accent-strong: #333333;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.site-header {
  margin-bottom: 14px;
}

.site-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}

.site-nav a {
  min-width: 0;
  border: 1px solid rgba(244, 240, 232, 0.12);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(26, 29, 33, 0.88);
  padding: 10px 6px;
  text-align: center;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
}

:root[data-theme="light"] .site-nav a,
:root[data-theme="light"] .result-panel,
:root[data-theme="light"] .form-section {
  border-color: var(--line);
  background: var(--panel);
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] {
  border-color: var(--accent);
  color: var(--text);
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  padding: 8px 0 20px;
}

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

h1 {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-bottom: 6px;
  font-size: clamp(1.15rem, 6vw, 2.4rem);
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
}

.intro {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.result-panel,
.form-section {
  border: 1px solid rgba(244, 240, 232, 0.12);
  border-radius: 8px;
  background: rgba(26, 29, 33, 0.88);
  box-shadow: var(--shadow);
}

.result-panel {
  padding: 18px;
  overflow: hidden;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.result-card {
  min-width: 0;
  border: 1px solid rgba(244, 240, 232, 0.1);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-strong);
}

.result-card span,
.result-card small {
  color: var(--quiet);
  font-weight: 700;
}

.result-value {
  display: flex;
  align-items: baseline;
  gap: 0;
  flex-wrap: wrap;
  min-width: 0;
}

.result-card strong {
  margin: 3px 0 0;
  color: var(--accent);
  font-size: clamp(2rem, 16vw, 4.4rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.result-value small {
  color: var(--accent);
  font-size: clamp(1.25rem, 6vw, 2.1rem);
  font-weight: 800;
  line-height: 1;
}

.result-value em {
  color: var(--muted);
  font-size: 0.92rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.3;
  margin-left: 6px;
}

.result-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.calculator {
  display: grid;
  gap: 14px;
}

.form-section {
  padding: 16px;
}

.form-section + .form-section {
  margin-top: 14px;
}

.form-section.compact {
  background: rgba(34, 38, 43, 0.72);
}

.form-section.compact p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.form-section.compact p + p {
  margin-top: 0;
}

.page-section p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.page-section a,
.form-section.compact a {
  color: var(--text);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-section p:last-child {
  margin-bottom: 0;
}

.help-image {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.site-footer {
  padding: 26px 4px 0;
  color: var(--muted);
  text-align: center;
}

.site-footer p {
  margin-bottom: 6px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.site-footer p:last-child {
  margin-bottom: 0;
}

.site-footer a {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.theme-toggle {
  border: 0;
  color: inherit;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  margin-bottom: 14px;
  font-size: 1rem;
  letter-spacing: 0;
}

.section-heading h2 {
  margin-bottom: 0;
}

label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #111316;
  padding: 0 12px;
  outline: none;
}

.unit-field {
  position: relative;
}

.unit-field input {
  padding-right: 12px;
}

:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea,
:root[data-theme="light"] .fixed-value {
  background: #ffffff;
}

textarea {
  min-height: 150px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 21px,
    calc(100% - 12px) 21px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14);
}

input[readonly] {
  color: var(--muted);
  background: #171a1e;
  cursor: default;
}

:root[data-theme="light"] input[readonly] {
  background: #eeeeee;
}

input::placeholder {
  color: #596169;
}

textarea::placeholder {
  color: #596169;
}

.contact-form button,
.submission-form button {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  background: #252a30;
  cursor: pointer;
  font-weight: 850;
}

:root[data-theme="light"] .contact-form button,
:root[data-theme="light"] .submission-form button {
  color: var(--text);
  background: #ffffff;
}

.contact-form button:hover,
.contact-form button:focus-visible,
.submission-form button:hover,
.submission-form button:focus-visible {
  filter: brightness(1.06);
}

.contact-form button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.contact-form label:first-child,
.submission-form label:first-child {
  margin-top: 0;
}

.form-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

@media (min-width: 520px) {
  .app-shell {
    padding-inline: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
