/* ── Recomp Engine · custom layer ─────────────────────────────
   Plain CSS only. The Tailwind Play CDN does not compile @apply
   from external stylesheets, so component styles live here in raw
   CSS and everything else uses utility classes in markup.
   Palette: slate #1F4E79 · teal #319595 · mist #F2F7F7
   ──────────────────────────────────────────────────────────── */

:root {
  --slate: #1f4e79;
  --slate-dark: #173a5a;
  --teal: #319595;
  --teal-dark: #257373;
  --mist: #f2f7f7;
  --input-bg: #eaf2f8;
  --output-bg: #eaf6ef;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

/* ── Utility ───────────────────────────────────────────────── */

.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ── Tab bar ───────────────────────────────────────────────── */

.tab-btn {
  flex: 1 0 auto;
  min-width: 72px;
  padding: 0.7rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  border-bottom: 3px solid transparent;
  background: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab-btn:active {
  background: rgba(255, 255, 255, 0.08);
}
.tab-btn[aria-selected='true'] {
  color: #fff;
  border-bottom-color: var(--teal);
}

/* ── Form controls ─────────────────────────────────────────── */

.field {
  width: 100%;
  border: 1px solid #cddce8;
  background: #fff;
  border-radius: 0.625rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--slate);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(49, 149, 149, 0.18);
}
.field::placeholder {
  color: #9db4c6;
  font-weight: 400;
}

/* Compact grid inputs (log tables) */
.cell {
  width: 100%;
  min-width: 0;
  border: 1px solid #dbe6ee;
  background: #fff;
  border-radius: 0.4rem;
  padding: 0.4rem 0.15rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  color: var(--slate);
  outline: none;
}
.cell:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(49, 149, 149, 0.18);
}
.cell::placeholder {
  color: #b9cbd8;
  font-weight: 400;
}

/* Kill number spinners — thumb-driven entry only */
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type='number'] {
  -moz-appearance: textfield;
}

select.field {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%231F4E79'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1.25rem;
  padding-right: 2rem;
}

/* ── Range slider ──────────────────────────────────────────── */

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
  outline: none;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: #d3e3ea;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--teal);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(31, 78, 121, 0.35);
  cursor: pointer;
}
input[type='range']::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #d3e3ea;
}
input[type='range']::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--teal);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(31, 78, 121, 0.35);
  cursor: pointer;
}

/* ── Checkboxes ────────────────────────────────────────────── */

input[type='checkbox'] {
  accent-color: var(--teal);
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Accordion ─────────────────────────────────────────────── */

.acc-body {
  display: none;
}
.acc[open] .acc-body {
  display: block;
}
.acc summary {
  list-style: none;
  cursor: pointer;
}
.acc summary::-webkit-details-marker {
  display: none;
}
.acc summary .chev {
  transition: transform 0.2s ease;
}
.acc[open] summary .chev {
  transform: rotate(90deg);
}

/* ── Super-set bounding box ────────────────────────────────── */

.ss-box {
  border: 2px dashed var(--teal);
  border-radius: 0.85rem;
  background: rgba(49, 149, 149, 0.045);
}

/* ── Segmented control ─────────────────────────────────────── */

.seg {
  display: flex;
  background: #e2ecf2;
  border-radius: 0.65rem;
  padding: 3px;
  gap: 3px;
}
.seg button {
  flex: 1;
  padding: 0.45rem 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #5b7c93;
  border-radius: 0.5rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg button[aria-pressed='true'] {
  background: #fff;
  color: var(--slate);
  box-shadow: 0 1px 3px rgba(31, 78, 121, 0.18);
}

/* ── Animation ─────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .page-enter {
    animation: fade-up 0.22s ease both;
  }
}
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Print — take the program to the gym on paper if the phone dies */
@media print {
  header,
  #toast {
    display: none !important;
  }
  .acc-body {
    display: block !important;
  }
}
