* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #1b2e1d; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #2b2116; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#app { position: relative; height: 100%; max-width: 520px; margin: 0 auto; overflow: hidden; background: #2f5d34; }
.screen { position: absolute; inset: 0; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: none; }

/* Prihlásenie */
#join { display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 20%, #8fd17a, #2f5d34 70%); overflow-y: auto; padding: 16px; }
.join-card { background: #fff8e7; border-radius: 22px; padding: 22px 20px; width: 100%; max-width: 380px; box-shadow: 0 10px 30px #0006; border: 4px solid #8b5a2b; text-align: center; }
.join-card h1 { margin: 0 0 6px; font-size: 28px; color: #6b3fa0; }
.sub { margin: 0 0 14px; font-size: 14px; color: #6b5a40; }
.join-card label { display: block; text-align: left; font-weight: 600; font-size: 14px; margin: 10px 0; }
.join-card input { display: block; width: 100%; margin-top: 4px; padding: 12px; border-radius: 12px; border: 2px solid #c9a46a; font-size: 17px; background: #fff; touch-action: auto; user-select: text; -webkit-user-select: text; }
.pick-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-weight: 600; font-size: 14px; }
.pick-row span { width: 50px; text-align: left; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #c9a46a; }
.sw.on { box-shadow: 0 0 0 3px #6b3fa0; transform: scale(1.12); }
#jPreview { width: 96px; height: 96px; image-rendering: pixelated; }
.big { width: 100%; padding: 14px; border-radius: 14px; background: linear-gradient(#a978e0, #6b3fa0); color: #fff; font-size: 18px; font-weight: 700; box-shadow: 0 4px 0 #4a2a72; }
.big:disabled { opacity: .5; box-shadow: none; }
.big:active { transform: translateY(3px); box-shadow: 0 1px 0 #4a2a72; }
.hint { font-size: 12px; color: #8a7a5a; margin-bottom: 0; }

/* Hra */
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: calc(env(safe-area-inset-top) + 8px) 8px 0; pointer-events: none; }
.hud-left, .hud-right { background: #fff8e7ee; border: 3px solid #8b5a2b; border-radius: 14px; padding: 5px 10px; font-weight: 700; font-size: 14px; pointer-events: auto; box-shadow: 0 3px 0 #0003; }
.hud-right { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; }
#hDate { font-size: 12px; color: #6b5a40; }
#hSky { cursor: pointer; }
.hbtn { background: #f0dcb0; border-radius: 10px; width: 36px; height: 34px; font-size: 18px; }
#toasts { position: absolute; top: calc(env(safe-area-inset-top) + 64px); left: 10px; right: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: #fff8e7f2; border: 2px solid #8b5a2b; border-radius: 12px; padding: 6px 11px; font-size: 13px; font-weight: 600; max-width: 100%; box-shadow: 0 3px 8px #0004; animation: tin .25s ease-out; text-align: center; }
.toast.magic { background: linear-gradient(135deg, #f3e5ff, #ffe4f5); border-color: #9b59d0; color: #4a2a72; }
.toast.gift { border-color: #e08a1e; background: #fff1d6; }
.toast.day { border-color: #3c7d3f; background: #eaffdf; }
.toast.out { opacity: 0; transition: opacity .5s; }
@keyframes tin { from { transform: translateY(-10px); opacity: 0; } }
#chatlog { position: absolute; left: 8px; bottom: 150px; max-width: 70%; display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
.chatline { background: #0008; color: #fff; padding: 3px 8px; border-radius: 8px; font-size: 13px; transition: opacity 1s; }
.chatline b { color: #ffd76a; }

#bottom { position: absolute; left: 0; right: 0; bottom: 0; pointer-events: none; padding-bottom: env(safe-area-inset-bottom); background: linear-gradient(#0000, #1b2e1dcc 18%, #1b2e1d); }
#selName { text-align: center; color: #fff; font-size: 12.5px; font-weight: 600; height: 18px; text-shadow: 0 1px 2px #000; }
#hotbar { pointer-events: auto; display: flex; gap: 6px; padding: 4px 8px 6px; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
#hotbar::-webkit-scrollbar { display: none; }
.slot { position: relative; flex: 0 0 auto; width: 52px; height: 52px; border-radius: 12px; background: #fff8e7; border: 3px solid #8b5a2b; display: flex; align-items: center; justify-content: center; }
.slot img { width: 40px; height: 40px; pointer-events: none; }
.slot.on { border-color: #ffd23f; box-shadow: 0 0 0 3px #ffd23f88; transform: translateY(-3px); }
.slot .n { position: absolute; right: 2px; bottom: 0; font-size: 12px; font-weight: 800; color: #2b2116; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.slot .wbar { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 4px; background: #0002; border-radius: 2px; }
.slot .wbar i { display: block; height: 100%; background: #3aa0ff; border-radius: 2px; }
#joy { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: #ffffff22; border: 3px solid #ffffff66; pointer-events: none; z-index: 3; box-shadow: 0 0 0 1px #0002; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #cfc0a0); box-shadow: 0 3px 6px #0006; }
#emotes { display: flex; justify-content: center; gap: 10px; padding: 2px 8px 8px; }
#emotes button { pointer-events: auto; width: 42px; height: 42px; border-radius: 50%; background: #fff8e7cc; font-size: 20px; box-shadow: 0 2px 0 #0004; }

/* Modálne okná */
#modal { position: absolute; inset: 0; background: #0008; display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.modal-card { background: #fff8e7; width: 100%; max-height: 82%; border-radius: 22px 22px 0 0; border: 4px solid #8b5a2b; border-bottom: none; display: flex; flex-direction: column; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 2px dashed #d9bf8c; }
.modal-head h2 { margin: 0; font-size: 20px; }
#mClose { background: #f0dcb0; border-radius: 10px; width: 38px; height: 38px; font-size: 18px; }
#mBody { overflow-y: auto; padding: 10px 14px calc(env(safe-area-inset-bottom) + 16px); touch-action: pan-y; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1; padding: 9px; border-radius: 10px; background: #f0dcb0; font-weight: 700; }
.tabs button.on { background: #8b5a2b; color: #fff; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: #fff; margin-bottom: 6px; border: 2px solid #f0dcb0; }
.row img { width: 40px; height: 40px; flex: 0 0 auto; }
.row .info { flex: 1; min-width: 0; }
.row .info b { display: block; font-size: 14.5px; }
.row .info small { display: block; color: #7a6a4a; font-size: 12px; }
.row .btns { display: flex; gap: 4px; }
.btn { padding: 8px 10px; border-radius: 10px; background: #6b3fa0; color: #fff; font-weight: 700; font-size: 13px; white-space: nowrap; }
.btn.alt { background: #3c7d3f; }
.btn.gray { background: #b9a888; }
.btn:disabled { opacity: .45; }
.badge { display: inline-block; padding: 1px 6px; border-radius: 8px; font-size: 11px; background: #eee; margin-right: 3px; }
.badge.now { background: #b8f0a0; }
.dlg { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.dlg canvas { flex: 0 0 auto; }
.bubble { background: #fff; border: 2px solid #d9bf8c; border-radius: 14px; padding: 10px 12px; font-size: 14.5px; line-height: 1.4; }
.cauldron-slots { display: flex; justify-content: center; gap: 10px; margin: 6px 0 12px; }
.cslot { width: 64px; height: 64px; border-radius: 50%; border: 3px dashed #8b5a2b; background: #3a2a4a; display: flex; align-items: center; justify-content: center; }
.cslot img { width: 48px; height: 48px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.gcell { position: relative; background: #fff; border: 2px solid #f0dcb0; border-radius: 12px; padding: 4px; text-align: center; }
.gcell img { width: 44px; height: 44px; }
.gcell .n { position: absolute; right: 5px; top: 2px; font-size: 12px; font-weight: 800; }
.card { background: #fff; border: 2px solid #f0dcb0; border-radius: 14px; padding: 10px; margin-bottom: 8px; display: flex; gap: 10px; }
.card img { width: 56px; height: 56px; flex: 0 0 auto; }
.card .latin { font-style: italic; color: #7a6a4a; font-size: 12.5px; }
.card p { margin: 5px 0 0; font-size: 13px; line-height: 1.35; }
.card.locked { opacity: .55; }
.card.magic { border-color: #c9a0f0; background: linear-gradient(135deg, #fff, #f7eeff); }
.wish { display: block; width: 100%; text-align: left; padding: 12px; margin-bottom: 8px; border-radius: 14px; background: linear-gradient(135deg, #f3e5ff, #ffe4f5); border: 2px solid #9b59d0; font-size: 15px; }
.wish b { display: block; font-size: 16px; color: #4a2a72; }
.help p { font-size: 14px; line-height: 1.45; margin: 6px 0; }
#chatbox { position: absolute; left: 8px; right: 8px; bottom: 156px; display: flex; gap: 6px; z-index: 5; }
#chatbox input { flex: 1; padding: 11px; border-radius: 12px; border: 2px solid #8b5a2b; font-size: 16px; touch-action: auto; user-select: text; -webkit-user-select: text; }
#chatbox button { width: 48px; border-radius: 12px; background: #6b3fa0; color: #fff; font-size: 18px; }
#conn { position: absolute; top: 40%; left: 50%; transform: translateX(-50%); background: #000b; color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 20; font-weight: 700; }
