/* SoEzy Notes — Apple-calm layout, holographic accents: deep night ground, glass surfaces, light that floats. */
:root {
  --bg: #05070d;
  --bg2: #0a0f1c;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.10);
  --edge: rgba(255, 255, 255, 0.12);
  --edge-strong: rgba(255, 255, 255, 0.22);
  --text: #f4f7fb;
  --text2: rgba(235, 242, 255, 0.68);
  --muted: rgba(235, 242, 255, 0.42);
  --holo1: #5ee7ff;
  --holo2: #a78bfa;
  --holo3: #f472b6;
  --ok: #34d399;
  --danger: #fb7185;
  --radius: 22px;
  --font: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overscroll-behavior: none; }
body { overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
input, textarea { font: inherit; color: var(--text); }
::selection { background: rgba(94, 231, 255, 0.3); }

/* the floating light behind everything */
.aurora { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.aurora i { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(90px); opacity: 0.20; animation: drift 26s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: var(--holo1); top: -30vmax; right: -20vmax; }
.aurora i:nth-child(2) { background: var(--holo2); bottom: -35vmax; left: -25vmax; animation-duration: 32s; }
.aurora i:nth-child(3) { background: var(--holo3); top: 30%; left: 40%; width: 40vmax; height: 40vmax; opacity: 0.10; animation-duration: 40s; }
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-6vmax, 5vmax, 0) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .aurora i, .node-float { animation: none !important; } }

#app { position: relative; z-index: 1; height: 100%; }

/* ── shared surfaces ── */
.glass { background: var(--glass); border: 1px solid var(--edge); border-radius: var(--radius); backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid var(--edge); background: var(--glass); cursor: pointer; font-weight: 600; font-size: 16px; transition: transform .15s ease, background .2s ease; }
.btn:active { transform: scale(0.97); }
.btn.primary { border: 0; background: linear-gradient(135deg, var(--holo1), var(--holo2)); color: #06101a; box-shadow: 0 10px 40px -10px rgba(94, 231, 255, 0.6); }
.btn.danger { color: var(--danger); border-color: rgba(251, 113, 133, 0.35); }
.btn.ghost { background: transparent; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge); background: var(--glass); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.icon-btn svg, .btn svg { width: 20px; height: 20px; }
.icon-btn:active { transform: scale(0.94); }

/* ── sign in ── */
.signin { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 24px calc(32px + var(--safe-bottom)); text-align: center; }
.orb { width: 132px; height: 132px; border-radius: 50%; position: relative; background: radial-gradient(circle at 35% 30%, #fff 0, var(--holo1) 18%, var(--holo2) 52%, transparent 72%); box-shadow: 0 0 80px 10px rgba(94, 231, 255, 0.35), inset 0 0 40px rgba(255, 255, 255, 0.4); animation: breathe 5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.05); box-shadow: 0 0 110px 20px rgba(167, 139, 250, 0.4), inset 0 0 40px rgba(255, 255, 255, 0.5); } }
.signin h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.signin p { margin: 0; color: var(--text2); font-size: 17px; line-height: 1.7; max-width: 340px; }
a.btn, a.btn:visited { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.discord { width: min(100%, 320px); min-height: 58px; justify-content: space-between; padding: 0 8px 0 22px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16); color: #fff; font-size: 17px;
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 18px 50px -20px rgba(88, 101, 242, 0.9); }
.discord .logo { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: #5865f2; box-shadow: 0 6px 18px -6px rgba(88, 101, 242, 0.9); }
.discord .logo svg { width: 24px; height: 24px; }
.wait { width: min(100%, 320px); padding: 18px; border-radius: 20px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); display: grid; gap: 10px; }
.wait .code { font-size: 34px; font-weight: 700; letter-spacing: 10px; direction: ltr; background: linear-gradient(135deg, var(--holo1), var(--holo2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.spinner { width: 22px; height: 22px; margin: 0 auto; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, 0.15); border-top-color: var(--holo1); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fine { color: var(--muted); font-size: 13px; }

/* ── home: the trees ── */
.home { height: 100%; overflow-y: auto; padding: calc(18px + var(--safe-top)) 18px calc(110px + var(--safe-bottom)); }
.home header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.home h1 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -0.4px; }
.hello { color: var(--text2); font-size: 15px; margin-top: 2px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge-strong); object-fit: cover; background: var(--glass); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.tree-card { position: relative; overflow: hidden; padding: 18px; min-height: 140px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; transition: transform .2s ease, border-color .2s ease; text-align: start; }
.tree-card:active { transform: scale(0.98); }
.tree-card::before { content: ''; position: absolute; inset: -40% -20% auto auto; width: 180px; height: 180px; border-radius: 50%; background: hsl(var(--h) 90% 65% / 0.22); filter: blur(40px); }
.tree-card h3 { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.4; position: relative; word-break: break-word; }
.meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--text2); font-size: 13px; position: relative; }
.bar { flex: 1; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, hsl(var(--h) 90% 65%), var(--holo2)); }
.empty { text-align: center; padding: 60px 20px; color: var(--text2); line-height: 1.8; }
.fab { position: fixed; z-index: 5; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--safe-bottom)); }

/* ── the tree canvas ── */
.canvas-wrap { position: fixed; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.canvas-wrap svg.canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.canvas-wrap svg.canvas.dragging { cursor: grabbing; }
.topbar { position: fixed; z-index: 4; top: calc(12px + var(--safe-top)); right: 12px; left: 12px; display: flex; align-items: center; gap: 10px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.topbar .title { flex: 1; min-width: 0; padding: 0 16px; height: 44px; display: flex; align-items: center; gap: 10px; border-radius: 999px; font-weight: 700; }
.topbar .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .title small { color: var(--text2); font-weight: 500; flex-shrink: 0; }
.zoombar { position: fixed; z-index: 4; left: 12px; bottom: calc(16px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 8px; }

.link { fill: none; stroke-width: 2.2; stroke-linecap: round; opacity: .75; }
.link.done { opacity: .22; }
.node rect.body { transition: fill .25s ease, opacity .25s ease; }
.node text { font-family: var(--font); fill: var(--text); font-size: 15px; font-weight: 600; pointer-events: none; }
.node .badge text { font-size: 11px; font-weight: 700; fill: #06101a; }
.node.done text.label { fill: rgba(235, 242, 255, 0.45); text-decoration: line-through; }
.node.done rect.body { opacity: .5; }
.node.selected rect.ring { opacity: 1; }
.node rect.ring { opacity: 0; transition: opacity .2s ease; }
.node-float { animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-3px); } }
.node { cursor: pointer; }
.add-dot { cursor: pointer; }

/* ── bottom sheet ── */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.45); opacity: 0; transition: opacity .25s ease; }
.scrim.on { opacity: 1; }
.sheet { position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; padding: 10px 18px calc(18px + var(--safe-bottom)); border-radius: 28px 28px 0 0; transform: translateY(105%); transition: transform .32s cubic-bezier(.2, .9, .25, 1); background: rgba(14, 19, 32, 0.86); border: 1px solid var(--edge); border-bottom: 0; backdrop-filter: blur(30px) saturate(150%); -webkit-backdrop-filter: blur(30px) saturate(150%); max-height: 88vh; overflow-y: auto; }
.sheet.on { transform: translateY(0); }
.grabber { width: 40px; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.22); margin: 4px auto 14px; }
.sheet h2 { margin: 0 0 14px; font-size: 20px; }
.field { width: 100%; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 14px 16px; font-size: 17px; outline: none; transition: border-color .2s ease; }
.field:focus { border-color: rgba(94, 231, 255, 0.6); }
textarea.field { min-height: 120px; resize: vertical; line-height: 1.7; font-size: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.row .btn { flex: 1 1 0; min-width: 120px; }
.label { display: block; color: var(--text2); font-size: 14px; margin: 14px 2px 8px; }
.hues { display: flex; gap: 10px; flex-wrap: wrap; }
.hue { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.hue.on { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15); }
.check { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.05); cursor: pointer; margin-top: 12px; font-weight: 600; }
.check .box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--edge-strong); display: grid; place-items: center; flex-shrink: 0; }
.check.on .box { background: var(--ok); border-color: var(--ok); }
.check .box svg { width: 16px; height: 16px; opacity: 0; transform: scale(0.6); transition: opacity 0.18s, transform 0.18s; }
.check.on .box svg { stroke: #06101a; opacity: 1; transform: none; }

/* ── update card / toast ── */
.update { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, 0.6); }
.update .card { max-width: 360px; width: 100%; padding: 28px 24px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.update h2 { margin: 0; font-size: 22px; }
.update p { margin: 0; color: var(--text2); line-height: 1.7; }
#toast { position: fixed; z-index: 50; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translate(-50%, 20px); opacity: 0; transition: all .25s ease; padding: 12px 18px; border-radius: 999px; background: rgba(20, 26, 42, 0.92); border: 1px solid var(--edge); font-size: 14px; pointer-events: none; white-space: nowrap; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
