:root {
  --canvas: #f3f1eb;
  --paper: #fffefa;
  --ink: #1f2924;
  --ink-soft: #4d5852;
  --muted: #858d87;
  --line: #dddeda;
  --green: #355d4b;
  --green-dark: #244638;
  --green-pale: #e8eee8;
  --gold: #b99054;
  --nav-height: calc(74px + env(safe-area-inset-bottom));
  --serif: "Noto Serif KR", "Songti TC", "AppleMyungjo", serif;
  --sans: "Pretendard", "Apple SD Gothic Neo", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; }
button {
  color: inherit;
  cursor: pointer;
  -webkit-appearance: none;
}

#app {
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 22px calc(var(--nav-height) + 36px);
  background: var(--canvas);
}

.hero {
  position: relative;
  min-height: 246px;
  margin: 0 -22px 24px;
  padding: calc(28px + env(safe-area-inset-top)) 26px 30px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(29,54,43,.22), rgba(29,54,43,.92)),
    linear-gradient(135deg, #6f806e 0%, #3e5e4d 48%, #263f34 100%);
}
.hero::before {
  content: "";
  position: absolute;
  width: 290px;
  height: 290px;
  right: -155px;
  top: -155px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  box-shadow:
    0 0 0 32px rgba(255,255,255,.025),
    0 0 0 64px rgba(255,255,255,.018);
}
.hero::after {
  content: "";
  position: absolute;
  left: 26px;
  bottom: 23px;
  width: 42px;
  height: 2px;
  background: rgba(212,190,147,.9);
}
.hero .eyebrow,
.hero h1,
.hero p { position: relative; z-index: 1; }
.hero .eyebrow {
  position: absolute;
  top: calc(24px + env(safe-area-inset-top));
  left: 26px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .17em;
  opacity: .72;
}
.hero h1 {
  margin: 0;
  padding-bottom: 52px;
  font-family: var(--serif);
  font-size: clamp(34px, 9vw, 42px);
  line-height: 1.08;
  letter-spacing: -.04em;
  font-weight: 600;
}
.hero p {
  margin: 0;
  color: rgba(255,255,255,.74);
  font-size: 13px;
  letter-spacing: .01em;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 26px 0 12px;
}
.section-title h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: -.025em;
}
.section-title span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 3px;
  margin: 10px 0 24px;
  overflow: hidden;
  background: #dcddd6;
}
.progress i {
  display: block;
  height: 100%;
  background: var(--gold);
  transition: width .3s ease;
}

.day-card,
.panel,
.reading-card {
  background: var(--paper);
  border: 1px solid rgba(180,184,176,.58);
  border-radius: 16px;
  box-shadow: 0 8px 26px rgba(42,55,48,.045);
}
.day-card { overflow: hidden; }
.day-card .day-head {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 16px 14px 18px;
}
.day-card .day-head strong {
  display: block;
  margin-bottom: 5px;
  font-family: var(--serif);
  font-size: 17px;
}
.day-card .day-head span {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.check {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1.5px solid #b4bab3;
  border-radius: 50%;
  background: transparent;
  position: relative;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.check:active { transform: scale(.94); }
.check[aria-checked="true"] {
  background: var(--green);
  border-color: var(--green);
}
.check[aria-checked="true"]::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 10px;
  width: 7px;
  height: 15px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.chapter-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: #fbfaf5;
}
.chapter-list button {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--green-dark);
  padding: 7px 4px;
  font-size: 12px;
  white-space: nowrap;
  letter-spacing: -.02em;
  box-shadow: 0 2px 8px rgba(38,52,44,.025);
}
.chapter-list button:active { background: var(--green-pale); }

.panel { padding: 18px; margin-top: 14px; }
.panel h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: -.02em;
}
.panel p {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}
.field {
  display: block;
  width: 100%;
  height: 50px;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0 13px;
  font-size: 15px;
  outline: none;
}
.field:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-pale); }
.primary {
  width: 100%;
  height: 52px;
  margin-top: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  letter-spacing: -.01em;
}
.primary:active { background: var(--green-dark); }
.text-button {
  display: block;
  margin: 8px auto 0;
  border: 0;
  background: none;
  color: var(--green);
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
}
.message {
  min-height: 20px;
  margin: 8px 0 0;
  color: #9a4e40;
  font-size: 13px;
  line-height: 1.5;
}

.reading-card {
  margin-top: 9px;
  overflow: hidden;
  border-left: 3px solid transparent;
}
.reading-card.done { border-left-color: var(--green); }
.reading-card button {
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 15px 16px 16px;
}
.reading-card strong {
  display: block;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
}
.reading-card span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12.5px;
}

.reader-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 68px 1fr 68px;
  align-items: center;
  margin: 0 -22px;
  min-height: calc(58px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0;
  background: rgba(243,241,235,.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.reader-top button {
  height: 44px;
  border: 0;
  background: none;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}
.reader-top strong {
  text-align: center;
  font-family: var(--serif);
  font-size: 14px;
}
.reader-body {
  padding: 24px 2px 48px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 2;
  letter-spacing: -.012em;
}
.verse {
  margin: 0 0 13px;
  text-align: justify;
  word-break: keep-all;
}
.verse sup {
  margin-right: 5px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10px;
  vertical-align: super;
}

.group-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px 0;
}
.group-row:first-of-type { border-top: 0; }
.group-row strong { font-family: var(--serif); font-size: 15px; }
.group-row span {
  flex: none;
  color: var(--muted);
  font-size: 12.5px;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--nav-height);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: start;
  padding: 10px 8px env(safe-area-inset-bottom);
  background: rgba(255,254,250,.97);
  border-top: 1px solid rgba(205,207,199,.9);
  backdrop-filter: blur(14px);
}
.bottom-nav button {
  height: 54px;
  border: 0;
  background: none;
  color: #9da49f;
  font-size: 11.5px;
  border-radius: 10px;
}
.bottom-nav button[aria-current="page"] {
  color: var(--green);
  font-weight: 800;
  background: var(--green-pale);
}
.nav-icon { display: block; }

@media (min-width: 900px) {
  body { background: #ebe9e2; }
  #app {
    width: 760px;
    max-width: none;
    margin-left: 240px;
    margin-right: auto;
    padding-left: 48px;
    padding-right: 48px;
  }
  .hero { margin-left: -48px; margin-right: -48px; border-radius: 0 0 24px 24px; }
  .bottom-nav {
    top: 0;
    right: auto;
    width: 240px;
    height: 100%;
    grid-template-columns: 1fr;
    grid-auto-rows: 54px;
    align-content: start;
    gap: 5px;
    border-top: 0;
    border-right: 1px solid var(--line);
    padding: 112px 18px 20px;
  }
  .bottom-nav button { height: 54px; text-align: left; padding: 0 18px; font-size: 14px; }
  .reader-top { margin-left: -48px; margin-right: -48px; }
  .chapter-list { grid-template-columns: repeat(7, 1fr); }
}
