:root {
  --ink: #2a2622;
  --ink-soft: #6e665b;
  --paper: #f4ecdc;
  --paper-deep: #e8dcc4;
  --seal: #a8402d;
  --night: #1b1a24;
  --line: rgba(60, 45, 30, .18);
  --glass: rgba(24, 22, 30, .62);
  --serif: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", "Batang", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--night); color: #f6efe2; font-family: var(--sans); -webkit-tap-highlight-color: transparent; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.boot { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; background: var(--night); text-align: center; transition: opacity .8s ease; }
.boot h1 { margin: 0; font: 500 26px/1.3 var(--serif); letter-spacing: .12em; }
.boot p { margin: 0; color: #b5ab99; font-size: 13px; }
.boot.done { opacity: 0; pointer-events: none; }

.hud-top { position: fixed; z-index: 5; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.brand { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 10px; background: var(--glass); backdrop-filter: blur(8px); }
.brand strong { font: 500 14px/1.3 var(--serif); letter-spacing: .06em; }
.brand span { color: #c9bfae; font-size: 12px; }
.icon-btn { pointer-events: auto; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--glass); backdrop-filter: blur(8px); font-size: 13px; }
.icon-btn[aria-pressed="true"] { color: #f3cf8e; }

.hint, .toast { position: fixed; z-index: 5; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); margin: 0; padding: 7px 14px; border-radius: 999px; background: var(--glass); font-size: 13px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; transition: opacity .5s ease; }
.hint { bottom: calc(76px + env(safe-area-inset-bottom)); white-space: normal; border-radius: 14px; width: max-content; }
.hint.gone { opacity: 0; }
.toast { top: calc(68px + env(safe-area-inset-top)); color: #f3cf8e; }

.hud-bottom { position: fixed; z-index: 5; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 6px; max-width: calc(100vw - 24px); padding: 6px; border-radius: 14px; background: var(--glass); backdrop-filter: blur(8px); }
.hud-bottom button { min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .09); font-size: 14px; white-space: nowrap; }
.hud-bottom button:active { background: rgba(255, 255, 255, .2); }
.hud-bottom .primary, .primary { background: var(--seal); color: #fff6e6; font-weight: 600; }
.hud-bottom .primary:active { background: #8f3424; }

.sheet { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 18px 18px 22px; overflow-y: auto; border: 0; border-radius: 16px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 70px rgba(0, 0, 0, .55); }
.sheet::backdrop { background: rgba(10, 8, 14, .45); }
.sheet header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sheet h2 { margin: 0; font: 600 21px/1.4 var(--serif); }
.sheet h3 { margin: 20px 0 6px; font: 600 14px/1.4 var(--serif); color: var(--seal); }
.sheet p { margin: 0; font-size: 15px; line-height: 1.75; }
.sheet ul { margin: 0; padding-left: 18px; font-size: 15px; line-height: 1.75; }
.lede { color: var(--ink-soft); font-size: 14px !important; line-height: 1.6 !important; }
.eyebrow { color: var(--ink-soft); font-size: 13px !important; }
.note { margin-top: 10px !important; color: var(--ink-soft); font-size: 12px !important; line-height: 1.6 !important; }
.close { flex: none; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 13px; }

#birth-form { display: flex; flex-direction: column; gap: 12px; }
.segmented { display: flex; gap: 6px; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 10px 0; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; text-align: center; }
.segmented input:checked + span { border-color: var(--seal); background: var(--seal); color: #fff6e6; }
.segmented input:disabled + span { opacity: .4; }
.segmented input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.row { display: grid; gap: 8px; }
.row.three { grid-template-columns: 1.4fr 1fr 1fr; }
.row.two { grid-template-columns: 1fr 1fr; }
.row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-soft); }
.row input { width: 100%; min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fffaf0; color: var(--ink); font-size: 16px; }
.row input:disabled { opacity: .45; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--seal); }
.timer { color: var(--seal); font-size: 13px !important; font-weight: 600; }
.error { color: var(--seal); font-size: 14px !important; }
.wide { width: 100%; min-height: 48px; margin-top: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-deep); font-size: 15px; }
.wide.primary { border-color: var(--seal); background: var(--seal); }
.wide:disabled { opacity: .6; }
#wear-title { margin-top: 20px; }
#share { margin-top: 10px; }

.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.pillar { padding: 8px 2px; border: 1px solid var(--line); border-radius: 8px; background: #fffaf0; text-align: center; }
.pillar small { display: block; color: var(--ink-soft); font-size: 11px; }
.pillar b { display: block; font: 600 24px/1.25 var(--serif); }
.pillar i { display: block; color: var(--ink-soft); font-size: 12px; font-style: normal; }
.pillar.empty b { color: var(--line); }

.glance { margin-top: 4px; }
#glance-text { font-size: 15px; line-height: 1.8; }
#glance-text.waiting { color: var(--ink-soft); }
.traits { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0 !important; padding: 0 !important; list-style: none; }
.traits li { padding: 4px 10px; border-radius: 999px; background: var(--paper-deep); font-size: 13px; line-height: 1.5; }
.scene { margin-top: 8px; padding: 10px 12px; border-left: 3px solid var(--seal); border-radius: 4px; background: #fffaf0; }
.scene small { display: block; color: var(--seal); font-size: 12px; }
.scene p { font-size: 15px; line-height: 1.6; }
.strong { font-weight: 600; }
.next { margin-top: 8px; }
.next a { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px; margin-top: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fffaf0; color: var(--ink); text-decoration: none; font-size: 14px; }
.next a span { flex: none; color: var(--seal); font-size: 12px; }

@media (max-width: 380px) {
  .hud-bottom button { padding: 0 10px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .boot, .hint { transition: none; }
}
