:root {
  --bg: #0f1012;
  --surface: #16181c;
  --surface-soft: #1c1f24;
  --line: #2a2f36;
  --text: #eceff3;
  --text-muted: #9ea6b2;
  --accent: #ff8a2a;
  --accent-strong: #e6710f;
  --accent-ring: rgba(255, 138, 42, 0.22);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: 'IBM Plex Sans', 'Avenir Next', 'Segoe UI', sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 8% 8%, rgba(255, 138, 42, 0.1), transparent 28%), var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.shell {
  width: 100%;
  max-width: 980px;
}

.room {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.6rem;
  animation: fadeIn 220ms ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.roomHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.roomTitleWrap {
  display: grid;
  gap: 0.32rem;
}

.eyebrow {
  font-family: 'IBM Plex Mono', 'Cascadia Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.roomHeader strong {
  font-size: 1.25rem;
  line-height: 1.2;
}

.hintText {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
  word-break: break-word;
}

.configHint {
  font-family: 'IBM Plex Mono', 'Cascadia Mono', monospace;
  font-size: 0.78rem;
}

.homeLink {
  text-decoration: none;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: 'IBM Plex Mono', 'Cascadia Mono', monospace;
  font-size: 0.8rem;
  padding: 0.56rem 0.82rem;
  border-radius: 8px;
  transition: border-color 140ms ease, color 140ms ease;
}

.homeLink:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.actionsGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.95rem;
}

.actionCard {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  display: grid;
  gap: 0.55rem;
}

.actionCard h2 {
  font-size: 0.96rem;
}

.actionCard p {
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.joinRow {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

button,
.uploadLabel {
  appearance: none;
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  padding: 0.68rem 0.92rem;
  background: var(--accent);
  color: #1d120a;
  font-family: 'IBM Plex Mono', 'Cascadia Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 140ms ease;
}

button:hover,
.uploadLabel:hover {
  filter: brightness(1.05);
}

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

input[type='text'] {
  width: 100%;
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111317;
  color: var(--text);
  font-family: 'IBM Plex Mono', 'Cascadia Mono', monospace;
  padding: 0.68rem 0.75rem;
}

input[type='text']::placeholder {
  color: #767f8d;
}

input[type='text']:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.editorCard {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #111317;
  overflow: hidden;
}

.editorTopBar {
  height: 36px;
  border-bottom: 1px solid var(--line);
  background: #171a1f;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.75rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #3b414b;
}

.dot:first-child {
  background: var(--accent);
}

.editorTopBar p {
  margin-left: 0.24rem;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', 'Cascadia Mono', monospace;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#sharedText {
  width: 100%;
  min-height: 370px;
  max-height: 760px;
  border: 0;
  resize: vertical;
  background: #111317;
  color: var(--text);
  font-family: 'IBM Plex Mono', 'Cascadia Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.7;
  padding: 1rem;
}

#sharedText:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent-ring);
}

#sharedText:disabled {
  background: #171a1e;
  color: #7f8896;
  cursor: not-allowed;
}

.filePanel {
  margin-top: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

#fileInput {
  display: none;
}

.filePanel small {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-family: 'IBM Plex Mono', 'Cascadia Mono', monospace;
}

.fileList {
  margin-top: 0.9rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fileList li {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.78rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.fileList span {
  color: #c8d0db;
  font-size: 0.81rem;
  font-family: 'IBM Plex Mono', 'Cascadia Mono', monospace;
}

.fileList a {
  text-decoration: none;
  white-space: nowrap;
  color: var(--accent);
  border: 1px solid #5a3b24;
  border-radius: 7px;
  padding: 0.34rem 0.55rem;
  font-size: 0.74rem;
  font-family: 'IBM Plex Mono', 'Cascadia Mono', monospace;
}

.fileList a:hover {
  border-color: var(--accent);
}

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

@media (max-width: 768px) {
  body {
    padding: 0.95rem 0.62rem;
  }

  .room {
    padding: 1rem;
    border-radius: 12px;
  }

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

  .homeLink {
    width: fit-content;
  }

  .joinRow {
    flex-direction: column;
  }

  #sharedText {
    min-height: 280px;
    font-size: 0.86rem;
  }

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

  .fileList li {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  color: var(--text);
  font-family: 'IBM Plex Mono', 'Cascadia Mono', monospace;
  font-size: 0.84rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 280ms ease, transform 280ms ease;
  z-index: 9999;
  max-width: 320px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-error {
  border-left: 3px solid #ef4444;
}

.toast-success {
  border-left: 3px solid var(--accent);
}

.toast-warning {
  border-left: 3px solid #f59e0b;
}

.toast-info {
  border-left: 3px solid #3b82f6;
}

@media (max-width: 768px) {
  .toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
}
