:root {
  color-scheme: light;
  --ink: #1a1a1a;
  --muted: #4f4f4f;
  --accent: #2c6e49;
  --accent-soft: #e3f0e9;
  --card: #ffffff;
  --shadow: rgba(10, 10, 10, 0.1);
  --warm: #f8f1e5;
  --edge: rgba(26, 26, 26, 0.1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f5f5f5;
  --muted: #c7c7c7;
  --accent: #63c29b;
  --accent-soft: rgba(99, 194, 155, 0.12);
  --card: #141414;
  --shadow: rgba(0, 0, 0, 0.6);
  --warm: #1c1c1c;
  --edge: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.6), transparent 55%),
    radial-gradient(circle at 70% 20%, rgba(44, 110, 73, 0.15), transparent 50%),
    linear-gradient(135deg, #f6efe3, #f5f8f3 40%, #e8f2ec 100%);
  color: var(--ink);
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(80, 80, 80, 0.2), transparent 55%),
    radial-gradient(circle at 70% 20%, rgba(99, 194, 155, 0.12), transparent 50%),
    linear-gradient(135deg, #0b0b0b, #121212 40%, #171717 100%);
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  animation: float-in 700ms ease-out both;
}

.top-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.hero__content {
  flex: 1 1 0;
}

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

.hero-main {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.title-block {
  flex: 1 1 320px;
}

.eyebrow {
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 8px;
  margin-top: auto;
}

h1 {
  font-family: "Fraunces", "Georgia", serif;
  font-size: clamp(2.3rem, 3vw, 2.8rem);
  margin: 0 0 12px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.features {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.lang-switch {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 12px 30px var(--shadow);
  min-width: 120px;
}

.lang-switch label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

select,
input {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}

:root[data-theme="dark"] select,
:root[data-theme="dark"] input {
  background: #0f0f0f;
}

.ghost-btn {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: none;
  box-shadow: none;
  width: auto;
}

.theme-icon {
  width: 32px;
  height: 32px;
  color: var(--ink);
}

.icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: inline-flex;
}

.ghost-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

input::placeholder {
  color: #9b9b9b;
}

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 20px 50px var(--shadow);
  border: 1px solid var(--edge);
  animation: rise-in 700ms ease-out 120ms both;
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(280px, 1fr);
  gap: 24px;
}

.inputs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
}

.field.checkbox label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}

.field.checkbox input {
  appearance: none;
  width: 1px;
  height: 1px;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-box {
  width: 20px;
  height: 20px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.checkbox-box svg {
  width: 100%;
  height: 100%;
}

.checkbox-box .check {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.12s ease-in-out, transform 0.12s ease-in-out;
}

.field.checkbox input:checked + .checkbox-box .check {
  opacity: 1;
  transform: scale(1);
}

select:focus-visible,
input:focus-visible,
.ghost-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  align-items: start;
}

.rate {
  background: var(--accent-soft);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(44, 110, 73, 0.2);
}

.rate .label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.rate-header .ghost-btn {
  width: auto;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.rate .value {
  font-size: 2rem;
  margin: 6px 0 16px;
  font-weight: 700;
  color: var(--accent);
}

.value.editable {
  cursor: text;
  border-bottom: 1px dashed rgba(44, 110, 73, 0.3);
  padding-bottom: 4px;
}

:root[data-theme="dark"] .value.editable {
  border-bottom-color: rgba(99, 194, 155, 0.4);
}

.value.editable[contenteditable="true"] {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-bottom-color: transparent;
}

.additions {
  display: grid;
  gap: 10px;
}

.addition-note {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: right;
}

.additions div {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--muted);
}

.totals {
  background: var(--warm);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(248, 241, 229, 0.9);
}

.total-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(26, 26, 26, 0.15);
  font-size: 1rem;
}

.total-row:last-of-type {
  border-bottom: none;
}

.total-row.grand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

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

.note a {
  color: var(--accent);
  font-weight: 600;
}

.footer {
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  animation: float-in 700ms ease-out 220ms both;
  line-height: 1.6;
}

.easter-egg {
  margin-top: 12px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.6;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .card {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .inputs {
    margin-bottom: 24px;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 28px 16px 40px;
  }

  .hero {
    align-items: flex-start;
  }

  .top-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .lang-switch label,
  .theme-switch label {
    display: none;
  }

  .lang-switch,
  .theme-switch {
    min-width: 0;
    flex: 1 1 120px;
  }

  .lang-switch select,
  .theme-switch .ghost-btn {
    padding: 8px 10px;
    font-size: 0.9rem;
  }
}
