:root {
  color-scheme: light;
  --accent: #f57c00;
  --accent-dark: #e65100;
  --surface: #f5f5f5;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #616161;
  --border: #bdbdbd;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
}

.header {
  background: var(--accent);
  color: #fff;
  padding: 16px 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-switcher {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 6px 0 2px;
}

.calc-switcher__btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.calc-switcher__btn:hover,
.calc-switcher__btn:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.calc-switcher__btn--active {
  border-color: var(--accent);
  background: rgba(245, 124, 0, 0.12);
  color: var(--accent-dark);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.field__control {
  position: relative;
  display: block;
}

.field__unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9375rem;
  color: var(--text-muted);
  pointer-events: none;
  user-select: none;
}

.field__control--unit-sm input {
  padding-right: 2.75rem;
}

input[type='text'],
input[type='number'],
select {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
}

input[type='text']:focus,
input[type='number']:focus,
select:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

input[type='text']:disabled,
input[type='number']:disabled,
select:disabled {
  background: #eceff1;
  border-color: #cfd8dc;
  color: #8a8f94;
  cursor: not-allowed;
}

.calc-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calc-block__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  text-align: center;
}

.radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
}

.radio input {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}

.radio__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.radio__hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}

.hidden {
  display: none;
}

.steroid-calc {
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-mode h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 600;
}

.activity-mode .radio {
  padding: 8px 0;
}

.activity-mode__custom {
  margin-top: 4px;
}

.mix-card {
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff3e0, #fff8f1);
  border: 1px solid #ffcc80;
}

.mix-card--compact {
  padding: 10px 12px;
}

.mix-card--compact .mix-card__label {
  font-size: 0.68rem;
  margin-bottom: 4px;
}

.mix-card--compact .mix-card__value {
  font-size: 0.85rem;
}

.mix-card__label {
  margin: 0 0 4px;
  color: #e65100;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mix-card__value {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
}

.mix-card__dose {
  display: block;
}

.mix-card__meta {
  margin: 6px 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #e65100;
}

.mix-card__meta:empty {
  display: none;
}

.steroid-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.steroid-results--solo .steroid-results__panels {
  grid-template-columns: 1fr;
}

.steroid-results--solo .mix-card--compact {
  padding: 14px;
}

.steroid-results--solo .mix-card--compact .mix-card__label {
  font-size: 0.875rem;
}

.steroid-results--solo .mix-card--compact .mix-card__value {
  font-size: 1.25rem;
}

.steroid-results--solo .mix-card__meta {
  font-weight: 500;
  line-height: 1.45;
  color: #455a64;
}

.steroid-results--solo .steroid-results__slider-row {
  grid-template-columns: 1fr;
}

.steroid-results--solo .steroid-results__slider-row .slider-section {
  grid-column: 1;
}

.custom-target-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.custom-target-slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.custom-target-slider.hidden {
  display: none;
}

.custom-target-slider__text {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
  color: #455a64;
}

.steroid-results__panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.steroid-results__slider-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.steroid-results__slider-row .slider-section {
  grid-column: 2;
}

.steroid-results__slider-row[hidden],
.steroid-results__slider-row.hidden,
#dynamicMixCard[hidden],
#dynamicMixCard.hidden {
  display: none;
}

.slider-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 0;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .steroid-results__panels,
  .steroid-results__slider-row {
    grid-template-columns: 1fr;
  }

  .steroid-results__slider-row .slider-section {
    grid-column: 1;
  }
}

.stack-calc {
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack-list-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-list-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stack-list-section h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.stack-btn {
  border: 1px solid #ffcc80;
  border-radius: var(--radius);
  background: #fff3e0;
  color: #e65100;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
}

.stack-btn:hover,
.stack-btn:focus-visible {
  background: #ffe0b2;
  outline: none;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.8fr) auto;
  gap: 8px;
  align-items: center;
}

.stack-row .field {
  gap: 4px;
  min-width: 0;
}

.stack-row .field__label {
  font-size: 0.75rem;
}

.stack-btn--remove {
  width: 35px;
  height: 35px;
  padding: 0;
  border-color: #ef9a9a;
  background: #ffebee;
  color: #b71c1c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}

.stack-btn__icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: block;
}

.stack-btn--remove:hover,
.stack-btn--remove:focus-visible {
  background: #ffe0e3;
}

.stack-btn--remove:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stack-row--add {
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
}

.stack-btn--add-row {
  width: 40px;
  height: 40px;
  padding: 0;
  line-height: 1;
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stack-btn--pin {
  width: 35px;
  height: 35px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
}

.stack-pinned-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-pinned-list:empty {
  display: none;
}

.stack-calc--pinned {
  border: 1px solid #ffcc80;
  background: #fffaf5;
}

.stack-pinned__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: -4px;
}

.stack-pinned__mark {
  display: inline-flex;
  color: #e65100;
}

.stack-pinned__mark .stack-btn__icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.stack-row--pinned {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.8fr);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: 320px;
  padding: 20px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.modal__panel .row {
  margin-bottom: 0;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal__actions .stack-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.modal__actions .stack-btn--primary:hover,
.modal__actions .stack-btn--primary:focus-visible {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.stack-result {
  padding-top: 8px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stack-result__line {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.95rem;
}

.stack-result__label {
  color: var(--text-muted);
}

.stack-result__value {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.stack-result__meta {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}
