:root {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #0f172a;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --link: #60a5fa;
  --error: #f87171;
  --accent: #22c55e;
  --accent-contrast: #0f172a;
}

html, body { height: 100%; }
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  width: 100%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}
.page-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
.topbar-title { font-weight: 600; font-size: 1.1rem; }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; }
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.3rem 0.5rem;
  text-decoration: none;
  font-family: inherit;
}
.link-btn:hover { color: var(--text); }
.card {
  width: 100%;
  max-width: 480px;
  margin: auto;
  padding: 2.5rem;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.landing-columns {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
}
.landing-col {
  position: relative;
  flex: 1 1 50%;
  min-width: 0;
  display: block;
  overflow: hidden;
}
.landing-col img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}
.landing-col:hover img { transform: scale(1.04); }
.landing-col-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.landing-col:hover .landing-col-label { opacity: 1; }
h1 { margin: 0 0 1.5rem; font-size: 1.4rem; }
form { display: flex; gap: 0.5rem; }
input[type="text"], input[type="password"] {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.95rem;
}
button { font-family: inherit; }
form button[type="submit"] {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
input:disabled, textarea:disabled { opacity: 0.6; cursor: not-allowed; }
.error { margin-top: 1rem; color: var(--error); font-size: 0.9rem; }
.hidden { display: none; }
#auth-form { flex-direction: column; }
#auth-form input { margin-bottom: 0.6rem; }
.auth-footer { margin-top: 0.8rem; font-size: 0.85rem; }
.auth-footer a { color: var(--link); }

/* --- Roadmap canvas --- */
.roadmap-shell {
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
  position: relative;
  background:
    radial-gradient(circle, var(--border) 1px, transparent 1px) 0 0 / 24px 24px;
}
.roadmap-canvas { position: relative; }
.roadmap-edges { position: absolute; top: 0; left: 0; pointer-events: none; }
.roadmap-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 200px;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.roadmap-node:hover { filter: brightness(1.12); }
.roadmap-node.goal { background: #2563eb; }
.roadmap-node.task { background: #16a34a; }
.roadmap-node.locked {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), 0 0 0 2px #facc15;
}
.roadmap-node.locked::after {
  content: "\1F512";
  margin-left: 0.4rem;
  font-size: 0.8rem;
}

/* --- Right-click insert menu --- */
.context-menu {
  position: fixed;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  padding: 0.35rem;
  z-index: 1000;
}
.context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.context-menu button:hover { background: var(--surface-alt); }
.context-menu button.hidden { display: none; }
.context-menu-separator { height: 1px; background: var(--border); margin: 0.3rem 0.25rem; }
.context-menu-danger { color: var(--error); }
.context-menu-danger:hover { background: rgba(248, 113, 113, 0.12); }

/* --- Side drawer --- */
.side-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 800;
}
.side-drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(600px, 60vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  z-index: 900;
}
.side-drawer.open { transform: translateX(0); }
.side-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.side-drawer-header h2 { margin: 0; }
.side-drawer-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex: 1 1 auto;
}
.field-label { color: var(--muted); font-size: 0.85rem; margin-top: 0.5rem; }
.side-drawer-body input[type="text"] { flex: 0 0 auto; }
#drawer-desc-input {
  min-height: 220px;
  resize: vertical;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
}
.locked-note {
  margin-top: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: #facc15;
  font-size: 0.85rem;
}
.pill-btn-primary {
  margin-top: 0.75rem;
  align-self: flex-start;
  padding: 0.55rem 1.2rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
