:root { color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: #e9ebf1; -webkit-font-smoothing: antialiased; }
#card { display: block; max-width: 480px; margin: 0 auto; background: var(--paper, #fff); color: var(--ink, #222); font-family: var(--font, serif); font-size: calc(16px * var(--fs, 1)); line-height: 1.85; word-break: keep-all; overflow-wrap: anywhere; min-height: 100vh; position: relative; }
@media (min-width: 620px) { #card { box-shadow: 0 0 60px rgba(40, 50, 90, .14); } }
.loading { padding: 40vh 24px 0; text-align: center; color: #777; font-family: sans-serif; }
#card p { margin: 0; }
#card h2 { font-size: 1.28em; font-weight: 400; line-height: 1.4; margin: 0 0 1.5em; letter-spacing: .04em; color: var(--pt); }
#card section { padding: 76px 26px; text-align: center; }
#card section.alt { background: var(--soft); }
.orn { margin: 0 auto 22px; line-height: 0; }
.orn svg { width: 64px; height: auto; }
.orn.wide svg { width: 100%; max-width: 300px; }

button, .b { font: inherit; color: inherit; cursor: pointer; }
.b { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 48px; padding: 9px 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); text-decoration: none; font-size: .94em; line-height: 1.35; }
.b:hover { border-color: var(--pt); }
.b.main { background: var(--pt); border-color: var(--pt); color: var(--on); }
.b.wide { width: 100%; }
.b.small { min-height: 40px; padding: 5px 13px; font-size: .86em; }
:focus-visible { outline: 3px solid var(--pt); outline-offset: 2px; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.row.full .b { flex: 1 1 0; min-width: 88px; padding-left: 8px; padding-right: 8px; }
.sub { color: var(--sub); font-size: .92em; }
.pre { white-space: pre-line; text-wrap: balance; }
#card .mt { margin-top: 26px; }

/* 인사말 */
#card .s-hello .title { font-size: 1.3em; margin-bottom: 1.4em; color: var(--pt); letter-spacing: .03em; white-space: pre-line; }
.kin { display: grid; grid-template-columns: auto auto auto; justify-content: center; gap: 10px 12px; margin: 40px auto 0; text-align: left; align-items: baseline; }
.kin .of { color: var(--sub); font-size: .92em; }
.kin .me { font-size: 1.16em; letter-spacing: .03em; }
.kin .p { text-align: right; }
.kin .one { grid-column: 1 / -1; text-align: center; }
.gone { display: inline-block; margin-right: .18em; font-size: .86em; }

/* 달력 */
.cal { width: 100%; max-width: 330px; margin: 30px auto 0; border-collapse: collapse; font-variant-numeric: tabular-nums; table-layout: fixed; }
.cal th { font-weight: 400; font-size: .86em; color: var(--sub); padding: 0 0 12px; }
.cal td { padding: 3px 0; height: 44px; font-size: .98em; }
.cal .sun { color: var(--pt2); }
.cal b { display: inline-flex; width: 38px; height: 38px; border-radius: 50%; align-items: center; justify-content: center; background: var(--pt); color: var(--on); font-weight: 400; }
#card .when { font-size: 1.14em; }
#card .dday { margin-top: 22px; }
.dday b { color: var(--pt2); font-weight: 400; font-size: 1.2em; }

/* 사진 */
#card section.s-gallery { padding-left: 0; padding-right: 0; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 0 4px; }
.pb { display: block; border: 0; padding: 0; background: var(--soft); overflow: hidden; width: 100%; }
.grid .pb { aspect-ratio: 1; }
.pb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; padding: 0 11%; scrollbar-width: none; }
.slide::-webkit-scrollbar { display: none; }
.slide .pb { flex: 0 0 100%; aspect-ratio: 4 / 5; scroll-snap-align: center; border-radius: 4px; }
#card .dots { margin-top: 14px; color: var(--sub); font-size: .9em; font-variant-numeric: tabular-nums; }
.rows { display: grid; gap: 8px; padding: 0 14px; }
.rows .pb img { height: auto; }
#card .more { margin-top: 18px; }

/* 크게 보기 */
dialog { border: 0; padding: 0; color: var(--ink); font-family: var(--font); }
dialog::backdrop { background: rgba(10, 12, 20, .55); }
dialog.view { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; background: #0c0d10; color: #fff; margin: 0; overflow: hidden; }
dialog.view .track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
dialog.view .track::-webkit-scrollbar { display: none; }
dialog.view .track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; scroll-snap-stop: always; }
dialog.view .top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 10px 20px; font-family: 'Malgun Gothic', sans-serif; font-size: 15px; background: linear-gradient(#0009, #0000); z-index: 2; }
dialog.view .top button { min-height: 44px; min-width: 60px; background: none; border: 0; color: #fff; }
dialog.view .nav { position: absolute; top: 50%; translate: 0 -50%; width: 52px; height: 72px; background: none; border: 0; color: #fff; z-index: 2; display: none; }
@media (hover: hover) and (pointer: fine) { dialog.view .nav { display: block; } }
dialog.view .nav.p { left: 4px; }
dialog.view .nav.n { right: 4px; }

/* 오시는 길 */
#card .hall { font-size: 1.2em; }
.map { display: block; width: calc(100% + 52px); margin: 28px -26px 0; height: auto; }
#card .osm { font-family: 'Malgun Gothic', sans-serif; font-size: 11px; color: var(--sub); text-align: right; line-height: 1.9; }
.osm a { color: inherit; }
.ways { text-align: left; margin: 34px 0 0; display: grid; gap: 20px; }
.ways dt { color: var(--pt); margin-bottom: 3px; }
.ways dd { margin: 0; white-space: pre-line; line-height: 1.75; }
.notes { display: grid; gap: 34px; }
.notes h3 { font-size: 1.06em; font-weight: 400; margin: 0 0 8px; color: var(--pt); }

/* 마음 전하실 곳 */
details.acc { border: 1px solid var(--line); border-radius: 6px; background: var(--paper); text-align: left; }
details.acc + details.acc { margin-top: 10px; }
details.acc summary { list-style: none; cursor: pointer; min-height: 54px; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: ''; width: 9px; height: 9px; border-right: 1.5px solid var(--sub); border-bottom: 1.5px solid var(--sub); transform: rotate(45deg) translate(-3px, -3px); transition: transform .2s; }
details.acc[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.acc ul { list-style: none; margin: 0; padding: 0 18px 6px; }
.acc li { border-top: 1px solid var(--line); padding: 14px 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; line-height: 1.6; }
.acc .no { white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.acc .acts { display: flex; gap: 6px; }
@media (max-width: 430px) { .acc li:has(.acts > :nth-child(2)) { grid-template-columns: 1fr; gap: 10px; } .acc li:has(.acts > :nth-child(2)) .acts > * { flex: 1; } }

/* 방명록 */
.book { list-style: none; margin: 28px 0 0; padding: 0; text-align: left; display: grid; gap: 12px; }
.book li { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; }
section:not(.alt) .book li { background: var(--soft); border-color: transparent; }
.book .w { white-space: pre-line; line-height: 1.7; }
.book .f { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--sub); font-size: .88em; }
.book .f button { background: none; border: 0; color: var(--sub); text-decoration: underline; text-underline-offset: 3px; min-height: 36px; padding: 0 4px; font-size: 1em; }

/* 연락하기 */
.people { display: grid; gap: 0; text-align: left; margin: 0; padding: 0; list-style: none; }
.people li { display: grid; grid-template-columns: 6.2em 1fr auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.people .r { color: var(--sub); font-size: .92em; }
.people .row { gap: 6px; flex-wrap: nowrap; }

/* 창 */
dialog.form { width: min(420px, calc(100vw - 28px)); max-height: calc(100dvh - 40px); overflow: auto; border-radius: 10px; background: var(--paper); padding: 26px 22px 22px; font-size: calc(16px * var(--fs, 1)); line-height: 1.6; word-break: keep-all; }
dialog.form h3 { margin: 0 0 16px; font-weight: 400; font-size: 1.2em; color: var(--pt); }
dialog.form label { display: block; margin: 14px 0 5px; font-size: .94em; }
dialog.form input[type=text], dialog.form input[type=password], dialog.form input[type=number], dialog.form textarea { width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; color: inherit; background: var(--paper); border: 1px solid var(--sub); border-radius: 6px; }
dialog.form textarea { min-height: 112px; resize: vertical; }
.opts { display: flex; gap: 8px; border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
.opts legend { font-size: .94em; padding: 0; margin-bottom: 5px; }
dialog.form .opts label { flex: 1; margin: 0; position: relative; }
.opts input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opts span { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; text-align: center; line-height: 1.3; }
.opts input:checked + span { background: var(--pt); border-color: var(--pt); color: var(--on); }
.opts input:focus-visible + span { outline: 3px solid var(--pt); outline-offset: 2px; }
dialog .err { color: var(--pt2); margin: 12px 0 0; min-height: 1.4em; }
dialog .sub { margin: 14px 0 0; }
.cv-hid { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: #22252e; color: #fff; padding: 12px 20px; border-radius: 8px; font: 15px/1.5 'Malgun Gothic', sans-serif; z-index: 60; width: max-content; max-width: calc(100vw - 40px); word-break: keep-all; text-wrap: balance; text-align: center; }

/* 음악·견본 띠 */
.bgm { position: absolute; top: 14px; right: 14px; z-index: 5; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .55); background: rgba(30, 34, 50, .42); color: #fff; display: grid; place-items: center; padding: 0; }
.bgm[hidden] { display: none; }
.draft ~ .bgm { top: 58px; }
.bgm svg { width: 22px; height: 22px; }
.bgm[aria-pressed=true] svg { animation: spin 5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#card .draft { position: sticky; top: 0; z-index: 20; background: #262f52; color: #fff; text-align: center; padding: 9px 16px; font: 14px/1.5 'Malgun Gothic', sans-serif; }
.draft b { color: #ffd84d; font-weight: 700; }
.made { padding: 26px 20px 40px; text-align: center; font: 13px/1.6 'Malgun Gothic', sans-serif; color: var(--sub); }
.made a { color: inherit; text-underline-offset: 3px; display: inline-block; padding: 8px; }
@media (prefers-reduced-motion: reduce) { .bgm svg { animation: none !important; } html { scroll-behavior: auto; } }

/* 만들기 화면의 미리보기 — 누르면 그 칸을 고친다 */
body.edit [data-sec] { cursor: pointer; }
body.edit [data-sec]:hover { box-shadow: inset 0 0 0 2px var(--pt); }
body.edit { background: transparent; }
#card .empty { color: var(--sub); border: 1px dashed var(--sub); border-radius: 6px; padding: 22px 16px; font-size: .92em; }
