:root {
  --bg: #111111;
  --panel: rgba(20, 20, 20, 0.86);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f8f1e7;
  --muted: #d5c2a7;
  --accent: #ff7a1a;
  --accent-soft: rgba(255, 122, 26, 0.18);
  --accent-strong: #ff9c43;
  --secondary: #248277;
  --secondary-soft: rgba(36, 130, 119, 0.22);
  --danger: #f25f5c;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --font-display: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  --font-body: "Gill Sans", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 122, 26, 0.22), transparent 30%),
    radial-gradient(circle at bottom right, rgba(36, 130, 119, 0.24), transparent 28%),
    linear-gradient(140deg, #0f0d0b 0%, #161312 45%, #191f1c 100%);
  color: var(--text);
  font-family: var(--font-body);
}

.background-glow {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.35;
  z-index: 0;
}

.background-glow-left {
  top: -8rem;
  left: -6rem;
  background: var(--accent-soft);
}

.background-glow-right {
  bottom: -10rem;
  right: -4rem;
  background: var(--secondary-soft);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hero-card,
.panel,
.lobby-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  padding: 2rem;
  border-radius: 28px;
  animation: rise 500ms ease-out;
}

.eyebrow,
.panel-label,
.code-label {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
}

h1 {
  max-width: 12ch;
  margin-top: 0.7rem;
  font-size: clamp(2.6rem, 5vw, 4.8rem);
}

.hero-copy {
  max-width: 42rem;
  margin: 1rem 0 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: rgba(248, 241, 231, 0.8);
}

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

.panel,
.lobby-panel {
  border-radius: 24px;
}

.panel {
  padding: 1.4rem;
  animation: rise 650ms ease-out;
}

.panel h2 {
  margin-top: 0.6rem;
  font-size: 1.8rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 1rem;
}

.field span {
  color: rgba(248, 241, 231, 0.82);
  font-size: 0.95rem;
}

.field input {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

button {
  appearance: none;
  border: 0;
  border-radius: 16px;
  padding: 0.95rem 1.2rem;
  margin-top: 1.2rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, box-shadow 150ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #18110c;
  box-shadow: 0 12px 24px rgba(255, 122, 26, 0.24);
}

.secondary-button {
  background: linear-gradient(135deg, #1f6e66 0%, var(--secondary) 100%);
  color: var(--text);
  box-shadow: 0 12px 24px rgba(36, 130, 119, 0.18);
}

.ghost-button {
  margin-top: 0;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lobby-panel {
  margin-top: 1rem;
  padding: 1.4rem;
  animation: rise 450ms ease-out;
}

.lobby-topline,
.lobby-code-box,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.lobby-topline h2 {
  margin-top: 0.5rem;
  font-size: 2rem;
}

.lobby-code-box {
  margin-top: 1.2rem;
  padding: 1rem 1.1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.lobby-code {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 8vw, 3.5rem);
  letter-spacing: 0.18em;
}

.status-row {
  margin-top: 1rem;
  color: rgba(248, 241, 231, 0.82);
}

.player-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.lobby-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.subpanel {
  display: flex;
  flex-direction: column;
  min-height: 24rem;
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.subpanel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.subpanel-header h3 {
  margin-top: 0.5rem;
  font-size: 1.45rem;
}

.chat-hint {
  margin: 0;
  color: rgba(248, 241, 231, 0.62);
  font-size: 0.9rem;
  text-align: right;
}

.voice-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.voice-toolbar button {
  margin-top: 0;
}

.voice-status {
  margin: 0.9rem 0 0;
  color: rgba(248, 241, 231, 0.74);
  line-height: 1.5;
}

.player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.05rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.player-name {
  font-size: 1rem;
  font-weight: 700;
}

.player-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.role-chip,
.self-chip,
.voice-chip {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.role-chip {
  background: rgba(255, 122, 26, 0.16);
  color: #ffc48f;
}

.self-chip {
  background: rgba(36, 130, 119, 0.2);
  color: #b7f0e5;
}

.voice-chip {
  background: rgba(118, 201, 255, 0.18);
  color: #b7e6ff;
}

.chat-panel {
  overflow: hidden;
}

.message-list {
  display: grid;
  gap: 0.75rem;
  flex: 1;
  margin-top: 1rem;
  padding-right: 0.25rem;
  overflow-y: auto;
}

.message-card {
  max-width: min(100%, 28rem);
  padding: 0.85rem 0.95rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.message-card-self {
  justify-self: end;
  background: rgba(36, 130, 119, 0.16);
  border-color: rgba(36, 130, 119, 0.28);
}

.message-card-system {
  max-width: 100%;
  justify-self: center;
  background: rgba(255, 122, 26, 0.12);
  border-color: rgba(255, 122, 26, 0.2);
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.45rem;
  color: rgba(248, 241, 231, 0.72);
  font-size: 0.82rem;
}

.message-author {
  font-weight: 700;
  color: var(--text);
}

.message-text {
  margin: 0;
  line-height: 1.45;
  color: rgba(248, 241, 231, 0.92);
  word-break: break-word;
}

.message-empty {
  margin: auto 0;
  color: rgba(248, 241, 231, 0.6);
}

.chat-form {
  margin-top: 1rem;
}

.chat-form button {
  margin-top: 1rem;
}

.flash-message {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  color: #ffd2ae;
}

.hidden {
  display: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .shell {
    padding-top: 1rem;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .lobby-content-grid {
    grid-template-columns: 1fr;
  }

  .lobby-topline,
  .lobby-code-box,
  .status-row,
  .subpanel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .lobby-code {
    letter-spacing: 0.1em;
  }

  button,
  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .voice-toolbar {
    width: 100%;
  }

  .player-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .subpanel,
  .message-list {
    min-height: auto;
  }
}
