/* v0.46 social: chat box (bottom-right, above the dock), whispers, parcels, Tamer profiles, friends */
#chat { position: fixed; right: 12px; bottom: 76px; z-index: 45; font-size: 14px; color: var(--ui-text); }
#chat .ch-pill { display: none; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 18px; background: #0d1626ee; border: 1px solid #3a5a8a; color: var(--ui-text); cursor: pointer; box-shadow: 0 4px 14px #0008; font: inherit; }
#chat.collapsed .ch-pill { display: flex; }
#chat.collapsed .ch-panel { display: none; }
#chat .ch-badge { background: var(--ui-bad); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; }
/* wide and see-through so the game shows behind it; solid again while you use it (hover / typing) */
#chat .ch-panel { width: min(600px, 46vw); height: 320px; display: flex; flex-direction: column; background: #0d16269e; border: 1px solid #3a5a8a99; border-radius: 10px; box-shadow: 0 4px 18px #0006; overflow: hidden; transition: background .2s, border-color .2s; }
#chat .ch-panel:hover, #chat .ch-panel:focus-within { background: #0d1626e6; border-color: #3a5a8a; }
#chat .ch-log { text-shadow: 1px 1px 0 #000, 0 0 3px #000; }
#chat .ch-head { display: flex; align-items: center; gap: 4px; padding: 4px 6px; background: #16233aaa; border-bottom: 1px solid #2c446899; }
#chat .ch-head button { background: none; border: 1px solid transparent; color: var(--ui-muted); border-radius: 6px; padding: 2px 8px; cursor: pointer; font: inherit; }
#chat .ch-head button.on { color: var(--ui-gold); border-color: var(--ui-gold-d); }
#chat .ch-head .ch-fr.alert { color: var(--ui-gold); }
#chat .ch-log { flex: 1; overflow-y: auto; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
#chat .ch-l { line-height: 1.35; word-wrap: break-word; }
#chat .ch-t { color: #6c7f9c; font-size: 11px; margin-right: 5px; }
#chat .ch-l.sys { color: var(--ui-gold); }
#chat .ch-l.w { color: #f3a6e0; }
#chat .ch-name { color: #8fd0ff; cursor: pointer; text-decoration: none; font-weight: bold; }
#chat .ch-l.sys .ch-name { color: #ffe08a; }
#chat .ch-parcel { margin: 3px 0 3px 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--ui-text); }
.ch-item { display: inline-block; background: #24365a; border: 1px solid #3a5a8a; border-radius: 6px; padding: 0 6px; font-size: 12px; }
.ch-item a, .ch-chip a { cursor: pointer; color: var(--ui-bad); margin-left: 3px; }
#chat .ch-att { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 6px; }
#chat .ch-att:empty { display: none; }
#chat .ch-in { display: flex; gap: 4px; padding: 5px 6px; border-top: 1px solid #2c4468; align-items: center; }
#chat .ch-in input { flex: 1; min-width: 0; background: #0a1220cc; color: var(--ui-text); border: 1px solid #3a5a8a; border-radius: 6px; padding: 5px 7px; font: inherit; }
#chat .ch-in button { padding: 4px 9px; }
#chat .ch-clip { background: none; border: none; cursor: pointer; font-size: 16px; }
.ch-chip { white-space: nowrap; background: #4a2a52; color: #f3a6e0; border-radius: 6px; padding: 1px 6px; font-size: 12px; }
/* Tamer profile */
.tp-name { font-size: 22px; color: var(--ui-gold); }
.tp-party { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-mon { width: 84px; display: flex; flex-direction: column; align-items: center; background: #16233a; border: 1px solid #2c4468; border-radius: 8px; padding: 4px; text-align: center; font-size: 12px; }
.tp-mon img { width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; }
.tp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tp-stats div { background: #16233a; border: 1px solid #2c4468; border-radius: 8px; padding: 5px; text-align: center; display: flex; flex-direction: column; }
.tp-stats b { font-size: 17px; color: var(--ui-accent); }
.tp-stats small { color: var(--ui-muted); font-size: 11px; }
.tp-act { margin-top: 10px; gap: 6px; flex-wrap: wrap; }
/* phones: a small button over the dock's right end; open = a full-width sheet */
@media (max-width: 760px), (max-height: 500px) {
  #chat { right: 6px; bottom: calc(70px + env(safe-area-inset-bottom)); }
  #chat.collapsed { bottom: calc(136px + env(safe-area-inset-bottom)); }
  #chat .ch-pill span { display: none; }
  #chat:not(.collapsed) { left: 4px; right: 4px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 60; }
  #chat .ch-panel { width: auto; height: 45vh; background: #0d1626a6; }
  #chat .ch-panel:focus-within { background: #0d1626e0; }
  #chat { font-size: 15px; }
  .tp-stats { grid-template-columns: repeat(2, 1fr); }
}
#chat .ch-in button.ok { background: #1f6a3c; border: 1px solid #6fe39a; border-radius: 6px; color: var(--ui-text); cursor: pointer; }
#chat .ch-in button.ok:disabled { opacity: .5; }
/* new-message alerts: a bubble with the latest line over the chat button, the button pulses, tab dots */
#chat .ch-bubble { display: none; position: absolute; right: 0; bottom: calc(100% + 8px); width: max-content; max-width: 300px; padding: 7px 10px; border-radius: 10px;
  background: #16233af2; border: 1px solid #5cc8f8; color: var(--ui-text); box-shadow: 0 4px 14px #000a; cursor: pointer; line-height: 1.35; animation: chpop .25s ease-out; }
#chat .ch-bubble::after { content: ''; position: absolute; right: 22px; bottom: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: #5cc8f8; }
#chat .ch-bubble.show { display: block; }
#chat .ch-bubble.w { border-color: #f3a6e0; color: #f3a6e0; } #chat .ch-bubble.w::after { border-top-color: #f3a6e0; }
#chat .ch-bubble.sys { border-color: var(--ui-gold); color: var(--ui-gold); } #chat .ch-bubble.sys::after { border-top-color: var(--ui-gold); }
#chat:not(.collapsed) .ch-bubble { display: none; }
#chat.pulse .ch-pill { border-color: #5cc8f8; animation: chpulse 1.4s ease-in-out infinite; }
#chat .ch-head button.new::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: var(--ui-bad); vertical-align: middle; }
@keyframes chpulse { 0%, 100% { box-shadow: 0 4px 14px #0008, 0 0 0 0 #5cc8f880; } 50% { box-shadow: 0 4px 14px #0008, 0 0 0 8px #5cc8f800; transform: scale(1.06); } }
@keyframes chpop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px), (max-height: 500px) { #chat .ch-bubble { max-width: calc(100vw - 24px); } }
/* players on this map (button under the map banner) + bot tags */
.banner .mp-btn { display: block; margin: 3px auto 0; font-size: 12px; text-shadow: none; color: #cfe6ff; background: #16233acc; border: 1px solid #3a5a8a; border-radius: 10px; padding: 1px 10px; cursor: pointer; }
.banner .mp-btn:hover { border-color: #5cc8f8; color: #fff; }
.botTag { color: #9fb0c8; font-weight: normal; font-size: .85em; margin-left: 1px; }
.mp-row { cursor: pointer; gap: 8px; align-items: center; }
.mp-row img.mini { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; }
.mp-act { color: #8fe8a8; }
/* phones (v0.47): the right-side icon bar (js/rail.js) — Journey / Chat / Players here, slides away with its tab */
#rail { display: none; }
@media (max-width: 760px), (max-height: 500px) {
  #rail { display: flex; flex-direction: column; gap: 8px; position: fixed; right: 0; top: 104px; z-index: 50; padding: 8px 6px; background: #0d1626b8; border: 1px solid #3a5a8a; border-right: 0; border-radius: 12px 0 0 12px; transition: transform .25s; }
  #rail.off { transform: translateX(100%); }
  #rail .rl-tab { position: absolute; left: -22px; top: 50%; transform: translateY(-50%); width: 22px; height: 52px; background: #0d1626d0; border: 1px solid #3a5a8a; border-right: 0; border-radius: 10px 0 0 10px; color: var(--ui-gold); font-size: 18px; padding: 0; cursor: pointer; }
  #rail .rl-b { position: relative; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; background: #16233a; border: 1px solid #3a5a8a; border-radius: 10px; padding: 0; cursor: pointer; }
  #rail .rl-b.on { border-color: var(--ui-gold); }
  #rail .rl-b .ico { width: 28px; height: 28px; }
  #rail .rl-e { font-size: 22px; line-height: 1; }
  #rail .rl-b b { position: absolute; right: -5px; top: -6px; min-width: 18px; padding: 0 4px; border-radius: 9px; background: var(--ui-bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
  #rail .rl-b[data-r="journey"] b { background: var(--ui-gold-d); }
  /* the tracker only opens from the bar (it covered the shop buttons) */
  #tracker { display: none; }
  body.tr-open #tracker { display: block; z-index: 95; }
  /* chat and players-here open from the bar too */
  body:has(#rail) #chat.collapsed .ch-pill { display: none; }
  body:has(#rail) #chat.collapsed { bottom: auto; top: 230px; right: 64px; }
  body:has(#rail) #chat.collapsed .ch-bubble { bottom: auto; top: 0; right: 0; }
  body:has(#rail) #chat.collapsed .ch-bubble::after { display: none; }
  body:has(#rail) .banner .mp-btn { display: none; }
}

/* other Tamers on the field (social.js drawPlayers): 32x48 frames drawn at 1.5x, walking = 4-frame cycle on the facing row */
#field > .mpl { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; cursor: pointer;
  transition: left 2s linear, top 2s linear; pointer-events: auto; --row: 0; }
#field > .mpl .tsp { width: 48px; height: 72px; background-size: 192px 288px; background-position: 0 calc(var(--row) * -72px); image-rendering: pixelated; order: 2;
  filter: drop-shadow(0 3px 2px #0006); }
#field > .mpl.mwalk .tsp { animation: mplwalk .6s steps(4) infinite; }
@keyframes mplwalk { from { background-position-x: 0; } to { background-position-x: -192px; } }
#field > .mpl .mpn { order: 1; font-size: 11px; line-height: 1.15; color: #fff; text-align: center; white-space: nowrap; text-shadow: 0 1px 2px #000, 0 0 3px #000;
  background: #0b162680; border-radius: 6px; padding: 1px 6px; }
#field > .mpl .mpn small { display: block; font-size: 9.5px; color: #cfe3f5; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
#field > .mpl:hover .mpn { background: #0b1626e6; }
@media (max-width: 700px) { #field > .mpl .tsp { width: 36px; height: 54px; background-size: 144px 216px; background-position: 0 calc(var(--row) * -54px); }
  #field > .mpl.mwalk .tsp { animation-name: mplwalkS; } @keyframes mplwalkS { to { background-position-x: -144px; } } #field > .mpl .mpn small { display: none; } }

/* server notice banner (social.js announce) */
#srvAnn { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 100000; display: flex; align-items: center; gap: 12px; max-width: min(760px, 94vw);
  padding: 10px 14px; border-radius: 10px; background: linear-gradient(90deg, #ff8a1e, #ffb347); color: #1b0f00; font-size: 15px; box-shadow: 0 6px 24px #0008; border: 2px solid #fff6; }
#srvAnn b { white-space: nowrap; letter-spacing: .04em; } #srvAnn span { flex: 1; line-height: 1.3; }
#srvAnn button { background: #0003; border: 0; color: #1b0f00; border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 14px; }
/* v0.70.3 System tab: battle lines (muted) and drops (gold), filter chips on top */
#chat .ch-sysf { display: flex; gap: 4px; padding: 3px 0 5px; position: sticky; top: -6px; z-index: 1; background: #101a2b; box-shadow: 0 4px 6px #101a2b; }
#chat .ch-sysf button { background: none; border: 1px solid #2c3d58; color: var(--ui-muted); border-radius: 99px; padding: 1px 9px; font-size: 11px; cursor: pointer; }
#chat .ch-sysf button.on { color: var(--ui-gold); border-color: var(--ui-gold-d); }
#chat .ch-l.sysl.sl-battle { color: #b9c6d8; } /* (not .battle: the battle screen owns that class) */
#chat .ch-l.sysl.sl-loot { color: #f2d27a; }

/* v7.9.5 the worn story Title under the name */
#field > .mpl .mpn .mpt { display: block; font-style: normal; font-size: 10px; color: #ffd76a; }
