:root {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}
#wordsBtn {
  display: none;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* pushes content to the top */
  background: #0f172a;
  color: #e2e8f0;
  gap: 20px;
  padding-top: 30px; /* adjust how far from the top */
}

#plus {
  background-color: green;
  display: none;
}

#minus {
  background-color: red;
  display: none;
}

#card {
  display: none;
}

.card {
  width: min(92vw, 420px);
  max-height: 90vh;
  background: #111827;
  padding: 28px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

h1 {
  margin: 0 0 16px;
  font-size: 28px;
  letter-spacing: 0.3px;
}

.display {
  font-size: 64px;
  font-weight: 700;
  text-align: center;
  padding: 18px 0;
  border-radius: 16px;
  background: #0b1220;
  border: 1px solid #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

button,
input[type="email"],
input[type="password"] {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 14px;
  font-size: 16px;
  font-weight: 500;
  background: #1f2937;
  color: #e5e7eb;
  transition: transform 0.04s ease, background 0.2s ease;
}

button {
  cursor: pointer;
  font-size: 20px;
  font-weight: 600;
}

button:active {
  transform: translateY(1px) scale(0.99);
}

button:hover {
  background: #263042;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid #60a5fa;
  outline-offset: 2px;
}

#password {
  display: none;
}

#email {
  display: none;
}

#loginBtn {
  display: none;
}
#logoutBtn {
  display: none;
}

#login {
  width: min(92vw, 420px);
  background: #111827;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#messages {
  display: none;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  background: #111827;
  padding: 16px;
  border-radius: 16px;
  margin-bottom: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);

  flex-grow: 1;
  max-height: calc(100vh - 60px);
  overflow: hidden;
}

.message-list {
  display: flex;
  flex-direction: column; /* messages start at top, flow downward */
  gap: 10px;
  flex-grow: 1; /* fills remaining space inside #messages */
  overflow-y: auto; /* scroll if content exceeds container */
  padding-right: 4px;
  padding-bottom: 12px;
  padding-top: 12px;
}

.messages-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#messages h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.message {
  background: #1f2937;
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  word-break: break-word;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.message-author {
  font-weight: 600;
  font-size: 14px;
  color: #60a5fa;
  display: flex;
  align-items: center;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-right: 8px;
}

.message-content {
  font-size: 15px;
  color: #e5e7eb;
}

.message-timestamp {
  font-size: 12px;
  opacity: 0.6;
  align-self: flex-end;
}

.message-options-btn {
  background: none;
  border: none;
  color: #e5e7eb;
  cursor: pointer;
  font-size: 16px;
}

.options-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 24px;
  background: #1f2937;
  border: 1px solid #263042;
  border-radius: 8px;
  flex-direction: column;
  z-index: 10;
}

.options-menu.show {
  display: flex;
}

.option-btn {
  background: none;
  border: none;
  color: #e5e7eb;
  padding: 6px 12px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}

.option-btn:hover {
  background: #263042;
}
#addMessageModal {
  display: none;
}
#addMessageBtn {
  appearance: none;
  border: 0;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  background: #1f2937;
  color: #e5e7eb;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.1s ease;
}

#addMessageBtn:hover {
  background: #263042;
}

#addMessageBtn:active {
  transform: scale(0.95);
}

/* Modal overlay */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

/* Modal content container */
.modal-content {
  background: #111827;
  padding: 24px;
  border-radius: 16px;
  width: min(90%, 400px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Textarea for message input */
.modal-content textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #1f2937;
  background: #0b1220;
  color: #e5e7eb;
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
}

/* Modal buttons container */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Buttons inside modal */
.modal-actions button {
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: #1f2937;
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.05s ease;
}

.modal-actions button:hover {
  background: #263042;
}

.modal-actions button:active {
  transform: translateY(1px) scale(0.98);
}

@media (max-height: 700px), (max-width: 400px) {
  .card,
  #login {
    padding: 16px;
  }
  h1 {
    font-size: 22px;
  }
  .display {
    font-size: 48px;
    padding: 12px 0;
  }
  button,
  input {
    font-size: 16px;
    padding: 10px;
  }
}

#plus:hover {
  background: #263042;
}

#minus:hover {
  background: #263042;
}

#home-btn {
  width: 100%;
  display: none;
}
