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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  height: 100dvh;
  overflow: hidden;
}

#app {
  height: 100%;
  max-width: 640px;
  margin: 0 auto;
}

/* Auth screen */
#auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
}

#auth-screen h1 {
  font-size: 2rem;
}

#auth-tabs {
  display: flex;
  gap: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid #333;
}

.auth-tab {
  padding: 0.5rem 1.5rem;
  background: #1a1a1a;
  color: #888;
  border: none;
  border-radius: 0;
  font-size: 0.875rem;
  cursor: pointer;
}

.auth-tab.active {
  background: #2563eb;
  color: #fff;
}

.auth-tab:hover:not(.active) {
  background: #252525;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 280px;
}

.auth-form[hidden] {
  display: none;
}

.auth-form input {
  padding: 0.75rem 1rem;
  border: 1px solid #333;
  border-radius: 0.5rem;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 1rem;
  outline: none;
}

.auth-form input:focus {
  border-color: #2563eb;
}

.auth-error {
  color: #e06c75;
  font-size: 0.8125rem;
  text-align: center;
}

#auth-screen[hidden],
#chat-screen[hidden] {
  display: none;
}

/* Chat screen */
#chat-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

#user-label {
  color: #888;
  font-size: 0.875rem;
}

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.message.system {
  text-align: center;
  color: #555;
  font-size: 0.8125rem;
  padding: 0.25rem 0;
}

.message.chat {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  line-height: 1.5;
  background: #1a1a1a;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  max-width: 80%;
}

.message.chat.own {
  align-self: flex-end;
  background: #1d3a5c;
}

.msg-name {
  font-weight: 600;
  flex-shrink: 0;
}

.msg-name {
  font-size: 0.8125rem;
}


.msg-text {
  word-break: break-word;
  white-space: pre-wrap;
}
.msg-text a {
  color: inherit;
  text-decoration: underline;
}

#chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid #222;
}

#msg-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #333;
  border-radius: 0.5rem;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
}

#msg-input:focus {
  border-color: #2563eb;
}

button {
  padding: 0.75rem 1.5rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

#bg-picker-label {
  cursor: pointer;
  display: flex;
  align-items: center;
}

#bg-picker-label svg {
  display: block;
}

#bg-picker {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.date-separator {
  text-align: center;
  color: #888;
  font-size: 0.75rem;
  margin: 0.75rem 0 0.25rem;
}

.msg-time {
  font-size: 0.6875rem;
  color: #888;
  align-self: flex-end;
  margin-top: 0.125rem;
}

.message.selected {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
  opacity: 0.8;
}

#delete-bar {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid #222;
}

#delete-bar[hidden] {
  display: none;
}

#delete-btn {
  flex: 1;
  background: #e06c75;
}

#delete-btn:hover {
  background: #c95a63;
}

#cancel-select-btn {
  background: #333;
}

#cancel-select-btn:hover {
  background: #444;
}
