:root {
  color-scheme: light dark;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  background-color: #0f172a;
  color: #e2e8f0;
}

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

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.app {
  width: min(960px, 94vw);
  display: grid;
  gap: 2rem;
  padding: 2rem;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.6);
}

h1,
h2,
label {
  margin: 0 0 0.5rem;
}

.muted {
  color: #94a3b8;
  margin: 0;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.join {
  display: flex;
  gap: 0.5rem;
}

.join input {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid #1e293b;
  background: rgba(15, 23, 42, 0.7);
  color: inherit;
}

button,
.file-upload {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-align: center;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #f8fafc;
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
}

.secondary {
  background: rgba(99, 102, 241, 0.2);
  color: #e0e7ff;
}

.secondary:hover {
  background: rgba(99, 102, 241, 0.35);
}

.link {
  background: transparent;
  color: #818cf8;
  padding: 0;
}

.file-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(56, 189, 248, 0.2);
  color: #bae6fd;
}

.file-upload:hover {
  background: rgba(56, 189, 248, 0.35);
}

.status {
  min-height: 1.5rem;
  color: #facc15;
}

.status[data-type='error'] {
  color: #f87171;
}

.status[data-type='success'] {
  color: #34d399;
}

.status[data-type='info'] {
  color: #facc15;
}

.session-code {
  font-size: 1.25rem;
  font-weight: 700;
  color: #38bdf8;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.history-control {
  display: flex;
  justify-content: flex-end;
}

.workspace__header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.workspace__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #94a3b8;
}

.items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.item-card {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #cbd5f5;
  font-weight: 600;
}

.item-content {
  position: relative;
}

.item-content pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.75rem;
  border-radius: 10px;
  font-family: 'Fira Code', 'SFMono-Regular', monospace;
  line-height: 1.4;
  font-size: 0.95rem;
}

.copy-btn {
  align-self: flex-start;
  background: rgba(99, 102, 241, 0.25);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  color: #c7d2fe;
}

.copy-btn:hover {
  background: rgba(99, 102, 241, 0.45);
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.composer textarea {
  resize: vertical;
  min-height: 6rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(15, 23, 42, 0.7);
  color: inherit;
  font-family: 'Fira Code', 'SFMono-Regular', monospace;
}

.composer__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .workspace__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .join {
    flex-direction: column;
  }

  .composer__actions {
    flex-direction: column;
    align-items: stretch;
  }
}
