:root {
  --paper: #FAFBF8;
  --surface: #FFFFFF;
  --ink: #13201A;
  --ink-muted: #5B6960;
  --ink-faint: #8C978F;
  --line: #E4E8E1;
  --green: #0E5C43;
  --green-deep: #0A4433;
  --green-soft: #E3EFE9;
  --green-line: #BFDBCE;
  --gold: #C79A46;
  --gold-light: #E7C77E;
  --gold-soft: #F4E9D3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Outfit", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 76px; } /* clears the fixed footer tab bar */

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, p { margin: 0; }

/* Malayalam text uses this font throughout body copy */
body, .am-header__back span, .am-list__row, .am-pagetitle, .am-description,
.am-markbtn, .am-note, .am-field__label, .am-field__desc, .am-toggle,
.am-savebtn, .am-seclabel, .am-tile__label, .am-streakline__lbl,
.am-datepill__label, .am-datepill__value, .am-hero__title, .am-navitem span,
.am-listenbtn__label, .am-statcard__k, .am-subheading, .am-dayrow *, .am-dot * {
  font-family: "Noto Sans Malayalam", "Outfit", sans-serif;
}

.am-container { max-width: 640px; margin: 0 auto; padding: 0 24px; }
.am-section { padding-top: 24px; padding-bottom: 32px; }

/* ---------- header ---------- */

.am-header {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--green-deep);
  background: var(--green);
  padding: 12px 20px;
}
.am-header__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
}
.am-header__back:hover { opacity: .8; }
.am-header__arrow { color: #FFFFFF; }
.am-header__brand { color: var(--gold-light); display: flex; }
.am-header__brand:hover { opacity: .8; }
.am-crest { width: 20px; height: 20px; }

/* ---------- footer tab bar ---------- */

.am-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  border-top: 1px solid #E0CFA8;
  background: var(--gold-soft);
  padding: 8px 8px calc(env(safe-area-inset-bottom, 0) + 8px);
}
.am-navitem {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 700;
  color: rgba(14, 92, 67, 0.55);
}
.am-navitem.is-active { color: var(--green); }
.am-navitem__dot { width: 3px; height: 3px; border-radius: 50%; background: transparent; }
.am-navitem.is-active .am-navitem__dot { background: var(--green); }

/* ---------- home hero ---------- */

.am-hero {
  position: relative;
  overflow: hidden;
  padding: 44px 24px 32px;
  background: linear-gradient(165deg, var(--green-deep) 0%, var(--green) 62%, #135C43 100%);
}
.am-hero__lattice { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .14; }
.am-hero__inner { position: relative; z-index: 2; max-width: 640px; margin: 0 auto; }
.am-hero__inner .am-crest { display: block; margin: 0 auto; width: 40px; height: 40px; color: var(--gold-light); }
.am-hero__title {
  margin-top: 12px;
  text-align: center;
  font-size: 21px;
  font-weight: 800;
  color: #fff;
}
.am-hero__flourish {
  width: 36px; height: 1px;
  margin: 12px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
}

.am-datesrow { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }
.am-datepill {
  flex: 1; max-width: 150px;
  text-align: center;
  border-radius: 9px;
  padding: 7px 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(231,199,126,.25);
}
.am-datepill__label {
  font-size: 8.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold-light);
}
.am-datepill__value { margin-top: 2px; font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap; }

.am-glasscard {
  margin-top: 20px;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 18px 30px -14px rgba(0,0,0,.4);
}
.am-streakline { display: flex; align-items: baseline; gap: 7px; margin-bottom: 12px; }
.am-streakline__num { font-size: 27px; font-weight: 800; color: var(--green-deep); }
.am-streakline__lbl { font-size: 11.5px; color: var(--ink-muted); }

.am-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.am-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
}
.am-tile--empty { opacity: .4; }
.am-tile.is-done { border-color: var(--gold); background: var(--gold-soft); }
.am-tile__label { font-size: 13px; font-weight: 600; color: var(--ink); }
.am-tile__check {
  display: flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--gold); color: #fff; font-size: 9px;
}

/* ---------- category / generic lists ---------- */

.am-seclabel {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 8px;
}
.am-list { display: flex; flex-direction: column; }
.am-list--bordered { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.am-list__row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--line);
  font-size: 13.5px; font-weight: 500; color: var(--ink);
}
li:last-child > .am-list__row { border-bottom: none; }
.am-list__row:hover { color: var(--green); }
.am-list__chev { color: var(--green); }
.am-list__empty { padding: 16px 0; font-size: 14px; color: var(--ink-muted); }

/* ---------- page title / rule ---------- */

.am-pagetitle { font-size: 18px; font-weight: 700; color: var(--ink); }
.am-goldrule { width: 28px; height: 2px; background: var(--gold); margin-top: 8px; border-radius: 1px; }
.am-description { margin-top: 12px; font-size: 14px; color: var(--ink-muted); }
.am-subheading { display: block; margin: 32px 0 8px; font-size: 14px; font-weight: 700; color: var(--ink); }

/* ---------- mark-complete button ---------- */

.am-markbtn {
  margin-top: 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 18px;
  font-size: 12px; font-weight: 700;
  color: var(--ink-muted);
}
.am-markbtn.is-done { border-color: var(--green); background: var(--green); color: #fff; }

/* ---------- item cards ---------- */

.am-cards { margin-top: 24px; }
.am-cards--with-audio { padding-bottom: 60px; }
.am-card {
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 16px;
}
.am-card:last-child { margin-bottom: 0; }

.am-actionrow { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.am-listenbtn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--green); border-radius: 8px;
  padding: 7px 13px;
  font-size: 12px; font-weight: 700; color: #FFFFFF; background: var(--green);
}
.am-listenbtn.is-active { border-color: var(--green-deep); background: var(--green-deep); color: #FFFFFF; }

.am-pdfwrap { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.am-pdfwrap__frame {
  position: absolute; inset: 6px; border: 1px solid rgba(199,154,70,.4); border-radius: 6px;
  pointer-events: none; z-index: 2;
}
.am-pdfwrap__iframe { width: 100%; height: 75vh; border: 0; display: block; }
.am-pdfwrap__link {
  display: inline-flex; align-items: center;
  border: 1px solid var(--green); border-radius: 8px; background: var(--green);
  padding: 7px 13px; font-size: 12px; font-weight: 700; color: #FFFFFF;
}
.am-pdfwrap__link:hover { background: var(--green-deep); }

.am-note { margin-top: 12px; font-size: 14px; line-height: 1.7; color: var(--ink-muted); }
.am-note--center { text-align: center; font-size: 12px; }

/* ---------- audio bar ---------- */

.am-audiobar {
  position: fixed; left: 0; right: 0; bottom: 60px; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(6px);
  padding: 10px 16px;
}
.am-audiobar__play {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--green); color: var(--green);
}
.am-audiobar__body { flex: 1; min-width: 0; }
.am-audiobar__title { font-size: 12px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-audiobar__body input[type="range"] { width: 100%; accent-color: var(--green); }
.am-audiobar__speed { flex: none; border: 1px solid var(--line); border-radius: 6px; padding: 4px; font-size: 11px; color: var(--ink-muted); background: transparent; }

/* ---------- streak page ---------- */

.am-statgrid { display: flex; gap: 12px; margin-top: 24px; }
.am-statcard { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 24px 12px; text-align: center; }
.am-statcard__v { font-size: 30px; font-weight: 800; color: var(--green-deep); }
.am-statcard__v--ink { color: var(--ink); }
.am-statcard__k { margin-top: 4px; font-size: 11px; color: var(--ink-muted); }

.am-dayrow { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.am-dayrow:last-child { border-bottom: none; }
.am-dayrow__date { color: var(--ink-muted); }
.am-dayrow__weekday { font-size: 11px; }
.am-dayrow__dots { display: flex; align-items: center; gap: 12px; font-size: 11px; }
.am-dot { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-muted); }
.am-dot .is-done { color: var(--green-deep); }
.am-dot__mark { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.am-dot__mark.is-done { background: var(--green); }

/* ---------- settings page ---------- */

.am-field { border: 1px solid var(--line); border-radius: 10px; padding: 14px 15px; margin-bottom: 10px; background: var(--surface); }
.am-field__row { display: flex; align-items: center; justify-content: space-between; }
.am-field__row--spaced { margin-top: 12px; }
.am-field__label { font-size: 13px; color: var(--ink); }
.am-field__desc { margin-top: 8px; font-size: 11.5px; color: var(--ink-muted); }
.am-field input[type="time"] {
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 13px; color: var(--ink); background: transparent;
}
.am-toggle { border-radius: 999px; border: 1px solid var(--line); padding: 5px 12px; font-size: 12px; font-weight: 700; color: var(--ink-muted); }
.am-toggle.is-on { border-color: var(--green); background: var(--green); color: #fff; }
.am-savebtn {
  width: 100%; margin-top: 6px;
  border-radius: 8px; border: 1px solid var(--green); background: var(--green);
  padding: 10px; font-size: 13px; font-weight: 700; color: #fff;
}

/* ---------- responsive ---------- */

@media (max-width: 480px) {
  .am-pdfwrap__iframe { height: 65vh; }
}
