:root {
  --text: #d9d6ee;
  --muted: #8a879a;
  --accent: #b9a7ff;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: var(--mono);
  background: #0b0a16;
  color: var(--text);
  overflow: hidden;
}

#bg { position: fixed; inset: 0; width: 100%; height: 100%; }

.app {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: clamp(190px, 17vw, 280px) 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 22px;
}
header { grid-column: 1 / -1; }
.sidebar { grid-column: 1; grid-row: 2; min-height: 0; }
.editor { grid-column: 2; grid-row: 2 / 4; min-height: 0; }
.footer { grid-column: 1; grid-row: 3; text-align: center; }

/* frosted glass with a thin gradient outline */
.panel {
  position: relative;
  border-radius: 14px;
  background: rgba(22, 20, 38, .6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.panel::before {
  content: "";
  position: absolute; inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,.38), rgba(255,255,255,.07) 40%, rgba(255,255,255,.07) 70%, rgba(255,255,255,.22));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

header.panel { display: flex; align-items: center; height: 74px; padding: 0 26px; }
header h1 {
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--accent);
  text-shadow: 0 0 4px rgba(190,170,255,.9), 0 0 16px rgba(140,110,255,.75), 0 0 34px rgba(110,80,255,.4);
}

.sidebar { display: flex; flex-direction: column; padding: 14px 12px 12px; }
.tools { display: flex; gap: 6px; margin: 0 0 10px 4px; }
.icon-btn {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  color: #e8e8f2;
  background: none;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); }
.icon-btn svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

#note-list {
  flex: 1;
  display: flex; flex-direction: column; gap: 6px;
  list-style: none;
  overflow-y: auto;
}
#note-list li { position: relative; }
.note-open {
  width: 100%;
  padding: 9px 30px 9px 9px;
  font: 400 16px var(--mono);
  text-align: left;
  color: #c3c9e6;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
  transition: background .15s;
}
.note-open:hover { background: rgba(255,255,255,.05); }
li[aria-current="true"] .note-open {
  color: #d3e2ff;
  background: rgba(70,100,220,.2);
  border-color: rgba(150,175,255,.55);
  text-shadow: 0 0 8px rgba(150,180,255,.5);
}
.note-delete {
  position: absolute; right: 5px; top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  font: 400 15px var(--mono);
  color: #c3c9e6;
  background: none; border: 0; border-radius: 5px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s;
}
li:hover .note-delete, .note-delete:focus-visible { opacity: 1; }
.note-delete:hover { background: rgba(255,90,110,.25); color: #fff; }

.footer button {
  padding: 6px 8px;
  font: 400 11px var(--mono);
  color: #dfe3f5;
  background: none; border: 0;
  cursor: pointer;
}
.footer button:hover { text-decoration: underline; }

.editor { display: flex; }
#text {
  flex: 1;
  width: 100%;
  padding: 18px 20px;
  font: 400 14px/1.6 var(--mono);
  tab-size: 2;
  color: var(--text);
  background: none;
  border: 0; outline: 0;
  border-radius: 14px;
  resize: none;
}
#text::placeholder { color: var(--muted); }

:focus-visible { outline: 2px solid #8fa8ff; outline-offset: 2px; }
#text:focus-visible { outline: 0; }

dialog {
  margin: auto;
  width: min(440px, 90vw);
  padding: 24px;
  font-family: var(--mono);
  color: var(--text);
  background: rgba(22,20,38,.92);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
}
dialog::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }
dialog h2 { margin-bottom: 12px; font-size: 18px; font-weight: 500; color: var(--accent); }
dialog p { margin-bottom: 10px; font-size: 13px; line-height: 1.6; color: #c9c6dd; }
dialog button {
  margin-top: 8px; padding: 8px 16px;
  font: 500 13px var(--mono);
  color: #111; background: #f3f3f3;
  border: 0; border-radius: 7px;
  cursor: pointer;
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100%; grid-template-columns: 1fr; grid-template-rows: auto auto minmax(320px, 60vh) auto; padding: 14px; }
  .sidebar { grid-row: 2; max-height: 220px; }
  .editor { grid-column: 1; grid-row: 3; }
  .footer { grid-row: 4; }
  header h1 { font-size: 30px; }
}
