:root {
  --paper: #F4EEE1;
  --panel: #FBF7EF;
  --white: #FFFFFF;
  --ink: #2E2A24;
  --muted: #8B8272;
  --line: #E6DCC8;
  --indigo: #5A4BDA;
  --pink: #E8548B;
  --yellow: #FFE49A;
  --coral: #FFB4A2;
  --mint: #BFE8CC;
  --sky: #AFD8F6;
  --lilac: #DEC9F7;
  --socratic-border: #B58EE6;
  --shadow: 0 8px 20px rgba(70, 55, 25, .14), 0 2px 5px rgba(0, 0, 0, .06);
  --radius: 14px;
  --radius-pill: 22px;
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
}

button {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* loading / auth screens */

#loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-weight: 700;
  color: var(--muted);
}

#auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  gap: 1.5rem;
}

#auth .auth-header {
  text-align: center;
}

#auth .auth-header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  color: var(--indigo);
}

#auth .auth-header p {
  color: var(--muted);
  margin: .35rem 0 0;
  font-weight: 700;
}

#login-form {
  width: 100%;
  max-width: 380px;
}

#invite-banner {
  width: 100%;
  max-width: 380px;
  background: var(--mint);
  color: #1f4d33;
  font-weight: 700;
  font-size: .9rem;
  padding: .7rem 1rem;
  border-radius: var(--radius);
  text-align: center;
}

.card-form {
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.card-form h2 {
  margin-top: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.card-form label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
  margin-top: .75rem;
}

.card-form input {
  margin-top: .35rem;
  padding: .55rem .7rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  background: var(--paper);
  color: var(--ink);
}

.card-form button {
  margin-top: 1.25rem;
  padding: .65rem 1rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--indigo);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.card-form button:disabled {
  opacity: .55;
  cursor: default;
}

/* status toast */

#status {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 100;
  padding: .7rem 1.1rem;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: .9rem;
  box-shadow: var(--shadow);
  max-width: min(90vw, 480px);
}

#status.error {
  background: var(--coral);
  color: #6b2418;
}

#status.ok {
  background: var(--mint);
  color: #285c3b;
}

/* top bar */

#topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 2px solid var(--line);
}

.logo {
  font-weight: 800;
  font-size: 15px;
  background: var(--ink);
  color: #fff;
  padding: 5px 9px;
  border-radius: 9px;
  letter-spacing: .5px;
}

.brand {
  font-weight: 800;
  font-size: 22px;
  color: var(--indigo);
}

.brand small {
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  margin-left: 8px;
}

#topbar .spacer {
  flex: 1;
}

.pill-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  box-shadow: var(--shadow);
}

.pill-btn:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.pulse {
  background: linear-gradient(0deg, #FFD873, #FFE49A);
  color: #7a5a00;
}

.invite {
  background: var(--mint);
  color: #1f4d33;
}

.bell {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  font-size: 18px;
  opacity: .55;
}

/* app shell layout */

#app-shell {
  display: grid;
  grid-template-columns: 200px 1fr 240px;
  height: calc(100vh - 66px);
}

.rail {
  padding: 18px 14px;
  overflow: auto;
}

.rail-left {
  background: var(--panel);
  border-right: 2px solid var(--line);
}

.rail-right {
  background: var(--panel);
  border-left: 2px solid var(--line);
  transition: margin-right .2s var(--ease-spring), opacity .2s;
}

.rail-right.hidden-rail {
  display: none;
}

.rail h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin: 0 0 12px;
}

.proj {
  background: var(--white);
  border-radius: 11px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .05);
  cursor: pointer;
}

.proj.active {
  background: var(--indigo);
  color: #fff;
}

.newproj {
  border: 2px dashed var(--line);
  border-radius: 11px;
  padding: 9px 12px;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  margin-bottom: 12px;
  background: transparent;
  width: 100%;
}

#new-project-form {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#new-project-form input {
  padding: 7px 9px;
  border: 2px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  background: var(--white);
}

#new-project-form button {
  border: none;
  border-radius: var(--radius-pill);
  background: var(--indigo);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
}

.rail-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

#user-summary {
  font-weight: 800;
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 4px;
  word-break: break-word;
}

.link-btn {
  background: none;
  border: none;
  color: var(--indigo);
  font-weight: 700;
  font-size: 12px;
  padding: 0;
  cursor: pointer;
}

/* center */

.center {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px 18px 0;
}

.tab {
  font-weight: 700;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 12px 12px 0 0;
  cursor: pointer;
  color: var(--muted);
  border: none;
  background: none;
  font-family: inherit;
}

.tab.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 -2px 6px rgba(0, 0, 0, .04);
}

.tab.disabled {
  opacity: .45;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--white);
  border-bottom: 2px solid var(--line);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 34px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

.switch {
  width: 34px;
  height: 20px;
  background: var(--line);
  border-radius: 20px;
  position: relative;
  transition: background .15s;
  flex-shrink: 0;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: left .15s;
}

.toggle input:checked + .switch {
  background: var(--indigo);
}

.toggle input:checked + .switch::after {
  left: 16px;
}

.search {
  flex: 1;
  max-width: 360px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}

.add {
  margin-left: auto;
  background: var(--indigo);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

#add-card-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  background: var(--white);
  border-bottom: 2px solid var(--line);
  height: 0;
  overflow: hidden;
  transition: height .15s, padding .15s;
}

#add-card-form.open {
  height: 52px;
  padding: 8px 18px;
}

#add-card-form input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
}

#add-card-form button {
  border: none;
  border-radius: var(--radius-pill);
  background: var(--pink);
  color: #fff;
  font-weight: 800;
  padding: 8px 16px;
  cursor: pointer;
}

/* canvas */

.canvas {
  position: relative;
  flex: 1;
  overflow: auto;
  background-color: var(--paper);
  background-image: radial-gradient(var(--line) 1.5px, transparent 1.5px);
  background-size: 26px 26px;
}

svg.links {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.note {
  position: absolute;
  width: 160px;
  min-height: 90px;
  border-radius: var(--radius);
  padding: 12px 13px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow);
  cursor: grab;
  transition: transform .25s var(--ease-spring), box-shadow .25s, outline-color .15s;
  z-index: 1;
}

.note:hover {
  transform: translateY(-4px) scale(1.03) rotate(0deg) !important;
  box-shadow: 0 14px 28px rgba(70, 55, 25, .2);
  z-index: 5;
}

.note.dragging {
  cursor: grabbing;
  transform: scale(1.05) rotate(0deg) !important;
  box-shadow: 0 14px 28px rgba(70, 55, 25, .25);
  z-index: 6;
  transition: none;
}

.note.selected {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}

.note .lbl {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  opacity: .65;
  margin-bottom: 5px;
}

.note .body {
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.note .body[contenteditable="true"] {
  cursor: text;
}

.n-idea {
  background: var(--yellow);
}

.n-q {
  background: var(--coral);
}

.n-soc {
  background: var(--lilac);
  border: 2px solid var(--socratic-border);
}

.align-bar {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--pink);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  max-width: min(92%, 520px);
}

.align-bar span {
  white-space: nowrap;
}

.align-bar input {
  flex: 1;
  min-width: 140px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
}

.align-bar button {
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.align-bar .submit {
  background: var(--ink);
  color: #fff;
}

.align-bar .cancel {
  background: rgba(255, 255, 255, .35);
  color: #fff;
}

/* pending rail */

.pcard {
  background: var(--white);
  border-radius: 13px;
  padding: 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 2px solid var(--line);
}

.pcard .rsn {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}

.upvote {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.up {
  background: var(--pink);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  border: none;
  border-radius: 14px;
  padding: 7px 14px;
  cursor: pointer;
}

.up:disabled {
  opacity: .55;
  cursor: default;
}

.pips {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
