/* The Ruins: walkable town UI (loaded after style.css) */
[hidden] { display: none !important; }
#lobby { position: absolute; inset: 0; overflow: hidden; background: #07040b; user-select: none; -webkit-user-select: none; }
#lbg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }

#ltop { position: absolute; top: 10px; left: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; pointer-events: none; }
#ltop > * { pointer-events: auto; }
#ltop .ltitle { font: 700 18px Cinzel, Georgia, serif; letter-spacing: .12em; color: #ffe2a0; text-shadow: 0 2px 6px #000; padding-right: 6px; }
#lonline { font: 12px Georgia, serif; color: #9a8f80; background: rgba(15,9,6,.75); border: 1px solid #3a2a1c; border-radius: 12px; padding: 3px 10px; }
#lonline.on { color: #4be3c5; border-color: #1f6b5c; }

#lmap { position: absolute; top: 10px; right: 10px; width: 200px; height: 142px; border: 2px solid #5a4430; border-radius: 6px; background: #07040b; box-shadow: 0 4px 16px rgba(0,0,0,.6); opacity: .92; pointer-events: none; }

#lchat { position: absolute; left: 10px; bottom: 66px; width: min(340px, calc(100% - 20px)); display: flex; flex-direction: column; gap: 6px; padding: 8px; pointer-events: auto; background: linear-gradient(145deg, rgba(24,16,13,.94), rgba(8,6,8,.88)); border: 1px solid rgba(216,168,74,.5); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.45), inset 0 1px rgba(255,235,190,.08); }
.lchat-head { display: flex; align-items: center; justify-content: space-between; padding: 0 3px 5px; border-bottom: 1px solid rgba(216,168,74,.2); }
.lchat-head b { color: #e7bd72; font: 700 10px Cinzel, Georgia, serif; letter-spacing: .14em; }
.lchat-head span { color: #8e8170; font: 10px Georgia, serif; }
#lmsgs { height: 190px; max-height: min(30vh, 240px); overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding: 2px 3px; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: #8a693b rgba(8,5,4,.35); }
#lmsgs::-webkit-scrollbar { width: 6px; }
#lmsgs::-webkit-scrollbar-thumb { background: #8a693b; border-radius: 6px; }
#lmsgs .cl { flex: 0 0 auto; font: 13px/1.35 Georgia, serif; color: #f0e6d0; background: rgba(12,7,5,.55); border-left: 2px solid rgba(216,168,74,.42); border-radius: 4px; padding: 5px 7px; text-shadow: 0 1px 2px #000; overflow-wrap: anywhere; }
#lmsgs .cl b { font-weight: 700; }
#lmsgs .cl.sys { color: #c4b8a5; font-style: italic; border-left-color: #776852; }
.lchat-compose { display: flex; gap: 5px; }
#lin { min-width: 0; flex: 1; pointer-events: auto; font: 13px Georgia, serif; color: #f0e6d0; background: rgba(5,4,5,.82); border: 1px solid #5a4430; border-radius: 6px; padding: 8px 10px; outline: none; }
#lin:focus { border-color: #d8a84a; box-shadow: 0 0 0 2px rgba(216,168,74,.12); }
#lin::placeholder { color: #7a6e5e; }
#lchat-send { flex: 0 0 auto; color: #ffe9a0; font: 700 11px Georgia, serif; background: linear-gradient(#533a20,#2a1b10); border: 1px solid #8a693b; border-radius: 6px; padding: 0 11px; cursor: pointer; }
#lchat-send:hover, #lchat-send:focus-visible { background: linear-gradient(#72502c,#3a2615); border-color: #d8a84a; outline: none; }

#lprompt { position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); font: 700 15px Cinzel, Georgia, serif; color: #ffe9a0; background: rgba(15,9,6,.92); border: 2px solid #d8a84a; border-radius: 22px; padding: 9px 22px; cursor: pointer; white-space: nowrap; box-shadow: 0 0 18px rgba(255,190,70,.3); animation: lpulse 1.6s ease-in-out infinite; }
@keyframes lpulse { 50% { box-shadow: 0 0 28px rgba(255,190,70,.6); } }

#lbar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100% - 20px); }
#lbar button { font: 600 13px Georgia, serif; color: #f0e6d0; background: rgba(24,15,10,.92); border: 1px solid #5a4430; border-radius: 6px; padding: 8px 14px; cursor: pointer; }
#lbar button:hover:not(:disabled) { border-color: #d8a84a; }
#lbar button.go { background: linear-gradient(#7a3fd0, #4a1f99); border-color: #b48cff; color: #fff; font-weight: 700; }
#lbar button.go:disabled { background: #2a2030; border-color: #3a2e48; color: #7a6e8a; cursor: not-allowed; }

/* shop panel that opens when you talk to a shopkeeper */
#lobby #lpanel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(880px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: rgba(18,12,10,.97); border: 2px solid #d8a84a; border-radius: 10px; box-shadow: 0 10px 50px rgba(0,0,0,.8); z-index: 5; }
#lobby #lpanel, #set .modal { scrollbar-width: thin; scrollbar-color: #9a7138 rgba(8,5,4,.7); }
#lobby #lpanel::-webkit-scrollbar, #set .modal::-webkit-scrollbar { width: 9px; }
#lobby #lpanel::-webkit-scrollbar-track, #set .modal::-webkit-scrollbar-track { background: rgba(8,5,4,.7); border-radius: 8px; }
#lobby #lpanel::-webkit-scrollbar-thumb, #set .modal::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #72502c, #c49a50 48%, #72502c); border: 2px solid rgba(18,12,10,.97); border-radius: 8px; }
#lobby #lpanel::-webkit-scrollbar-thumb:hover, #set .modal::-webkit-scrollbar-thumb:hover { background: linear-gradient(90deg, #9a7138, #f0ca73 48%, #9a7138); }
#lobby #lpanel::-webkit-scrollbar-corner, #set .modal::-webkit-scrollbar-corner { background: transparent; }
#lobby #lpanel .mh { position: sticky; top: -14px; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -14px -14px 0; padding: 10px 12px; background: linear-gradient(#1a120d,#100a08); border-bottom: 1px solid rgba(216,168,74,.25); }
#lobby #lpanel .mh > div { display: flex; align-items: center; gap: 8px; }
#lobby #lpanel .mh h2 { margin: 0; font: 700 18px Cinzel, Georgia, serif; letter-spacing: .1em; color: #ffe2a0; }
#lobby #lpanel .mh button { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; color: #f0dfc0; font: 18px/1 Georgia, serif; background: linear-gradient(#34261a, #1a110b); border: 1px solid #6e512f; border-radius: 6px; cursor: pointer; box-shadow: inset 0 1px rgba(255,255,255,.07), 0 2px 6px rgba(0,0,0,.4); }
#lobby #lpanel .mh button:hover { color: #ffe2a0; background: linear-gradient(#563a20, #26180e); border-color: #d8a84a; }
#lobby #lpanel .mh button:focus-visible { outline: 2px solid #ffd24a; outline-offset: 2px; }
#lnpc { --npc-accent: #d8a84a; order: 2; display: flex; align-items: center; gap: 12px; min-height: 88px; padding: 7px 10px; background: radial-gradient(ellipse at 4% 50%, color-mix(in srgb, var(--npc-accent) 15%, transparent), transparent 58%), linear-gradient(110deg, rgba(33,22,18,.96), rgba(13,9,10,.88)); border: 1px solid color-mix(in srgb, var(--npc-accent) 48%, #33251b); border-left: 3px solid var(--npc-accent); border-radius: 7px; box-shadow: inset 0 1px rgba(255,255,255,.035), 0 5px 16px rgba(0,0,0,.22); }
#lnpc .npc-portrait { position: relative; flex: 0 0 62px; height: 74px; display: grid; place-items: end center; overflow: hidden; background: radial-gradient(ellipse at 50% 87%, color-mix(in srgb, var(--npc-accent) 38%, transparent), transparent 62%); border: 1px solid color-mix(in srgb, var(--npc-accent) 45%, #28201d); border-radius: 32px 32px 8px 8px; }
#lnpc .npc-portrait::after { position: absolute; inset: auto 7px 4px; height: 1px; content: ""; background: linear-gradient(90deg, transparent, var(--npc-accent), transparent); opacity: .8; }
#lnpc .npc-portrait img { display: block; width: 58px; height: 74px; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
#lnpc .npc-details { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
#lnpc .npc-eyebrow { color: var(--npc-accent); font: 700 10px Cinzel, Georgia, serif; letter-spacing: .13em; text-transform: uppercase; }
#lnpc .npc-name { color: #fff0cf; font: 700 19px Cinzel, Georgia, serif; line-height: 1.15; text-shadow: 0 2px 6px rgba(0,0,0,.65); }
#lnpc .npc-title { color: #ad9c84; font: 12px Georgia, serif; }
#lnpc .npc-quote { margin: 4px 0 0; color: #e4d7c3; font: italic 13px/1.4 Georgia, serif; }
#lobby #ltabs { position: sticky; top: 39px; z-index: 2; order: 1; display: flex; gap: 6px; margin: 0; padding: 4px 0 7px; background: rgba(18,12,10,.98); border-bottom: 1px solid rgba(216,168,74,.24); }
#lobby #ltabs button { color: #cabb9f; background: rgba(5,4,6,.45); border: 1px solid #38291e; border-bottom: 0; border-radius: 6px 6px 0 0; padding: 7px 14px; cursor: pointer; font: 600 12px Georgia, serif; }
#lobby #ltabs button:hover { color: #ffe2a0; border-color: #876336; }
#lobby #ltabs button.on { color: #ffe2a0; background: linear-gradient(rgba(216,168,74,.2), rgba(20,13,10,.8)); border-color: #a77c3e; box-shadow: inset 0 2px #e4bc70; }
#lobby #lstock { order: 3; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 2px; }
#lobby #lstock .icard .top { grid-template-columns: minmax(120px, .42fr) minmax(0, 1fr); gap: 8px; padding: 9px 9px 6px; }
#lobby #lstock .ic.w { width: 64px; height: 64px; margin-bottom: 4px; }
#lobby #lstock .ic.w img { width: 58px; height: 58px; }
#lobby #lstock .nm b { font-size: 12px; letter-spacing: .5px; }
#lobby #lstock .ds p, #lobby #lstock .blk small { font-size: 11px; }
#lobby #lstock .ft { padding: 0 9px 9px; }
#lobby #lpanel .mh { order: 0; }

@media (max-width: 640px) {
  #lmap { width: 120px; height: 85px; }
  #lchat { bottom: 150px; width: min(280px, calc(100% - 150px)); padding: 6px; }
  #lmsgs { height: 140px; max-height: min(26vh, 220px); }
  #lprompt { bottom: 120px; font-size: 13px; }
  #ltop .ltitle { font-size: 14px; }
  #ltop { right: 8px; left: 8px; gap: 4px; }
  #ltop .pill { padding: 3px 7px; font-size: 11px; }
  #lonline { font-size: 10px; padding: 3px 6px; }
  #lbar { bottom: max(8px, env(safe-area-inset-bottom)); gap: 4px; }
  #lbar button { padding: 8px 9px; font-size: 11px; }
  #lin { min-height: 40px; }
  #lprompt { max-width: calc(100% - 156px); overflow: hidden; text-overflow: ellipsis; }
  #lobby #lpanel { gap: 8px; padding: 10px; }
  #lobby #lpanel .mh { top: -10px; margin: -10px -10px 0; }
  #lobby #ltabs { top: 38px; flex-wrap: wrap; }
  #lobby #lstock { grid-template-columns: minmax(0, 1fr); }
  #lobby #lstock .icard .top { grid-template-columns: minmax(0, 1fr); }
  #lobby #lstock .icard .lf { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 8px; align-items: center; }
  #lobby #lstock .ic.w { width: 56px; height: 56px; margin: 0; }
  #lobby #lstock .ic.w img { width: 50px; height: 50px; }
  #lnpc { min-height: 78px; gap: 9px; padding: 6px 8px; }
  #lnpc .npc-portrait { flex-basis: 54px; height: 66px; }
  #lnpc .npc-portrait img { width: 52px; height: 66px; }
  #lnpc .npc-name { font-size: 16px; }
  #lnpc .npc-quote { font-size: 12px; }
}

#lonline.off { color: #ff8a7a; border-color: #7a2a24; }
#ltop .gold-rate { padding: 4px 8px; }

/* settings window */
#set { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.6); z-index: 60; }
#set .modal { width: min(460px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; padding: 14px 16px; background: rgba(18,12,10,.98); border: 2px solid #d8a84a; border-radius: 10px; box-shadow: 0 10px 50px rgba(0,0,0,.8); }
#set .mh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
#set .mh h2 { margin: 0; font: 700 18px Cinzel, Georgia, serif; letter-spacing: .1em; color: #ffe2a0; }
#set .srow { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 4px; border-bottom: 1px solid #2e2218; color: #f0e6d0; font: 14px Georgia, serif; cursor: pointer; }
#set .srow small { display: block; margin-top: 2px; color: #9a8f80; font-size: 11px; }
#set .srow input { width: 20px; height: 20px; accent-color: #d8a84a; cursor: pointer; }
#set .srow.acct { cursor: default; border-bottom: 0; }
#set .srow button, #set .mh button { font: 600 13px Georgia, serif; color: #f0e6d0; background: rgba(24,15,10,.92); border: 1px solid #5a4430; border-radius: 6px; padding: 7px 14px; cursor: pointer; }
#set .srow button:hover, #set .mh button:hover { border-color: #d8a84a; }
