/* Player interaction UI (public/social_ui.js). Art: /ui/soc_*.webp (tools/build_socialui.py). Everything is scoped by id so it cannot touch the other windows. */

/* ── player menu: RightMenu_Top / Back / Bottom.tga, 94 px art, 4 px side borders kept, the middle stretches ── */
#socMenu { position:fixed; z-index:357; display:none; width:max-content; min-width:164px; max-width:min(92vw, 260px); filter:drop-shadow(0 4px 10px rgba(0,0,0,.7)); user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; touch-action:none; font-family:system-ui, 'Segoe UI', Arial, sans-serif; }
#socMenu.on { display:block; }
#socMenu .rmT, #socMenu .rmM, #socMenu .rmB { border-style:solid; border-width:0 4px; box-sizing:border-box; }
#socMenu .rmT { height:14px; border-image:url(/ui/soc_rm_top.webp) 0 4 0 4 fill / 0 4px 0 4px stretch; }
#socMenu .rmM { border-image:url(/ui/soc_rm_back.webp) 0 4 0 4 fill / 0 4px 0 4px stretch; padding:0 2px; }
#socMenu .rmB { height:14px; border-image:url(/ui/soc_rm_bottom.webp) 0 4 0 4 fill / 0 4px 0 4px stretch; }
#socMenu .rmH { height:20px; margin:-4px 0 2px; font:700 11px/20px system-ui; text-align:center; letter-spacing:.04em; color:#d9b45a; text-shadow:0 1px 2px #000; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; border-bottom:1px solid rgba(217,180,90,.22); }
#socMenu .rmG { height:8px; }
#socMenu .rmR { display:block; width:100%; height:38px; margin:0; padding:0 14px; border:0; border-radius:2px; background:none; text-align:left; font:600 14px/38px system-ui, 'Segoe UI', Arial, sans-serif; color:#e9e2cf; text-shadow:0 1px 2px #000; cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent; white-space:nowrap; }
#socMenu .rmR:active { background:linear-gradient(rgba(215,170,80,.34), rgba(150,100,30,.26)); color:#fff4cf; }
@media (hover:hover) { #socMenu .rmR:hover { background:linear-gradient(rgba(215,170,80,.34), rgba(150,100,30,.26)); color:#fff4cf; } #socMenu .rmR { height:26px; line-height:26px; font-size:13px; } }
/* mobile: the target frame is the way in when the target is a player; a small chevron says so */
#targetFrame.socTap { pointer-events:auto !important; cursor:pointer; }
#targetFrame.socTap::after { content:""; position:absolute; right:6px; top:19px; width:0; height:0; border:solid transparent; border-width:6px 5px 0; border-top-color:#e8c777; filter:drop-shadow(0 1px 1px #000); animation:socNudge 2.4s ease-in-out infinite; pointer-events:none; }
@keyframes socNudge { 0%, 80%, 100% { transform:translateY(0); } 90% { transform:translateY(2px); } }

/* ── request popup: the login screens' confirm box (.delBox) with its OK / Cancel art buttons, not modal (the game goes on under it) ── */
#socAsk { position:fixed; left:50%; top:max(70px, 18vh); transform:translateX(-50%); display:none; z-index:356; }
#socAsk.on { display:block; }
#socAsk .delBox { width:min(86vw, 330px); padding:12px 14px 10px; }
#socAsk .delT { font-size:14px; } #socAsk .delN { margin:5px 0 4px; font-size:13px; }
#socAsk .cd { display:block; margin-bottom:8px; font:600 11px system-ui; color:#9c9482; }
#socAsk .sbtn { --k:1; }

/* ── art buttons from the Status window sheets (status/ok.webp: OK / Cancel rows, status/blank.webp for a text label): 4 states = normal, hover, disabled, pressed ── */
.sbt { position:relative; box-sizing:border-box; width:54px; height:28px; flex:none; padding:0; border:0; background:url(/ui/status/ok.webp) 0 0 / 256px 64px no-repeat; font:700 11px/28px Verdana, Tahoma, sans-serif; color:#ea9207; text-shadow:0 1px 1px #000; cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent; } /* native size: the 64x32 cells of status/ok.webp 1:1 (the plate is 54x28); it used to be stretched x1.42 */
.sbt::after { content:""; position:absolute; inset:-8px -6px; }
.sbt.no { background-position:0 -32px; }
.sbt.blank { display:flex; align-items:center; justify-content:center; line-height:12px; background:none; border:solid transparent; border-width:8px; border-image:url(/ui/status/blank_0.webp) 8 fill / 8px stretch; } /* text plate: 9-slice (crisp rim, plain middle stretches to any width) */
@media (hover:hover) { .sbt:hover:not(:disabled) { background-position-x:-64px; } .sbt.blank:hover:not(:disabled) { border-image-source:url(/ui/status/blank_1.webp); } }
.sbt:disabled { background-position-x:-128px; cursor:default; color:#6d5a3a; } .sbt.blank:disabled { border-image-source:url(/ui/status/blank_2.webp); } .sbt:active:not(:disabled) { background-position-x:-192px; } .sbt.blank:active:not(:disabled) { border-image-source:url(/ui/status/blank_3.webp); }

/* ── number pad ── */
#socPad { position:fixed; left:50%; top:50%; transform:translate(-50%,-50%); display:none; z-index:358; user-select:none; -webkit-user-select:none; touch-action:none; }
#socPad.on { display:block; }
#socPad .pdB { width:236px; padding:10px 12px 12px; border:1px solid #5a4a30; border-radius:3px; background:linear-gradient(#1c1710,#0d0b08); box-shadow:0 0 0 2px #000, 0 8px 30px #000, 0 0 0 100vmax rgba(0,0,0,.35); }
#socPad .pdT { font:600 13px system-ui; color:#e9dcc0; text-align:center; margin-bottom:6px; text-shadow:0 1px 3px #000; }
#socPad .pdV { height:34px; margin-bottom:8px; padding:0 8px; font:700 18px/34px system-ui; text-align:right; color:#ffd54a; background:#070605; border:1px solid #4a3c22; box-shadow:inset 0 2px 5px #000; } #socPad .pdV.max { color:#7be08f; }
#socPad .pdK { display:grid; grid-template-columns:repeat(3,1fr); gap:4px; }
#socPad .pdKey { height:38px; border:1px solid #6a5530; border-radius:3px; background:linear-gradient(#2c2518,#120e08); color:#f0e6c8; font:700 16px system-ui; cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent; } #socPad .pdKey:active { background:#4a3a14; }
#socPad .pdR { display:flex; justify-content:space-between; margin-top:8px; }

/* ── trade window: frame REBUILT from the Inspect art (no trade art in the client files), boxes = the original empty equipment box ── */
#socTrade { position:fixed; display:none; transform-origin:0 0; background:url(/ui/soc_trade_frame.webp) 0 0 / 610px 306px no-repeat; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; touch-action:none; font-family:system-ui, 'Segoe UI', Arial, sans-serif; color:#e6dec6; }
#socTrade.on { display:block; }
#socTrade .st { position:absolute; left:70px; top:5px; width:470px; height:30px; text-align:center; cursor:move; }
#socTrade .st b { font:700 15px/30px system-ui, 'Segoe UI', Arial, sans-serif; color:#fff; text-shadow:0 0 2px #000, 0 1px 2px #000, 1px 0 0 #000, -1px 0 0 #000; }
#socTrade .sx, #socInsp .sx { position:absolute; width:26px; height:26px; padding:0; border:0; background:none; font:400 22px/24px system-ui; color:#d8cfb8; text-shadow:0 1px 2px #000; cursor:pointer; touch-action:manipulation; z-index:3; }
#socTrade .sx { right:12px; top:7px; } #socInsp .sx { left:222px; top:9px; }
#socTrade .sx::after, #socInsp .sx::after { content:""; position:absolute; inset:-8px; }
#socTrade .sx:hover, #socInsp .sx:hover { color:#ffe08a; }
#socTrade .pane { position:absolute; top:44px; } #socTrade .A { left:26px; width:153px; } #socTrade .B { left:190px; width:153px; } #socTrade .C { left:360px; width:228px; }
#socTrade .ph { display:flex; align-items:center; gap:3px; height:18px; font:700 11px/18px system-ui; }
#socTrade .who { flex:1; min-width:0; font-style:normal; color:#f0cf7a; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; text-shadow:0 1px 2px #000; }
#socTrade .ph u { padding:0 4px; text-decoration:none; font:700 9px/14px system-ui; color:#6f6450; border:1px solid #3d3322; background:#0c0a07; border-radius:2px; }
#socTrade .ph u.lk.on { color:#1a1208; background:#e0b85a; border-color:#f0cf7a; } #socTrade .ph u.ok.on { color:#08210f; background:#7be08f; border-color:#b9f5c6; }
#socTrade .grid { margin-top:2px; display:grid; grid-template-columns:repeat(4, 36px); gap:3px; }
#socTrade .grid.bag { margin-top:4px; grid-template-columns:repeat(6, 34px); gap:2px; }
#socTrade .sl { position:relative; width:36px; height:36px; background:url(/ui/soc_slot.webp) 0 0 / 100% 100% no-repeat; cursor:default; }
#socTrade .A .sl.full, #socTrade .grid.bag .sl.full { cursor:pointer; }
#socTrade .grid.bag .sl { width:34px; height:34px; }
#socTrade .sl img { position:absolute; left:3px; top:3px; right:3px; bottom:3px; width:calc(100% - 6px); height:calc(100% - 6px); object-fit:contain; pointer-events:none; filter:drop-shadow(0 1px 1px #000); }
#socTrade .sl svg { position:absolute; inset:4px; width:calc(100% - 8px); height:calc(100% - 8px); pointer-events:none; }
#socTrade .sl .n { position:absolute; right:3px; bottom:0; font:800 10px/11px system-ui; color:#fff; text-shadow:-1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; pointer-events:none; }
#socTrade .sl.used { box-shadow:inset 0 0 0 2px rgba(224,184,90,.9); } #socTrade .sl.used img, #socTrade .sl.used svg { opacity:.35; }
#socTrade .A .sl.full:active { box-shadow:inset 0 0 0 2px #e66; }
#socTrade .gold, #socTrade .mine { display:flex; align-items:center; gap:6px; height:24px; margin-top:4px; padding:0 6px; border:1px solid #4a3c22; border-radius:2px; background:#070605; box-shadow:inset 0 2px 5px #000; }
#socTrade .gold:not(.ro) { cursor:pointer; border-color:#8f7336; } #socTrade .gold:not(.ro):active { background:#1a1408; }
#socTrade .gold s, #socTrade .mine s { width:12px; height:12px; flex:none; border-radius:50%; background:radial-gradient(circle at 35% 30%, #ffe9a0, #c58a1c 70%, #6a4608); box-shadow:0 0 0 1px #2a1a04; }
#socTrade .gold span, #socTrade .mine span { flex:1; text-align:right; font:700 12px/22px system-ui; color:#ffd54a; text-shadow:0 1px 2px #000; }
#socTrade .mine { margin-top:8px; } #socTrade .mine::before { content:"Your gold"; font:600 10px system-ui; color:#9c9482; order:0; } #socTrade .mine s { order:1; margin-left:auto; } #socTrade .mine span { flex:none; order:2; }
#socTrade .hint { position:absolute; left:26px; top:209px; width:317px; height:14px; font:600 11px/14px system-ui; text-align:center; color:#b9ae92; text-shadow:0 1px 2px #000; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } #socTrade .hint.go { color:#7be08f; }
#socTrade .btns { position:absolute; left:26px; top:224px; width:317px; height:38px; display:flex; justify-content:center; gap:14px; }
#socTrade .tabs { display:flex; gap:2px; height:22px; }
#socTrade .tb { flex:1; padding:0; border:1px solid #6a5530; border-bottom:0; border-radius:5px 5px 0 0; background:linear-gradient(#26231d,#0e0c09); color:#8d836d; font:700 12px/20px Cinzel, Georgia, serif; cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
#socTrade .tb.sel { color:#fff3cf; border-color:#d6b46a; background:linear-gradient(#4a4030,#17120c); box-shadow:inset 0 0 8px rgba(215,170,90,.28); } #socTrade .tb.off { opacity:.45; cursor:default; }

/* ── inspect window: the original art as it is, item icons over its boxes ── */
#socInsp { position:fixed; display:none; transform-origin:0 0; background:url(/ui/soc_insp_frame.webp) 0 0 / 256px 290px no-repeat; user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; touch-action:none; font-family:system-ui, 'Segoe UI', Arial, sans-serif; }
#socInsp.on { display:block; }
#socInsp .it { position:absolute; left:48px; top:3px; width:150px; height:36px; cursor:move; }
#socInsp .isl { position:absolute; cursor:pointer; touch-action:manipulation; }
#socInsp .isl.full { background:#17130d; }
#socInsp .isl img { display:block; width:100%; height:100%; object-fit:contain; pointer-events:none; } #socInsp .isl svg { width:100%; height:100%; pointer-events:none; }
#socInsp .isl .n { position:absolute; right:1px; bottom:-1px; font:800 9px/10px system-ui; color:#fff; text-shadow:-1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; }
#socInsp .look { position:absolute; left:62px; top:46px; width:124px; height:200px; pointer-events:none; } #socInsp .look canvas { display:block; width:100%; height:100%; object-fit:contain; filter:drop-shadow(0 2px 3px #000); }

/* ── item card (same look as the bag's) ── */
#socTip { position:fixed; display:none; z-index:360; width:268px; box-sizing:border-box; padding:10px 12px; background:rgba(10,8,6,.97); border:1px solid #b79553; border-radius:3px; box-shadow:0 0 0 1px #000, 0 10px 34px #000; font:12.5px/1.38 system-ui, 'Segoe UI', Arial, sans-serif; color:#eee; pointer-events:none; }
#socTip.on { display:block; }
#socTip .tpH { display:flex; align-items:center; gap:8px; margin-bottom:5px; padding-bottom:6px; border-bottom:1px solid #3a3020; } #socTip .tpH img { width:42px; height:42px; object-fit:contain; flex:none; } #socTip .tpH b { font-size:14px; }
#socTip .g { color:#7be36a; } #socTip .w { color:#ececec; } #socTip .o { color:#ff9b2f; font-weight:600; } #socTip .r { color:#ff5a4a; } #socTip .tgap { margin-top:6px; }
#socTip .gems { display:flex; gap:8px; margin-top:8px; } #socTip .gems i { width:24px; height:24px; border-radius:2px; border:2px solid #8d6c34; background:linear-gradient(135deg,#17140f,#050403); box-shadow:inset 0 2px 4px #000, 0 0 0 1px #2a2013; }
#socTip .gems i.on { border-color:#e0b85a; background:radial-gradient(circle at 40% 35%,#6fb8e0,#123a52); } #socTip .gems i.on img { width:100%; height:100%; object-fit:contain; display:block; } #socTip .gems i.cont { border-color:#6a5530; background:radial-gradient(circle at 40% 35%,#35546a,#0d2230); }

/* ── whisper lines in the chat (the original colours are not in the files we have; pink is our choice) ── */
#chatLog .whisper { color:#ff9cf0; } #chat.open #chatLog .whisper { cursor:pointer; } #chatLog .whisper b { font-weight:700; }

/* ── duel banner (docs/duel_research.md): countdown, fight bar, result */
#socDuel { position:fixed; left:50%; top:calc(64px + env(safe-area-inset-top, 0px)); transform:translateX(-50%); z-index:340; display:none; min-width:150px; max-width:min(92vw, 360px); padding:6px 14px 8px; text-align:center; pointer-events:none; user-select:none; -webkit-user-select:none; border:1px solid #c29c4e; border-radius:6px; background:rgba(14,11,8,.82); box-shadow:0 4px 14px #000b; font-family:system-ui, 'Segoe UI', Arial, sans-serif; color:#e9e2cf; }
#socDuel.on { display:block; }
#socDuel .dvT { font:800 34px/1.1 system-ui, 'Segoe UI', Arial, sans-serif; color:#ffcf6a; text-shadow:0 2px 4px #000; letter-spacing:.04em; }
#socDuel .dvT:empty { display:none; }
#socDuel .dvN { font:600 12px/1.4 system-ui, sans-serif; color:#e9e2cf; text-shadow:0 1px 2px #000; }
#socDuel .dvG { display:none; pointer-events:auto; margin-top:5px; min-height:32px; padding:0 14px; border:1px solid #8a6a2e; border-radius:4px; background:rgba(60,40,12,.9); color:#f3dca0; font:600 12px system-ui, sans-serif; touch-action:manipulation; }
#socDuel[data-st=fight] .dvG { display:inline-block; }
#socDuel[data-st=fight] { padding:4px 12px 6px; }
#socDuel[data-st=end][data-r=win] .dvT { color:#7be07f; } #socDuel[data-st=end][data-r=lose] .dvT { color:#ff7a6a; }

#socTrade .sl, #socTrade img, #socInsp img { image-rendering:auto; } /* slots / item icons are drawn smaller than their art: smooth down-scale, not the window's pixel doubling */
html.dint .sbt, html.dint #socAsk .sbtn { image-rendering:pixelated; } /* 1 css px = 1 art px on a whole-number DPR: exact pixel doubling (crisp.js sets .dint) */
