.online-site-header {
  position: relative;
  z-index: 4;
  align-items: center;
}

body[data-page="play-online"] {
  background:
    radial-gradient(circle at top, rgba(63, 138, 85, 0.28), transparent 30%),
    linear-gradient(180deg, #17643b 0%, #133720 24%, var(--bg) 100%);
}

body[data-page="play-online"]::before {
  content: none;
  display: none;
}

.online-app {
  width: min(100%, 1180px);
}

.online-game-screen {
  width: min(100%, 1040px);
}

.online-game-screen .layout {
  width: min(100%, 1040px);
}

.online-lobby {
  min-height: calc(100dvh - 120px);
  display: grid;
  place-items: center;
}

.online-card h1 {
  margin: 22px 0 0;
  color: var(--text);
  font-size: clamp(2.2rem, 7vw, 4.8rem);
  line-height: 0.9;
  text-transform: uppercase;
}

.online-actions {
  display: grid;
  gap: 12px;
}

.online-color-note {
  margin: 14px 0 0;
  color: rgba(245, 245, 239, 0.72);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.online-link {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.invite-box {
  display: grid;
  gap: 10px;
  margin-top: 24px;
  text-align: left;
}

.invite-box span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.invite-box input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  padding: 12px;
}

.online-status {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
}

.online-status strong {
  color: var(--text);
  font-size: clamp(0.78rem, 0.62rem + 0.28vw, 0.96rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.online-status span,
.online-sidebar .online-link {
  color: var(--muted);
  font-size: clamp(0.66rem, 0.56rem + 0.2vw, 0.82rem);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.online-sidebar {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.online-sidebar .online-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(68, 200, 117, 0.56);
  border-radius: 0;
  background: linear-gradient(180deg, #0d3d24 0%, #17643b 100%);
  color: var(--text);
  padding: 0 22px;
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.22);
}

.online-game-screen .game-topbar {
  margin-bottom: clamp(18px, 2.4vw, 28px);
}

.online-game-screen .hand-card.is-remote {
  opacity: 0.82;
}

.online-game-screen .hand-card.is-local-turn {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 0 0 2px rgba(245, 245, 239, 0.16),
    0 18px 36px rgba(0, 0, 0, 0.18);
}

.online-game-screen .hand-card {
  gap: 10px;
  overflow: hidden;
  justify-items: center;
}

.online-game-screen .hand-card .panel-label {
  display: block;
  margin: 0 0 5px;
  max-width: none;
  color: currentColor;
  font-size: clamp(0.52rem, 0.46rem + 0.16vw, 0.64rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-align: center;
}

.online-player-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  align-items: start;
  justify-items: center;
  min-width: 0;
  min-height: 128px;
  text-align: center;
}

.online-player-head > div {
  display: grid;
  justify-items: center;
  min-width: 0;
  max-width: 100%;
}

.online-player-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
  color: currentColor;
  font-size: clamp(0.74rem, 0.52rem + 0.34vw, 0.92rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1.05;
  text-transform: uppercase;
}

.online-player-record {
  display: grid;
  gap: 3px;
  justify-items: center;
  min-width: 0;
  text-align: center;
}

.online-player-record span,
.online-player-record strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: currentColor;
  font-size: clamp(0.5rem, 0.42rem + 0.14vw, 0.6rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.online-game-screen .hand-card.is-white-hand {
  color: #111111;
}

.online-game-screen .hand-card.is-black-hand {
  color: #f5f5ef;
}

.online-game-screen .hand-hint {
  display: none;
  margin: 0;
  color: currentColor;
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1.2;
  opacity: 0.72;
  text-align: left;
  text-transform: uppercase;
}

@media (max-width: 559px) {
  .online-status {
    justify-items: center;
    text-align: center;
  }

  .online-game-screen .hand-card {
    align-content: start;
  }

  .online-player-head {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    column-gap: 8px;
    min-height: auto;
    text-align: center;
    justify-items: center;
    align-items: baseline;
    width: 100%;
  }

  .online-player-head > div {
    display: contents;
  }

  .online-game-screen .hand-card .panel-label,
  .online-player-name,
  .online-player-record span,
  .online-player-record strong {
    font-size: clamp(0.58rem, 2.3vw, 0.72rem);
    letter-spacing: 0.08em;
    line-height: 1;
  }

  .online-game-screen .hand-card .panel-label {
    justify-self: start;
  }

  .online-player-name {
    justify-self: start;
  }

  .online-player-record span {
    justify-self: end;
  }

  .online-player-record strong {
    justify-self: end;
  }

  .online-player-record {
    display: contents;
  }

  .online-game-screen .tile-rack {
    grid-template-columns: repeat(4, minmax(46px, 56px));
    gap: clamp(12px, 4vw, 26px);
    justify-content: center;
    margin-top: clamp(16px, 4.2vh, 28px);
  }

  .online-game-screen .tile-slot {
    width: min(100%, 56px);
  }
}

@media (min-width: 560px) {
  .online-player-head {
    grid-template-columns: 1fr;
    min-height: 112px;
    width: 100%;
  }

  .online-player-head > div {
    display: grid;
  }

  .online-player-record {
    display: grid;
  }

  .online-game-screen .hand-card .panel-label {
    font-size: clamp(0.4rem, 0.72vw, 0.52rem);
    letter-spacing: 0.04em;
  }

  .online-player-name {
    font-size: clamp(0.56rem, 0.88vw, 0.74rem);
  }

  .online-player-record span,
  .online-player-record strong {
    font-size: clamp(0.38rem, 0.72vw, 0.5rem);
    letter-spacing: 0.03em;
  }

  .online-game-screen .hand-card {
    padding-inline: 8px;
  }

  .online-game-screen .tile-rack {
    margin-top: clamp(20px, 3.8vh, 42px);
    width: 100%;
    justify-items: center;
  }
}

@media (min-width: 860px) {
  .online-player-head {
    min-height: 142px;
  }

  .online-game-screen .hand-card .panel-label {
    font-size: 0.56rem;
    letter-spacing: 0.06em;
  }

  .online-player-name {
    font-size: 0.8rem;
  }

  .online-player-record span,
  .online-player-record strong {
    font-size: 0.54rem;
    letter-spacing: 0.05em;
  }

  .online-game-screen .hand-card {
    padding-inline: 10px;
  }

  .online-game-screen .tile-rack {
    margin-top: clamp(22px, 3.8vh, 46px);
  }
}

@media (min-width: 640px) {
  #onlineOpponentHandCard {
    grid-column: 1;
  }

  .online-game-screen .board-panel {
    grid-column: 2;
  }

  #onlinePlayerHandCard {
    grid-column: 3;
  }
}

@media (min-width: 980px) {
  .online-app {
    width: min(100%, 1180px);
  }

  .online-game-screen {
    width: min(100%, 1040px);
  }

  .online-game-screen .layout {
    width: min(100%, 1040px);
  }
}
