:root {
  --bg: #323f4b;
  --bg-soft: #3a4855;
  --bg-deep: #202a33;
  --panel: rgba(58, 72, 85, 0.92);
  --ink: #f5f7fa;
  --muted: #9aa5b1;
  --line: #5f6c79;
  --accent: #f5f7fa;
  --accent-strong: #cbd2d9;
  --accent-ink: #202a33;
  --editor-bg: #f5f7fa;
  --editor-ink: #24323f;
  --error: #ffb3b3;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family:
    "Roboto Condensed",
    "Avenir Next",
    "Helvetica Neue",
    Helvetica,
    Arial,
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, #445463 0, transparent 38%),
    radial-gradient(circle at 90% 8%, #2a343f 0, transparent 34%),
    radial-gradient(circle at 85% 85%, #28313b 0, transparent 30%),
    var(--bg);
}

.app-shell {
  max-width: 1100px;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 400;
  color: #ffffff;
}

.subtle {
  margin: 4px 0 0;
  color: var(--muted);
}

.subtle a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.subtle a:hover {
  color: var(--ink);
}

.app-footer {
  margin-top: 10px;
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

.app-shell > .panel:last-child {
  margin-bottom: 0;
}

input,
textarea,
button {
  font: inherit;
}

textarea {
  width: 100%;
  flex: 1;
  height: auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--editor-bg);
  color: var(--editor-ink);
  font-size: 14px;
  line-height: 1.45;
  resize: none;
}

.editor-wrap {
  padding: 0;
  border: 0;
  background: transparent;
  flex: 1;
  min-height: 0;
  display: flex;
}

.editor-wrap textarea {
  display: block;
  min-height: 0;
}

textarea::placeholder {
  color: #758394;
}

button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  line-height: 1;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

#saveBtn {
  background: var(--accent);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}

button:hover:not(:disabled) {
  background: rgba(245, 247, 250, 0.08);
  border-color: var(--accent-strong);
}

#saveBtn:hover:not(:disabled) {
  background: #ffffff;
}

button[hidden] {
  display: none;
}

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

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

#logoutBtn:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  /* Intentional exception: avatar is circular, not a rounded rectangle button. */
  width: 22px;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 247, 250, 0.08);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-avatar-fallback {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
  }

  .app-footer {
    justify-content: flex-start;
  }
}
