/* In-ride community HUD panels. The dock is a kit toolbar placed by sleddin-hud.css;
 * only it and the open panels take pointer input, so the thumb pads stay usable. */
.sleddin-community,
.sleddin-community * { box-sizing: border-box; }
.sleddin-community[hidden],
.sleddin-community [hidden] { display: none !important; }

.sleddin-community {
  --community-cyan: #42e0ff;
  --community-violet: #a36bff;
  --community-pink: #ff4fd8;
  --community-ice: #e9f8ff;
  --community-panel: rgb(6 18 36 / 88%);
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  color: var(--community-ice);
  font-family: var(--i8-font, system-ui, sans-serif);
}

.community-send,
.community-close,
.community-periods button,
.community-link,
.community-actions button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid rgb(66 224 255 / 45%);
  border-radius: 10px 3px 10px 3px;
  background: linear-gradient(135deg, rgb(10 30 58 / 92%), rgb(40 20 70 / 88%));
  color: var(--community-ice);
  font: 700 0.82rem/1 var(--i8-font, system-ui, sans-serif);
  letter-spacing: 0.06em;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.community-send:focus-visible,
.community-close:focus-visible,
.community-periods button:focus-visible,
.community-link:focus-visible,
.community-form input:focus-visible,
.community-form select:focus-visible { outline: 2px solid var(--community-cyan); outline-offset: 2px; }
.community-talk { touch-action: none; user-select: none; -webkit-user-select: none; }
.community-talk.is-talking,
.community-fin.is-talking { border-color: var(--community-pink); background: linear-gradient(135deg, rgb(120 20 90 / 92%), rgb(60 20 110 / 90%)); transform: scale(1.05); }
.community-fin { touch-action: none; user-select: none; -webkit-user-select: none; }
.community-fin.is-speaking { border-color: var(--community-violet); }

.community-notice {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 68px);
  left: 50%;
  max-width: min(460px, calc(100% - 140px));
  margin: 0;
  padding: 8px 12px;
  transform: translateX(-50%);
  border: 1px solid rgb(66 224 255 / 35%);
  border-radius: 10px;
  background: var(--community-panel);
  font-size: 0.9rem;
  text-align: center;
}

.community-chat,
.community-board {
  position: absolute;
  left: calc(max(10px, env(safe-area-inset-left, 0px)) + 96px);
  top: calc(env(safe-area-inset-top, 0px) + 68px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgb(66 224 255 / 42%);
  border-radius: 14px 4px 14px 4px;
  background:
    radial-gradient(ellipse at 6% 0%, rgb(66 224 255 / 12%), transparent 45%),
    radial-gradient(ellipse at 100% 100%, rgb(163 107 255 / 14%), transparent 45%),
    var(--community-panel);
  box-shadow: 0 12px 28px rgb(0 0 0 / 45%);
  pointer-events: auto;
  animation: community-enter 200ms ease-out both;
}
.community-chat { width: min(360px, calc(100% - 120px)); max-height: min(46vh, 380px); }
.community-board { width: min(520px, calc(100% - 120px)); max-height: calc(100% - 150px); }
.community-chat header,
.community-board header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; border-bottom: 1px solid rgb(66 224 255 / 20%); letter-spacing: 0.05em; }
.community-close { min-width: 44px; padding: 0; font-size: 1.3rem; }

.community-log { flex: 1; min-height: 72px; margin: 0; padding: 8px 12px; overflow-y: auto; list-style: none; font-size: 0.95rem; line-height: 1.3; overscroll-behavior: contain; }
.community-log li { margin: 0 0 6px; overflow-wrap: anywhere; }
.community-name { padding: 0; border: 0; background: none; color: var(--community-cyan); font: 700 0.95rem var(--i8-font, system-ui, sans-serif); cursor: pointer; }
.community-self .community-name { color: var(--community-pink); cursor: default; }
.community-fin .community-name { color: var(--community-violet); }
.community-system { color: rgb(233 248 255 / 72%); font-style: italic; }
.community-scope { margin-left: 6px; padding: 1px 4px; border-radius: 4px; background: rgb(66 224 255 / 16%); font-size: 0.7rem; letter-spacing: 0.08em; }
.community-actions { display: inline-flex; gap: 6px; margin-left: 8px; }
.community-actions button { min-height: 36px; font-size: 0.75rem; }

.community-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid rgb(66 224 255 / 20%); }
.community-form input,
.community-form select { min-height: 44px; border: 1px solid rgb(66 224 255 / 35%); border-radius: 8px; background: rgb(2 10 22 / 82%); color: var(--community-ice); font: 600 1rem var(--i8-font, system-ui, sans-serif); }
.community-form input { flex: 1; min-width: 0; padding: 0 10px; }
.community-form select { padding: 0 6px; }

.community-periods { display: flex; gap: 6px; padding: 8px 12px 0; }
.community-periods button[aria-selected="true"] { border-color: var(--community-cyan); box-shadow: 0 0 10px rgb(66 224 255 / 40%); }
.community-board-body { overflow-y: auto; padding: 4px 12px 12px; overscroll-behavior: contain; }
.community-board-body h3 { margin: 12px 0 6px; color: var(--community-cyan); font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; }
.community-board-body h4 { margin: 0 0 4px; font-size: 0.95rem; }
.community-roster,
.community-profiles { margin: 0; padding: 0; list-style: none; }
.community-roster li,
.community-profiles li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid rgb(66 224 255 / 10%); }
.community-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rider, #62e7ff); box-shadow: 0 0 8px var(--rider, #62e7ff); }
.community-meta { flex-basis: 100%; color: rgb(233 248 255 / 70%); font-size: 0.85rem; }
.community-verified { padding: 1px 5px; border-radius: 5px; background: rgb(88 101 242 / 78%); font-size: 0.68rem; letter-spacing: 0.06em; }
.community-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.community-games article { padding: 8px; border: 1px solid rgb(66 224 255 / 18%); border-radius: 8px; background: rgb(2 10 22 / 48%); }
.community-games ol { margin: 0; padding-left: 18px; font-size: 0.88rem; }
.community-empty { margin: 4px 0; color: rgb(233 248 255 / 66%); font-size: 0.9rem; }
.community-reward { margin-top: 12px; padding: 10px; border: 1px solid rgb(163 107 255 / 45%); border-radius: 10px; background: rgb(60 20 110 / 32%); }
.community-reward h3 { margin-top: 0; }
.community-support { border-color: rgb(77 232 255 / 45%); background: rgb(12 50 72 / 36%); }
.community-support .community-link { margin-right: 8px; }
.community-link-secondary { opacity: .85; }
.community-link { display: inline-flex; align-items: center; justify-content: center; margin-top: 6px; text-decoration: none; }

/* Phones and portrait tablets: chat and board panels sit below the community icon
   (the dock folds when a panel opens) and draw above the HUD while open. */
@media (max-width: 600px), (max-width: 900px) and (orientation: portrait) {
  .community-chat,
  .community-board { left: max(8px, env(safe-area-inset-left, 0px)); right: max(8px, env(safe-area-inset-right, 0px)); top: calc(env(safe-area-inset-top, 0px) + 112px); width: auto; }
  .community-chat { max-height: 36vh; }
  .community-board { max-height: 52vh; }
  .community-notice { top: calc(env(safe-area-inset-top, 0px) + 112px); max-width: calc(100% - 20px); }
}
@media (max-height: 520px) and (orientation: landscape) {
  .community-chat,
  .community-board { top: calc(env(safe-area-inset-top, 0px) + 98px); left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 300px)); max-height: calc(100% - 110px); }
  .community-notice { top: calc(env(safe-area-inset-top, 0px) + 98px); }
}
/* On-screen keyboard open (ride-controls.js sets --sled-kb-top/--sled-kb-height to
   the part of the stage still visible): chat and the board fit above the keys,
   the log shrinks first and the message field stays in view. */
html[data-soft-keyboard="open"] .sleddin-community .community-chat,
html[data-soft-keyboard="open"] .sleddin-community .community-board { top: calc(var(--sled-kb-top, 0px) + 6px); bottom: auto; max-height: max(116px, calc(var(--sled-kb-height, 50vh) - 12px)); overflow: hidden; animation: none; }
html[data-soft-keyboard="open"] .sleddin-community .community-log { min-height: 0; }
html[data-soft-keyboard="open"] .sleddin-community .community-chat header { padding-block: 2px; }
html[data-soft-keyboard="open"] .sleddin-community .community-notice { display: none; }
html[data-input-mode="touch"] .community-actions button { min-height: 44px; }
/* The entry slide animates the individual `translate` property, never `transform`, so its filled end state can
   never override a panel's own transform (the centred landscape translateX(-50%), or the desktop and console
   rails' transform: none in sleddin-hud.css). */
@keyframes community-enter { from { opacity: 0; translate: 0 -6px; } to { opacity: 1; translate: none; } }
@media (prefers-reduced-motion: reduce) {
  .community-chat,
  .community-board { animation: none; }
  .community-talk.is-talking,
  .community-fin.is-talking { transform: none; }
}
