/* Moonhowl — many-screen extras (ONLINE worker). Only .online-* classes. Mobile-first, RTL-safe. */

.online-root { display: flex; flex-direction: column; gap: var(--gap, 1rem); }
.online-entry .title { margin-block-end: 0; }

.online-label { font-weight: 600; }
.online-join-row { flex-wrap: nowrap; align-items: stretch; }
.online-code-input {
  flex: 1 1 auto;
  min-inline-size: 0;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-family: var(--font-num, monospace);
  font-size: 1.25rem;
  text-align: center;
}
.online-guest a { font-weight: 700; }

/* Room code */
.online-code {
  font-family: var(--font-num, monospace);
  font-size: clamp(2.4rem, 1.6rem + 5vw, 4rem);
  font-weight: 800;
  letter-spacing: 0.3em;
  padding-inline-start: 0.3em; /* balance trailing letter-spacing */
  line-height: 1.1;
  direction: ltr;
  unicode-bidi: isolate;
}
.online-link {
  max-inline-size: 100%;
  overflow-wrap: anywhere;
  opacity: 0.75;
  direction: ltr;
  unicode-bidi: isolate;
}

/* Lobby options */
.online-option { justify-content: space-between; align-items: center; }
.online-option-label { flex: 1 1 10rem; min-inline-size: 0; }
.online-step-value { min-inline-size: 3.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.online-kick { min-block-size: var(--tap, 44px); padding-inline: 0.6rem; font-size: var(--fs-xs, 0.8rem); }

/* Phase header + reconnect */
.online-conn { display: flex; align-items: center; gap: 0.4rem; }
.online-spin { display: inline-block; }

/* Role (tap to show / hide) */
.online-role-toggle {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  inline-size: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  border-radius: var(--r-lg, 20px);
}
.online-role-toggle:focus-visible { outline: 3px solid var(--focus, currentColor); outline-offset: 3px; }
.online-role-hidden { min-block-size: 7rem; display: grid; place-content: center; gap: 0.3rem; }
.online-role-hint { display: block; }
.online-allies, .online-lover { margin: 0; }
.online-potions { gap: 0.4rem; }

/* Events, actions */
.online-events { gap: 0.45rem; }
.online-event { line-height: 1.4; }
.online-actions .subtitle { margin: 0; }
.online-sleep, .online-discuss { font-size: var(--fs-lg, 1.2rem); margin-block: 0.5rem; }
.online-submitted, .online-seer-result { margin: 0; }
.online-player-btn { -webkit-tap-highlight-color: transparent; }
.online-arrow-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.online-arrow-from { font-weight: 600; }
.online-arrow { opacity: 0.6; }
[dir="rtl"] .online-arrow { display: inline-block; transform: scaleX(-1); }
.online-seer-wolf { font-weight: 700; }
.online-winner { font-weight: 700; }

/* Chat */
.online-chat-toggle { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.online-chat-title { display: none; margin: 0; padding: 0.75rem 0.9rem 0; }
.online-chat-body { gap: 0.5rem; min-block-size: 0; }
.online-chat-body > .tabs { margin: 0.5rem 0.5rem 0; }
.online-chat-collapsed .online-chat-body { display: none; }
.online-chat-closed { margin: 0; padding: 0.5rem 0.75rem 0.75rem; }
.online-chat-name {
  display: block;
  font-size: var(--fs-xs, 0.8rem);
  font-weight: 700;
  color: var(--accent-ink, inherit);
  overflow-wrap: anywhere;
}
.online-chat-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.online-unread { margin-inline-start: 0.35rem; }
.online-chat-caret { margin-inline-start: auto; }

/* Layout: stacked on phones (chat last), two columns on wide screens */
.online-layout { display: flex; flex-direction: column; gap: var(--gap, 1rem); }
.online-primary { min-inline-size: 0; }
.online-chat-col { min-inline-size: 0; }

@media (min-width: 1000px) {
  /* Break out of the 760px container for the room screen (symmetric, so RTL-safe). */
  .online-in-room { margin-inline: calc(50% - min(590px, 50vw - 1.5rem)); }
  .online-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    align-items: start;
  }
  .online-chat-col { position: sticky; inset-block-start: 4.5rem; }
  .online-chat { max-block-size: calc(100vh - 6rem); }
  .online-chat .chat-log { max-block-size: none; min-block-size: 16rem; block-size: calc(100vh - 16rem); }
  .online-chat-toggle { display: none; }
  .online-chat-title { display: block; }
  .online-chat-collapsed .online-chat-body { display: flex; }
}

@media (prefers-reduced-motion: no-preference) {
  .online-conn .online-spin, .online-connecting .online-spin { animation: online-bob 1.6s ease-in-out infinite; }
  .online-events, .online-seer-result { animation: online-in 320ms ease-out both; }
}
@keyframes online-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes online-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
