@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&family=DM+Sans:wght@300;400;500&display=swap');

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

:root {
  --bg: #0e0e0e;
  --surface: #161616;
  --border: #242424;
  --text: #e8e8e8;
  --muted: #666;
  --pink: #F5A9B8;
  --pink-dim: rgba(245, 169, 184, 0.12);
  --radius: 6px;
  --font-mono: 'DM Mono', monospace;
  --font-sans: 'DM Sans', sans-serif;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

h1 {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: lowercase;
  color: var(--pink);
  position: fixed;
  top: 12px;
  left: 16px;
  right: auto;
  padding: 0;
  line-height: 28px;
  z-index: 200;
  background: var(--bg);
  padding: 0 16px 0 0;
  text-align: left;
}

form {
  display: flex;
  gap: 6px;
  align-items: center;
}

input[type="text"],
input[type="file"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus {
  border-color: var(--pink);
}

input[type="file"] {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 5px 8px;
}

input[type="file"]::file-selector-button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  margin-right: 8px;
  transition: border-color 0.15s, color 0.15s;
}

input[type="file"]::file-selector-button:hover {
  border-color: var(--pink);
  color: var(--pink);
}

button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  height: 28px;
  padding: 0 10px;
  line-height: 28px;
}

button:hover {
  border-color: var(--pink);
  color: var(--pink);
  background: var(--pink-dim);
}

button:active {
  opacity: 0.7;
}

#message-form {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  z-index: 100;
}

#message-form input[type="text"] {
  flex: 1;
}

#username-form {
  position: fixed;
  top: 12px;
  right: 16px;
  display: flex;
  gap: 6px;
  align-items: center;
}

#username-form input[type="text"] {
  width: 120px;
  height: 28px;
  font-size: 12px;
  padding: 0 10px;
  line-height: 28px;
}

ul {
  padding-top: 50px;
  list-style: none;
  padding: 70px 280px 80px 20px;
  max-width: calc(100% - 130px);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

li {
  font-size: 13px;
  line-height: 1.7;
  word-break: break-all;
  overflow-wrap: anywhere;
  padding: 2px 0;
}

.msg-time {
  display: none;
  font-size: 11px;
  margin-right: 6px;
  color: var(--muted);
  background: var(--bg);
  padding: 0 4px 0 8px;
  pointer-events: none;
  white-space: nowrap;
}

li:hover .msg-time {
  display: inline;
}

li img {
  border-radius: var(--radius);
  margin-top: 6px;
  max-width: 300px;
  display: block;
}

a {
  color: var(--pink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

#typing-indicator {
  position: fixed;
  bottom: 68px;
  left: 20px;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
  min-height: 1em;
  pointer-events: none;
}

#upload-error,
#upload-status {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}

#upload-error { color: var(--pink); }

#userlist {
  position: fixed;
  right: 16px;
  top: 48px;
  width: auto;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
}

#userlist strong {
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 2px;
}

#userlist div {
  padding: 0;
  font-size: 12px;
  display: block;
  clear: both;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

body.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

body.login-page p {
  color: var(--muted);
  font-size: 13px;
}

body.login-page a button {
  border-color: var(--pink);
  color: var(--pink);
}

body.login-page a button:hover {
  background: var(--pink-dim);
}
#command-suggestion {
  position: fixed;
  bottom: 68px;
  left: 20px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  pointer-events: none;
}
input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#username-form button[type="submit"]:disabled {
    display: none;
    pointer-events: none;
}
#message-form button[type="submit"]:disabled {
  pointer-events: none;
  opacity: 0.4;
  cursor: not-allowed;
}

.divider {
    width: 1px;
    height: 28px;
    background: var(--border);
    flex-shrink: 0;
    margin: 0 8px;
}

#mute-btn::before {
    font-family: 'tabler-icons';
    content: '\ea35';
}

#mute-btn.muted::before {
    content: '\ece9'; /* ti-bell-off */
}
  #color-input {
    position: fixed;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
  }

@media (max-width: 600px) {
  h1 {
    font-size: 12px;
    top: 10px;
    left: 12px;
  }
  #username-form {
    top: auto;
    bottom: 60px;
    right: 0;
    left: 0;
    padding: 8px 12px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
    z-index: 101;
  }
  #username-form input[type="text"] {
    flex: 1;
    width: auto;
  }
  input[type="text"] {
    font-size: 16px
  }
  #message-form {
    bottom: 0;
    padding: 8px 12px;
  }
  ul {
    padding: 44px 12px 130px 12px;
    max-width: 100%;
  }
  #userlist {
    position: fixed;
    top: 8px;
    right: 12px;
    max-width: 120px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
  }
  #userlist strong {
    display: none;
  }
  #userlist div {
    display: inline;
    font-size: 11px;
  }
  #userlist div::after {
    content: ' ';
  }
  #typing-indicator, #command-suggestion {
    bottom: 128px;
    left: 12px;
    font-size: 10px;
  }
  #upload-error, #upload-status {
    bottom: 132px;
  }
  li {
    font-size: 12px;
  }
  #signout span, #signout .ti-logout + * {
    display: none;
  }
  #signout {
    padding: 0 10px;
    flex-shrink: 0;
  }
  .btn-label {
    display: none;
  }
  #color-input {
    display: none;
  }
  #color-btn {
    display: none;
  }
}