/* 넘돌이 — index.html 전용. 박스 없이 글자·구분선 위주(박스는 버튼·입력칸·뜨는 창만). */
:root { --hy-bg: #fbfaf6; --hy-ink: #1b1b1b; --hy-sub: #6b6b66; --hy-line: #dcd8cc; --hy-accent: #6e1c2c; --hy-warn: #a4552a; }
@media (prefers-color-scheme: dark) { :root { --hy-bg: #14161a; --hy-ink: #eceae2; --hy-sub: #9a9a94; --hy-line: #34363b; --hy-accent: #b84d65; --hy-warn: #e0905b; } }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--hy-bg); color: var(--hy-ink); font-family: system-ui, "Noto Sans KR", "Malgun Gothic", sans-serif; }
body.hymn { min-height: 100dvh; }
#hyGate { padding: 40px 20px; text-align: center; color: var(--hy-sub); }
#hyApp { max-width: 760px; margin: 0 auto; padding: 14px 16px 60px; }
.hy-head { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--hy-line); padding-bottom: 10px; margin-bottom: 6px; }
.hy-head h1 { font-size: 20px; margin: 0; flex: 1; }
.hy-head .hy-tag { font-size: 12px; color: var(--hy-sub); }
.hy-btn { font: inherit; font-size: 15px; padding: 9px 14px; border: 1px solid var(--hy-line); background: none; color: var(--hy-ink); border-radius: 8px; cursor: pointer; }
.hy-btn.primary { background: var(--hy-accent); border-color: var(--hy-accent); color: #fff; }
.hy-btn.small { font-size: 13px; padding: 5px 10px; }
.hy-btn.warn { color: var(--hy-warn); }
.hy-btn[disabled] { opacity: .45; }
.hy-note { color: var(--hy-sub); font-size: 13px; line-height: 1.5; margin: 8px 0; }
.hy-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--hy-line); }
.hy-row .t { flex: 1; min-width: 0; }
.hy-row .t b { display: block; font-size: 16px; }
.hy-row .t small { color: var(--hy-sub); }
.hy-empty { color: var(--hy-sub); padding: 30px 0; text-align: center; }
.hy-sec { margin: 22px 0 8px; font-size: 14px; color: var(--hy-sub); font-weight: 700; border-bottom: 1px solid var(--hy-line); padding-bottom: 4px; }
.hy-field { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.hy-field label { min-width: 84px; color: var(--hy-sub); font-size: 14px; }
.hy-field input[type=text], .hy-field select { font: inherit; padding: 8px 10px; border: 1px solid var(--hy-line); border-radius: 8px; background: var(--hy-bg); color: var(--hy-ink); }
.hy-field input[type=text] { flex: 1; min-width: 140px; }
.hy-seq { font-size: 13px; color: var(--hy-ink); line-height: 1.7; word-break: keep-all; }
.hy-seq span { display: inline-block; margin-right: 8px; }
.hy-seq .intro, .hy-seq .amen { color: var(--hy-accent); }
.hy-seq .refrain { color: var(--hy-warn); }
.hy-prog { color: var(--hy-sub); font-size: 14px; padding: 12px 0; }

/* 줄 고치기 */
.hy-page { position: relative; margin: 14px 0; border-top: 1px solid var(--hy-line); border-bottom: 1px solid var(--hy-line); touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.hy-page canvas { display: block; width: 100%; height: auto; }
.hy-ov { position: absolute; left: 0; right: 0; pointer-events: none; }
.hy-cut { position: absolute; left: 0; right: 0; height: 0; border-top: 3px solid #2a6cff; pointer-events: none; }
.hy-hnd { position: absolute; left: 0; right: 0; top: -16px; height: 32px; pointer-events: auto; touch-action: none; cursor: ns-resize; z-index: 4; }
.hy-cut::after { content: "↕"; position: absolute; right: 6px; top: -13px; background: #2a6cff; color: #fff; font-size: 12px; line-height: 1; padding: 4px 8px; border-radius: 10px; pointer-events: none; }
.hy-lbl { position: absolute; left: 6px; top: 4px; background: rgba(42,108,255,.92); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 10px; pointer-events: auto; cursor: pointer; z-index: 3; white-space: nowrap; }
.hy-lbl.off { background: rgba(120,120,120,.92); text-decoration: line-through; }
.hy-line.off { background: rgba(120,120,120,.35); }
.hy-rowbar { position: absolute; left: 4%; right: 4%; background: rgba(40,170,90,.18); border-top: 2px solid rgba(40,170,90,.9); border-bottom: 2px solid rgba(40,170,90,.9); pointer-events: none; }
.hy-rowbar .g { position: absolute; left: 0; right: 0; height: 26px; pointer-events: auto; touch-action: none; cursor: ns-resize; }
.hy-rowbar .g.t { top: -13px; } .hy-rowbar .g.b { bottom: -13px; }
.hy-rowctl { position: absolute; right: 6px; bottom: 4px; display: flex; gap: 4px; z-index: 3; pointer-events: auto; }
.hy-rowctl button { font: inherit; font-size: 12px; padding: 3px 8px; border: 1px solid rgba(40,170,90,.9); background: var(--hy-bg); color: var(--hy-ink); border-radius: 10px; }
.hy-addtap { position: absolute; inset: 0; z-index: 2; background: rgba(42,108,255,.06); cursor: crosshair; }

/* 가로 한 줄 보기 */
#hyView { position: fixed; inset: 0; z-index: 50; display: none; flex-direction: column; background: #fff; color: #111; }
#hyView.on { display: flex; }
#hyView .vbar { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 2px 8px; padding-top: max(2px, env(safe-area-inset-top)); border-bottom: 1px solid #ddd; font-size: 13px; }
#hyView .vbar .ttl { font-weight: 700; white-space: nowrap; max-width: 36%; overflow: hidden; text-overflow: ellipsis; }
#hyView .vbar .pos { color: #666; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hyView .vbar button { font: inherit; padding: 4px 10px; border: 1px solid #ddd; background: none; color: #111; border-radius: 6px; }
#hyView .vbar button.on { border-color: #b8860b; color: #b8860b; font-weight: 700; }
#vStage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
#vCur { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }
#vWrap { position: relative; max-width: 100%; max-height: 100%; display: inline-block; line-height: 0; }
#vImg { display: block; max-width: 100%; max-height: calc(100dvh - 40px - var(--hy-peek) - env(safe-area-inset-top) - env(safe-area-inset-bottom)); width: auto; height: auto; user-select: none; -webkit-user-drag: none; }
#vBand { position: absolute; left: 0; right: 0; background: rgba(255, 200, 0, .28); pointer-events: none; display: none; }
#vLabel { position: absolute; left: 6px; top: 2px; font-size: 12px; line-height: 1.2; color: #b8860b; font-weight: 700; pointer-events: none; }
#vPeek { flex: 0 0 var(--hy-peek); overflow: hidden; opacity: .32; display: flex; justify-content: center; }
#vPeek img { width: 100%; object-fit: cover; object-position: top; max-width: calc((100dvh - 40px) * 3.2); }
#vZP, #vZN { position: absolute; top: 0; bottom: 0; }
#vZP { left: 0; width: 28%; } #vZN { left: 28%; right: 0; }
#vEnd { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-size: 22px; background: rgba(255,255,255,.97); z-index: 5; }
#vEnd small { color: #666; font-size: 14px; }
#vHint { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 18px; background: rgba(255,255,255,.92); z-index: 4; pointer-events: none; }
#vAll { position: absolute; inset: 0; display: none; overflow-y: auto; background: #fff; z-index: 6; }
#vAll img { display: block; width: 100%; height: auto; }
#hyView { --hy-peek: 12dvh; }

/* 2판: 자동 넘김(마이크로 연주를 듣고 다음 줄로) */
#hyView .vbar button#vAuto.on { border-color: #1f8a5a; color: #1f8a5a; font-weight: 700; }
#hyView .vbar button#vAuto.rec { border-color: #c0392b; color: #c0392b; font-weight: 700; }
#vMic { display: inline-flex; align-items: center; width: 14px; height: 14px; }
#vMic[hidden] { display: none; }
#vMic i { display: block; width: 10px; height: 10px; border-radius: 50%; background: #1f8a5a; opacity: .25; transition: opacity .1s, transform .1s; }
#vMic.rec i { background: #c0392b; }
#vFollowBar { position: absolute; left: 0; right: 0; top: 0; height: 5px; background: #e4e4e4; z-index: 3; pointer-events: none; }
#vFollowBar[hidden] { display: none; }
#vFollowBar b { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #1f8a5a; transition: width .12s linear; }
#vFollowBar b.late { background: #d9822b; }
#vFollowBar b.weak { background: #b9b9b9; }
#vFollowBar i { position: absolute; left: 75%; top: -2px; bottom: -2px; width: 2px; background: #666; }
#vFollowMsg { position: absolute; left: 8px; right: 8px; bottom: 6px; z-index: 7; padding: 6px 10px; font-size: 13px; line-height: 1.4; background: rgba(30, 30, 30, .88); color: #fff; border-radius: 8px; pointer-events: none; }
#vFollowMsg[hidden] { display: none; }
#vFollowPanel { position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px 24px; background: rgba(255, 255, 255, .97); text-align: center; font-size: 15px; line-height: 1.55; overflow-y: auto; }
#vFollowPanel[hidden] { display: none; }
#vFollowPanel .btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
#vFollowPanel button { font: inherit; padding: 9px 16px; border: 1px solid #bbb; background: none; color: #111; border-radius: 8px; }
#vFollowPanel button.primary { background: #6e1c2c; border-color: #6e1c2c; color: #fff; }
#vFollowPanel small { color: #666; font-size: 13px; }
.hy-refstat { font-size: 14px; line-height: 1.6; margin: 6px 0; }
.hy-refstat.bad { color: var(--hy-warn); }

/* 3판: 절 번호(1·2·3·4)로 바로 가기, 책장 넘어가는 느낌, 폰을 세우면 악보 한 쪽 전체 */
#vVerses { display: inline-flex; gap: 4px; align-items: center; flex: 0 0 auto; }
#vVerses:empty { display: none; }
#hyView .vbar #vVerses button { min-width: 30px; padding: 4px 8px; font-weight: 700; }
@keyframes hyFlipFwd { from { transform: perspective(1400px) rotateY(-42deg) translateX(8%); opacity: .12; filter: brightness(.82); } to { transform: none; opacity: 1; filter: none; } }
@keyframes hyFlipBack { from { transform: perspective(1400px) rotateY(42deg) translateX(-8%); opacity: .12; filter: brightness(.82); } to { transform: none; opacity: 1; filter: none; } }
.flip-fwd { transform-origin: left center; animation: hyFlipFwd .38s cubic-bezier(.2, .7, .2, 1); }
.flip-back { transform-origin: right center; animation: hyFlipBack .38s cubic-bezier(.2, .7, .2, 1); }
@media (prefers-reduced-motion: reduce) { .flip-fwd, .flip-back { animation: none; } }
#vPortrait { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; }
#vPWrap { position: relative; line-height: 0; }
#vPImg { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
#vPLine { position: absolute; left: 0; right: 0; background: rgba(31, 138, 90, .10); border-left: 4px solid #1f8a5a; border-top: 1px solid rgba(31, 138, 90, .5); border-bottom: 1px solid rgba(31, 138, 90, .5); pointer-events: none; transition: top .28s ease, height .28s ease; }
#vPBand { position: absolute; left: 2%; right: 2%; background: rgba(255, 200, 0, .30); pointer-events: none; transition: top .28s ease, height .28s ease; display: none; }
@media (orientation: portrait) {
  #vCur, #vPeek, #vHint { display: none !important; }
  #vPortrait { display: flex; }
  #hyView .vbar { flex-wrap: wrap; }
  #hyView .vbar .ttl { max-width: 56%; }
  #hyView .vbar .pos { flex: 1 1 60px; min-width: 60px; }
  #vVerses { order: 10; width: 100%; padding: 2px 0 4px; }
}
