:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #181a20;
  --panel-soft: #20232b;
  --line: #303542;
  --text: #f6f7fb;
  --muted: #9aa3b2;
  --primary: #39d98a;
  --primary-strong: #12b76a;
  --red: #ff6b6b;
  --blue: #5cc8ff;
  --gold: #f6c85f;
  --shadow: 0 22px 55px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(57, 217, 138, 0.12), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(100%, 980px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 16px 32px;
}

.summary-panel,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 26, 32, 0.92);
  box-shadow: var(--shadow);
}

.summary-panel {
  padding: 24px 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.3rem, 12vw, 4.4rem);
}

h2 {
  font-size: 1.45rem;
}

.subtitle {
  max-width: 30rem;
  margin: 12px 0 26px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.calculator label {
  display: block;
  margin-bottom: 10px;
  color: #d7dce6;
  font-weight: 700;
}

.money-input {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 74px;
  border: 1px solid #3a4150;
  border-radius: 8px;
  background: #0d0e11;
  padding: 0 18px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.money-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(57, 217, 138, 0.14);
}

.money-input span {
  color: var(--muted);
  font-size: 2rem;
  font-weight: 800;
}

.money-input input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: clamp(2rem, 11vw, 4rem);
  font-weight: 850;
  letter-spacing: 0;
  min-width: 0;
}

.money-input input::placeholder {
  color: #4c5360;
}

.mode-toggle {
  margin: 14px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #14161b;
  padding: 0;
}

.mode-toggle legend {
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.switch-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 74px;
  padding: 13px 14px;
  cursor: pointer;
}

.switch-row span:first-child {
  min-width: 0;
}

.switch-row strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 1rem;
}

.switch-row small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 132px;
  height: 42px;
  border: 1px solid #3a4150;
  border-radius: 8px;
  background: #0d0e11;
  padding: 4px;
  transition: border-color 160ms ease, background 160ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: 6px;
  background: var(--primary);
  transition: transform 160ms ease, background 160ms ease;
}

.switch-option {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: 100%;
  color: #7f8898;
  font-size: 0.86rem;
  font-weight: 900;
  transition: color 160ms ease;
}

.switch-option-split {
  color: #07120d;
}

.switch-row input:checked + .switch {
  border-color: var(--primary);
  background: rgba(57, 217, 138, 0.18);
}

.switch-row input:checked + .switch::after {
  transform: translateX(100%);
  background: var(--primary);
}

.switch-row input:checked + .switch .switch-option-split {
  color: #7f8898;
}

.switch-row input:checked + .switch .switch-option-full {
  color: #07120d;
}

.switch-row input:focus-visible + .switch {
  box-shadow: 0 0 0 4px rgba(57, 217, 138, 0.14);
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 850;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary-button {
  background: var(--primary);
  color: #07120d;
}

.primary-button:hover {
  background: #62e8a5;
}

.ghost-button,
.copy-button {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
}

.ghost-button:hover,
.copy-button:hover:not(:disabled) {
  background: #292e39;
}

.results-panel {
  margin-top: 16px;
  padding: 18px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.copy-button {
  width: 100%;
  min-height: 54px;
  margin-top: 14px;
  padding: 0 16px;
  line-height: 1.15;
}

.total-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15171c;
}

.total-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 16px;
}

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

.total-card strong {
  font-size: clamp(1.15rem, 5.8vw, 1.85rem);
  text-align: right;
  white-space: nowrap;
}

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

.result-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--primary);
}

.result-card strong {
  display: block;
  margin: 9px 0 4px;
  font-size: clamp(1.45rem, 8vw, 2.15rem);
  line-height: 1.05;
  word-break: break-word;
}

.result-card small {
  color: #7f8898;
  font-weight: 650;
}

.accent-red::before {
  background: var(--red);
}

.accent-green::before {
  background: var(--primary-strong);
}

.accent-blue::before {
  background: var(--blue);
}

.accent-gold::before {
  background: var(--gold);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  min-height: 46px;
  border: 1px solid rgba(57, 217, 138, 0.4);
  border-radius: 8px;
  background: #111f19;
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 10px 14px;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 700px) {
  .app-shell {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 18px;
    align-items: start;
    padding-top: 42px;
  }

  .results-panel {
    margin-top: 0;
  }

  .actions {
    grid-template-columns: 1fr auto;
  }

  .ghost-button {
    padding: 0 22px;
  }

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