/* Sendira Web App v1 — Design Tokens & Layout sesuai sendira_app-spec_v1.md */
:root {
  color-scheme: light;
  --a-paper: #FBF6EC;
  --a-card: #FFFDF8;
  --a-ink: #1E2836;
  --a-mute: #5A6270;
  --a-line: #E8DDC9;
  --a-sage: #1D4A40;
  --a-sage2: #2F6B5E;
  --a-sagel: #E2EFE8;
  --a-gold: #E7B04A;
  --a-goldl: #FFF2D6;
  --a-goldd: #8A6413;
  --a-shu: #C44A33;
  --a-shul: #FBE6DF;
  --a-white: #FFFDF8;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #EFE8D8;
  color: var(--a-ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.45;
  overflow-x: clip;
}

body {
  margin: 0;
  padding: 0;
  background: #EFE8D8;
  color: var(--a-ink);
  font-family: var(--sans);
  min-height: 100dvh;
  overflow-x: clip;
}

.shell {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--a-paper);
  box-shadow: 0 16px 48px rgba(20, 25, 30, 0.12);
  display: flex;
  flex-direction: column;
}

.shell.wide {
  max-width: 960px;
}

@media (max-width: 480px) {
  html, body {
    background: var(--a-paper);
  }
  .shell {
    max-width: none;
    box-shadow: none;
  }
}

/* ---------- APP SCREEN ---------- */
.scr {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  background: var(--a-paper);
  color: var(--a-ink);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  font-size: 19px;
  line-height: 1.4;
}

.top {
  flex: none;
  min-height: 62px;
  padding: max(8px, env(safe-area-inset-top, 8px)) 16px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--a-paper);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top .t {
  font-weight: 800;
  font-size: 20px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ibtn {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 0;
  background: var(--a-card);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--a-line);
  color: var(--a-ink);
  cursor: pointer;
  padding: 0;
  transition: transform 120ms ease-out, background-color 120ms ease-out;
}

.ibtn:active {
  transform: scale(0.96);
}

.ibtn[aria-pressed="false"] {
  background: var(--a-shul);
  color: var(--a-shu);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 4px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  background: var(--a-sagel);
  color: var(--a-sage);
  border: 0;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.pill svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.main {
  flex: 1;
  min-height: 0;
  padding: 6px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.main.with-nav {
  padding-bottom: 108px;
}

.card {
  background: var(--a-card);
  border-radius: 22px;
  box-shadow: inset 0 0 0 1.5px var(--a-line);
  padding: 16px;
}

.lab {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--a-mute);
}

.h {
  font-size: 26px;
  line-height: 1.18;
  font-weight: 800;
  margin: 0;
  text-wrap: balance;
}

.serif {
  font-family: var(--serif);
  font-weight: 700;
}

.sub {
  color: var(--a-mute);
  font-size: 18px;
  margin: 0;
  line-height: 1.4;
}

/* ---------- TOMBOL BESAR (min 54–64px) ---------- */
.btn {
  min-height: 64px;
  padding: 12px 18px;
  border-radius: 18px;
  border: 0;
  font: 800 20px/1.2 var(--sans);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  width: 100%;
  text-decoration: none;
  text-align: center;
  transition: transform 120ms ease-out, background-color 120ms ease-out, opacity 120ms ease-out;
}

.btn:active:not([disabled]) {
  transform: scale(0.98);
}

.btn.pri {
  background: var(--a-sage);
  color: var(--a-white);
}

.btn.gold {
  background: var(--a-gold);
  color: #2A1F07;
}

.btn.ghost {
  background: var(--a-card);
  color: var(--a-ink);
  box-shadow: inset 0 0 0 2px var(--a-line);
}

.btn.shu {
  background: var(--a-shu);
  color: var(--a-white);
}

.btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn:focus-visible,
.ibtn:focus-visible,
.opt:focus-visible,
.chk:focus-visible,
.nv:focus-visible,
.seg button:focus-visible,
.pain button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--a-gold);
  outline-offset: 2px;
}

/* ---------- PROGRESS BAR BERSEGMEN ---------- */
.bar {
  display: flex;
  gap: 6px;
}

.bar i {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--a-line);
}

.bar i.on {
  background: var(--a-sage2);
}

.bar i.now {
  background: var(--a-gold);
}

/* ---------- BOTTOM NAV 4 ITEM ---------- */
.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  min-height: 84px;
  padding: 8px 8px max(16px, env(safe-area-inset-bottom, 16px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--a-card);
  box-shadow: 0 -1.5px 0 var(--a-line);
  z-index: 30;
}

@media (max-width: 480px) {
  .nav {
    max-width: none;
  }
}

.nv {
  border: 0;
  background: none;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  font: 700 15px/1.1 var(--sans);
  color: var(--a-mute);
  cursor: pointer;
  padding: 4px 2px;
  min-height: 54px;
}

.nv.on {
  color: var(--a-sage);
}

.nv svg {
  width: 56px;
  height: 32px;
  padding: 4px 16px;
  border-radius: 12px;
}

.nv.on svg {
  background: var(--a-sagel);
}

/* ---------- ILUSTRASI GERAKAN ---------- */
.illus {
  border-radius: 20px;
  background: #C9D3BA;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.illus img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tag {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 1;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  background: var(--a-card);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 12px;
  color: var(--a-sage);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tag svg {
  width: 18px;
  height: 18px;
}

/* ---------- LANGKAH BERNOMOR ---------- */
.steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 18px;
  line-height: 1.35;
}

.steps b {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--a-sage);
  color: var(--a-white);
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
}

/* ---------- OPSI RADIO & CHECKBOX ---------- */
.opt {
  width: 100%;
  min-height: 60px;
  border-radius: 16px;
  border: 0;
  background: var(--a-card);
  box-shadow: inset 0 0 0 2px var(--a-line);
  font: 700 19px/1.28 var(--sans);
  color: var(--a-ink);
  text-align: left;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background-color 120ms ease-out, box-shadow 120ms ease-out;
}

.opt .dot {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2.5px var(--a-line);
  display: grid;
  place-items: center;
}

.opt[aria-checked="true"] {
  box-shadow: inset 0 0 0 3px var(--a-sage);
  background: var(--a-sagel);
}

.opt[aria-checked="true"] .dot {
  background: var(--a-sage);
  box-shadow: none;
}

.opt[aria-checked="true"] .dot::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--a-white);
}

.chk {
  width: 100%;
  border: 0;
  text-align: left;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--a-card);
  box-shadow: inset 0 0 0 2px var(--a-line);
  font: 700 19px/1.3 var(--sans);
  color: var(--a-ink);
  cursor: pointer;
}

.chk .bx {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: inset 0 0 0 2.5px var(--a-line);
  display: grid;
  place-items: center;
}

.chk[aria-checked="true"] {
  box-shadow: inset 0 0 0 3px var(--a-sage2);
  background: var(--a-sagel);
}

.chk[aria-checked="true"] .bx {
  background: var(--a-sage2);
  box-shadow: none;
}

.chk .bx svg {
  opacity: 0;
}

.chk[aria-checked="true"] .bx svg {
  opacity: 1;
}

/* ---------- STRIP KEAMANAN (BERHENTI) ---------- */
.safe {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--a-shul);
  border-radius: 16px;
  padding: 10px 12px 10px 14px;
  color: #7E2A1C;
  font-weight: 800;
  font-size: 18px;
}

.safe button {
  margin-left: auto;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  border: 0;
  background: var(--a-shu);
  color: var(--a-white);
  font: 800 17px/1 var(--sans);
  cursor: pointer;
  flex: none;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* ---------- HERO CARD (SAGE) ---------- */
.hero {
  background: var(--a-sage);
  color: var(--a-white);
  border-radius: 24px;
  padding: 20px;
  display: grid;
  gap: 12px;
}

.hero .lab {
  color: #A9C9BC;
}

.scale {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.scale div {
  display: grid;
  gap: 6px;
  justify-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #A9C9BC;
}

.scale i {
  width: 100%;
  height: 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
}

.scale .on i {
  background: var(--a-gold);
  box-shadow: 0 0 0 3px rgba(231, 176, 74, 0.35);
}

.scale .on {
  color: var(--a-gold);
}

/* ---------- BARIS HASIL TES ---------- */
.res {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1.5px solid var(--a-line);
}

.res:first-of-type {
  border-top: 0;
}

.res .ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--a-sagel);
  display: grid;
  place-items: center;
  color: var(--a-sage);
}

.res .k {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.25;
}

.res .v {
  font-weight: 800;
  font-size: 16px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--a-goldl);
  color: var(--a-goldd);
  white-space: nowrap;
}

/* ---------- DAFTAR GERAKAN ---------- */
.mv {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 20px;
  background: var(--a-card);
  box-shadow: inset 0 0 0 1.5px var(--a-line);
  cursor: pointer;
  text-align: left;
  width: 100%;
  border: 0;
  color: var(--a-ink);
  font-family: var(--sans);
}

.mv .th {
  width: 76px;
  height: 70px;
  border-radius: 14px;
  background: #C9D3BA;
  overflow: hidden;
  flex: none;
}

.mv .th img,
.thb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  display: block;
}

.mv .k {
  font-weight: 800;
  font-size: 18px;
  line-height: 1.22;
}

.mv .d {
  font-size: 16px;
  color: var(--a-mute);
  margin-top: 2px;
}

.mv.done {
  opacity: 0.68;
}

.mv.next {
  box-shadow: inset 0 0 0 3px var(--a-gold);
  background: var(--a-goldl);
}

.ok {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--a-sage2);
  display: grid;
  place-items: center;
  flex: none;
}

.nexttag {
  font-size: 14px;
  font-weight: 800;
  color: var(--a-goldd);
}

/* ---------- TIMER & ULANGAN ---------- */
.timer {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex: none;
}

.ring svg {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.ring .tx {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
}

.ring .tx b {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
}

.ring .tx span {
  font-size: 14px;
  color: var(--a-mute);
  font-weight: 700;
  margin-top: 2px;
}

.reps {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.reps .big {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.reps .dots {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.reps .dots i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--a-line);
}

.reps .dots i.on {
  background: var(--a-sage2);
}

.reps .dots i.now {
  background: var(--a-gold);
}

/* ---------- SKALA NGILU 0–10 ---------- */
.pain {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.pain button {
  height: 56px;
  min-width: 0;
  padding: 0;
  border-radius: 14px;
  border: 0;
  font: 800 22px/1 var(--sans);
  cursor: pointer;
  color: var(--a-ink);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.pain button[aria-pressed="true"] {
  outline: 4px solid var(--a-sage);
  outline-offset: 2px;
}

/* ---------- MINGGU INI & TIMELINE ---------- */
.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.week div {
  display: grid;
  gap: 6px;
  justify-items: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--a-mute);
}

.week i {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 2px var(--a-line);
}

.week .d i {
  background: var(--a-sage2);
  box-shadow: none;
}

.week .t i {
  box-shadow: inset 0 0 0 3px var(--a-gold);
  background: var(--a-goldl);
}

.week .t {
  color: var(--a-goldd);
}

.mini {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.mini i {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--a-line);
}

.mini i.on {
  background: var(--a-gold);
}

.chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart text {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  fill: var(--a-mute);
}

.tl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  position: relative;
}

.tl div {
  display: grid;
  justify-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--a-mute);
  text-align: center;
  position: relative;
  z-index: 1;
}

.tl i {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 2px var(--a-line);
  background: var(--a-card);
}

.tl .d i {
  background: var(--a-sage2);
  box-shadow: none;
}

.tl .t i {
  background: var(--a-gold);
  box-shadow: none;
}

.tl .t {
  color: var(--a-goldd);
}

.tl::before {
  content: "";
  position: absolute;
  left: 12.5%;
  right: 12.5%;
  top: 19px;
  height: 3px;
  background: var(--a-line);
  z-index: 0;
}

/* ---------- INPUT ANGKA & FORM ---------- */
.fld {
  display: grid;
  gap: 6px;
}

.fld label {
  font-size: 16px;
  font-weight: 800;
  color: var(--a-ink);
}

.fld input,
.fld select {
  width: 100%;
  height: 58px;
  border-radius: 14px;
  border: 2px solid var(--a-line);
  background: var(--a-card);
  color: var(--a-ink);
  font: 800 22px/1 var(--sans);
  padding: 0 14px;
}

/* ---------- CHECKLIST 8 PERTANYAAN TES 3 ---------- */
.qitem {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-top: 1.5px solid var(--a-line);
}

.qitem:first-child {
  border-top: 0;
  padding-top: 0;
}

.qitem p {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.seg button {
  min-height: 48px;
  border-radius: 12px;
  border: 0;
  background: var(--a-paper);
  box-shadow: inset 0 0 0 2px var(--a-line);
  font: 700 17px/1 var(--sans);
  color: var(--a-ink);
  cursor: pointer;
  padding: 6px 4px;
}

.seg button[aria-pressed="true"] {
  background: var(--a-sage);
  color: var(--a-white);
  box-shadow: none;
}

/* ---------- RESPONSIVE 320px ---------- */
@media (max-width: 359px) {
  .main {
    padding-left: 14px;
    padding-right: 14px;
  }
  .h {
    font-size: 23px;
  }
  .btn {
    font-size: 18px;
    min-height: 58px;
  }
  .pain {
    gap: 5px;
  }
  .pain button {
    height: 50px;
    font-size: 19px;
  }
  .week i {
    width: 32px;
    height: 32px;
  }
  .timer {
    gap: 12px;
  }
  .ring, .ring svg {
    width: 104px;
    height: 104px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
