/* 에덴 빌리지 — 이용자 화면 스타일 (따뜻한 정원 톤) */
/* 글꼴: Pretendard (SIL Open Font License 1.1) — fonts.css(자체 호스팅) 또는 운영 서버에서는 jsDelivr CDN */
:root {
  --cream: #f7f0e3; --paper: #fffaf1; --ink: #3a3128; --ink-soft: #6f6253; --line: #e6d9c2;
  --leaf: #6f9a4f; --leaf-d: #4f7a37; --sky: #bfe0ef; --gold: #d9a23a; --rose: #d9705f; --plum: #7a5c8f;
  --glass: rgba(255, 250, 241, .92); --shadow: 0 6px 24px rgba(58, 49, 40, .16);
  --r: 14px; --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --text-xs: 12px; --text-sm: 13px; --text-md: 15px; --text-lg: 17px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: var(--font); color: var(--ink); background: var(--cream); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--leaf-d); }
.muted { color: var(--ink-soft); }
[hidden] { display: none !important; }

/* ---------------- 첫 화면 ---------------- */
body.landing { min-height: 100%; overflow-x: hidden; background: linear-gradient(#cfe8f3 0%, #f3ead6 62%, #a8cf8a 62%); }
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.sun { position: absolute; top: 7%; right: 9%; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(#fff5c9, #ffd877 60%, rgba(255, 216, 119, 0) 72%); }
.cloud { position: absolute; height: 34px; border-radius: 40px; background: #fff; opacity: .85; animation: drift 70s linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 46px; height: 46px; top: -22px; left: 18px; } .cloud::after { width: 34px; height: 34px; top: -14px; left: 54px; }
.c1 { top: 14%; left: -10%; width: 120px; } .c2 { top: 24%; left: -30%; width: 90px; animation-duration: 95s; } .c3 { top: 8%; left: -50%; width: 140px; animation-duration: 120s; }
@keyframes drift { to { transform: translateX(160vw); } }
.hills { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: 46vh; z-index: 0; }
.land { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 56px 16px 40px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: start; }
.kicker { margin: 0; letter-spacing: .2em; font-size: 13px; color: var(--leaf-d); font-weight: 700; }
.intro h1 { font-size: clamp(40px, 7vw, 68px); margin: 6px 0 12px; letter-spacing: -.02em; color: #3d5a2a; text-shadow: 0 2px 0 #fff; }
.lead { font-size: 18px; line-height: 1.7; margin: 0 0 24px; }
.features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.features li { background: rgba(255, 250, 241, .8); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.features span { font-size: 14px; color: var(--ink-soft); }
.card-soft { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 22px; }
.entry h2 { margin: 0 0 6px; }
.tabs { display: flex; gap: 4px; background: #f1e6d2; padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tabs button { flex: 1; border: 0; background: none; padding: 10px 6px; border-radius: 9px; font-weight: 600; color: var(--ink-soft); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.pane { display: none; flex-direction: column; gap: 12px; } .pane.on { display: flex; }
.pane label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.pane input { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px; }
.pane input:focus { outline: 3px solid rgba(111, 154, 79, .3); border-color: var(--leaf); }
.btn-main { display: block; text-align: center; text-decoration: none; border: 0; background: var(--leaf); color: #fff; padding: 14px; border-radius: 12px; font-weight: 700; font-size: 16px; box-shadow: 0 3px 0 var(--leaf-d); }
.btn-main:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--leaf-d); }
.btn-main:disabled { opacity: .6; }
.btn-link { border: 0; background: none; color: var(--ink-soft); text-decoration: underline; margin-top: 10px; }
.hint { font-size: 13px; color: var(--ink-soft); margin: 0; line-height: 1.5; }
.error { color: #b3412f; background: #fdecea; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 12px 0 0; }
.foot { position: relative; z-index: 1; text-align: center; color: #3d5a2a; font-size: 13px; padding: 20px 16px 28px; }
@media (max-width: 820px) { .land { grid-template-columns: 1fr; padding-top: 32px; gap: 24px; } .lead { font-size: 16px; } .features { grid-template-columns: 1fr; } }

/* ---------------- 게임 화면 (2차 개편: 단순하고 조용한 화면) ---------------- */
body.play { overflow: hidden; background: #2f3b2a; touch-action: none; user-select: none; -webkit-user-select: none; font-size: var(--text-md); letter-spacing: -0.01em; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(58, 49, 40, .08); background: rgba(255, 252, 246, .94); border-radius: 999px; padding: 7px 13px; box-shadow: 0 2px 10px rgba(40, 32, 24, .14); font-size: var(--text-sm); font-weight: 600; color: var(--ink); white-space: nowrap; }
.chip b { font-weight: 700; } .chip small { color: var(--ink-soft); font-weight: 500; } .chip .caret { color: #a3967f; font-size: 10px; }
.chip.gold b { color: #9a6410; }
.chip:hover { background: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c98a2b; flex: none; }
.dot.ok { background: #5fbf57; } .dot.bad { background: #d9534f; }
#hud-top { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 12px 8px; pointer-events: none; }
#hud-top > * { pointer-events: auto; }
#where { max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.badge { display: inline-block; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--rose); color: #fff; font-size: 11px; font-weight: 700; text-align: center; font-style: normal; }

/* 오른쪽 패널: 대화 · 사람들 */
#side { position: fixed; right: 12px; top: calc(58px + env(safe-area-inset-top)); bottom: calc(86px + env(safe-area-inset-bottom)); width: 330px; z-index: 15; display: flex; flex-direction: column; background: rgba(255, 252, 246, .95); border: 1px solid rgba(58, 49, 40, .08); border-radius: 16px; box-shadow: 0 8px 28px rgba(40, 32, 24, .18); overflow: hidden; }
#side:not(.open) { display: none; }
.side-tabs { display: flex; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); }
.side-tabs button { border: 0; background: none; padding: 8px 12px; border-radius: 10px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-soft); }
.side-tabs button.on { background: #f1e6d2; color: var(--ink); }
.side-tabs .side-close { margin-left: auto; width: 32px; padding: 6px 0; }
#side section { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.scope { display: flex; gap: 4px; padding: 8px 10px 0; }
.scope button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; font-size: var(--text-xs); font-weight: 600; color: var(--ink-soft); }
.scope button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
#chat-log { list-style: none; margin: 0; padding: 8px 12px; overflow-y: auto; flex: 1; font-size: 14px; line-height: 1.5; user-select: text; -webkit-user-select: text; }
#chat-log li { padding: 3px 0; word-break: break-word; }
#chat-log .nick { font-weight: 700; cursor: pointer; color: #3d5a2a; }
#chat-log .nick.guest { color: #857a6b; } #chat-log .nick.staff { color: #2d6aa3; }
#chat-log .near { font-size: 10px; color: #7a5c8f; background: #efe7f6; border-radius: 4px; padding: 0 4px; margin-right: 4px; font-weight: 700; }
#chat-log time { color: #b3a68f; font-size: 11px; margin-left: 4px; }
#chat-log .sys { color: #8a7d69; font-size: var(--text-xs); }
#chat-log .ann { background: #fff4d6; border-radius: 10px; padding: 8px 10px; margin: 6px 0; }
#chat-log .deleted .txt { color: #a3967f; font-style: italic; }
#chat-log .rep { border: 0; background: none; color: #c7b9a2; font-size: 12px; padding: 0 4px; visibility: hidden; }
#chat-log li:hover .rep { visibility: visible; }
#chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
#chat-input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; font-size: 15px; user-select: text; -webkit-user-select: text; }
#chat-input:focus { outline: 2px solid rgba(111, 154, 79, .35); border-color: var(--leaf); }
#chat-form button { border: 0; background: var(--leaf); color: #fff; border-radius: 12px; padding: 0 14px; font-weight: 700; font-size: var(--text-sm); }
.people { list-style: none; margin: 0; padding: 4px 8px 10px; overflow-y: auto; }
.people h4 { margin: 10px 6px 4px; font-size: var(--text-xs); color: var(--ink-soft); font-weight: 700; }
.person { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 10px; }
.person:hover { background: #f6eedf; }
.person canvas { flex: none; border-radius: 50%; background: #e7f2da; }
.person .who { flex: 1; min-width: 0; line-height: 1.3; }
.person .who b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .who small { color: var(--ink-soft); font-size: var(--text-xs); display: flex; align-items: center; gap: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.person .acts { display: flex; gap: 2px; }
.person .acts button { border: 0; background: none; width: 30px; height: 30px; border-radius: 8px; font-size: 15px; }
.person .acts button:hover { background: #ebe0cb; }
.st { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.st.available { background: #5fbf57; } .st.worship { background: #9b7bd1; } .st.away { background: #e8b04a; } .st.dnd { background: #d9534f; }

/* 하단 도구 막대 */
#dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 16; display: flex; align-items: center; gap: 2px; background: rgba(255, 252, 246, .96); border: 1px solid rgba(58, 49, 40, .08); padding: 5px; border-radius: 18px; box-shadow: 0 8px 28px rgba(40, 32, 24, .2); }
#dock > button { position: relative; border: 0; background: none; border-radius: 12px; min-width: 52px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 20px; gap: 2px; color: var(--ink); }
#dock > button span { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
#dock > button:hover, #dock > button.on { background: #f1e6d2; }
#dock > button i.badge { position: absolute; top: 4px; right: 6px; }
#dock .sep { width: 1px; height: 30px; background: var(--line); margin: 0 4px; }
#dock .me { flex-direction: row; gap: 8px; padding: 0 12px 0 6px; min-width: 0; }
#dock .me canvas { border-radius: 50%; background: #e7f2da; }
#dock .me .me-name { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
#dock .me .me-name b { font-size: 14px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dock .me .me-name small { font-size: 11px; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; font-weight: 600; }

/* 팝오버 메뉴 */
.pop { position: fixed; z-index: 30; background: #fffcf6; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(40, 32, 24, .22); padding: 6px; min-width: 220px; }
.pop button.item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; text-align: left; }
.pop button.item:hover, .pop button.item.on { background: #f1e6d2; }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.pop .st-text { display: flex; gap: 6px; padding: 6px 8px 8px; }
.pop .st-text input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 14px; user-select: text; -webkit-user-select: text; }
#emotes { position: fixed; z-index: 30; display: flex; gap: 2px; }
#emotes button { border: 0; background: none; font-size: 26px; width: 46px; height: 46px; border-radius: 12px; }
#emotes button:hover { background: #f1e6d2; }

/* 상황별 행동 버튼 (가까이 있을 때만 나타남) */
#action { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 14; border: 0; background: var(--ink); color: #fff; padding: 10px 18px 10px 10px; border-radius: 999px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); animation: pop .18s ease; }
#action kbd { background: #fff; color: var(--ink); border-radius: 7px; padding: 2px 8px; font-family: inherit; font-weight: 800; font-size: 13px; }
@keyframes pop { from { transform: translateX(-50%) scale(.9); opacity: 0; } }

/* 조이스틱 (터치 기기에서만) */
#joystick { position: fixed; left: calc(20px + env(safe-area-inset-left)); bottom: calc(96px + env(safe-area-inset-bottom)); width: 116px; height: 116px; border-radius: 50%; background: rgba(255, 255, 255, .2); border: 2px solid rgba(255, 255, 255, .45); z-index: 16; display: none; touch-action: none; }
#joystick .knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: rgba(255, 252, 246, .95); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
body.touch #joystick { display: block; }
body.touch.panel-open #joystick { display: none; }

/* 모달 */
#modal { position: fixed; inset: 0; z-index: 40; background: rgba(30, 26, 22, .42); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { width: min(560px, 100%); max-height: min(86vh, 760px); background: #fffcf6; border-radius: 20px; box-shadow: 0 20px 50px rgba(30, 24, 18, .3); display: flex; flex-direction: column; overflow: hidden; }
.modal-box.wide { width: min(920px, 100%); }
.modal-box header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-box h2 { margin: 0; font-size: var(--text-lg); font-weight: 800; }
.modal-box .close { border: 0; background: #f1e6d2; width: 34px; height: 34px; border-radius: 50%; }
.modal-body { padding: 18px 20px 22px; overflow-y: auto; user-select: text; -webkit-user-select: text; font-size: var(--text-md); }
.modal-body h3 { margin: 20px 0 8px; font-size: 15px; font-weight: 700; }
.modal-body p { line-height: 1.65; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 14px; font-weight: 600; font-size: 14px; }
.btn.primary { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.warn { background: #fff; border-color: #e3b7ad; color: #a1402f; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-col { display: flex; flex-direction: column; gap: 12px; }
.form-col label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.form-col input, .form-col select, .form-col textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; font-size: 15px; }
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.list > li { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; }
.grid-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.item-card { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.item-card canvas { align-self: center; }
.item-card .name { font-weight: 700; } .item-card .desc { font-size: 12px; color: var(--ink-soft); min-height: 32px; line-height: 1.45; }
.item-card .price { color: #8a5a10; font-weight: 700; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #efe5d2; color: var(--ink-soft); font-weight: 700; }
.tag.ok { background: #e1f0d6; color: #3f6a28; } .tag.gold { background: #fbecc8; color: #8a5a10; }
.bar { height: 8px; background: #efe5d2; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #8cc56b, #6f9a4f); border-radius: 999px; }
.quiz-choice { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 13px 15px; margin: 8px 0; font-size: 15px; }
.quiz-choice.right { background: #e1f0d6; border-color: #8cc56b; } .quiz-choice.wrong { background: #fbe3dd; border-color: #e3a090; }
.video { position: relative; padding-top: 56.25%; background: #1f1b17; border-radius: 14px; overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .novideo { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; color: #e9dcc5; padding: 20px; line-height: 1.6; }
.scripture { background: #fbf4e4; border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 8px; white-space: pre-line; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatches button.on { box-shadow: 0 0 0 3px var(--leaf); }
.opts { display: flex; gap: 6px; flex-wrap: wrap; } .opts button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 12px; font-size: 14px; } .opts button.on { background: var(--leaf); color: #fff; border-color: var(--leaf); }
.char-edit { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: start; }
.char-edit .preview { background: radial-gradient(#e7f2da, #cfe3bb); border-radius: 16px; display: flex; justify-content: center; padding: 14px 0; }
.tips { display: grid; gap: 10px; }
.tips .tip { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tips .tip b { display: block; margin-bottom: 2px; } .tips .tip span { color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.tips .tip i { font-style: normal; font-size: 24px; }
@media (max-width: 520px) { .char-edit { grid-template-columns: 1fr; } }

#toasts { position: fixed; top: calc(62px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; align-items: center; width: min(92vw, 420px); pointer-events: none; }
.toast { background: rgba(40, 34, 28, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); animation: tin .25s ease; text-align: center; pointer-events: auto; }
.toast.warn { background: #a1402f; } .toast.good { background: #4f7a37; } .toast.gold { background: #a8741c; }
.toast .row { justify-content: center; margin-top: 8px; } .toast .btn { padding: 5px 10px; font-size: 13px; }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }
#banner { position: fixed; top: calc(60px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 45; width: min(92vw, 560px); background: #fff4d6; border: 1px solid #ecd28f; border-radius: 14px; box-shadow: var(--shadow); padding: 12px 16px; }
#banner b { display: block; margin-bottom: 4px; }
.noscript { position: fixed; inset: 0; background: var(--cream); padding: 40px; }

/* 모바일 */
@media (max-width: 760px) {
  #dock { left: 8px; right: 8px; transform: none; justify-content: space-between; }
  #dock > button { min-width: 0; flex: 1; height: 50px; }
  #dock .me .me-name { display: none; }
  #dock .me { padding: 0; flex: 1; justify-content: center; }
  #dock .sep { display: none; }
  #side { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(76px + env(safe-area-inset-bottom)); height: min(52vh, 440px); }
  #action { bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.touch #action { left: auto; right: 16px; transform: none; bottom: calc(110px + env(safe-area-inset-bottom)); }
  .modal-box { max-height: 92vh; }
}
@media (max-width: 380px) { #dock > button span { display: none; } }
