* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}

.screen { display: none; width: 100%; height: 100vh; }

#auth-screen, #recovery-display-screen {
  display: none;
  align-items: center;
  justify-content: center;
}

.auth-box {
  background: #1e293b;
  padding: 2.5rem;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
}
.auth-box h1 { font-size: 1.4rem; margin-top: 0; }
.auth-box input {
  width: 100%;
  padding: 0.7rem;
  margin: 0.4rem 0;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
}
.auth-box button {
  width: 100%;
  padding: 0.8rem;
  margin-top: 0.8rem;
  border: none;
  border-radius: 6px;
  background: #3b82f6;
  color: white;
  font-weight: 600;
  cursor: pointer;
}
.auth-box button:disabled { background: #475569; cursor: not-allowed; }
.auth-box a { color: #60a5fa; }
.muted { color: #94a3b8; font-size: 0.85rem; }
.error { color: #f87171; font-size: 0.85rem; min-height: 1.2em; }

.recovery-key-box {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  letter-spacing: 1px;
  background: #0f172a;
  border: 1px dashed #f59e0b;
  color: #f59e0b;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  margin: 1rem 0;
  user-select: all;
}

#app-screen { display: none; flex-direction: row; }
.sidebar {
  width: 280px;
  background: #1e293b;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #334155;
}
.sidebar-header { padding: 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; }
.sidebar-header input {
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
}
.sidebar-header button {
  padding: 0.5rem;
  border: none;
  border-radius: 6px;
  background: #3b82f6;
  color: white;
  cursor: pointer;
}
.note-list { flex: 1; overflow-y: auto; }
.note-item {
  padding: 0.7rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #273449;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-item:hover { background: #273449; }
.note-item.active { background: #334155; font-weight: 600; }
.sidebar-footer {
  padding: 0.7rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #334155;
  font-size: 0.85rem;
}
.sidebar-footer button {
  background: none;
  border: 1px solid #475569;
  color: #e2e8f0;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
}

.editor { flex: 1; display: flex; flex-direction: column; padding: 1.5rem; }
#note-title {
  font-size: 1.3rem;
  font-weight: 600;
  background: transparent;
  border: none;
  color: #e2e8f0;
  margin-bottom: 1rem;
  outline: none;
}
#note-content {
  flex: 1;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 1rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  font-family: inherit;
}
.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.8rem;
  border-top: 1px solid #334155;
}
.danger { background: #ef4444; color: white; border: none; padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer; }

.btn-back-mobile {
  display: none;
  background: none;
  border: 1px solid #475569;
  color: #e2e8f0;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  align-self: flex-start;
  margin-bottom: 0.8rem;
}

@media (max-width: 768px) {
  .auth-box { padding: 1.5rem; }
  #app-screen { flex-direction: column; }
  .sidebar { width: 100%; height: 100%; border-right: none; }
  .editor { width: 100%; height: 100%; padding: 1rem; display: none; }
  #app-screen.show-editor .sidebar { display: none; }
  #app-screen.show-editor .editor { display: flex; }
  .btn-back-mobile { display: inline-block; }
  #note-title { font-size: 1.15rem; }
  .sidebar-header button, .sidebar-header input { font-size: 1rem; }
  .note-item { padding: 0.9rem 1rem; }
}
