.online-body {
  min-height: 100vh;
  transition: color 180ms ease, background-color 180ms ease;
}

.online-body .panel,
.online-body .room-bar,
.online-body .connection-chip,
.online-body .icon-button {
  backdrop-filter: blur(10px);
}

:root[data-theme="dark"] .online-body .panel,
:root[data-theme="dark"] .online-body .room-bar {
  background-color: color-mix(in srgb, var(--surface) 90%, transparent);
}

:root[data-theme="light"] .online-body .panel,
:root[data-theme="light"] .online-body .room-bar {
  background-color: color-mix(in srgb, var(--surface) 88%, transparent);
}

.online-header .header-actions {
  padding-right: 54px;
}

.online-header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.online-top-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 12px;
  text-decoration: none;
}

.online-top-back[hidden] {
  display: none;
}

#online-theme-toggle {
  position: fixed;
  z-index: 80;
  top: 12px;
  right: 12px;
  box-shadow: var(--shadow-small);
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease, transform 130ms ease;
}

#online-theme-toggle:hover {
  transform: translateY(-1px) rotate(5deg);
}

.online-shell {
  width: min(1040px, calc(100% - 28px));
  min-height: calc(100vh - 78px);
  margin: 0 auto;
  padding: clamp(14px, 3vh, 30px) 0 50px;
}

.connection-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.connection-chip::before {
  width: 0.55rem;
  height: 0.55rem;
  content: "";
  background: #e6b05a;
  border-radius: 50%;
}

.connection-chip[data-status="connected"]::before {
  background: #43c48b;
}

.connection-chip[data-status="offline"]::before {
  background: #ec7182;
}

.online-loading {
  display: grid;
  min-height: 55vh;
  place-items: center;
  align-content: center;
  gap: 1rem;
  color: var(--muted);
}

.loading-dot {
  width: 2rem;
  height: 2rem;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: online-spin 800ms linear infinite;
}

.online-home {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(340px, 1.1fr);
  align-items: center;
  gap: clamp(1.4rem, 5vw, 4rem);
  min-height: min(680px, calc(100vh - 130px));
}

.online-home-copy {
  display: flow-root;
}

.online-home-character {
  float: right;
  width: auto;
  height: auto;
  max-width: min(225px, 45%);
  max-height: 270px;
  margin: 0.25rem 0 0.5rem 0.75rem;
  object-fit: contain;
  pointer-events: none;
}

.online-home-copy h1 {
  margin: 0.35rem 0 0.8rem;
  font-size: clamp(2.4rem, 5vw, 3.3rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
  white-space: nowrap;
}

:root[data-theme="dark"] .online-home-copy h1 {
  text-shadow:
    -1px -1px 0 #050814,
    1px -1px 0 #050814,
    -1px 1px 0 #050814,
    1px 1px 0 #050814,
    0 2px 8px rgb(0 0 0 / 45%);
}

.online-home-copy p:not(.eyebrow) {
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.8;
}

.online-home-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  clear: both;
  gap: 1rem;
  padding-top: 0.75rem;
}

.online-home-buttons .button {
  white-space: nowrap;
}

.mobile-streaming-guide {
  display: none;
}

.online-site-buttons,
.online-guide-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.online-site-buttons .button {
  min-width: 0;
  padding-inline: .4rem;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  justify-content: center;
  font-size: clamp(.75rem, 3.4vw, .95rem);
}

.online-site-buttons-single {
  grid-template-columns: minmax(0, 1fr);
}

.online-guide-buttons .button {
  min-width: 0;
  padding-inline: 0.4rem;
  font-size: clamp(0.75rem, 3.4vw, 0.95rem);
}

.how-to-play-dialog #how-to-play-content h2 {
  margin: 1.65rem 0 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--muted);
  font-size: 1.05rem;
}

.how-to-play-dialog ol {
  padding-left: 1.4rem;
}

.how-to-play-dialog li + li {
  margin-top: 0.45rem;
}

.okaka-return-button {
  text-align: center;
  justify-content: center;
  background: #fad18f;
  color: #302415;
  border-color: #fad18f;
  font-size: clamp(0.8rem, 3.7vw, 1rem);
}

.streaming-guide-dialog {
  box-sizing: border-box;
  width: min(560px, calc(100% - 28px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: clamp(1rem, 4vw, 1.8rem);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  line-height: 1.75;
}

.streaming-guide-dialog::backdrop {
  background: rgb(0 0 0 / 55%);
}

.streaming-guide-dialog h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.15rem, 5vw, 1.5rem);
}

.streaming-guide-dialog ul {
  padding-left: 1.3rem;
}

.streaming-guide-dialog li + li {
  margin-top: 0.45rem;
}

.streaming-guide-dialog form {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.streaming-credit {
  margin-block: 1rem;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.online-entry-panel {
  display: grid;
  gap: 1.1rem;
  padding: clamp(1.1rem, 3vw, 1.7rem);
}

.online-entry-panel h2,
.online-panel h2 {
  margin: 0;
}

.entry-form {
  display: grid;
  gap: 0.75rem;
}

.code-join-details {
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.code-join-details summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.code-join-details .entry-form {
  margin-top: 0.85rem;
}

.invite-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem 0.8rem;
}

.invite-row .button {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  justify-content: center;
}

.entry-separator {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.entry-separator::before,
.entry-separator::after {
  height: 1px;
  content: "";
  background: var(--line);
}

.online-input {
  width: 100%;
  min-height: 48px;
  padding: 0.72rem 0.85rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
}

.online-input:focus {
  outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-color: var(--accent);
}

.room-code-input {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 900;
}

.online-note {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.online-policy-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.online-policy-links a {
  min-height: 38px;
  padding-block: 0.4rem;
  font-size: 0.72rem;
}

.online-error {
  padding: 0.75rem 0.9rem;
  color: #ffcad1;
  background: rgb(158 38 58 / 24%);
  border: 1px solid rgb(236 113 130 / 45%);
  border-radius: 12px;
}

.room-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.room-code {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.room-code span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.room-code strong {
  color: var(--accent);
  font-size: 1.2rem;
  letter-spacing: 0.14em;
}

.room-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.online-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 1rem;
  align-items: start;
}

.online-stage.is-focus {
  display: block;
  max-width: 720px;
  margin: 0 auto;
}

.online-panel {
  padding: clamp(1rem, 3vw, 1.6rem);
}

.online-panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.online-phase-label {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.participant-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.participant {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.participant-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.participant-badges {
  display: flex;
  gap: 0.3rem;
}

:root[data-theme="light"] {
  --result-win-text: #a72037;
  --result-win-bg: #fde7eb;
  --result-win-border: #df8492;
  --result-lose-text: #225d9e;
  --result-lose-bg: #e6f0ff;
  --result-lose-border: #8cb4e5;
}

:root[data-theme="dark"] {
  --result-win-text: #ff9fac;
  --result-win-bg: #3d2732;
  --result-win-border: #aa596b;
  --result-lose-text: #a4d2ff;
  --result-lose-bg: #233953;
  --result-lose-border: #608dbb;
}

.participant.is-winner,
.participant.is-loser {
  border-width: 2px;
}

.participant.is-winner {
  color: var(--result-win-text);
  background: var(--result-win-bg);
  border-color: var(--result-win-border);
}

.participant.is-loser {
  color: var(--result-lose-text);
  background: var(--result-lose-bg);
  border-color: var(--result-lose-border);
}

.result-outcome-badge.is-winner {
  color: var(--result-win-text);
  border-color: var(--result-win-border);
}

.result-outcome-badge.is-loser {
  color: var(--result-lose-text);
  border-color: var(--result-lose-border);
}

.result-winning-heading {
  color: var(--result-win-text);
}

.mini-badge {
  padding: 0.18rem 0.45rem;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 900;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.mini-badge.is-ready {
  color: #79dfb1;
}

.mini-badge.is-offline {
  color: #ff9cab;
}

.duo-same, .duo-correct { color: #ff8585; }
.duo-different, .duo-incorrect { color: #83baff; }
[data-theme="light"] .duo-same, [data-theme="light"] .duo-correct { color: #b42535; }
[data-theme="light"] .duo-different, [data-theme="light"] .duo-incorrect { color: #1758a8; }
.duo-confirmation { max-width: 42rem; margin-inline: auto; }

.category-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.category-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.online-settings {
  display: grid;
  gap: 1rem;
}

.room-access-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.room-access-setting small {
  margin-left: auto;
  font-size: inherit;
}

.room-access-setting .button {
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 0.76rem;
}

.compact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.compact-field {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.online-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.online-actions > * {
  flex: 1 1 150px;
}

.online-focus {
  text-align: center;
}

.online-focus h1 {
  margin: 0.35rem 0 0.7rem;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1.1;
}

.online-focus > p {
  color: var(--muted);
  line-height: 1.7;
}

.private-topic {
  margin: 1.2rem 0;
  padding: clamp(1.2rem, 4vw, 2rem) 1rem;
  color: var(--on-accent);
  font-size: clamp(2.2rem, 8vw, 4.5rem);
  font-weight: 900;
  line-height: 1.1;
  background: var(--accent);
  border-radius: 18px;
  overflow-wrap: anywhere;
}

.online-focus > .topic-stage-message.is-active {
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 900;
}

.own-topic-details {
  margin: 1rem auto;
  max-width: 430px;
  color: var(--muted);
}

.own-topic-details summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  list-style: none;
}

.own-topic-details summary::-webkit-details-marker {
  display: none;
}

.own-topic-details summary::before {
  content: "▷";
}

.own-topic-details[open] summary::before {
  content: "▽";
}

.own-topic-details strong {
  display: block;
  margin-top: 0.5rem;
  color: var(--accent);
  font-size: 1.5rem;
}

.online-timer {
  margin: 1rem 0;
  font-size: clamp(4rem, 15vw, 8rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.suspect-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1.2rem;
}

.suspect-buttons .button {
  min-height: 58px;
}

.waiting-card {
  margin-top: 1rem;
  padding: 0.9rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.result-topics-online {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin: 1rem 0;
}

.result-topic-online {
  padding: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.result-topic-online span,
.result-topic-online strong {
  display: block;
}

.result-topic-online span {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
}

.result-topic-online strong {
  color: var(--accent);
  font-size: 1.35rem;
}

.online-result-character {
  width: min(180px, 38vw);
  max-height: 190px;
  object-fit: contain;
}

.pause-list {
  margin: 1rem 0;
  color: #ff9cab;
  font-weight: 800;
}

body.is-embedded .online-header {
  position: fixed;
  z-index: 70;
  top: 0;
  right: 0;
  width: 0;
  min-height: 0;
  padding: 0;
}

body.is-embedded .online-header .brand,
body.is-embedded .connection-chip {
  display: none;
}

body.is-embedded .online-header .header-actions {
  padding: 0;
}

body.is-embedded #online-theme-toggle {
  top: 9px;
  right: 9px;
  width: 38px;
  height: 38px;
  font-size: 1.05rem;
}

body.is-embedded .online-shell {
  width: calc(100% - 14px);
  min-height: 100vh;
  padding: 7px 0 30px;
}

body.is-embedded .online-home {
  display: block;
  min-height: auto;
}

body.is-embedded .online-home-copy {
  display: none;
}

body.is-embedded .online-policy-links {
  display: none;
}

body.is-embedded .online-stage {
  display: block;
}

body.is-embedded .online-stage > * + * {
  margin-top: 0.7rem;
}

body.is-embedded .online-panel {
  padding: 0.75rem;
}

body.is-embedded .room-bar {
  margin-bottom: 0.5rem;
  min-height: 42px;
  padding: 0.45rem 3rem 0.45rem 0.6rem;
}

body.is-embedded .online-focus h1 {
  font-size: clamp(1.55rem, 9vw, 2.6rem);
}

body.is-embedded .private-topic {
  font-size: clamp(1.7rem, 12vw, 3rem);
}

body.is-embedded .online-timer {
  font-size: clamp(3.2rem, 24vw, 5.5rem);
}

@media (max-width: 760px) {
  .desktop-streaming-guide {
    display: none;
  }

  .mobile-streaming-guide {
    display: grid;
    padding-top: 0;
  }

  .online-home,
  .online-stage {
    grid-template-columns: 1fr;
  }

  .online-shell {
    padding-bottom: 18px;
  }

  .online-home {
    align-items: start;
    gap: 0.75rem;
    min-height: auto;
  }

  .online-home-copy h1 {
    margin: 0.15rem 0 0.4rem;
    font-size: clamp(1.75rem, 8.6vw, 2.4rem);
  }

  .online-home-copy p:not(.eyebrow) {
    margin: 0.3rem 0;
    font-size: 0.82rem;
    line-height: 1.5;
  }

  .online-home-copy .button-text {
    min-height: 36px;
    padding-block: 0.35rem;
  }

  .online-entry-panel {
    gap: 0.65rem;
    padding: 0.85rem;
  }

  .online-entry-panel h2 {
    font-size: 1.3rem;
  }

  .entry-form {
    gap: 0.5rem;
  }

  .entry-separator {
    gap: 0.5rem;
  }

  .online-input {
    min-height: 44px;
    padding: 0.55rem 0.7rem;
  }

  .online-entry-panel .button-large,
  .online-home-buttons .button-large {
    min-height: 46px;
    padding: 0.65rem 1rem;
  }

  .online-entry-panel .online-note {
    margin: 0;
    font-size: 0.74rem;
    line-height: 1.45;
  }

  .online-policy-links {
    gap: 0.4rem;
  }

  .online-policy-links a {
    min-height: 34px;
    padding: 0.3rem 0.45rem;
    font-size: 0.68rem;
  }
}

@media (max-width: 420px) {
  .online-home-character {
    max-width: 37.5%;
    max-height: 138px;
    margin-left: 0.5rem;
  }

  .invite-row {
    gap: 0.25rem;
  }

  .invite-row .button {
    padding-inline: 0.45rem;
    font-size: 0.8rem;
  }

  .online-header {
    min-height: 56px;
    padding: 7px 9px;
  }

  .online-header .brand > span:last-child {
    display: none;
  }

  .online-shell {
    width: calc(100% - 18px);
    padding-top: 4px;
  }

  #online-theme-toggle {
    top: 9px;
    right: 9px;
    width: 42px;
    height: 42px;
  }

  .category-checks,
  .compact-fields,
  .suspect-buttons,
  .result-topics-online {
    grid-template-columns: 1fr;
  }

  .room-code strong {
    font-size: 1rem;
  }

  .online-home-copy .eyebrow {
    font-size: 0.7rem;
  }
}

@media (max-width: 420px) and (max-height: 740px) {
  .online-home {
    gap: 0.5rem;
  }

  .online-home-copy p:not(.eyebrow) {
    font-size: 0.76rem;
    line-height: 1.4;
  }

  .online-entry-panel {
    gap: 0.5rem;
    padding: 0.7rem;
  }

  .online-entry-panel h2 {
    font-size: 1.15rem;
  }

  .online-entry-panel .online-note {
    font-size: 0.68rem;
  }
}

@keyframes online-spin {
  to { transform: rotate(360deg); }
}

.no-wolf-setting { min-width: 0; margin: 0; padding: 0; border: 0; }
.no-wolf-setting legend { margin-bottom: 0.45rem; font-weight: 700; }
.no-wolf-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.35rem; }
.no-wolf-options label { display: flex; align-items: center; justify-content: center; gap: 0.35rem; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.no-wolf-options label:has(input:checked) { outline: 2px solid var(--accent); outline-offset: -2px; }
.no-wolf-options input { margin: 0; accent-color: var(--accent); }
.no-wolf-options label:focus-within { outline: 2px solid currentColor; }
.no-wolf-setting .online-note { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  .loading-dot {
    animation-duration: 1600ms;
  }
}
