/* Ape In! — online lobby, rooms and in-game online extras. */

/* ---------------------------------------------------------- menu card --- */
.mode-card .tier.live { animation: livePulse 2s ease-in-out infinite; }
@keyframes livePulse { 50% { box-shadow: 0 0 14px color-mix(in srgb, var(--c) 70%, transparent); } }

/* ------------------------------------------------------- connection --- */
.net-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; padding: 6px 12px; border-radius: 99px; white-space: nowrap;
  background: rgba(255,255,255,.06); border: 1px solid var(--panel-border); color: var(--muted);
}
.net-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.net-chip[data-s="online"] { color: var(--green); border-color: rgba(61,220,132,.4); }
.net-chip[data-s="online"]::before { background: var(--green); box-shadow: 0 0 10px var(--green); }
.net-chip[data-s="connecting"]::before, .net-chip[data-s="offline"]::before { background: var(--gold); animation: blink 1s infinite; }
.net-chip[data-s="offline"] { color: var(--gold); }
@keyframes blink { 50% { opacity: .3; } }
.net-note { color: var(--gold); font-size: 14px; text-align: center; min-height: 1.2em; margin: 16px 0 0; }

/* -------------------------------------------------------------- home --- */
.online-wrap .menu-head { margin-bottom: 18px; }
.online-title { font-size: clamp(34px, 7vw, 56px); margin: 0; }
.online-wrap .menu-sub { color: var(--muted); max-width: 60ch; margin: 6px 0 18px; }
.online-name { margin-bottom: 18px; }
.online-name .input { width: min(100%, 260px); font-weight: 700; }
.online-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.online-card { min-height: 220px; padding: 18px; }
.online-card .big-ico { font-size: 40px; line-height: 1; filter: drop-shadow(0 0 14px color-mix(in srgb, var(--c) 70%, transparent)); }
.online-card h3 { font-size: 24px; }
.join-card {
  --c: var(--gold); position: relative; display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--radius);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 18%, transparent), rgba(22,12,46,.85) 55%);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); backdrop-filter: blur(8px);
}
.join-card .tier { position: absolute; top: 12px; right: 12px; font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; padding: 4px 8px; border-radius: 99px; background: color-mix(in srgb, var(--c) 25%, transparent); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); }
.join-card h3 { margin: 30px 0 0; font-family: var(--display); font-weight: 400; font-size: 24px; letter-spacing: .5px; }
.code-input {
  font-family: var(--display); font-size: 30px; letter-spacing: 10px; text-align: center; text-transform: uppercase;
  padding: 12px 8px 12px 18px; color: var(--gold);
}
.code-input::placeholder { color: rgba(255,210,63,.25); }

/* -------------------------------------------------------------- room --- */
.room-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
  padding: 18px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-border); backdrop-filter: blur(10px);
}
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.room-code {
  font-family: var(--display); font-size: clamp(40px, 9vw, 64px); letter-spacing: clamp(6px, 2vw, 14px); line-height: 1.05;
  color: var(--gold); text-shadow: 0 0 24px rgba(255,210,63,.45); user-select: all;
}
.room-share { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 320px; }
.room-share span { color: var(--muted); font-size: 13px; }
.room-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-top: 4px; }
.room-panel { min-width: 0; }
.lobby-seats { display: grid; gap: 10px; }
.lobby-seat {
  --c: var(--violet); display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; min-width: 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 16%, transparent), rgba(22,12,46,.8) 60%);
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); animation: rise .3s ease-out both;
}
.lobby-seat.you { box-shadow: 0 0 0 1px var(--c), 0 0 20px color-mix(in srgb, var(--c) 30%, transparent); }
.lobby-seat.empty { background: rgba(255,255,255,.03); border-style: dashed; opacity: .7; }
.ls-av {
  width: 46px; height: 46px; flex: none; position: relative; border-radius: 14px; display: grid; place-items: center; overflow: hidden;
  font-family: var(--display); font-size: 16px; color: #fff; background: color-mix(in srgb, var(--c) 45%, #1a0d38);
  border: 2px solid var(--c);
}
.ls-av.art { background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--c) 45%, transparent), rgba(22,12,46,.9)); }
.ls-av img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; transform: scale(1.25); transform-origin: 50% 20%; }
.ls-txt { flex: 1; min-width: 0; }
.ls-txt b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-txt b i { font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; padding: 2px 6px; border-radius: 99px; background: var(--c); color: #12062b; vertical-align: 2px; margin-left: 4px; }
.ls-txt small { color: var(--muted); font-size: 13px; }
.ls-txt small .ok { color: var(--green); font-weight: 700; }
.ls-txt small .away { color: var(--gold); font-weight: 700; }
.ls-tag { font-weight: 800; color: var(--dim); width: 32px; text-align: center; }
.ls-tag.ok { color: var(--green); }
.ls-x { padding: 6px 10px; }
.add-char { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.add-char > span { color: var(--muted); font-size: 13px; font-weight: 600; margin-right: 2px; }
.char-chip {
  --c: var(--violet); display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 99px; cursor: pointer;
  font-weight: 700; font-size: 13px; color: var(--text); background: color-mix(in srgb, var(--c) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); transition: transform .12s, background .15s;
}
.char-chip:hover { background: color-mix(in srgb, var(--c) 32%, transparent); transform: translateY(-1px); }
.char-chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; background: rgba(0,0,0,.3); }
.rules-list { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--panel-border); }
.rule { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rule > span { color: var(--muted); font-weight: 600; font-size: 14px; }
.rule .input { min-width: 130px; }
.rule.ro b { font-variant-numeric: tabular-nums; }
.rule.check { justify-content: flex-start; cursor: pointer; }
.rule.check input { width: 18px; height: 18px; accent-color: var(--pink); }
.room-note { color: var(--dim); font-size: 13px; margin: 12px 2px 0; line-height: 1.4; }
.room-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px 18px; margin-top: 22px; }
.room-why { margin: 0; color: var(--muted); font-weight: 600; flex: 1; min-width: 200px; text-align: right; }
.btn-big { font-family: var(--display); font-weight: 400; font-size: 20px; padding: 16px 32px; border-radius: 16px; min-width: 220px; }
.btn:disabled { opacity: .45; cursor: default; filter: grayscale(.4); }

@media (max-width: 760px) {
  .room-grid { grid-template-columns: minmax(0, 1fr); }
  .room-foot { justify-content: stretch; }
  .room-why { text-align: center; }
  .btn-big { width: 100%; }
}

/* ------------------------------------------------------------ in game --- */
.seat .nm .you-tag, .seat .nm .auto-tag {
  font-style: normal; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
  padding: 1px 5px; border-radius: 99px; margin-left: 5px; vertical-align: 1px;
}
.seat .nm .you-tag { background: var(--c); color: #12062b; }
.seat .nm .auto-tag { background: rgba(255,210,63,.2); color: var(--gold); border: 1px solid rgba(255,210,63,.4); }
.seat.auto .av { filter: saturate(.5); }

.turnbox { position: relative; }
.turn-clock {
  --pct: 100%; position: absolute; top: -12px; right: -10px; padding: 3px 9px; border-radius: 99px; font-weight: 800; font-size: 12.5px;
  font-variant-numeric: tabular-nums; color: #12062b; background: linear-gradient(90deg, var(--cyan) var(--pct), rgba(77,201,255,.35) var(--pct));
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.turn-clock.low { background: linear-gradient(90deg, var(--red) var(--pct), rgba(255,77,109,.35) var(--pct)); color: #fff; animation: blink .8s infinite; }

.emotes { position: relative; display: flex; }
.emotes button { cursor: pointer; transition: transform .12s, background .12s; }
.emotes button:active { transform: scale(.94); }
.take-back { animation: livePulse 1.6s infinite; --c: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  .mode-card .tier.live, .take-back, .turn-clock.low, .net-chip::before { animation: none; }
}

/* keep toasts clear of the taller online controls */
body:has(#emotes:not([hidden])) .toast { bottom: calc(200px + var(--safe-b)); }

/* emote tray: one 😀 button; tap it for a tray of labelled emotes */
.bottom { position: relative; }
.emotes .emote-toggle {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; font-size: 22px;
  background: rgba(22,12,46,.85); border: 1px solid var(--panel-border);
}
.emotes .emote-toggle:hover, .emotes.open .emote-toggle { border-color: var(--lux-soft, rgba(232,192,106,.5)); background: rgba(40,22,74,.95); }
.emotes .emote-list {
  display: none; position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 30;
  grid-template-columns: repeat(4, 76px); gap: 6px; padding: 8px; border-radius: 16px;
  background: rgba(16,8,34,.97); border: 1px solid var(--panel-border); box-shadow: 0 12px 34px rgba(0,0,0,.55);
}
.emotes.open .emote-list { display: grid; animation: rise .18s ease-out both; }
.emotes .emote-list button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; padding: 5px 3px; border-radius: 12px; color: #f3edff;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
}
.emotes .emote-list button:hover { background: rgba(255,255,255,.1); transform: translateY(-1px); }
.emotes .emo-i { font-size: 22px; line-height: 1; }
.emotes .emo-l { font-size: 10.5px; font-weight: 700; line-height: 1.1; text-align: center; max-width: 100%; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 700px) {
  .emotes { position: absolute; right: 12px; top: 0; z-index: 6; }
  .emotes .emote-toggle { width: 46px; height: 46px; }
  .emotes .emote-list { grid-template-columns: repeat(4, 66px); }
  .emotes .emote-list button { min-height: 56px; }
  .hint { font-size: 12.5px; }
}
