:root {
  --bg: #1f1f22;
  --bg-soft: #25262b;
  --panel: #2a2b31;
  --panel-2: #30313a;
  --panel-3: rgba(54, 57, 68, 0.78);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(132, 127, 255, 0.65);
  --text: #f2f4fb;
  --muted: #a9aec2;
  --accent: #7c83ff;
  --accent-2: #9c89ff;
  --success: #58d68d;
  --warning: #f0b34f;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(124, 131, 255, 0.14), transparent 22%),
    radial-gradient(circle at bottom right, rgba(156, 137, 255, 0.1), transparent 22%),
    linear-gradient(180deg, #1b1c20, #202229 40%, #1d1f25);
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.workspace {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 72px 260px minmax(0, 1fr);
}

.rail,
.sidebar,
.topbar,
.game-window,
.modal-card,
.thread-message,
.info-card,
.round-card,
.receipt-card {
  border: 1px solid var(--line);
}

.rail {
  background: linear-gradient(180deg, #17181c, #1a1b20);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  padding: 1rem 0;
}

.rail-logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 800;
  font-size: 1.1rem;
}

.rail-icons {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  align-items: center;
}

.rail-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #434655;
}

.rail-dot.active {
  width: 14px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #b8bdff, #7c83ff);
}

.sidebar {
  background: rgba(29, 30, 36, 0.92);
  padding: 1.4rem 1rem 1.4rem 1.2rem;
  border-left: 0;
  border-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-label,
.top-pill,
.round-badge,
.context-label,
.input-label,
.score-strip span,
.round-meta span {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.sidebar h1,
.topbar h2,
.game-header h3,
.modal-card h4 {
  margin: 0;
  font-family: "Manrope", sans-serif;
}

.sidebar h1 {
  font-size: 1.5rem;
}

.channel-block {
  display: grid;
  gap: 0.75rem;
}

.channel {
  padding: 0.85rem 0.9rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.channel.active,
.channel:hover {
  background: rgba(255, 255, 255, 0.06);
}

.info-card {
  padding: 1rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(56, 59, 70, 0.9), rgba(42, 43, 49, 0.95));
}

.info-card p {
  margin: 0 0 0.8rem;
  color: var(--text);
  line-height: 1.55;
}

.info-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  display: grid;
  gap: 0.35rem;
}

.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: rgba(34, 35, 41, 0.9);
  border-top: 0;
  border-right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

.topbar h2 {
  font-size: 1.35rem;
}

.topbar-pills {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.top-pill {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.chat-stage {
  position: relative;
  flex: 1;
  padding: 1.4rem;
}

.chat-thread {
  min-height: calc(100vh - 120px);
  padding: 1rem;
  padding-right: 480px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(36, 37, 43, 0.82), rgba(30, 31, 37, 0.94)),
    linear-gradient(90deg, transparent 0, transparent 55%, rgba(124, 131, 255, 0.04) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.thread-message {
  display: flex;
  gap: 1rem;
  padding: 1.1rem 1rem;
  border-radius: 20px;
  background: rgba(47, 49, 58, 0.72);
  margin-bottom: 1rem;
}

.thread-message.highlight {
  background: rgba(54, 55, 64, 0.9);
}

.thread-message.compact {
  background: rgba(43, 44, 52, 0.72);
}

.thread-message.faded {
  opacity: 0.76;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 800;
  color: white;
}

.avatar-gold {
  background: linear-gradient(135deg, #f2a65a, #d97f33);
}

.avatar-red {
  background: linear-gradient(135deg, #d86161, #9f3f48);
}

.avatar-blue {
  background: linear-gradient(135deg, #5a9bf6, #3d68d1);
}

.avatar-purple {
  background: linear-gradient(135deg, #a576ff, #7458db);
}

.message-content {
  min-width: 0;
}

.message-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.4rem;
}

.message-meta strong {
  font-size: 1rem;
}

.message-meta span,
.message-meta time,
.message-body,
.modal-copy,
#receipt-source,
.receipt-context {
  color: var(--muted);
}

.message-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.7rem, 3vw, 3rem);
  font-weight: 800;
  font-family: "Manrope", sans-serif;
}

.message-body {
  margin: 0.3rem 0;
  font-size: 1rem;
  line-height: 1.55;
}

.mention {
  color: #9aa1ff;
}

.reactions {
  display: flex;
  gap: 0.7rem;
  margin-top: 1rem;
}

.reactions span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.read-line {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1.2rem 0;
  color: #9891ff;
  font-weight: 700;
}

.read-line::before,
.read-line::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-strong);
}

.game-window {
  position: absolute;
  top: 2rem;
  right: 2rem;
  width: min(420px, calc(100% - 2rem));
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(36, 37, 44, 0.95), rgba(30, 31, 38, 0.98));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.window-bar p {
  margin: 0;
  color: var(--muted);
}

.window-dots {
  display: flex;
  gap: 0.35rem;
}

.window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.game-header,
.round-card,
.score-strip,
.round-meta,
.actions,
.modal-top,
.receipt-head {
  display: flex;
  gap: 1rem;
}

.game-header,
.round-card,
.modal-card {
  padding: 1.2rem;
}

.game-header {
  justify-content: space-between;
  align-items: flex-end;
}

.score-strip {
  gap: 1.1rem;
}

.score-strip div {
  text-align: right;
}

.score-strip strong {
  display: block;
  font-size: 1.35rem;
  font-family: "Manrope", sans-serif;
}

.round-card {
  flex-direction: column;
  margin: 0 1.2rem 1.2rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.round-meta,
.actions,
.modal-top,
.receipt-head {
  justify-content: space-between;
  align-items: center;
}

.round-badge {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(124, 131, 255, 0.12);
  color: #c9ccff;
}

.context-card,
.receipt-card {
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(62, 65, 77, 0.95), rgba(47, 49, 57, 0.95));
  padding: 1rem;
}

.context-person {
  margin-top: 0.35rem;
  font-size: 1.2rem;
  font-weight: 800;
  font-family: "Manrope", sans-serif;
}

.context-line {
  margin: 0.5rem 0 0;
  font-size: 1.1rem;
  line-height: 1.5;
}

.context-subline {
  margin: 0.7rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

#guess-input,
.choice-button {
  width: 100%;
  border-radius: 14px;
}

#guess-input {
  margin-top: 0.45rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  background: rgba(14, 15, 19, 0.55);
  color: var(--text);
}

#guess-input:focus-visible {
  outline: 2px solid rgba(124, 131, 255, 0.8);
  outline-offset: 2px;
}

.choice-grid {
  display: grid;
  gap: 0.7rem;
}

.choice-button,
.primary-button,
.secondary-button,
.close-button {
  border: 0;
  cursor: pointer;
}

.choice-button {
  padding: 0.95rem 1rem;
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  transition: transform 160ms ease, background 160ms ease;
}

.choice-button:hover,
.choice-button:focus-visible,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.choice-button.selected {
  background: rgba(124, 131, 255, 0.22);
}

.primary-button,
.secondary-button {
  padding: 0.88rem 1rem;
  border-radius: 14px;
  font-weight: 700;
}

.primary-button {
  flex: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}

.secondary-button {
  min-width: 96px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.feedback {
  min-height: 1.4rem;
  margin: 0;
  color: var(--warning);
}

.feedback.good {
  color: var(--success);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(6, 7, 10, 0.58);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(520px, 100%);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(36, 37, 44, 0.98), rgba(27, 28, 33, 0.98));
  box-shadow: var(--shadow);
}

.modal-card h4 {
  font-size: 1.6rem;
  margin: 0.3rem 0 0;
}

.close-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 1.5rem;
}

.modal-copy {
  line-height: 1.6;
}

.receipt-answer {
  margin: 1rem 0 0;
  font-size: 1.5rem;
  font-weight: 800;
  font-family: "Manrope", sans-serif;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 72px 220px minmax(0, 1fr);
  }

  .chat-thread {
    padding-right: 0;
  }

  .game-window {
    position: static;
    width: 100%;
    margin-top: 1rem;
  }
}

@media (max-width: 820px) {
  .workspace {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .chat-stage,
  .topbar {
    padding: 1rem;
  }

  .thread-message {
    padding: 0.9rem;
  }

  .message-title {
    font-size: 1.9rem;
  }

  .game-header,
  .actions,
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .rail {
    display: none;
  }

  .chat-thread {
    border-radius: 18px;
  }

  .game-window {
    border-radius: 18px;
  }
}
