:root {
  color-scheme: light dark;
  /* 은서 전용: sage / cream / warm gray. 팔레트 변경은 이 토큰에서 합니다. */
  --bg: #edf3ee;
  --surface: #fbfcf8;
  --surface-soft: #dce9e0;
  --primary: #3f6b57;
  --primary-soft: #d5e5db;
  --on-primary: #fffefa;
  --accent: #f2ddd7;
  --text: #233d33;
  --text-muted: #52655c;
  --border: #bacbc0;
  --control-border: #748c80;
  --success: #35644d;
  --warning: #81584b;
  --focus: #376c57;
  --overlay: #162d2466;
  --shadow: #162d2426;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Apple SD Gothic Neo",
    sans-serif;
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
.button {
  min-height: 48px;
  padding: 11px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:hover,
.button:hover {
  border-color: var(--primary);
}
button.primary,
.button.primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}
header > a:last-child {
  font-size: 0.85rem;
  padding: 12px;
}
.brand {
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.05em;
}
.brand-icon {
  display: inline-grid;
  place-items: center;
  color: var(--primary);
  background: var(--surface-soft);
  border-radius: 12px;
  width: 38px;
  height: 38px;
  margin-right: 6px;
}
.shell {
  max-width: 860px;
  margin: auto;
  padding: 0 28px;
}
main {
  padding: 34px 0 125px;
}
h1 {
  font-size: 2.2rem;
  line-height: 1.25;
  letter-spacing: -0.07em;
  margin: 6px 0 14px;
}
h2 {
  font-size: 1.2rem;
  letter-spacing: -0.035em;
  margin: 0 0 12px;
}
h3 {
  font-size: 1.05rem;
  margin: 0 0 4px;
}
p {
  margin: 8px 0 18px;
}
.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--primary);
}
.muted,
small {
  color: var(--text-muted);
}
.hero {
  position: relative;
  background: var(--surface-soft);
  padding: 30px;
  border-radius: 24px;
  margin: 26px 0;
  overflow: hidden;
}
.hero:after {
  content: "✳";
  position: absolute;
  right: 24px;
  top: -20px;
  font-size: 150px;
  color: var(--primary);
  opacity: 0.08;
  pointer-events: none;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.tile {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: 20px;
  gap: 14px;
  border-radius: 20px;
}
.tile .icon {
  font-size: 1.6rem;
}
.tile strong {
  word-break: keep-all;
  display: block;
}
.tile small {
  word-break: keep-all;
  display: block;
  font-size: 0.76rem;
  font-weight: 400;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 22px;
  border-radius: 20px;
  margin: 16px 0;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.between {
  justify-content: space-between;
}
.stack {
  display: grid;
  gap: 12px;
}
.soft {
  background: var(--surface-soft);
}
.warm {
  background: var(--accent);
}
.full {
  width: 100%;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.stats strong {
  display: block;
  font-size: 1.65rem;
  font-weight: 650;
}
.stats small {
  font-size: 0.78rem;
}
.rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}
label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 14px 0 5px;
}
input:not([type="checkbox"]),
select,
textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px;
  max-width: 100%;
}
textarea {
  min-height: 100px;
  resize: vertical;
}
input[type="checkbox"] {
  accent-color: var(--primary);
  width: 20px;
  height: 20px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--surface-soft);
  border-radius: 12px;
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.step {
  font-size: 2rem;
  margin: 18px 0;
}
.progress {
  height: 5px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.progress i {
  height: 100%;
  background: var(--primary);
  display: block;
}
.pill {
  font-size: 0.75rem;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--surface-soft);
}
.empty {
  text-align: center;
  padding: 32px 20px;
}
.note {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.hymn {
  display: flex;
  gap: 16px;
  align-items: center;
}
.hymn img {
  width: 90px;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 10px;
}
.hymn > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
nav {
  position: fixed;
  z-index: 5;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}
nav a {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  min-height: 52px;
  border-radius: 12px;
}
nav span {
  font-size: 0.75rem;
}
nav a[aria-current="page"] {
  background: var(--surface-soft);
  color: var(--primary);
}
#message:not(:empty) {
  position: fixed;
  z-index: 20;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 14px 22px;
  border-radius: 14px;
  width: max-content;
  max-width: 90vw;
  box-shadow: 0 8px 30px var(--shadow);
}
details {
  margin: 14px 0;
}
summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
}
.section-title {
  margin-top: 28px;
}
.timer {
  font-variant-numeric: tabular-nums;
}
.danger {
  color: var(--warning);
}
dialog {
  max-width: min(560px, 90vw);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 25px;
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop {
  background: var(--overlay);
}
@media (max-width: 480px) {
  .shell {
    padding: 0 18px;
  }
  header {
    padding: 16px 0;
  }
  main {
    padding-top: 26px;
  }
  h1 {
    font-size: 1.9rem;
  }
  .hero {
    padding: 23px;
  }
  .tile {
    padding: 15px 12px;
    gap: 9px;
  }
  .tile strong {
    word-break: keep-all;
    font-size: 0.9rem;
  }
  .tile .icon {
    font-size: 1.35rem;
  }
  .card {
    padding: 18px;
  }
  .stats {
    gap: 8px;
  }
  .stats strong {
    font-size: 1.35rem;
  }
  .grid .tile:last-child:nth-child(odd) {
    grid-column: 1/-1;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #172720;
    --surface: #22372d;
    --surface-soft: #2c4437;
    --primary: #b0d0bb;
    --primary-soft: #365441;
    --on-primary: #193d2c;
    --accent: #493c39;
    --text: #eff5ee;
    --text-muted: #bdcec3;
    --border: #4c6857;
    --control-border: #819d8b;
    --success: #b0d0bb;
    --warning: #edc4b7;
    --focus: #b0d0bb;
    --overlay: #08160ecc;
    --shadow: #00000040;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button,
  a {
    transition:
      background 0.15s,
      border-color 0.15s;
  }
}

/* 기존 화면 배치 유지. 색상 상태와 작은 화면/키보드/standalone 보완. */
body {
  min-height: 100svh;
}
a {
  color: var(--primary);
}
.brand {
  color: var(--text);
}
nav {
  background: var(--surface-soft);
}
nav a[aria-current="page"] {
  background: var(--primary-soft);
}
.pill {
  background: var(--primary-soft);
  color: var(--success);
}
input:not([type="checkbox"]),
select,
textarea {
  border-color: var(--control-border);
  font-size: max(1rem, 16px);
  min-width: 0;
  scroll-margin-block: 24px 130px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.choice:has(input:checked) {
  background: var(--primary-soft);
  color: var(--success);
}
input[type="checkbox"] {
  flex-shrink: 0;
}
input[type="file"] {
  overflow: hidden;
  white-space: normal;
}
input::file-selector-button {
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--text);
  min-height: 44px;
  font: inherit;
  padding: 8px 12px;
  margin-right: 8px;
}
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
.shell {
  padding-left: max(28px, env(safe-area-inset-left));
  padding-right: max(28px, env(safe-area-inset-right));
}
header {
  padding-top: max(24px, env(safe-area-inset-top));
}
dialog {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overflow-wrap: anywhere;
}
html[data-keyboard="open"] nav {
  visibility: hidden;
  pointer-events: none;
}
html[data-keyboard="open"] #message:not(:empty) {
  bottom: auto;
  top: max(12px, env(safe-area-inset-top));
}
@media (max-width: 480px) {
  .shell {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }
  header {
    padding-top: max(16px, env(safe-area-inset-top));
  }
}

/* Photos stay alongside text; processing disables only the photo controls. */
.photo-panel {
  margin: 20px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.photo-tile {
  min-width: 0;
}
.photo-tile button:first-child {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
}
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-tile button:last-child {
  width: 100%;
  padding: 6px;
  font-size: 0.8rem;
}
.photo-inputs label {
  position: relative;
  margin: 0;
  overflow: hidden;
  font-weight: 500;
}
input.photo-file {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.photo-inputs label:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.photo-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.photo-panel[aria-busy="true"] .photo-status::before {
  content: "◌ ";
}
.photo-dialog {
  width: min(760px, 94vw);
  padding: 16px;
}
.gallery-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 65dvh;
  object-fit: contain;
  margin: 12px 0;
}
.photo-dialog .row {
  gap: 6px;
}
.photo-dialog button {
  font-size: 0.85rem;
  padding: 8px 10px;
}

[hidden] {
  display: none !important;
}
