* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #25304a 0%, #141821 55%, #0b0d13 100%);
  color: #f0f3ff;
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
}

main {
  position: relative;
  width: min(96vw, 1220px);
  margin: 24px auto;
}

#game {
  width: 100%;
  height: auto;
  display: block;
  border: 2px solid #3f4e75;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  background: #0f131f;
}

.channel-badge {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(8, 13, 24, 0.82);
  border: 1px solid rgba(126, 151, 212, 0.65);
  color: #d7e6ff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#channelBadge {
  position: fixed !important;
  top: auto !important;
  left: auto !important;
  right: 12px !important;
  bottom: 12px !important;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: radial-gradient(circle at top, rgba(46, 61, 95, 0.65), rgba(8, 12, 20, 0.86) 70%);
}

.screen.visible {
  display: flex;
}

.screen-panel {
  width: min(92%, 640px);
  padding: 28px 26px;
  border-radius: 16px;
  border: 1.5px solid rgba(138, 164, 224, 0.62);
  background: rgba(8, 12, 20, 0.88);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.38);
  text-align: center;
}

h1,
h2 {
  margin: 0 0 10px;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(24px, 3vw, 36px);
}

h2 {
  font-size: clamp(21px, 2.4vw, 30px);
}

.hint {
  margin: 0 0 16px;
  color: #c6d0e7;
  line-height: 1.4;
}

.title-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.title-actions .primary-btn,
.title-actions .ghost-btn {
  width: min(260px, 84vw);
}

.modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(6, 9, 16, 0.78);
}

.modal-panel {
  width: min(92%, 560px);
  border-radius: 14px;
  border: 1.5px solid rgba(138, 164, 224, 0.62);
  background: rgba(8, 12, 20, 0.94);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.38);
  padding: 22px 20px;
}

.modal-panel h3 {
  margin: 0 0 12px;
  font-size: clamp(20px, 2.6vw, 28px);
  letter-spacing: 0.02em;
}

.controls-list {
  margin: 0 0 16px;
  padding-left: 20px;
  color: #d8e2f9;
  line-height: 1.55;
  text-align: left;
}

.channel-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}

.primary-btn,
.ghost-btn {
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 16px;
  transition: transform 120ms ease, filter 120ms ease, background-color 120ms ease;
}

.primary-btn {
  background: #66d4a4;
  color: #0a1520;
}

.ghost-btn {
  background: rgba(126, 151, 212, 0.2);
  color: #d8e6ff;
  border: 1px solid rgba(126, 151, 212, 0.55);
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.channel-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.channel-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(120, 139, 190, 0.42);
  background: rgba(17, 23, 39, 0.72);
  text-align: left;
}

.channel-name {
  margin: 0 0 4px;
  font-weight: 700;
  color: #f0f4ff;
}

.channel-meta {
  margin: 0;
  color: #b7c4e2;
  font-size: 13px;
}

.channel-join-btn {
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid rgba(118, 192, 158, 0.65);
  background: rgba(100, 212, 164, 0.2);
  color: #b9f2d7;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.channel-join-btn:hover {
  filter: brightness(1.1);
}

.channel-empty {
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed rgba(128, 148, 194, 0.55);
  color: #b8c5e4;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  main {
    width: min(96vw, 960px);
    margin: 12px auto;
  }

  .screen-panel {
    width: min(95%, 560px);
    padding: 20px 16px;
  }

  .channel-item {
    grid-template-columns: 1fr;
  }

  .channel-join-btn {
    width: 100%;
  }
}
