:root {
  color-scheme: light;
  --bg: #e7ecea;
  --ink: #111a18;
  --muted: #64716d;
  --line: rgba(17, 26, 24, 0.12);
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --surface: #f7faf8;
  --accent: #1d9a8a;
  --accent-dark: #137064;
  --blue: #376fa8;
  --coral: #c95c54;
  --purple: #8a5aa0;
  --amber: #d09a26;
  --danger: #cd3d37;
  --shadow: 0 24px 70px rgba(20, 32, 29, 0.18);
  --soft-shadow: 0 14px 34px rgba(20, 32, 29, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(128deg, rgba(55, 111, 168, 0.2) 0 24%, transparent 24% 100%),
    linear-gradient(306deg, rgba(201, 92, 84, 0.18) 0 20%, transparent 20% 100%),
    linear-gradient(180deg, #f3f5f1, var(--bg));
  color: var(--ink);
}

body.game-immersive {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-shell {
  min-height: 100dvh;
  padding: 18px;
  display: grid;
  place-items: center;
}

.workspace {
  width: min(1180px, 100%);
  height: min(850px, calc(100dvh - 36px));
  min-height: 620px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(17, 26, 24, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(155deg, rgba(29, 154, 138, 0.14), transparent 38%),
    linear-gradient(24deg, rgba(138, 90, 160, 0.13), transparent 34%),
    rgba(247, 250, 248, 0.92);
  box-shadow: var(--shadow);
}

.os-shell {
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr) 78px;
}

.os-statusbar {
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(17, 26, 24, 0.08);
  background: rgba(255, 255, 255, 0.54);
  backdrop-filter: blur(18px);
}

.os-status-left,
.os-status-right,
.os-mini-status {
  display: flex;
  align-items: center;
}

.os-status-left {
  gap: 10px;
  min-width: 0;
}

.os-status-left span {
  font-weight: 900;
}

.os-status-left strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.os-status-right {
  gap: 8px;
}

.os-mini-status {
  min-height: 30px;
  padding: 0 10px;
  gap: 7px;
  border: 1px solid rgba(17, 26, 24, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.install-pwa-button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 900;
}

.install-pwa-button:hover {
  background: #243631;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.signal-dot {
  width: 11px;
  height: 11px;
  display: inline-block;
  border-radius: 999px;
  background: #aab5b1;
}

.signal-dot.online {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(29, 154, 138, 0.14);
}

.os-home,
.os-app-screen {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.os-home {
  padding: 22px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
}

.home-hero {
  min-height: 156px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.34fr);
  align-items: end;
  gap: 18px;
  border: 1px solid rgba(17, 26, 24, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.55)),
    linear-gradient(90deg, rgba(29, 154, 138, 0.18), rgba(55, 111, 168, 0.14), rgba(201, 92, 84, 0.12));
  box-shadow: var(--soft-shadow);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--ink), #30423d);
  color: white;
  font-size: 1.2rem;
  font-weight: 900;
}

.brand h1 {
  font-size: clamp(1.72rem, 4vw, 3.2rem);
  line-height: 1;
}

.brand p {
  margin-top: 7px;
  color: var(--muted);
  font-weight: 700;
}

.home-snapshot {
  min-height: 104px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: 7px 12px;
  border: 1px solid rgba(17, 26, 24, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.home-snapshot .label {
  grid-column: 1 / -1;
}

.home-snapshot strong {
  min-width: 0;
  overflow: hidden;
  font-size: 1.22rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.os-widget {
  min-height: 112px;
  padding: 14px;
  display: grid;
  align-content: end;
  gap: 4px;
  border: 1px solid rgba(17, 26, 24, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 22px rgba(20, 32, 29, 0.08);
}

.os-widget strong {
  font-size: 1.08rem;
}

.os-widget small {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.3;
}

.radio-widget {
  border-top: 4px solid var(--accent);
}

.chat-widget {
  border-top: 4px solid var(--blue);
}

.games-widget {
  border-top: 4px solid var(--coral);
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  gap: 14px;
  align-content: start;
}

.app-icon-button {
  min-width: 0;
  min-height: 116px;
  padding: 12px 10px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  border: 1px solid rgba(17, 26, 24, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(20, 32, 29, 0.08);
}

.app-icon-button:hover,
.app-icon-button.active {
  border-color: rgba(29, 154, 138, 0.42);
  background: rgba(255, 255, 255, 0.92);
}

.app-icon {
  width: 54px;
  height: 54px;
  position: relative;
  display: block;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.radio-icon {
  background: linear-gradient(135deg, var(--accent), #0f6d64);
}

.radio-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 11px;
  width: 15px;
  height: 22px;
  transform: translateX(-50%);
  border: 3px solid #fff;
  border-radius: 999px;
}

.radio-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 24px;
  height: 14px;
  transform: translateX(-50%);
  border-bottom: 3px solid #fff;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
}

.chat-icon {
  background: linear-gradient(135deg, var(--blue), #264b83);
}

.chat-icon::before {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  top: 15px;
  height: 23px;
  border: 3px solid #fff;
  border-radius: 8px;
}

.chat-icon::after {
  content: "";
  position: absolute;
  left: 19px;
  bottom: 11px;
  width: 10px;
  height: 10px;
  background: #fff;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.games-icon {
  background: linear-gradient(135deg, var(--coral), #9b433e);
}

.games-icon::before,
.games-icon::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.games-icon::before {
  left: 12px;
  top: 23px;
  width: 30px;
  height: 10px;
  background: #fff;
}

.games-icon::after {
  right: 13px;
  top: 13px;
  width: 9px;
  height: 9px;
  background: #fff;
  box-shadow: -18px 18px 0 #fff, 0 18px 0 #fff;
}

.people-icon {
  background: linear-gradient(135deg, var(--purple), #603878);
}

.people-icon::before,
.people-icon::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: #fff;
}

.people-icon::before {
  left: 17px;
  top: 13px;
  width: 20px;
  height: 20px;
}

.people-icon::after {
  left: 11px;
  bottom: 10px;
  width: 32px;
  height: 16px;
}

.os-app-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 16px 18px 0;
  gap: 12px;
}

.app-titlebar {
  min-height: 58px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.home-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(17, 26, 24, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 20px rgba(20, 32, 29, 0.08);
}

.home-button span {
  width: 18px;
  height: 18px;
  border-left: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform: rotate(45deg) translate(3px, -3px);
}

.app-titlebar h2 {
  margin-top: 2px;
  overflow: hidden;
  font-size: 1.44rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.os-app-deck {
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.os-app-view {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.radio-panel {
  height: 100%;
  min-height: 360px;
  padding: clamp(18px, 4vw, 34px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(18px, 4vw, 44px);
  overflow: hidden;
  border: 1px solid rgba(17, 26, 24, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(29, 154, 138, 0.2), transparent 56%),
    linear-gradient(315deg, rgba(208, 154, 38, 0.18), transparent 38%),
    var(--panel-solid);
  box-shadow: var(--soft-shadow);
}

.radio-copy h2 {
  margin-top: 6px;
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 0.98;
}

.radio-copy p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
}

.radio-actions {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.mic-button,
.secure-link {
  min-height: 44px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-weight: 900;
  text-decoration: none;
}

.mic-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.mic-button:hover:not(:disabled) {
  border-color: var(--accent);
}

.mic-button:disabled {
  cursor: default;
  opacity: 0.82;
}

.mic-button.ready {
  color: var(--accent-dark);
}

.mic-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #aab5b1;
}

.mic-button.ready .mic-status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(29, 154, 138, 0.12);
}

.secure-link {
  background: var(--ink);
  color: #ffffff;
}

.talk-button {
  width: clamp(132px, 22vw, 190px);
  height: clamp(132px, 22vw, 190px);
  padding: 18px;
  display: grid;
  place-items: center;
  gap: 7px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  box-shadow: 0 18px 34px rgba(29, 154, 138, 0.28);
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
  user-select: none;
  touch-action: none;
}

.talk-button:hover {
  background: var(--accent-dark);
}

.talk-button:disabled {
  cursor: not-allowed;
  background: #aab5b1;
  box-shadow: none;
  opacity: 0.78;
}

.talk-button:active,
.talk-button.talking {
  transform: scale(0.96);
  background: var(--danger);
  box-shadow: 0 12px 28px rgba(205, 61, 55, 0.26);
}

.talk-icon {
  width: 32px;
  height: 42px;
  position: relative;
  border: 4px solid currentColor;
  border-radius: 18px;
}

.talk-icon::before,
.talk-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: currentColor;
}

.talk-icon::before {
  bottom: -15px;
  width: 4px;
  height: 12px;
  border-radius: 999px;
}

.talk-icon::after {
  bottom: -20px;
  width: 24px;
  height: 4px;
  border-radius: 999px;
}

.chat-panel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(17, 26, 24, 0.08);
  border-radius: 8px;
  background: var(--panel-solid);
  box-shadow: var(--soft-shadow);
}

.messages {
  min-height: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

.message,
.notice {
  max-width: min(680px, 92%);
  border-radius: 8px;
}

.message {
  padding: 11px 13px;
  background: #eef4f1;
}

.message.own {
  align-self: flex-end;
  background: #dff3ef;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.message-color {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.message-text {
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.notice {
  align-self: center;
  padding: 6px 10px;
  background: #f6f8f7;
  color: var(--muted);
  font-size: 0.82rem;
}

.message-form {
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #f8faf9;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input[type="text"],
#displayName,
#messageInput {
  padding: 0 13px;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(29, 154, 138, 0.13);
}

.message-form button,
.game-card button,
.game-footer button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
}

.message-form button,
.game-card button {
  background: var(--ink);
}

.message-form button:hover,
.game-card button:hover:not(:disabled) {
  background: #243631;
}

.game-card button:disabled,
.game-footer button:disabled {
  cursor: default;
  background: #aab5b1;
}

#gamesApp {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 14px;
}

.game-library-panel {
  min-width: 0;
  min-height: 0;
  padding: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  overflow: auto;
  border: 1px solid rgba(17, 26, 24, 0.08);
  border-radius: 8px;
  background: var(--panel-solid);
  box-shadow: var(--soft-shadow);
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.library-header h2,
.game-topbar h2 {
  margin-top: 3px;
  font-size: 1.24rem;
  line-height: 1.15;
}

.library-online {
  min-height: 34px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f8f7;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.game-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  align-content: start;
}

.game-card {
  min-width: 0;
  min-height: 268px;
  padding: 12px;
  display: grid;
  grid-template-rows: 108px minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.game-card-preview {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(rgba(20, 32, 29, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 29, 0.06) 1px, transparent 1px),
    #dfe8e5;
  background-size: 36px 36px;
}

.game-card-preview span {
  position: absolute;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.78);
}

.game-card-preview span:nth-child(1) {
  left: 24px;
  top: 28px;
  width: 52px;
  height: 52px;
  background: var(--accent);
}

.game-card-preview span:nth-child(2) {
  right: 28px;
  top: 18px;
  width: 24px;
  height: 24px;
  background: var(--purple);
}

.game-card-preview span:nth-child(3) {
  right: 74px;
  bottom: 18px;
  width: 14px;
  height: 14px;
  background: #d85a68;
}

.maze-preview {
  background:
    linear-gradient(90deg, transparent 0 22%, rgba(20, 32, 29, 0.18) 22% 25%, transparent 25% 100%),
    linear-gradient(rgba(20, 32, 29, 0.12) 0 18%, transparent 18% 40%, rgba(20, 32, 29, 0.12) 40% 45%, transparent 45% 100%),
    #e7efeb;
}

.duel-preview {
  background:
    radial-gradient(circle at 35% 50%, var(--blue) 0 18px, transparent 19px),
    radial-gradient(circle at 66% 50%, var(--coral) 0 18px, transparent 19px),
    linear-gradient(90deg, rgba(20, 32, 29, 0.16), transparent 38% 62%, rgba(20, 32, 29, 0.16)),
    #e2ebe7;
}

.game-card-kicker {
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.game-card h3 {
  margin: 3px 0 0;
  font-size: 1.02rem;
  line-height: 1.16;
}

.game-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.36;
}

.game-card-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.game-card-meta span {
  min-height: 26px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #e9f0ed;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.is-coming {
  opacity: 0.78;
}

.game-panel {
  min-width: 0;
  min-height: 0;
  padding: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  overflow: hidden;
  border: 1px solid rgba(17, 26, 24, 0.08);
  border-radius: 8px;
  background: var(--panel-solid);
  box-shadow: var(--soft-shadow);
}

.game-panel.is-library-hidden {
  display: none;
}

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.game-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(74px, 1fr));
  gap: 8px;
}

.game-stats div {
  min-height: 50px;
  padding: 8px 10px;
  display: grid;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f7;
}

.game-stats span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.game-stats strong {
  margin-top: 2px;
  font-size: 1.02rem;
}

.game-stage {
  min-height: 320px;
  position: relative;
  overflow: hidden;
  border: 1px solid #cdd8d3;
  border-radius: 8px;
  background: #dfe8e5;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
}

.game-toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  max-width: min(320px, calc(100% - 28px));
  padding: 9px 12px;
  transform: translateX(-50%);
  border-radius: 8px;
  background: rgba(20, 32, 29, 0.88);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

.game-action-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  gap: 10px;
  touch-action: none;
}

.game-action-controls button {
  min-width: 74px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: rgba(20, 32, 29, 0.86);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(20, 32, 29, 0.18);
}

.game-action-controls button:active {
  transform: translateY(1px);
}

.mobile-stick {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 118px;
  height: 118px;
  display: none;
  border: 1px solid rgba(20, 32, 29, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.46);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.42);
  touch-action: none;
  user-select: none;
}

.mobile-stick::before,
.mobile-stick::after {
  content: "";
  position: absolute;
  background: rgba(20, 32, 29, 0.16);
  border-radius: 999px;
}

.mobile-stick::before {
  left: 50%;
  top: 14px;
  bottom: 14px;
  width: 2px;
  transform: translateX(-50%);
}

.mobile-stick::after {
  left: 14px;
  right: 14px;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
}

.mobile-stick span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(29, 154, 138, 0.3);
}

.game-footer {
  min-height: 44px;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.game-footer button {
  background: var(--accent);
}

.game-footer button:hover {
  background: var(--accent-dark);
}

.leaderboard {
  min-width: 0;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  list-style: none;
}

.leaderboard li {
  min-width: 118px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f7;
  font-size: 0.78rem;
}

.leaderboard i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.leaderboard span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard small {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.people-app {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1fr);
  gap: 14px;
}

.profile-panel,
.people-panel {
  border: 1px solid rgba(17, 26, 24, 0.08);
  border-radius: 8px;
  background: var(--panel-solid);
  box-shadow: var(--soft-shadow);
}

.profile-panel {
  min-height: 174px;
  padding: 16px;
  align-self: start;
}

.profile-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.profile-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
}

.color-picker {
  padding: 4px;
}

.people-panel {
  min-height: 0;
  padding: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 900;
}

.panel-title span:last-child {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e8eeeb;
  color: var(--muted);
  font-size: 0.85rem;
}

.users-list {
  min-height: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  list-style: none;
}

.user-item {
  min-height: 42px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.user-color {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.user-name {
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-speaking {
  min-width: 58px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(224, 183, 63, 0.18);
  color: #8a6610;
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.remote-audio {
  display: none;
}

.os-dock {
  min-width: 0;
  padding: 10px 16px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-top: 1px solid rgba(17, 26, 24, 0.08);
  background: rgba(255, 255, 255, 0.46);
  backdrop-filter: blur(18px);
}

.dock-button {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(17, 26, 24, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 22px rgba(20, 32, 29, 0.1);
}

.dock-button.active,
.dock-button:hover {
  border-color: rgba(29, 154, 138, 0.42);
  background: rgba(255, 255, 255, 0.94);
}

.dock-button .app-icon {
  width: 38px;
  height: 38px;
}

.dock-button .radio-icon::before {
  top: 8px;
  width: 11px;
  height: 16px;
  border-width: 2px;
}

.dock-button .radio-icon::after {
  bottom: 8px;
  width: 18px;
  height: 10px;
  border-bottom-width: 2px;
  border-left-width: 2px;
  border-right-width: 2px;
}

.dock-button .chat-icon::before {
  left: 8px;
  right: 8px;
  top: 11px;
  height: 17px;
  border-width: 2px;
}

.dock-button .chat-icon::after {
  left: 14px;
  bottom: 8px;
  width: 8px;
  height: 8px;
}

.dock-button .games-icon::before {
  left: 9px;
  top: 17px;
  width: 22px;
  height: 8px;
}

.dock-button .games-icon::after {
  right: 9px;
  top: 9px;
  width: 7px;
  height: 7px;
  box-shadow: -13px 13px 0 #fff, 0 13px 0 #fff;
}

.dock-home-icon {
  width: 28px;
  height: 28px;
  position: relative;
  display: block;
}

.dock-home-icon::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 3px solid var(--ink);
  border-radius: 8px;
}

.dock-home-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3px;
  width: 13px;
  height: 13px;
  transform: rotate(45deg);
  border-left: 3px solid var(--ink);
  border-top: 3px solid var(--ink);
}

.game-immersive .game-panel,
.game-panel:fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100dvw;
  height: 100dvh;
  min-height: 100dvh;
  padding: 0;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #dfe8e5;
}

.game-immersive .game-stage,
.game-panel:fullscreen .game-stage {
  position: absolute;
  inset: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
}

.game-immersive .game-topbar,
.game-panel:fullscreen .game-topbar {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  z-index: 5;
  pointer-events: none;
}

.game-immersive .game-topbar > div:first-child,
.game-panel:fullscreen .game-topbar > div:first-child {
  display: none;
}

.game-immersive .game-stats,
.game-panel:fullscreen .game-stats {
  width: min(220px, 42dvw);
  margin-left: auto;
  pointer-events: auto;
}

.game-immersive .game-stats div,
.game-panel:fullscreen .game-stats div {
  min-height: 42px;
  border-color: rgba(20, 32, 29, 0.16);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(10px);
}

.game-immersive .game-footer,
.game-panel:fullscreen .game-footer {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  z-index: 6;
  min-height: 0;
  display: block;
  pointer-events: none;
}

.game-immersive .game-footer button,
.game-panel:fullscreen .game-footer button {
  min-height: 40px;
  padding: 0 14px;
  pointer-events: auto;
  background: rgba(20, 32, 29, 0.86);
  box-shadow: 0 10px 24px rgba(20, 32, 29, 0.18);
}

.game-immersive .leaderboard,
.game-panel:fullscreen .leaderboard {
  display: none;
}

.game-immersive .mobile-stick,
.game-panel:fullscreen .mobile-stick {
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: clamp(96px, 19vmin, 134px);
  height: clamp(96px, 19vmin, 134px);
  display: block;
}

.game-immersive .game-action-controls,
.game-panel:fullscreen .game-action-controls {
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 5;
}

.game-immersive .game-action-controls button,
.game-panel:fullscreen .game-action-controls button {
  min-width: clamp(66px, 12vmin, 88px);
  min-height: clamp(44px, 8vmin, 56px);
}

.game-immersive .game-toast,
.game-panel:fullscreen .game-toast {
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 84px));
}

@media (max-width: 900px) {
  .app-shell {
    padding: 0;
    place-items: stretch;
  }

  .workspace {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .home-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .widget-grid {
    order: 3;
    grid-template-columns: 1fr;
  }

  .app-grid {
    order: 2;
    grid-template-columns: repeat(4, minmax(70px, 1fr));
  }

  .app-icon-button {
    min-height: 98px;
  }

  .people-app {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .people-panel {
    min-height: 260px;
  }

  .mobile-stick {
    display: block;
  }
}

@media (max-width: 620px) {
  .os-shell {
    grid-template-rows: 44px minmax(0, 1fr) 72px;
  }

  .os-statusbar {
    padding: 0 12px;
  }

  .os-status-left strong,
  .os-mini-status:last-child {
    display: none;
  }

  .os-home {
    padding: 14px;
    gap: 14px;
  }

  .brand {
    align-items: flex-end;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
  }

  .brand h1 {
    font-size: clamp(1.58rem, 9vw, 2.4rem);
  }

  .app-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .app-icon-button {
    min-height: 88px;
    padding: 8px 4px;
    font-size: 0.82rem;
  }

  .app-icon {
    width: 46px;
    height: 46px;
  }

  .os-app-screen {
    padding: 10px 12px 0;
  }

  .app-titlebar {
    min-height: 52px;
  }

  .radio-panel {
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: center;
    text-align: center;
  }

  .radio-actions {
    justify-content: center;
  }

  .message-form {
    grid-template-columns: 1fr;
  }

  .game-topbar,
  .game-footer {
    grid-template-columns: 1fr;
  }

  .game-topbar {
    display: grid;
  }

  .game-stage {
    min-height: 300px;
  }

  .mobile-stick {
    left: 12px;
    bottom: 12px;
    width: 104px;
    height: 104px;
  }

  .mobile-stick span {
    width: 40px;
    height: 40px;
  }

  .game-action-controls {
    right: 12px;
    bottom: 12px;
    gap: 8px;
  }

  .game-action-controls button {
    min-width: 62px;
    min-height: 44px;
    padding: 0 10px;
  }

  .message,
  .notice {
    max-width: 100%;
  }

  .os-dock {
    padding: 9px 12px 12px;
    gap: 9px;
  }

  .dock-button {
    width: 50px;
    height: 50px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .os-shell {
    grid-template-rows: 38px minmax(0, 1fr) 58px;
  }

  .os-home {
    grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.2fr);
    grid-template-rows: auto minmax(0, 1fr);
    padding: 12px;
  }

  .home-hero {
    grid-row: 1 / -1;
    min-height: 0;
  }

  .widget-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .os-widget {
    min-height: 86px;
  }

  .app-grid {
    align-self: start;
  }

  .os-dock {
    padding: 7px 12px;
  }

  .dock-button {
    width: 44px;
    height: 44px;
  }

  .game-immersive .game-stats,
  .game-panel:fullscreen .game-stats {
    width: min(190px, 34dvw);
  }

  .game-immersive .game-stats div,
  .game-panel:fullscreen .game-stats div {
    min-height: 36px;
    padding: 6px 8px;
  }

  .game-immersive .game-footer button,
  .game-panel:fullscreen .game-footer button {
    min-height: 36px;
  }

  .game-immersive .mobile-stick,
  .game-panel:fullscreen .mobile-stick {
    width: clamp(86px, 21vmin, 118px);
    height: clamp(86px, 21vmin, 118px);
  }

  .game-immersive .mobile-stick span,
  .game-panel:fullscreen .mobile-stick span {
    width: 38px;
    height: 38px;
  }
}
