* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; touch-action: manipulation; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; background: #0b1020; overflow: hidden; font-family: Heebo, Arial, sans-serif; user-select: none; }
#wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(#1b2a5a, #070b18); }
#stage { position: relative; width: 960px; height: 540px; flex: none; transform-origin: center center; background: #000; overflow: hidden; border-radius: 12px; box-shadow: 0 10px 50px #000a; }
#cv { position: absolute; inset: 0; width: 960px; height: 540px; }
button { font-family: inherit; cursor: pointer; }

/* HUD */
#hud { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; align-items: center; gap: 8px; direction: rtl; pointer-events: none; }
#hud > * { pointer-events: auto; }
.chip { background: #000a; color: #fff; border: 2px solid #ffffff55; border-radius: 22px; padding: 4px 12px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.chip.small { font-size: 13px; padding: 4px 10px; }
#who { display: flex; align-items: center; gap: 6px; padding: 3px 12px 3px 4px; }
#who img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; object-position: 50% 22%; border: 2px solid #fff; }
#prog { flex: 1; min-width: 160px; }
#progBar { height: 20px; background: #000a; border: 2px solid #fff8; border-radius: 12px; overflow: hidden; }
#progFill { height: 100%; width: 0%; background: linear-gradient(90deg, #1f3fa8, #4ab0ff, #ffd24a); transition: width .3s; }
#progTxt { text-align: center; color: #fff; font-weight: 900; font-size: 13px; white-space: nowrap; text-shadow: 0 1px 3px #000; margin-top: 1px; }
#energyBox { display: flex; align-items: center; gap: 4px; color: #ffd24a; }
#enBar { width: 80px; height: 14px; border-radius: 8px; background: #000a; border: 2px solid #fff8; overflow: hidden; }
#enFill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff9f1a, #ffe14d); transition: width .2s; }
.ib { background: #000a; border: 2px solid #ffffff55; color: #fff; border-radius: 50%; width: 34px; height: 34px; font-size: 16px; padding: 0; }
.ib:hover { background: #1f3fa8; }

/* בועות דיבור */
.bubble { position: absolute; display: none; max-width: 330px; min-width: 70px; padding: 10px 14px; background: #fff; border: 3px solid #1f3fa8; border-radius: 20px; font-size: 20px; font-weight: 700; line-height: 1.25; color: #111; text-align: center; box-shadow: 0 4px 14px #0006; z-index: 5; direction: rtl; animation: pop .18s ease-out; }
.bubble::after { content: ''; position: absolute; bottom: -16px; right: 26px; border: 10px solid transparent; border-top: 14px solid #1f3fa8; border-bottom: 0; }
.bubble.npc { border-color: #c2202b; background: #fff8f0; }
.bubble.npc::after { border-top-color: #c2202b; right: auto; left: 26px; }
.bubble.shout { font-size: 26px; font-weight: 900; color: #c2202b; border-width: 4px; transform-origin: bottom; animation: shout .35s infinite alternate; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes shout { from { transform: rotate(-1.5deg) scale(1); } to { transform: rotate(1.5deg) scale(1.05); } }

#toast { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); background: linear-gradient(#fff6c8, #ffe27a); color: #3a2a00; border: 3px solid #d89b00; border-radius: 16px; padding: 8px 20px; font-weight: 900; font-size: 20px; z-index: 6; box-shadow: 0 6px 20px #0007; animation: pop .25s; white-space: nowrap; }

/* תפריט פעולות */
#menu { position: absolute; left: 8px; right: 8px; bottom: 6px; display: flex; gap: 6px; direction: rtl; }
.card { flex: 1; height: 112px; border-radius: 14px; border: 3px solid #ffd24a; background: linear-gradient(#2a54c9, #14307f); color: #fff; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; transition: transform .1s, filter .2s; box-shadow: 0 4px 0 #0a1a50; }
.card:hover:not(:disabled) { transform: translateY(-5px); filter: brightness(1.15); }
.card:active:not(:disabled) { transform: translateY(1px); }
.card .em { font-size: 30px; line-height: 1.1; }
.card .nm { font-size: 12.5px; font-weight: 900; line-height: 1.1; }
.card .sub { font-size: 11px; opacity: .9; font-weight: 700; }
.card .sub b { color: #ffd24a; }
.card:disabled { filter: grayscale(.9) brightness(.65); cursor: not-allowed; border-color: #888; }
.card.locked { background: linear-gradient(#444, #222); }
#menu.busy .card { pointer-events: none; opacity: .35; }
#btnQuit { position: absolute; left: 10px; bottom: 124px; background: #000b; color: #fff; border: 2px solid #ffffff66; border-radius: 16px; padding: 5px 12px; font-size: 13px; font-weight: 700; z-index: 4; }
#btnQuit:hover { background: #9a1c26; }

/* מיני-משחק תזמון */
#timing { position: absolute; left: 50%; top: 66px; transform: translateX(-50%); width: 420px; background: #000c; border: 3px solid #ffd24a; border-radius: 18px; padding: 10px 16px 12px; text-align: center; color: #fff; z-index: 7; }
#tLabel { font-weight: 900; font-size: 18px; margin-bottom: 8px; }
#track { position: relative; height: 26px; background: #333; border-radius: 14px; border: 2px solid #fff; overflow: hidden; cursor: pointer; direction: ltr; }
#zone { position: absolute; top: 0; bottom: 0; background: linear-gradient(#5dff7a, #1fbf3f); box-shadow: 0 0 12px #5dff7a; }
#marker { position: absolute; top: -2px; bottom: -2px; width: 8px; background: #fff; border-radius: 4px; transform: translateX(-50%); box-shadow: 0 0 8px #fff; }
#tBtn { margin-top: 8px; background: #ffd24a; border: 0; border-radius: 12px; padding: 6px 22px; font-weight: 900; font-size: 16px; color: #3a2a00; }
#tRes { font-size: 26px; font-weight: 900; min-height: 30px; margin-top: 4px; }
.r-perfect { color: #5dff7a; } .r-good { color: #ffe14d; } .r-ok { color: #fff; } .r-miss { color: #ff6b6b; }

#polaroid { position: absolute; right: 90px; top: 110px; width: 170px; background: #fff; padding: 8px 8px 4px; transform: rotate(5deg); box-shadow: 0 6px 20px #000a; z-index: 6; animation: pop .25s; }
#polaroid img { width: 100%; height: 190px; object-fit: cover; object-position: 50% 20%; display: block; }
#polCap { font-weight: 900; font-size: 15px; text-align: center; padding: 4px 0; color: #222; }

/* מסכים */
.overlay { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: flex-end; padding: 0 28px; background: linear-gradient(270deg, #040a1caa 0%, #040a1c66 50%, #0000 75%); direction: rtl; }
.overlay[hidden], [hidden] { display: none !important; }
.panel { width: 540px; max-height: 510px; overflow: auto; background: #101b44f0; border: 3px solid #ffd24a; border-radius: 20px; padding: 14px 22px; color: #fff; }
.panel h1 { margin: 0; font-size: 38px; color: #ffd24a; text-shadow: 0 3px 0 #0007; }
.panel h3 { margin: 10px 0 4px; font-size: 16px; }
.sub { margin: 2px 0 8px; font-size: 16px; opacity: .95; }
.note { font-size: 11px; opacity: .65; margin: 8px 0 0; }
label { display: block; font-weight: 700; margin: 6px 0; }
input { display: block; width: 100%; margin-top: 4px; padding: 8px 12px; border-radius: 12px; border: 3px solid #4ab0ff; font-size: 20px; font-weight: 700; font-family: inherit; }
.diffs { display: flex; gap: 8px; margin: 8px 0; }
.diffs button { flex: 1; padding: 6px; border-radius: 12px; border: 2px solid #fff6; background: #ffffff1a; color: #fff; font-weight: 700; font-size: 16px; }
.diffs button.on { background: #ffd24a; color: #3a2a00; border-color: #ffd24a; }
.big { width: 100%; padding: 10px; font-size: 22px; font-weight: 900; border-radius: 16px; border: 0; background: linear-gradient(#ffe27a, #ffb800); color: #3a2a00; box-shadow: 0 4px 0 #a37100; margin-top: 4px; }
.big:hover { filter: brightness(1.08); }
.endbox { width: 560px; max-height: 520px; overflow: auto; text-align: center; background: #101b44f0; border: 3px solid #ffd24a; border-radius: 22px; padding: 14px 22px; color: #fff; margin: 0 auto; }
#endEmoji { font-size: 64px; line-height: 1; } #endText { font-size: 28px; font-weight: 900; margin: 6px 0; color: #ffd24a; } #endScore { font-size: 18px; margin-bottom: 6px; }
#endScreen { justify-content: flex-end; background: linear-gradient(270deg, #040a1c99 0%, #0000 70%); }
#endScreen .endbox { margin: 0; width: 520px; }
#lbModal { justify-content: center; background: #040a1caa; }
.lb { width: 100%; border-collapse: collapse; font-size: 15px; }
.lb td, .lb th { padding: 3px 8px; border-bottom: 1px solid #ffffff22; text-align: right; }
.lb tr.me td { color: #ffd24a; font-weight: 900; }
.empty { opacity: .7; font-size: 14px; }
.star { position: absolute; z-index: 9; font-size: 54px; cursor: pointer; filter: drop-shadow(0 0 10px gold); animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) scale(1.1); } }

/* מובייל: המשחק מותאם לרוחב; במצב לאורך מוצגת הצעה לסובב */
#rotate { display: none; }
body.portrait #rotate { display: block; position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 99; background: #ffd24a; color: #3a2a00; font-weight: 900; font-size: 14px; padding: 6px 14px; border-radius: 14px; }

/* קרדיט המפתחת */
#credit { position: absolute; right: 10px; bottom: 124px; z-index: 4; pointer-events: none; background: #000a; color: #fff; border: 2px solid #ffd24a; border-radius: 16px; padding: 4px 12px; font-size: 13px; font-weight: 500; white-space: nowrap; }
#credit b { color: #ffd24a; font-weight: 900; }
.devby { margin: 0 0 8px; font-size: 15px; color: #fff; } .devby b { color: #ffd24a; font-weight: 900; }

.panel h2.tagline { margin: 0 0 6px; font-size: 22px; font-weight: 700; color: #fff; opacity: .95; }
