:root {
  --bg: #eee3d3;
  --surface: #fffdf8;
  --surface-soft: #f9f3ea;
  --nav: #b89667;
  --nav-dark: #8c6a3f;
  --text: #2f271f;
  --muted: #817263;
  --line: #e2d5c3;
  --gold: #f4c95d;
  --rose: #f3b9b5;
  --sage: #a8b79d;
  --shadow: 0 18px 48px rgba(98, 73, 43, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR",
    system-ui, sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.5), transparent 32%),
    linear-gradient(180deg, #f4ecdf 0%, var(--bg) 42%, #e7d8c5 100%);
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vw, 34px);
}

.phone-frame {
  width: min(100%, 430px);
  min-height: min(880px, calc(100dvh - 20px));
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(139, 104, 61, 0.22);
  border-radius: clamp(24px, 7vw, 38px);
  background: linear-gradient(180deg, #f2e7d8 0%, #eadbc7 100%);
  box-shadow: var(--shadow);
}

.content {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: clamp(16px, 4vw, 24px);
  padding: clamp(26px, 7vw, 42px) clamp(18px, 5vw, 30px) 18px;
}

.app-shell.is-list-open .list-view {
  align-content: stretch;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding-top: clamp(18px, 4.8vw, 30px);
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 54px;
}

h1 {
  margin: 0;
  color: #3a2d21;
  font-size: clamp(33px, 9vw, 48px);
  line-height: 1;
  letter-spacing: 0;
  font-weight: 900;
}

h1 span {
  color: var(--nav-dark);
}

.hand-border {
  position: relative;
  border: 1px solid rgba(117, 86, 50, 0.1);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(118, 88, 52, 0.1);
}

.hand-border::before {
  display: none;
}

.verse-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: var(--verse-card-height, 310px);
  padding: 18px 16px 17px;
}

.verse-top {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 9px;
  color: #3b3026;
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 850;
}

.verse-top strong {
  padding: 6px 9px;
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--nav-dark);
}

.highlight-bar {
  appearance: none;
  cursor: pointer;
  width: min(100%, 68px);
  height: 28px;
  justify-self: start;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f7d979, var(--gold));
  box-shadow: inset 0 0 0 1px rgba(125, 88, 25, 0.12);
}

.highlight-bar:focus-visible,
.circle-control:focus-visible,
.back-button:focus-visible,
.trail-back:focus-visible,
.category-pill:focus-visible,
.memory-card:focus-visible {
  outline: 3px solid rgba(140, 106, 63, 0.36);
  outline-offset: 3px;
}

.sun-icon {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 15px;
  background:
    radial-gradient(circle at 50% 50%, #fff9db 0 21%, transparent 22%),
    conic-gradient(from 0deg, #d9a83d 0 12%, transparent 12% 25%, #d9a83d 25% 37%, transparent 37% 50%, #d9a83d 50% 62%, transparent 62% 75%, #d9a83d 75% 87%, transparent 87%),
    #ffe8a1;
}

.sun-icon::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 3px solid #7d5b20;
  border-radius: 50%;
}

.verse-body {
  align-self: stretch;
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.circle-control {
  appearance: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  align-self: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff1b8;
  box-shadow: inset 0 0 0 1px rgba(129, 94, 31, 0.12);
  position: relative;
}

.circle-control::after {
  content: "";
  position: absolute;
  top: 11px;
  width: 10px;
  height: 10px;
  border: solid var(--nav-dark);
  border-width: 0 0 3px 3px;
}

.circle-control.left::after {
  left: 13px;
  transform: rotate(45deg);
}

.circle-control.right::after {
  right: 13px;
  transform: rotate(-135deg);
}

.verse-copy,
.verse-lines {
  align-self: start;
  display: grid;
  gap: 4px;
}

.verse-copy p {
  margin: 0;
}

.verse-meta {
  color: var(--nav-dark);
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 850;
  line-height: 1.25;
}

.verse-topic {
  color: #362c23;
  font-size: clamp(17px, 4.7vw, 23px);
  font-weight: 900;
  line-height: 1.18;
}

.verse-ref {
  color: var(--nav-dark);
  font-size: clamp(14px, 3.9vw, 18px);
  font-weight: 850;
  line-height: 1.2;
}

.verse-note {
  color: var(--muted);
  font-size: clamp(12px, 3.15vw, 13px);
  font-weight: 700;
  line-height: 1.28;
}

.verse-measure {
  position: absolute;
  left: -10000px;
  top: 0;
  visibility: hidden;
  pointer-events: none;
}

.verse-lines span,
.under-line {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: #eadfce;
}

.verse-lines span:first-child {
  width: 88%;
}

.verse-lines span:last-child {
  width: 100%;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.list-header p,
.list-header h2 {
  margin: 0;
}

.list-header p {
  color: var(--nav-dark);
  font-size: 12px;
  font-weight: 800;
}

.list-header h2 {
  margin-top: 3px;
  color: #3a2d21;
  font-size: clamp(22px, 5.8vw, 30px);
  letter-spacing: 0;
  line-height: 1.08;
}

.back-button {
  appearance: none;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 9px 13px;
  background: #fffaf1;
  color: var(--nav-dark);
  box-shadow: inset 0 0 0 1px rgba(117, 86, 50, 0.12);
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

.memory-list {
  min-height: 0;
  overflow: hidden;
  padding: 14px;
}

.memory-trail {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.trail-back {
  appearance: none;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface-soft);
  color: var(--nav-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.memory-trail span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-note {
  border-radius: 16px;
  padding: 12px 13px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.memory-items {
  max-height: min(560px, calc(100dvh - 230px));
  overflow: auto;
  display: grid;
  gap: 9px;
  padding-right: 2px;
}

.section-overview {
  height: 100%;
  max-height: none;
  overflow: hidden;
  grid-template-rows: repeat(5, minmax(112px, 1fr));
  gap: 9px;
  padding-right: 0;
}

.section-group {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 7px;
  border-radius: 20px;
  padding: 11px;
  background: #fbf7ef;
  box-shadow: inset 0 0 0 1px rgba(117, 86, 50, 0.08);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.section-heading span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: #efe4d5;
  color: var(--nav-dark);
  font-size: 13px;
  font-weight: 900;
}

.section-heading strong {
  min-width: 0;
  overflow: hidden;
  color: #322820;
  font-size: clamp(15px, 4vw, 17px);
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.category-pill {
  appearance: none;
  position: relative;
  min-width: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 16px;
  padding: 16px 8px 10px;
  background: #fffdf8;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  box-shadow:
    inset 0 0 0 1px rgba(117, 86, 50, 0.08),
    0 5px 14px rgba(118, 88, 52, 0.06);
}

.category-pill:hover {
  background: #fff8ea;
}

.category-watermark {
  position: absolute;
  left: 10px;
  top: 6px;
  color: rgba(184, 150, 103, 0.2);
  font-size: 31px;
  font-weight: 950;
  line-height: 1;
}

.category-pill strong {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: -webkit-box;
  overflow: hidden;
  width: 100%;
  color: #332920;
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 900;
  line-height: 1.15;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.category-pill em {
  display: none;
}

.verse-card-list {
  max-height: min(620px, calc(100dvh - 214px));
  gap: 10px;
}

.memory-card {
  appearance: none;
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 18px;
  padding: 13px;
  background: #fbf7ef;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(117, 86, 50, 0.08);
  transition:
    background-color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.verse-list-card {
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  padding: 15px 13px;
}

.memory-card:hover {
  background: #fffaf2;
  box-shadow:
    inset 0 0 0 1px rgba(117, 86, 50, 0.13),
    0 7px 18px rgba(118, 88, 52, 0.08);
  transform: translateY(-1px);
}

.memory-badge {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #efe4d5;
  color: var(--nav-dark);
  font-size: 13px;
  font-weight: 900;
}

.memory-card-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.memory-card-copy strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #322820;
  font-size: clamp(15px, 4.2vw, 17px);
  font-weight: 900;
  white-space: nowrap;
}

.memory-card-copy small {
  color: var(--nav-dark);
  font-size: 13px;
  font-weight: 900;
}

.memory-card-copy em {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 750;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.verse-list-card .memory-card-copy em {
  display: block;
  -webkit-line-clamp: unset;
}

.memory-card-count {
  justify-self: end;
  border-radius: 999px;
  padding: 6px 9px;
  background: #fff4cf;
  color: #77581d;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.habit-list {
  display: grid;
  gap: clamp(15px, 3.8vw, 20px);
}

.habit-card {
  min-height: 112px;
  display: grid;
  grid-template-columns: 70px 1fr 54px;
  align-items: center;
  padding: 13px 14px 13px 0;
}

.habit-card.tall {
  min-height: 120px;
}

.habit-card.compact {
  min-height: 96px;
}

.habit-tab {
  align-self: stretch;
  display: grid;
  place-items: center;
  margin-left: 12px;
  border-radius: 20px;
  background: var(--surface-soft);
  color: var(--nav-dark);
  font-size: clamp(20px, 5.7vw, 27px);
  font-weight: 900;
}

.habit-main {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 7px;
  padding: 0 clamp(12px, 4vw, 22px);
  color: #322820;
  font-size: clamp(20px, 5.6vw, 27px);
  font-weight: 850;
}

.habit-main span {
  display: block;
}

.habit-main strong {
  font-weight: 900;
}

.habit-main.align-end {
  justify-items: end;
}

.qt-main {
  gap: 4px;
}

.qt-main strong {
  font-size: clamp(18px, 5vw, 23px);
  line-height: 1.18;
}

.qt-main span {
  color: var(--nav-dark);
  font-size: clamp(15px, 4.1vw, 18px);
  font-weight: 850;
}

.qt-preview {
  display: -webkit-box;
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: clamp(12px, 3.25vw, 14px);
  font-weight: 700;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pink-mark {
  min-width: 116px;
  padding: 5px 18px 6px;
  text-align: right;
  background: #f7d6d4;
  border-radius: 999px;
  color: #6a403d;
}

.under-line {
  width: 118px;
  height: 5px;
}

.under-line.small {
  width: 86px;
}

.yellow-label {
  padding: 5px 13px 6px;
  border: 0;
  border-radius: 12px;
  background: #ffe59b;
  color: #6d511a;
  font-size: clamp(16px, 4.5vw, 20px);
  box-shadow: inset 0 0 0 1px rgba(123, 91, 28, 0.12);
}

.check-box {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8cbc8, var(--rose));
  box-shadow:
    inset 0 0 0 1px rgba(128, 69, 64, 0.12),
    0 6px 16px rgba(139, 83, 74, 0.12);
  position: relative;
  transform: none;
}

.check-box::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 12px;
  width: 20px;
  height: 12px;
  border: solid #5b3632;
  border-width: 0 0 4px 4px;
  transform: rotate(-45deg);
}

.bottom-nav {
  min-height: 76px;
  display: grid;
  grid-template-columns: 0.9fr 0.78fr 1.52fr 0.9fr 0.9fr 0.9fr;
  border-top: 1px solid rgba(102, 73, 39, 0.18);
  background: linear-gradient(180deg, #c5a375, var(--nav));
  box-shadow: 0 -12px 28px rgba(112, 79, 41, 0.1);
}

.nav-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 8px 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.26);
  color: #fffaf1;
  font-size: clamp(15px, 4.3vw, 22px);
  font-weight: 850;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(78, 53, 27, 0.16);
}

.nav-cell:last-child {
  border-right: 0;
}

.home-icon,
.profile-icon {
  position: relative;
}

.home-icon::before {
  content: "";
  width: 31px;
  height: 27px;
  border: 4px solid #fffaf1;
  border-top: 0;
  border-radius: 0 0 5px 5px;
  transform: translateY(7px);
}

.home-icon::after {
  content: "";
  position: absolute;
  width: 25px;
  height: 25px;
  border-left: 4px solid #fffaf1;
  border-top: 4px solid #fffaf1;
  border-radius: 4px 0 0 0;
  transform: translateY(-10px) rotate(45deg);
}

.profile-icon::before {
  content: "";
  width: 21px;
  height: 21px;
  border: 4px solid #fffaf1;
  border-radius: 50%;
  transform: translateY(-12px);
}

.profile-icon::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 31px;
  border: 4px solid #fffaf1;
  border-radius: 50% 50% 12px 12px;
  border-top: 0;
  transform: translateY(16px);
}

@media (min-width: 760px) {
  .phone-frame {
    width: min(92vw, 540px);
    min-height: min(900px, calc(100dvh - 68px));
  }

  .content {
    padding-inline: 38px;
  }
}

@media (max-width: 390px) {
  .phone-frame {
    min-height: calc(100dvh - 20px);
    border-radius: 25px;
  }

  .content {
    padding: 25px 14px 15px;
    gap: 16px;
  }

  .verse-card {
    padding-inline: 16px;
  }

  .habit-card {
    grid-template-columns: 62px 1fr 50px;
    min-height: 112px;
  }

  .habit-card.tall {
    min-height: 120px;
  }

  .habit-card.compact {
    min-height: 96px;
  }

  .habit-tab {
    margin-left: 10px;
    border-radius: 18px;
  }

  .check-box {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .check-box::after {
    left: 11px;
    top: 11px;
    width: 18px;
    height: 11px;
  }

  .bottom-nav {
    grid-template-columns: 0.82fr 0.72fr 1.58fr 0.82fr 0.82fr 0.82fr;
    min-height: 72px;
  }

  .nav-cell {
    font-size: clamp(14px, 4.2vw, 18px);
    padding-inline: 2px;
  }
}
