:root {
  color-scheme: light;
  --paper: #f4efe5;
  --paper-deep: #e9dfcf;
  --ink: #27231f;
  --muted: #766e64;
  --line: rgba(53, 44, 36, .16);
  --accent: #8d382b;
  --wood: #9a6545;
  --card: rgba(255, 253, 248, .88);
  font-family: ui-serif, "Apple SD Gothic Neo", "Noto Serif KR", serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); min-height: 100vh; }
button, input { font: inherit; }
button { color: inherit; }
.topbar { position: sticky; top: 0; z-index: 20; height: 58px; padding: env(safe-area-inset-top) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; background: rgba(244,239,229,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.brand { border: 0; background: none; font-size: 21px; font-weight: 800; cursor: pointer; }
.account-area { display: flex; align-items: center; gap: 9px; font-family: ui-sans-serif, system-ui; }
.sync-status { color: var(--muted); font-size: 11px; }
.sync-status.syncing { color: #976b19; }
.sync-status.synced, .sync-status.ready { color: #39704a; }
.sync-status.error { color: #a1261c; }
.account-button { border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; background: var(--card); cursor: pointer; font-size: 12px; font-weight: 700; }
main { width: min(760px, 100%); margin: 0 auto; padding: 26px 18px calc(102px + env(safe-area-inset-bottom)); }
main > * { animation: content-in .34s ease-out both; }
.tabbar { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(3, 1fr); min-height: 66px; padding: 6px max(10px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(10px, env(safe-area-inset-left)); background: rgba(250,247,240,.94); border-top: 1px solid var(--line); backdrop-filter: blur(18px); }
.tabbar button { border: 0; background: none; color: var(--muted); display: grid; justify-items: center; gap: 2px; font: 12px ui-sans-serif, system-ui; cursor: pointer; }
.tabbar button span { font: 22px serif; }
.tabbar button.active { color: var(--accent); font-weight: 700; }
h1 { margin: 0 0 8px; font-size: clamp(28px, 7vw, 42px); }
h2 { margin: 0 0 14px; font-size: 22px; }
h3 { margin: 20px 0 8px; font-size: 17px; }
p { line-height: 1.75; }
.muted { color: var(--muted); }
.eyebrow { color: var(--accent); font: 700 12px ui-sans-serif, system-ui; letter-spacing: .12em; }
.summary { text-align: center; margin-bottom: 25px; }
.chosen { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.chosen span { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; }
.sticks { display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 12px; margin: 22px 0; }
.stick { position: relative; border: 0; min-height: 180px; border-radius: 15px; color: white; background: linear-gradient(100deg, #805136, var(--wood) 50%, #74462f); box-shadow: 0 5px 12px rgba(45,30,20,.18); cursor: pointer; transform-origin: 50% 90%; transition: transform .28s cubic-bezier(.2,.75,.25,1), box-shadow .25s, filter .25s, background .3s; }
.stick::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; }
.stick .mark { position: relative; display: grid; justify-items: center; gap: 24px; opacity: .78; transition: transform .25s, opacity .25s; }
.stick .mark i { width: 10px; height: 10px; display: block; border: 1px solid rgba(255,255,255,.48); border-radius: 50%; }
.stick .mark b { font: 25px ui-sans-serif, system-ui; }
.stick .reveal { position: relative; display: grid; gap: 8px; font-weight: 800; font-size: 18px; }
.stick.selected { background: linear-gradient(120deg, #a04a38, var(--accent)); transform: translateY(-11px) rotateY(0); box-shadow: 0 15px 26px rgba(91,38,29,.28); animation: stick-reveal .58s cubic-bezier(.2,.85,.25,1.15) both; }
.stick.selected .reveal { animation: reveal-text .5s .18s both; }
.stick:disabled:not(.selected) { opacity: .58; cursor: default; }
.sticks.shuffling { perspective: 850px; }
.sticks.shuffling .stick { pointer-events: none; box-shadow: 0 15px 25px rgba(45,30,20,.26); will-change: transform; }
.controls { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.button { border: 1px solid var(--line); border-radius: 12px; padding: 11px 17px; background: var(--card); cursor: pointer; font-weight: 700; transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease; }
.button.primary { border-color: var(--accent); color: white; background: var(--accent); }
.button.danger { color: #a1261c; }
.button:disabled { opacity: .45; cursor: default; }
.shuffle-button span { display: inline-block; transition: transform .35s; }
.shuffling + .controls .shuffle-button span { animation: spin .55s linear infinite; }
.record-tools { display: flex; gap: 9px; flex-wrap: wrap; margin: 17px 0; }
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 17px; padding: 19px; box-shadow: 0 4px 14px rgba(47,35,25,.05); }
.result-head { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 15px; margin-bottom: 18px; }
.hex-symbol { font-size: 62px; line-height: 1; }
.result-head h1 { margin: 0; font-size: clamp(27px, 7vw, 38px); }
.result-head p { margin: 4px 0 0; color: var(--muted); }
.scripture { padding: 13px 0; border-bottom: 1px solid var(--line); }
.scripture .original { font-weight: 700; line-height: 1.7; }
.scripture p { margin: 6px 0 0; }
details { border-bottom: 1px solid var(--line); padding: 13px 0; }
summary { cursor: pointer; font-weight: 700; }
details p { white-space: pre-wrap; }
.line-card, .list-row { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 13px; padding: 15px; background: var(--card); cursor: pointer; transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, background .2s ease; }
.line-card { margin-top: 9px; }
.line-card strong, .list-row strong { display: block; font-size: 16px; }
.line-card span, .list-row span { display: block; margin-top: 5px; color: var(--muted); line-height: 1.45; }
.list { display: grid; gap: 9px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.list-row .row-main { min-width: 0; }
.list-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { width: 100%; border: 1px solid var(--line); border-radius: 13px; background: white; padding: 13px 14px; margin: 4px 0 16px; }
.back { border: 0; background: none; padding: 0 0 17px; color: var(--accent); cursor: pointer; font-weight: 700; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.private-notice { display: grid; gap: 7px; margin-top: 20px; padding: 15px; border: 1px dashed rgba(141,56,43,.35); border-radius: 13px; background: rgba(141,56,43,.045); }
.private-notice span { color: var(--muted); font-size: 14px; line-height: 1.5; }
.private-notice .button { justify-self: start; margin-top: 3px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: auto; }
.toast { position: fixed; z-index: 50; bottom: calc(84px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); padding: 10px 15px; border-radius: 999px; color: white; background: rgba(38,34,30,.92); font: 14px ui-sans-serif, system-ui; }
dialog { width: min(440px, calc(100% - 28px)); border: 0; border-radius: 20px; padding: 0; color: var(--ink); background: var(--paper); box-shadow: 0 24px 80px rgba(34,25,18,.3); }
dialog::backdrop { background: rgba(34,29,24,.42); backdrop-filter: blur(5px); }
.auth-card { position: relative; padding: 27px; }
.auth-card h2 { margin-top: 8px; }
.auth-card label { display: block; margin: 18px 0 7px; font-weight: 700; }
.auth-card .search { margin-bottom: 10px; }
.auth-message { min-height: 24px; color: var(--accent); font-size: 14px; }
.account-actions { display: grid; gap: 9px; margin: 20px 0 12px; }
.dialog-close { position: absolute; right: 13px; top: 11px; border: 0; background: none; cursor: pointer; color: var(--muted); font: 25px ui-sans-serif, system-ui; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes content-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes stick-reveal {
  0% { transform: translateY(0) rotateY(0); }
  42% { transform: translateY(-8px) rotateY(90deg) scale(1.04); }
  43% { transform: translateY(-8px) rotateY(-90deg) scale(1.04); }
  100% { transform: translateY(-11px) rotateY(0) scale(1); }
}
@keyframes reveal-text { from { opacity: 0; transform: scale(.75); } to { opacity: 1; transform: scale(1); } }
@media (hover: hover) {
  .stick:not(:disabled):hover { transform: translateY(-9px) rotate(-1deg) scale(1.025); filter: brightness(1.08); box-shadow: 0 14px 24px rgba(45,30,20,.24); }
  .stick:not(:disabled):hover .mark { transform: scale(1.18); opacity: 1; }
  .button:not(:disabled):hover { transform: translateY(-2px); border-color: rgba(141,56,43,.45); box-shadow: 0 7px 16px rgba(47,35,25,.1); }
  .line-card:hover, .list-row:hover { transform: translateY(-3px); border-color: rgba(141,56,43,.38); box-shadow: 0 8px 18px rgba(47,35,25,.1); background: #fffdf8; }
  .tabbar button:hover { color: var(--accent); transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
@media (max-width: 480px) { .sticks { gap: 8px; } .stick { min-height: 145px; } main { padding-inline: 14px; } }
