@font-face { font-family: OP; src: url(../fonts/overpass-latin-900-normal.woff2) format('woff2'); font-weight: 900; }
@font-face { font-family: OP; src: url(../fonts/overpass-latin-800-normal.woff2) format('woff2'); font-weight: 800; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fd0f2; font-family: OP, system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas { display: block; }

#load { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: max(7vh, env(safe-area-inset-top)) 20px max(9vh, env(safe-area-inset-bottom)); background: #7cc8f0 url(../ui/start.jpg) center / cover no-repeat; color: #3a1f0b; z-index: 50; transition: opacity .5s; }
#load img { width: min(78vw, 420px); filter: drop-shadow(0 10px 18px rgba(120, 60, 0, .35)); animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) scale(1.02); } }
@media (prefers-reduced-motion: reduce) { #load img { animation: none; } }
#load span { font-weight: 900; font-size: 16px; color: #fff; background: rgba(17, 17, 17, .6); border-radius: 999px; padding: 10px 20px; }
#playBtn { border: 0; border-radius: 26px; padding: 18px 64px; font: 900 30px OP, system-ui; color: #fff; background: linear-gradient(#ff5a3c, #d9201a); border-bottom: 6px solid #9c1410; box-shadow: 0 10px 24px rgba(0, 0, 0, .35); cursor: pointer; animation: bob 1.4s ease-in-out infinite; }
#playBtn[hidden] { display: none; }
#load.off { opacity: 0; pointer-events: none; }

#hud { position: fixed; inset: 0; pointer-events: none; color: #fff; }
#topbar { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#brand { height: 46px; width: auto; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .35)); }
#where { background: rgba(17, 17, 17, .65); border-radius: 999px; padding: 7px 12px; font-weight: 800; font-size: 13px; opacity: 0; transition: opacity .3s; }
#where.on { opacity: 1; }
#hint { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: rgba(17, 17, 17, .7); border-radius: 999px; padding: 9px 16px; font-weight: 800; font-size: 14px; transition: opacity .6s; white-space: nowrap; }
#hint.off { opacity: 0; }

/* ---------- create your resident ---------- */
#creator { position: fixed; inset: 0; z-index: 40; display: grid; grid-template-rows: minmax(0, 46%) minmax(0, 1fr); background: linear-gradient(#ffe27a, #ffc928); color: #3a1f0b; }
@media (min-width: 900px) { #creator { grid-template-rows: none; grid-template-columns: minmax(0, 1fr) 460px; } }
.cr-stage { position: relative; min-height: 0; background: #f2b640 url(../ui/creator-bg.jpg) center 82% / cover no-repeat; }
#crView { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.cr-title { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 16px; font-weight: 900; font-size: 22px; }
.cr-dice { position: absolute; right: 14px; bottom: 12px; width: 52px; height: 52px; border: 0; border-radius: 50%; background: #fff; font-size: 26px; box-shadow: 0 6px 16px rgba(0, 0, 0, .2); cursor: pointer; }
.cr-panel { min-height: 0; background: #fffaf0; border-radius: 22px 22px 0 0; box-shadow: 0 -8px 24px rgba(0, 0, 0, .12); padding: 14px 16px max(16px, env(safe-area-inset-bottom)); overflow-y: auto; }
@media (min-width: 900px) { .cr-panel { border-radius: 0; } }
.cr-step { display: flex; flex-direction: column; gap: 12px; min-height: 100%; }
.cr-step[hidden] { display: none; }
.cr-tabs { display: flex; gap: 6px; background: #f1e6cc; border-radius: 999px; padding: 4px; }
.cr-tabs button { flex: 1; border: 0; background: none; border-radius: 999px; padding: 10px 4px; font: 900 15px OP, system-ui; color: #7a5a33; cursor: pointer; }
.cr-tabs button.on { background: #3a1f0b; color: #ffd23a; }
.cr-row b { display: block; font-size: 14px; margin: 4px 0 8px; }
.cr-items { display: flex; flex-wrap: wrap; gap: 9px; }
.sw { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 2px #e3d3ae; cursor: pointer; }
.sw.on { box-shadow: 0 0 0 3px #3a1f0b; transform: scale(1.08); }
.chip { border: 2px solid #e3d3ae; background: #fff; border-radius: 999px; padding: 10px 14px; font: 800 14px OP, system-ui; color: #3a1f0b; cursor: pointer; min-height: 44px; }
.chip.on { background: #3a1f0b; border-color: #3a1f0b; color: #ffd23a; }
.cr-next { margin-top: auto; border: 0; border-radius: 16px; padding: 15px; font: 900 18px OP, system-ui; background: #e8302a; color: #fff; cursor: pointer; }
.cr-back { border: 2px solid #e3d3ae; border-radius: 16px; padding: 15px; font: 900 16px OP, system-ui; background: #fff; color: #3a1f0b; cursor: pointer; }
.cr-btns { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: auto; }
.cr-btns .cr-next { margin: 0; }
#crAcc h3 { margin: 4px 0; font-size: 20px; }
#crAcc label { display: flex; flex-direction: column; gap: 5px; font-weight: 800; font-size: 14px; }
#crAcc input { font: 700 16px OP, system-ui; padding: 12px 14px; border-radius: 12px; border: 2px solid #e3d3ae; background: #fff; color: #3a1f0b; }
#crAcc input:focus { outline: none; border-color: #3a1f0b; }
.opt { font-weight: 700; opacity: .6; }
.cr-msg { margin: -6px 0 0; font-size: 12.5px; font-weight: 700; opacity: .7; }
.cr-msg.bad { color: #c4142b; opacity: 1; }
.cr-err { margin: 0; min-height: 18px; color: #c4142b; font-weight: 800; font-size: 14px; }

/* ---------- areas, map, buttons ---------- */
#area { background: rgba(17, 17, 17, .8); border-radius: 999px; padding: 8px 14px; font-weight: 900; font-size: 14px; color: #ffd23a; }
#where { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 46px); left: 50%; transform: translateX(-50%); white-space: nowrap; }
#fade { position: fixed; inset: 0; background: #ffc928; opacity: 0; pointer-events: none; transition: opacity .35s; z-index: 30; }
#fade.on { opacity: 1; }
.icobtn { position: fixed; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 20; width: 78px; border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 0; cursor: pointer; transition: transform .12s; }
.icobtn:active { transform: scale(.9); }
.icobtn img { width: 68px; height: 68px; object-fit: contain; filter: drop-shadow(0 5px 8px rgba(0, 0, 0, .35)); }
.icobtn span { margin-top: -6px; font: 900 13px OP, system-ui; color: #fff; text-shadow: 0 0 3px #3a1f0b, 0 0 3px #3a1f0b, 0 2px 3px #3a1f0b; }
#mapBtn { right: 10px; } #meBtn { left: 10px; } #chatBtn { right: 92px; }
#coins { display: flex; align-items: center; gap: 4px; background: rgba(17, 17, 17, .8); border-radius: 999px; padding: 3px 12px 3px 3px; font-weight: 900; color: #ffd23a; }
#coins img { width: 30px; height: 30px; }
#topbar { justify-content: flex-start; } #area { margin-left: auto; }
#chatBar { position: fixed; left: 10px; right: 10px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 92px); z-index: 25; display: flex; gap: 8px; align-items: center; background: #fffaf0; border: 3px solid #f2a007; border-radius: 999px; padding: 6px; box-shadow: 0 8px 20px rgba(0,0,0,.3); max-width: 560px; margin: 0 auto; }
#chatBar[hidden] { display: none; }
#chatBar input { flex: 1; min-width: 0; border: 0; background: none; font: 800 16px OP, system-ui; color: #3a1f0b; padding: 8px 10px; outline: none; }
#chatBar button { border: 0; border-radius: 999px; background: #e8302a; color: #fff; font: 900 15px OP, system-ui; padding: 10px 16px; cursor: pointer; }
#chatBar .cx { background: none; padding: 0; width: 40px; height: 40px; } #chatBar .cx img { width: 40px; height: 40px; }
#hint { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 80px); }

#citymap { position: fixed; inset: 0; z-index: 35; background: rgba(10, 30, 50, .55); display: flex; align-items: center; justify-content: center; padding: 14px; }
#citymap[hidden] { display: none; }
.map-box { width: min(560px, 100%); background: #fffaf0; border-radius: 24px; padding: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); color: #3a1f0b; }
.map-head { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 10px; }
.map-head h3 { margin: 0; font-size: 22px; }
.map-x, .pc-x { width: 46px; height: 46px; border: 0; background: none; padding: 0; cursor: pointer; } .map-x img, .pc-x img { width: 100%; height: 100%; filter: drop-shadow(0 3px 5px rgba(0,0,0,.35)); }
.map-island { position: relative; aspect-ratio: 1; border-radius: 18px; overflow: hidden; }
.map-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.map-island .sea { fill: #3aa6dc; } .map-island .sand { fill: #f0dca8; }
.map-island .roads line { stroke: #e8dcc2; stroke-width: 2.6; stroke-linecap: round; }
.map-pin { position: absolute; transform: translate(-50%, -50%); border: 0; background: none; padding: 0; width: 20%; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; cursor: pointer; color: #3a1f0b; border-radius: 50%; }
.map-pin:hover, .map-pin:focus-visible { background: radial-gradient(rgba(255,240,170,.55), rgba(255,240,170,0) 70%); outline: none; }
.map-pin i { display: none; }
.map-pin b { background: rgba(255,250,240,.95); border: 2px solid #3a1f0b; border-radius: 999px; padding: 3px 9px; box-shadow: 0 3px 8px rgba(0,0,0,.3); }
.map-pin small { display: none; }
.map-pin b { font: 900 11.5px OP, system-ui; white-space: nowrap; }
.map-pin.here b { background: #3a1f0b; color: #ffd23a; border-color: #ffd23a; }
.map-pin.here::after { content: 'YOU ARE HERE'; position: absolute; top: 4%; font: 900 9.5px OP, system-ui; background: #e8302a; color: #fff; border-radius: 6px; padding: 2px 5px; white-space: nowrap; }
.map-tip { text-align: center; margin: 10px 0 2px; font-weight: 800; font-size: 13px; opacity: .7; }

/* ---------- player card (frame art: ui/card.png, 1086x1448) ---------- */
#pcard { position: fixed; inset: 0; z-index: 36; background: rgba(10, 30, 50, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
#pcard[hidden] { display: none; }
.pc-box { position: relative; width: min(340px, 86vw); color: #3a1f0b; text-align: center; }
.pc-x { position: absolute; top: -8px; right: -8px; z-index: 5; }
.pc-coin { width: 1em; height: 1em; vertical-align: -3px; margin-right: 2px; }
.pc-card { position: relative; aspect-ratio: 1086 / 1448; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .4)); }
.pc-win { position: absolute; left: 13%; right: 16%; top: 9%; bottom: 44%; border-radius: 22% 22% 10% 10%; overflow: hidden; background: radial-gradient(circle at 50% 62%, #fffbe6 0, #ffe9a6 38%, var(--rc) 100%); }
.pc-pic { position: absolute; left: 50%; bottom: 0; height: 92%; transform: translateX(-50%); }
.pc-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pc-rank { position: absolute; right: 4%; top: 36%; width: 30%; height: auto; transform: rotate(8deg); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); }
.pc-stat { position: absolute; top: 58.5%; height: 16.5%; width: 26%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.pc-stat.s1 { left: 8.2%; } .pc-stat.s2 { left: 37%; } .pc-stat.s3 { left: 65.6%; }
.pc-stat b { font-size: clamp(18px, 6vw, 24px); line-height: 1; } .pc-stat span { font-weight: 800; font-size: 11px; opacity: .75; }
.pc-name { position: absolute; left: 17%; right: 17%; top: 79%; height: 9%; display: flex; align-items: center; justify-content: center; font: 900 clamp(15px, 5vw, 20px) OP, system-ui; color: #5a2e08; text-shadow: 0 1px 0 rgba(255, 255, 255, .5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-joined { margin: 12px 0 8px; font-weight: 800; font-size: 13px; color: #fffaf0; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.pc-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pc-badge { background: #3a1f0b; color: #ffd23a; border-radius: 999px; padding: 6px 11px; font-weight: 900; font-size: 12.5px; }
.pc-none { font-weight: 800; font-size: 12.5px; color: #fffaf0; opacity: .8; }

/* ---------- my villa ---------- */
#homeBtn { left: 92px; } #homeBtn[hidden] { display: none; }
.homeico { font-style: normal; font-size: 46px; line-height: 68px; height: 68px; filter: drop-shadow(0 5px 8px rgba(0,0,0,.35)); }
.pc-home { margin: 0 auto 10px; display: block; border: 0; border-radius: 999px; padding: 12px 22px; font: 900 16px OP, system-ui; color: #fff; background: linear-gradient(#2fb35a, #1f8a42); border-bottom: 4px solid #146a30; box-shadow: 0 6px 14px rgba(0,0,0,.3); cursor: pointer; }

/* ---- log in / staff desk dialogs ---- */
.dlg{position:fixed;inset:0;z-index:60;display:grid;place-items:center;background:rgba(40,22,6,.55);padding:16px}
.dlg-box{width:min(380px,100%);background:#fff7e6;border:4px solid #f2b236;border-radius:22px;padding:22px 20px 16px;box-shadow:0 14px 40px rgba(0,0,0,.35);display:flex;flex-direction:column;gap:10px;font-family:OP,system-ui,sans-serif;color:#4a2f05}
.dlg-box h3{margin:0 0 4px;text-align:center;font-size:22px}
.dlg-logo{width:150px;align-self:center;margin-top:-6px}
.dlg-box label{display:flex;flex-direction:column;gap:4px;font-weight:800;font-size:14px}
.dlg-box input,.dlg-box select{font:inherit;font-size:16px;padding:10px 12px;border:2px solid #e3c48a;border-radius:12px;background:#fff;color:#3a2405}
.dlg-box input:focus,.dlg-box select:focus{outline:3px solid #ffd23a;border-color:#d99a1a}
.dlg-go{font:inherit;font-weight:900;font-size:18px;padding:12px;border:0;border-radius:14px;background:linear-gradient(#ffcf3a,#f29a12);color:#5a2a00;box-shadow:0 4px 0 #b9670a;cursor:pointer}
.dlg-go:disabled{opacity:.6}
.dlg-link,.cr-login{font:inherit;font-weight:800;background:none;border:0;color:#b35d00;text-decoration:underline;cursor:pointer;padding:6px;min-height:40px}
.dlg-note{margin:0;font-size:13px;text-align:center;opacity:.8}
.cr-err.ok{color:#1f7a3a}
#adminBtn{position:fixed;right:12px;bottom:96px;z-index:20}
#online{display:inline-flex;align-items:center;gap:6px;margin-left:8px;padding:6px 12px;border-radius:999px;background:rgba(0,0,0,.45);color:#fff;font:800 14px OP,system-ui}
#online::before{content:'';width:9px;height:9px;border-radius:50%;background:#3ddc6a;box-shadow:0 0 8px #3ddc6a}
