/* Social (social.js): friends, reports, contact form, ranked ladder page, in-game chat. */
:root { --so-gold: #f6dc9c; --so-ink: #f4e9ee; --so-mute: rgb(244 233 238 / .64); --so-line: rgb(246 220 156 / .22); --so-panel: rgb(26 12 12 / .92); }

/* ---------- avatars, rows */
.so-avatar { position: relative; flex: none; display: grid; place-items: center; width: 34px; height: 34px; overflow: hidden; border: 1px solid var(--so-line); border-radius: 50%;
  background: linear-gradient(140deg, #5a2b1d, #2a1210); color: var(--so-gold); font: 700 14px/1 var(--ec-font-ui, system-ui); }
.so-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.so-dot { flex: none; width: 9px; height: 9px; margin-left: -14px; align-self: flex-end; border: 2px solid #1d0d0c; border-radius: 50%; background: #6b6168; }
.is-online > .so-dot, .rk-person .so-dot { background: #5fe08e; box-shadow: 0 0 8px #5fe08e; }
.so-list { display: grid; gap: 6px; margin: 6px 0 14px; padding: 0; list-style: none; }
.so-friend { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid rgb(255 255 255 / .07); border-radius: 12px; background: rgb(0 0 0 / .18); }
.so-who { display: grid; flex: 1; min-width: 0; gap: 1px; }
.so-who b { overflow: hidden; color: #fff6ec; font: 650 14.5px/1.25 var(--ec-font-ui, system-ui); white-space: nowrap; text-overflow: ellipsis; }
.so-who small { overflow: hidden; color: var(--so-mute); font: 500 12px/1.3 var(--ec-font-ui, system-ui); white-space: nowrap; text-overflow: ellipsis; }
.so-row-actions { display: flex; flex: none; align-items: center; gap: 6px; }
.so-small { min-height: 32px !important; padding: 0 12px !important; font-size: 13px !important; }
.so-small:disabled { opacity: .45; cursor: not-allowed; }
/* Friend request: Accept and Decline are one button design (wine, gold edge, cream Cormorant
   serif); Accept is a touch bigger with a gold sheen so it's the one you want to press. */
.so-req-btn { display: inline-grid; place-items: center; min-height: 34px; margin: 0; padding: 0 16px; border: 1px solid rgb(246 220 156 / .45); border-radius: 16px; cursor: pointer;
  background: linear-gradient(180deg, rgb(255 236 214 / .07), rgb(255 236 214 / 0)), rgb(28 9 7 / .62); color: #f6dc9c;
  font: 700 16px/1 'Cormorant Garamond', var(--ec-font-display, Georgia, serif); letter-spacing: normal; text-transform: none; box-shadow: none;
  transition: border-color .16s, background-color .16s, transform .16s, box-shadow .16s; }
.so-req-btn:hover { border-color: rgb(246 220 156 / .8); background-color: rgb(45 16 13 / .8); }
.so-req-btn:disabled { opacity: .45; cursor: not-allowed; }
.so-req-accept { min-height: 38px; padding: 0 20px; font-size: 17.5px; border-color: rgb(246 220 156 / .85); color: #fff1cf;
  background: linear-gradient(115deg, rgb(255 244 214 / 0) 30%, rgb(255 244 214 / .22) 46%, rgb(255 244 214 / 0) 62%) no-repeat, linear-gradient(180deg, rgb(246 220 156 / .26), rgb(217 171 82 / .08)), rgb(58 20 12 / .85);
  background-size: 250% 100%, auto, auto; background-position: 100% 0, 0 0, 0 0;
  box-shadow: 0 0 0 1px rgb(246 220 156 / .12), 0 0 16px -4px rgb(246 200 110 / .55), inset 0 1px 0 rgb(255 244 214 / .35);
  animation: so-accept-sheen 3.2s ease-in-out infinite; }
.so-req-accept:hover { transform: translateY(-1px); border-color: #f6dc9c; box-shadow: 0 0 0 1px rgb(246 220 156 / .25), 0 0 22px -3px rgb(246 200 110 / .75), inset 0 1px 0 rgb(255 244 214 / .45); }
@keyframes so-accept-sheen { 0%, 55% { background-position: 100% 0, 0 0, 0 0; } 85%, 100% { background-position: -50% 0, 0 0, 0 0; } }
@media (prefers-reduced-motion: reduce) { .so-req-accept { animation: none; } }
.so-tag { padding: 3px 8px; border-radius: 99px; background: rgb(255 255 255 / .07); color: var(--so-mute); font: 600 11.5px var(--ec-font-ui, system-ui); }
.so-more { position: relative; }
.so-more summary { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--so-line); border-radius: 9px; color: var(--so-ink); cursor: pointer; list-style: none; }
.so-more summary::-webkit-details-marker { display: none; }
.so-more > div { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; display: grid; min-width: 150px; padding: 5px; border: 1px solid var(--so-line); border-radius: 11px; background: var(--so-panel); box-shadow: 0 14px 30px -12px #000; }
.so-more > div button { padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--so-ink); font: 500 13px var(--ec-font-ui, system-ui); text-align: left; cursor: pointer; }
.so-more > div button:hover, .so-more > div button:focus-visible { background: rgb(255 255 255 / .08); outline: none; }
.so-add { display: flex; gap: 8px; margin: 4px 0 4px; }
.so-add input { flex: 1; min-width: 0; min-height: 42px; padding: 0 12px; border: 1px solid var(--so-line); border-radius: 11px; background: rgb(0 0 0 / .3); color: #fff; font: 500 15px var(--ec-font-ui, system-ui); }
.so-find { position: relative; display: flex; flex: 1; min-width: 0; }
.so-find > input { width: 100%; }
.so-find-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; gap: 2px; max-height: 320px; margin: 0; padding: 5px; overflow-y: auto; list-style: none;
  border: 1px solid var(--so-line); border-radius: 12px; background: #1f0e0d; box-shadow: 0 18px 40px -14px #000; }
.so-find-list[hidden] { display: none; }
.so-find-list [role=option] { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 9px; cursor: pointer; }
.so-find-list [role=option]:hover, .so-find-list [aria-selected=true] { background: rgb(246 220 156 / .1); }
.so-find-list .is-done { cursor: default; }
.so-find-list .is-done:hover { background: none; }
.so-find-add { flex: none; padding: 4px 11px; border: 1px solid var(--so-line); border-radius: 99px; color: var(--so-gold); font: 650 12.5px var(--ec-font-ui, system-ui); }
.so-find-none { padding: 9px 10px; color: var(--so-mute); font: 500 13px var(--ec-font-ui, system-ui); }
.so-msg { min-height: 1.2em; margin: 2px 0 6px; color: var(--so-gold); font: 500 13px var(--ec-font-ui, system-ui); }
.pf-subhead small { margin-left: 6px; color: var(--so-mute); font-size: .7em; font-weight: 500; }
.room-invite-friends { width: min(460px, 100%); margin: 14px auto 0; text-align: left; }
.so-invite-list { margin-top: 8px; }

/* ---------- dialogs */
.so-dialog { width: min(470px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 22px 22px 18px; overflow: auto; border: 1px solid var(--so-line); border-radius: 18px;
  background: linear-gradient(160deg, #2a1310, #160a0b); color: var(--so-ink); box-shadow: 0 30px 80px -20px #000; }
.so-dialog::backdrop { background: rgb(8 4 6 / .66); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.so-dialog h2 { margin: 2px 0 6px; color: #fff6ec; font: 600 24px/1.15 var(--ec-font-display, Georgia, serif); }
.so-eyebrow { margin: 0; color: var(--so-gold); font: 700 11px var(--ec-font-ui, system-ui); letter-spacing: .18em; text-transform: uppercase; }
.so-note { margin: 0 0 14px; color: var(--so-mute); font: 400 14px/1.45 var(--ec-font-ui, system-ui); }
.so-x { position: absolute; top: 10px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgb(255 255 255 / .06); color: var(--so-ink); font-size: 20px; cursor: pointer; }
.so-form { display: grid; gap: 12px; }
.so-form label { display: grid; gap: 5px; color: var(--so-ink); font: 600 13px var(--ec-font-ui, system-ui); }
.so-form label small { color: var(--so-mute); font-weight: 400; }
.so-form :is(input, select, textarea) { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--so-line); border-radius: 10px; background: rgb(0 0 0 / .32); color: #fff; font: 400 15px/1.35 var(--ec-font-ui, system-ui); }
.so-form textarea { resize: vertical; }
.so-form select option { background: #1d0d0c; }
.so-reasons { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.so-reasons legend { margin-bottom: 6px; font: 600 13px var(--ec-font-ui, system-ui); }
.so-radio { display: flex !important; align-items: center; gap: 10px !important; padding: 9px 11px; border: 1px solid rgb(255 255 255 / .08); border-radius: 10px; background: rgb(0 0 0 / .2); cursor: pointer; font-weight: 500 !important; }
.so-radio input { width: 17px; height: 17px; min-height: 0; margin: 0; accent-color: var(--so-gold); }
.so-radio:has(input:checked) { border-color: var(--so-gold); background: rgb(246 220 156 / .08); }
.so-err { min-height: 1.1em; margin: 0; color: #ffb0a8; font: 500 13px var(--ec-font-ui, system-ui); }
.so-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.so-done { display: grid; gap: 8px; justify-items: start; }
.so-done strong { color: var(--so-gold); font: 650 17px var(--ec-font-ui, system-ui); }
.so-done p { margin: 0 0 6px; color: var(--so-mute); font: 400 14px/1.45 var(--ec-font-ui, system-ui); }

/* ---------- profile: clickable ranked / legacy cards */
.pf-rank[data-ranked-open], .pf-legacy[data-legacy-open] { cursor: pointer; transition: border-color 180ms, translate 180ms, box-shadow 180ms; }
.pf-rank[data-ranked-open]:hover, .pf-rank[data-ranked-open]:focus-visible, .pf-legacy[data-legacy-open]:hover, .pf-legacy[data-legacy-open]:focus-visible {
  border-color: var(--so-gold); translate: 0 -2px; box-shadow: 0 16px 34px -18px rgb(246 220 156 / .5); outline: none; }
.pf-open-hint { display: inline-block; margin-top: 4px; color: var(--so-gold); font: 600 12.5px var(--ec-font-ui, system-ui); }

/* ---------- ranked ladder page */
.rk-page { max-width: 820px; margin: 0 auto; }
.rk-mode { margin: 6px 0 16px; max-width: 340px; }
.rk-summary { display: flex; align-items: center; gap: 18px; padding: 16px 18px; border: 1px solid var(--so-line); border-radius: 18px; background: linear-gradient(120deg, rgb(70 30 20 / .55), rgb(20 10 12 / .7)); }
.rk-summary-badge .rank-badge { scale: 1.35; margin: 10px; }
.rk-summary-copy { display: grid; flex: 1; gap: 4px; min-width: 0; text-align: left; }
.rk-summary-copy small { color: var(--so-gold); font: 700 11px var(--ec-font-ui, system-ui); letter-spacing: .16em; text-transform: uppercase; }
.rk-summary-copy strong { color: #fff6ec; font: 600 26px/1.1 var(--ec-font-display, Georgia, serif); }
.rk-summary-copy p { margin: 0; color: var(--so-ink); font: 500 14px var(--ec-font-ui, system-ui); }
.rk-summary-copy .rk-fine { color: var(--so-mute); font-size: 12.5px; }
.rk-bar { display: block; height: 7px; margin: 3px 0; overflow: hidden; border-radius: 9px; background: rgb(255 255 255 / .1); }
.rk-bar i { display: block; width: var(--p); height: 100%; border-radius: inherit; background: linear-gradient(90deg, #fff1c9, var(--so-gold) 40%, #d39a3a); }
.rk-friends-note { margin: 12px 2px 8px; }
.rk-ladder { position: relative; display: grid; gap: 6px; max-height: min(62vh, 760px); margin: 0; padding: 4px 6px 4px 0; overflow-y: auto; list-style: none; scroll-padding: 80px; }
.rk-row { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid rgb(255 255 255 / .06); border-radius: 14px; background: rgb(0 0 0 / .2); text-align: left; }
.rk-row[data-state="locked"] { opacity: .62; }
.rk-row[data-state="locked"] .rk-badge { filter: grayscale(.7) brightness(.8); }
.rk-row[data-state="current"] { border-color: var(--so-gold); background: linear-gradient(110deg, rgb(246 220 156 / .14), rgb(0 0 0 / .25)); box-shadow: 0 0 24px -10px rgb(246 220 156 / .6); opacity: 1; }
.rk-badge { flex: none; display: grid; place-items: center; width: 62px; }
.rk-info { display: grid; flex: 1; gap: 2px; min-width: 0; }
.rk-info b { color: #fff6ec; font: 650 16px/1.2 var(--ec-font-ui, system-ui); }
.rk-info small { color: var(--so-mute); font: 500 12.5px/1.3 var(--ec-font-ui, system-ui); }
.rk-cp { color: var(--so-gold); font-weight: 650; }
.rk-to { color: var(--so-gold) !important; }
.rk-people { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 46%; }
.rk-person { display: inline-flex; align-items: center; gap: 6px; max-width: 150px; padding: 3px 9px 3px 3px; border: 1px solid var(--so-line); border-radius: 99px; background: rgb(0 0 0 / .32); color: var(--so-ink); font: 600 12px var(--ec-font-ui, system-ui); }
.rk-person .so-avatar { width: 24px; height: 24px; font-size: 11px; }
.rk-person > span:not(.so-avatar) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rk-person .so-dot { width: 7px; height: 7px; margin: 0; border: 0; }
.rk-person.is-me { border-color: var(--so-gold); background: rgb(246 220 156 / .18); color: #fff6ec; }
@media (max-width: 640px) {
  .rk-summary { flex-wrap: wrap; gap: 12px; padding: 14px; }
  .rk-summary #rk-play { width: 100%; }
  .rk-row { gap: 10px; padding: 9px 10px; flex-wrap: wrap; }
  .rk-badge { width: 48px; }
  .rk-badge .rank-badge { scale: .85; }
  .rk-people { max-width: none; width: 100%; justify-content: flex-start; padding-left: 58px; }
  .rk-people:empty { display: none; }
  .rk-ladder { max-height: none; overflow: visible; }
}

/* ---------- in-game chat (rooms): small, bottom-left, see-through. Text stays readable on any
   background: a dark glass panel behind each line plus a text shadow. Only the input shows until
   someone writes. */
.rc-chat { position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 60; display: grid; gap: 5px; width: min(270px, calc(100vw - 28px)); pointer-events: none; }
body:not(.duel-view) .rc-chat { bottom: max(14px, env(safe-area-inset-bottom)); }
.rc-log { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.rc-msg { justify-self: start; max-width: 100%; padding: 5px 9px; border-radius: 10px; background: rgb(10 8 12 / .66); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: #fff; font: 500 13px/1.35 var(--ec-font-ui, system-ui); text-shadow: 0 1px 2px rgb(0 0 0 / .9); overflow-wrap: anywhere; pointer-events: auto;
  animation: rc-in 260ms ease both; transition: opacity 600ms ease; }
.rc-msg b { color: #ffd98a; font-weight: 700; }
.rc-msg.is-mine b { color: #9fd8ff; }
.rc-msg.is-old { opacity: 0; }
.rc-chat.is-active .rc-msg.is-old, .rc-chat:hover .rc-msg.is-old { opacity: .9; }
@keyframes rc-in { from { opacity: 0; translate: 0 6px; } }
.rc-form { display: flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid rgb(255 255 255 / .14); border-radius: 11px; background: rgb(10 8 12 / .55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); pointer-events: auto; opacity: .72; transition: opacity 160ms, border-color 160ms, background 160ms; }
.rc-chat.is-active .rc-form, .rc-form:hover { opacity: 1; border-color: rgb(246 220 156 / .5); background: rgb(10 8 12 / .72); }
.rc-input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 0; background: none; color: #fff; font: 500 13px var(--ec-font-ui, system-ui); text-shadow: 0 1px 2px #000; outline: none; }
.rc-input::placeholder { color: rgb(255 255 255 / .6); }
.rc-send, .rc-report { flex: none; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: rgb(255 255 255 / .08); color: #fff; font-size: 14px; cursor: pointer; }
.rc-send:hover, .rc-report:hover { background: rgb(255 255 255 / .18); }
.rc-report svg { width: 15px; height: 15px; fill: none; stroke: #ffb0a8; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.rc-chat:not(.is-active) .rc-send { display: none; }
.rc-err { margin: 0; padding: 0 4px; color: #ffc2bb; font: 600 12px/1.3 var(--ec-font-ui, system-ui); text-shadow: 0 1px 2px #000; }
.rc-err:empty { display: none; }
@media (max-width: 700px) {
  .rc-chat { width: min(220px, calc(100vw - 28px)); }
  body.duel-view .rc-chat { bottom: auto; top: max(64px, env(safe-area-inset-top)); }
}
@media (prefers-reduced-motion: reduce) { .rc-msg { animation: none; } }
/* Safe chat (2026-12-01): strangers online get preset phrases; blocked = no typing at all. */
.rc-send[hidden], .rc-input[hidden], .rc-quick[hidden] { display: none; }
.rc-quick { display: flex; flex-wrap: wrap; gap: 4px; pointer-events: auto; }
.rc-phrase { padding: 4px 9px; border: 1px solid rgb(246 220 156 / .35); border-radius: 999px; background: rgb(10 8 12 / .72); color: #fff;
  font: 600 12px/1.2 var(--ec-font-ui, system-ui); cursor: pointer; }
.rc-phrase:hover, .rc-phrase:focus-visible { border-color: rgb(246 220 156 / .85); background: rgb(60 22 32 / .9); }
.rc-chat.is-quick .rc-form, .rc-chat.is-off .rc-form { justify-content: flex-end; width: max-content; justify-self: start; }
.rc-msg[data-from] > b { cursor: pointer; }
.rc-msg[data-from] > b:hover { text-decoration: underline; }
/* Report / Block menu for a player in a room. */
.rc-menu { position: fixed; z-index: 9000; display: grid; min-width: 150px; padding: 6px; border: 1px solid rgb(246 220 156 / .5); border-radius: 12px;
  background: #1c0d12; box-shadow: 0 12px 30px rgb(0 0 0 / .55); }
.rc-menu p { margin: 2px 8px 6px; color: #ffd98a; font: 700 13px/1.2 var(--ec-font-ui, system-ui); overflow-wrap: anywhere; }
.rc-menu button { padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: #fff; text-align: left; font: 600 14px var(--ec-font-ui, system-ui); cursor: pointer; }
.rc-menu button:hover, .rc-menu button:focus-visible { background: rgb(246 220 156 / .12); outline: none; }
/* "Staying safe in Era Clash" rules (new-rules pop-up and guests' first online room). */
.so-rules { display: grid; gap: 10px; margin: 0 0 16px; padding: 0; list-style: none; }
.so-rules li { padding: 10px 12px; border: 1px solid rgb(255 255 255 / .08); border-radius: 10px; background: rgb(0 0 0 / .2);
  color: var(--so-mute); font: 400 14px/1.45 var(--ec-font-ui, system-ui); }
.so-rules b { display: block; margin-bottom: 2px; color: var(--so-gold); font-weight: 700; }
.so-rules-dialog .so-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
/* Report form: "Also block" + blocked players list in Friends & Gifts. */
.so-check { display: flex !important; align-items: center; gap: 10px !important; font-weight: 500 !important; cursor: pointer; }
.so-check input { width: 17px; height: 17px; min-height: 0; margin: 0; accent-color: var(--so-gold); }
.so-blocked > summary { cursor: pointer; list-style: none; }
.so-blocked > summary::-webkit-details-marker { display: none; }
.so-blocked > summary::after { content: ' +'; color: var(--so-gold); }
.so-blocked[open] > summary::after { content: ' −'; }

/* ---------- notification number (owner, 2026-11-30): account button + Friends & Gifts tab */
#account-open { position: relative; }
.ec-note-badge {
  position: absolute; top: -5px; right: -6px; z-index: 2; min-width: 19px; height: 19px; padding: 0 5px; display: grid; place-items: center;
  border-radius: 999px; border: 2px solid #1a0806; background: #c7362b; color: #fff6e6;
  font: 800 11px/1 var(--ec-font-ui, Inter, system-ui, sans-serif); box-shadow: 0 2px 8px rgb(0 0 0 / .5); pointer-events: none;
  animation: ec-note-pop .35s cubic-bezier(.2,.9,.3,1.4);
}
.ec-note-badge[hidden] { display: none; }
.pf-tab { position: relative; }
.pf-tab > .ec-note-badge { top: 0; right: -10px; }
@keyframes ec-note-pop { from { transform: scale(.3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ec-note-badge { animation: none; } }
.so-invites { margin-bottom: 22px; }
