:root {
  color-scheme: dark light;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #0d1117;
  color: #f0f3f7;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #1b2735 0%, #090a0f 100%);
}

.container {
  width: min(960px, 95vw);
  padding: 1rem 0;
}

.panel {
  background-color: rgba(10, 13, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

h1 {
  margin: 0;
  font-size: 1.75rem;
}

.subtitle {
  margin-top: 0.5rem;
  color: rgba(240, 243, 247, 0.75);
}

.status {
  margin: 1rem 0;
  padding: 0.875rem;
  border-radius: 12px;
  background: rgba(18, 25, 38, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.875rem;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

.invite {
  margin-top: 1rem;
}

.copy-wrapper {
  display: flex;
  gap: 0.5rem;
}

.copy-wrapper input {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(13, 19, 30, 0.9);
  color: inherit;
  font-size: 0.875rem;
  min-width: 0;
}

.copy-wrapper button {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #46c3db, #5850ec);
  color: white;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.chat-header {
  margin-bottom: 0.5rem;
}

.nicknames {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nickname {
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-status {
  margin: 0.5rem 0 0 0;
  font-size: 0.875rem;
  color: rgba(240, 243, 247, 0.7);
  text-align: center;
}

.session-status.conversation-ended {
  color: rgba(248, 113, 113, 0.9);
  font-weight: 600;
  padding: 0.75rem;
  background: rgba(220, 38, 38, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.messages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 360px;
  overflow-y: auto;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(18, 27, 43, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.message.outbound {
  background: rgba(70, 195, 219, 0.18);
  border-color: rgba(70, 195, 219, 0.45);
  align-self: flex-end;
}

.message .meta {
  display: block;
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
  color: rgba(240, 243, 247, 0.6);
}

.message .body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

#messageForm {
  margin-top: 0.5rem;
}

.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

#messageInput {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(13, 19, 30, 0.9);
  color: inherit;
  font-size: 0.875rem;
  min-width: 0;
}

#fileButton {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(13, 19, 30, 0.9);
  color: inherit;
  font-size: 1.25rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s;
}

#fileButton:hover {
  background: rgba(18, 25, 38, 0.9);
}

#messageForm button[type="submit"] {
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #46c3db, #5850ec);
  color: white;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.file-content {
  margin-top: 0.5rem;
}

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
  text-decoration: none;
  transition: background 0.2s;
  cursor: pointer;
  width: 100%;
}

.file-details {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.file-size-small {
  font-size: 0.75rem;
  color: rgba(240, 243, 247, 0.5);
  margin-top: 0.15rem;
}

.file-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.file-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(18, 25, 38, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8125rem;
  gap: 0.5rem;
}

.file-info #fileName {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(240, 243, 247, 0.9);
}

.file-info #fileSize {
  flex-shrink: 0;
  color: rgba(240, 243, 247, 0.7);
  font-weight: 600;
}

.file-info.file-too-large {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.4);
}

.file-info.file-too-large #fileSize {
  color: #f87171;
}

.file-limit {
  margin: 0.5rem 0 0 0;
  font-size: 0.75rem;
  color: rgba(240, 243, 247, 0.5);
  text-align: center;
}

.file-icon {
  font-size: 1.25rem;
}

.file-name {
  font-size: 0.875rem;
  word-break: break-all;
}

.message.outbound .file-link {
  background: rgba(70, 195, 219, 0.15);
  border-color: rgba(70, 195, 219, 0.3);
}

.message.outbound .file-link:hover {
  background: rgba(70, 195, 219, 0.25);
  border-color: rgba(70, 195, 219, 0.4);
}

@media (max-width: 640px) {
  .container {
    padding: 0.5rem 0;
  }

  .panel {
    padding: 1rem;
    border-radius: 16px;
  }

  h1 {
    font-size: 1.375rem;
  }

  .subtitle {
    font-size: 0.875rem;
  }

  .status {
    margin: 0.75rem 0;
    padding: 0.75rem;
    font-size: 0.8125rem;
  }

  .copy-wrapper {
    gap: 0.5rem;
  }

  .copy-wrapper input {
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
  }

  .copy-wrapper button {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
  }

  .chat {
    margin-top: 1rem;
    gap: 0.75rem;
  }

  .nickname {
    font-size: 0.875rem;
  }

  .session-status {
    font-size: 0.8125rem;
    margin: 0.25rem 0 0 0;
  }

  .messages {
    max-height: 280px;
  }

  .input-row {
    gap: 0.5rem;
  }

  #messageInput {
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
  }

  #fileButton {
    padding: 0.625rem 0.875rem;
    font-size: 1.125rem;
  }

  #messageForm button[type="submit"] {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }

  .file-info {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
  }

  .file-limit {
    font-size: 0.6875rem;
    margin-top: 0.4rem;
  }
}
