:root {
  --blue: #2B4ACB; --blue-d: #1C318C; --yellow: #FFC93C; --ink: #18203A; --sub: #555E78; --mute: #9AA1B5;
  --bg: #F4F6FB; --card: #FFFFFF; --line: #E3E7F2; --soft: #EEF1FA; --gold: #FFF4D1; --red: #C2410C; --green: #15803D;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Noto Sans KR', system-ui, sans-serif; }
button, input, textarea, select { font-family: inherit; font-size: 16px; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
.jua { font-family: 'Jua', 'Noto Sans KR', sans-serif; font-weight: 400; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.splash { margin: auto; color: var(--sub); }
.page { flex: 1; padding: 20px 20px calc(96px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.top .t-sub { font-size: 13px; color: var(--sub); }
.top h1 { margin: 2px 0 0; font-size: 26px; }
.avatar { width: 44px; height: 44px; border-radius: 22px; background: #FFE27A; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.card { background: var(--card); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card h2 { margin: 0; font-size: 15px; font-weight: 700; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--sub); font-size: 13px; }
.hero { background: var(--blue); color: #fff; border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.hero .big { font-size: 24px; }
.hero .small { font-size: 13px; opacity: .9; }
.btn { height: 52px; border: none; border-radius: 14px; font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; text-decoration: none; }
.btn-y { background: var(--yellow); color: var(--ink); }
.btn-b { background: var(--blue); color: #fff; }
.btn-l { background: #fff; color: var(--ink); border: 1px solid #C9D1EA; }
.btn-k { background: #FEE500; color: #191600; }
.btn-s { height: 40px; font-size: 14px; border-radius: 11px; padding: 0 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-w { width: 100%; }
.seg4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.seg4 i { height: 10px; border-radius: 5px; background: #DDE2EF; display: block; }
.seg4 i.on { background: var(--blue); }
.days { display: flex; gap: 8px; flex-wrap: wrap; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--sub); width: 52px; }
.day b { width: 38px; height: 38px; border-radius: 19px; background: #DDE2EF; color: var(--sub); display: flex; align-items: center; justify-content: center; }
.day.on b { background: var(--blue); color: #fff; }
.day.today b { background: #fff; border: 2px dashed var(--blue); color: var(--blue); }
.day.today.on b { background: var(--blue); color: #fff; border: none; }
.mons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mon { aspect-ratio: 1; border-radius: 14px; background: var(--soft); display: flex; align-items: center; justify-content: center; border: none; padding: 4px; }
.mon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.mon.rare { background: var(--gold); }
.mon.legend { background: #F3E8FF; }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); z-index: 20; }
nav.tabs .in { max-width: 560px; margin: 0 auto; display: flex; height: 68px; }
nav.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; color: var(--sub); text-decoration: none; }
nav.tabs a.on { color: var(--blue); font-weight: 700; }
nav.tabs a.off { color: var(--mute); }
nav.tabs svg { width: 22px; height: 22px; }

.progress { height: 10px; border-radius: 5px; background: #DDE2EF; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--blue); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid #C9D1EA; background: #fff; font-size: 14px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile { border-radius: 14px; background: #fff; border: none; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 1px 3px rgba(24,32,58,.1); }
.tile img { width: 64px; height: 64px; image-rendering: pixelated; }
.tile .n { font-size: 10px; color: var(--sub); }
.tile .nm { font-size: 11px; font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.rare { background: var(--gold); }
.tile.legend { background: #F3E8FF; }
.tile.no { background: #E6E9F2; box-shadow: none; }
.tile.no img { filter: brightness(0); opacity: .18; }
.tile.no .nm { color: var(--mute); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--sub); }
.badge.rare { background: var(--yellow); color: var(--ink); }
.badge.legend { background: #7C3AED; color: #fff; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--sub); }
.field input, .field textarea, .field select { height: 46px; border-radius: 10px; border: 1px solid #C9D1EA; padding: 0 12px; background: #fff; color: var(--ink); font-size: 16px; }
.field textarea { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; line-height: 1.6; }

.overlay { position: fixed; inset: 0; background: rgba(24,32,58,.96); z-index: 50; display: flex; padding: 24px 24px calc(24px + var(--safe-b)); overflow-y: auto; }
.sheet { position: fixed; inset: 0; background: rgba(24,32,58,.5); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet .box { background: #fff; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 20px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; max-height: 92vh; overflow: auto; }
.reward { margin: auto; width: 100%; max-width: 360px; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.reward .orb { width: min(220px, 56vw); height: min(220px, 56vw); border-radius: 50%; flex: none; background: #24305A; border: 4px solid var(--yellow); display: flex; align-items: center; justify-content: center; animation: pop .6s ease-out; }
.reward .orb.legend { border-color: #C084FC; box-shadow: 0 0 40px #A855F7; }
.reward .orb img { width: 80%; height: 80%; object-fit: contain; }
.reward .note { background: #24305A; border-radius: 14px; padding: 12px 14px; font-size: 13px; color: #C9D1EA; width: 100%; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }

.timer { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 12px 16px; }
.timer .bar { flex: 1; height: 8px; border-radius: 4px; background: #F1E3DA; overflow: hidden; }
.timer .bar i { display: block; height: 100%; background: var(--red); transition: width .25s linear; }
.timer b { color: var(--red); min-width: 44px; text-align: right; }
.verse { font-size: 19px; line-height: 1.75; margin: 0; word-break: keep-all; }
.blank { display: inline-block; min-width: 72px; border-bottom: 3px solid var(--blue); color: var(--blue); text-align: center; font-weight: 700; }
.opt { min-height: 56px; border-radius: 14px; border: 2px solid #DDE2EF; background: #fff; font-size: 17px; text-align: left; padding: 10px 18px; width: 100%; }
.opt:active { border-color: var(--blue); }
.opt.ok { border-color: var(--green); background: #ECFDF3; }
.opt.bad { border-color: var(--red); background: #FFF1EB; }
.warn { display: flex; gap: 8px; align-items: center; background: var(--gold); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: #5B4300; }

.tabs2 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: #E6E9F2; border-radius: 12px; padding: 4px; gap: 4px; }
.tabs2 button { height: 40px; border: none; border-radius: 9px; background: transparent; font-size: 14px; color: var(--sub); }
.tabs2 button.on { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.qrbox { background: #fff; border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 10px; }
.qrbox canvas, .qrbox img { width: 100%; height: auto; image-rendering: pixelated; }
.qrfull { position: fixed; inset: 0; background: #fff; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; }
.qrfull .qrbox { width: min(80vw, 70vh); }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--soft); font-size: 15px; }
.li:first-child { border-top: none; }
.li .grow { flex: 1; min-width: 0; }
.chk { width: 44px; height: 44px; border-radius: 12px; border: 2px solid #C9D1EA; background: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.chk.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.switch { width: 56px; height: 32px; border-radius: 16px; border: none; background: #C9D1EA; position: relative; padding: 0; flex: none; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .15s; }
.switch.on { background: var(--blue); }
.switch.on::after { left: 27px; }
.qedit { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.qedit textarea { width: 100%; min-height: 70px; border-radius: 10px; border: 1px solid #C9D1EA; padding: 8px 10px; font-size: 15px; line-height: 1.5; }
.qedit .o { display: flex; gap: 8px; align-items: center; }
.qedit .o input[type=text] { flex: 1; height: 40px; border-radius: 9px; border: 1px solid #C9D1EA; padding: 0 10px; font-size: 15px; }
.qedit .o input[type=radio] { width: 22px; height: 22px; }
.scan video { width: 100%; border-radius: 16px; background: #000; aspect-ratio: 1; object-fit: cover; }
#toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 90; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; }
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 18px; padding: 32px 24px; text-align: center; }
.login .logo { width: 96px; height: 96px; border-radius: 28px; }
.empty { text-align: center; color: var(--sub); padding: 24px 0; font-size: 14px; }
.ywrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; -webkit-overflow-scrolling: touch; }
.ytab { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.ytab th, .ytab td { padding: 3px 2px; text-align: center; white-space: nowrap; }
.ytab thead th { font-weight: 500; color: var(--sub); vertical-align: bottom; }
.ytab .ym { font-size: 10px; color: var(--blue); font-weight: 700; height: 14px; text-align: left; padding-left: 3px; }
.ytab .yd { font-size: 10px; min-width: 18px; }
.ytab .yname { position: sticky; left: 0; background: #fff; text-align: left; box-sizing: border-box; width: 84px; min-width: 84px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; font-weight: 700; font-size: 13px; z-index: 1; padding-right: 6px; }
.ytab .ycnt { position: sticky; left: 84px; background: #fff; box-sizing: border-box; width: 50px; min-width: 50px; z-index: 1; border-right: 1px solid var(--line); padding-right: 6px; }
.ytab .ycnt b { display: block; font-size: 13px; }
.ytab .ycnt span { font-size: 10px; color: var(--sub); }
.ytab td i { display: block; width: 16px; height: 16px; border-radius: 4px; background: #E6E9F2; margin: 0 auto; }
.ytab td i.on { background: var(--blue); }
.ytab .yt { font-size: 10px; font-weight: 500; color: var(--sub); }
.ytab .ysum td, .ytab .ysum th { color: var(--sub); font-size: 11px; border-top: 1px solid var(--line); }
.pwa-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 14px; background: #EAF0FF; border-bottom: 1px solid #CDD8F6; color: var(--ink); font-size: 14px; line-height: 1.35; }
.pwa-bar img { width: 28px; height: 28px; border-radius: 7px; flex: 0 0 auto; background: #fff; }
.pwa-txt { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.pwa-btn { flex: 0 0 auto; border: 0; border-radius: 999px; background: var(--blue); color: #fff; font: inherit; font-size: 13px; font-weight: 700; padding: 7px 14px; cursor: pointer; white-space: nowrap; }
.pwa-x { flex: 0 0 auto; border: 0; background: none; color: var(--sub); font-size: 16px; width: 30px; height: 30px; cursor: pointer; }
.pwa-help { position: fixed; inset: 0; z-index: 100; background: rgba(24,32,58,.45); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.pwa-help-card { background: #fff; border-radius: 18px; padding: 20px 20px 16px; width: 100%; max-width: 420px; font-size: 15px; line-height: 1.6; }
.pwa-help-card ol { margin: 10px 0 14px; padding-left: 20px; }
.pwa-help-card .pwa-btn { width: 100%; padding: 11px; font-size: 15px; }
.pwa-share { display: inline-block; border: 1.5px solid currentColor; border-radius: 5px; padding: 0 4px; font-size: 12px; color: var(--blue); }
