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

:root {
  --cyan: #00e5ff;
  --purple: #8a2be2;
  --blue: #1a73e8;
  --bg-deep: #030814;
  --bg-panel: rgba(13, 22, 48, 0.75);
  --text: #d6e4ff;
  --text-dim: #5b7094;
  --border: rgba(0, 229, 255, 0.25);
  --glow-cyan: rgba(0, 229, 255, 0.35);
  --glow-purple: rgba(138, 43, 226, 0.4);
}

body {
  font-family: "SF Mono", "JetBrains Mono", "Consolas", -apple-system, "PingFang SC", "Microsoft YaHei", monospace;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(26, 115, 232, 0.18), transparent),
    radial-gradient(ellipse 50% 40% at 85% 110%, rgba(138, 43, 226, 0.15), transparent),
    linear-gradient(160deg, #040a1a 0%, #060d22 45%, #030814 100%);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2vh;
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.view {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* 网格背景 */
.view::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
  z-index: -1;
}

/* 扫描线 */
.view::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  height: 140px;
  background: linear-gradient(180deg, transparent, rgba(0, 229, 255, 0.05), transparent);
  animation: scan 9s linear infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes scan {
  0% { top: -20%; }
  100% { top: 120%; }
}

/* ---------- 登录卡片 ---------- */
.login-card {
  width: min(440px, 92vw);
  padding: 44px 40px 32px;
  text-align: center;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  box-shadow:
    0 0 40px rgba(0, 229, 255, 0.08),
    0 0 90px rgba(138, 43, 226, 0.12),
    inset 0 0 30px rgba(0, 229, 255, 0.03);
  position: relative;
  animation: card-in 0.6s ease both;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  padding: 1px;
  background: linear-gradient(135deg, var(--cyan), transparent 35%, transparent 65%, var(--purple));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.7;
  pointer-events: none;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.logo-icon {
  width: 84px;
  height: 84px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  color: var(--cyan);
  background: radial-gradient(circle, rgba(0, 229, 255, 0.14), rgba(0, 229, 255, 0.02));
  border: 1px solid var(--border);
  box-shadow: 0 0 26px var(--glow-cyan);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 22px var(--glow-cyan); }
  50% { box-shadow: 0 0 38px var(--glow-purple); }
}

.app-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 3px;
  margin-bottom: 8px;
  text-shadow: 0 0 18px rgba(0, 229, 255, 0.45);
}

.app-title span {
  color: var(--cyan);
  text-shadow: 0 0 22px var(--glow-cyan);
}

.app-subtitle {
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 4px;
  margin-bottom: 34px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
  padding: 15px 18px;
  background: rgba(3, 8, 20, 0.6);
  border: 1px solid rgba(91, 112, 148, 0.35);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  letter-spacing: 2px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.input-wrap input::placeholder {
  color: var(--text-dim);
  letter-spacing: 1px;
}

.input-wrap input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12), 0 0 24px var(--glow-cyan);
}

.input-glow {
  position: absolute;
  bottom: -1px;
  left: 15%;
  right: 15%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.input-wrap input:focus ~ .input-glow {
  opacity: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 22px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  box-shadow: 0 0 22px rgba(26, 115, 232, 0.35);
}

.btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: -80%;
  width: 60%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  animation: shine 3.2s ease-in-out infinite;
}

@keyframes shine {
  0%, 55% { left: -80%; }
  85%, 100% { left: 130%; }
}

.btn-primary:hover {
  box-shadow: 0 0 34px rgba(26, 115, 232, 0.55);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-arrow {
  transition: transform 0.25s;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}

.btn-small {
  padding: 10px 22px;
  font-size: 13px;
  letter-spacing: 1px;
}

.btn-ghost {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--border);
  padding: 9px 18px;
  font-size: 13px;
  letter-spacing: 1px;
}

.btn-ghost:hover {
  background: rgba(0, 229, 255, 0.08);
  box-shadow: 0 0 18px var(--glow-cyan);
}

.error-msg {
  color: #ff4d6d;
  font-size: 13px;
  margin-top: 18px;
  text-shadow: 0 0 12px rgba(255, 77, 109, 0.5);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.demo-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  padding: 10px 14px;
  border: 1px dashed rgba(0, 255, 163, 0.45);
  border-radius: 10px;
  background: rgba(0, 255, 163, 0.06);
  animation: pulse-tip 2.4s ease-in-out infinite;
}

@keyframes pulse-tip {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 255, 163, 0.12); }
  50% { box-shadow: 0 0 20px rgba(0, 255, 163, 0.3); }
}

.demo-label {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.demo-value {
  font-size: 16px;
  font-weight: 700;
  color: #00ffa3;
  text-shadow: 0 0 12px rgba(0, 255, 163, 0.6);
  letter-spacing: 4px;
  background: rgba(0, 255, 163, 0.08);
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid rgba(0, 255, 163, 0.3);
}

.login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 1px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ffa3;
  box-shadow: 0 0 10px rgba(0, 255, 163, 0.8);
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- 编辑器 ---------- */
.editor-card {
  width: min(1400px, 96vw);
  height: 94vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  box-shadow:
    0 0 40px rgba(0, 229, 255, 0.07),
    0 0 90px rgba(138, 43, 226, 0.1);
  overflow: hidden;
  animation: card-in 0.5s ease both;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 26px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.15);
  background: rgba(3, 8, 20, 0.45);
}

.editor-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.editor-title .app-title {
  font-size: 20px;
  letter-spacing: 2px;
  margin-bottom: 0;
}

.session-badge {
  font-size: 10px;
  letter-spacing: 2px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--cyan);
  box-shadow: 0 0 14px var(--glow-cyan);
  text-shadow: 0 0 8px var(--glow-cyan);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 20px;
}

.autosave-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.autosave-toggle input {
  display: none;
}

.toggle-slider {
  width: 46px;
  height: 24px;
  border-radius: 20px;
  background: rgba(91, 112, 148, 0.3);
  border: 1px solid rgba(91, 112, 148, 0.4);
  position: relative;
  transition: all 0.3s;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #8fa3c8;
  transition: all 0.3s;
}

.autosave-toggle input:checked + .toggle-slider {
  background: rgba(0, 229, 255, 0.2);
  border-color: var(--cyan);
  box-shadow: 0 0 16px var(--glow-cyan);
}

.autosave-toggle input:checked + .toggle-slider::after {
  left: 24px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--glow-cyan);
}

.toggle-label {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 1px;
  transition: color 0.3s;
}

.autosave-toggle input:checked ~ .toggle-label {
  color: var(--cyan);
  text-shadow: 0 0 10px var(--glow-cyan);
}

.editor-body {
  flex: 1;
  padding: 20px 26px;
  display: flex;
  min-height: 0;
}

#note-textarea {
  flex: 1;
  width: 100%;
  padding: 22px;
  background: rgba(3, 8, 20, 0.55);
  border: 1px solid rgba(91, 112, 148, 0.25);
  border-radius: 12px;
  font-size: 17px;
  line-height: 1.85;
  color: var(--text);
  resize: none;
  outline: none;
  font-family: inherit;
  transition: border-color 0.25s, box-shadow 0.25s;
}

#note-textarea::placeholder {
  color: var(--text-dim);
}

#note-textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1), 0 0 28px var(--glow-cyan);
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 26px;
  border-top: 1px solid rgba(0, 229, 255, 0.15);
  background: rgba(3, 8, 20, 0.45);
}

.save-status {
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 1px;
}

.save-status.saved {
  color: #00ffa3;
  text-shadow: 0 0 10px rgba(0, 255, 163, 0.5);
}

.save-status.error {
  color: #ff4d6d;
  text-shadow: 0 0 10px rgba(255, 77, 109, 0.5);
}

@media (max-width: 640px) {
  body { padding: 1vh; }
  .editor-header, .editor-footer { padding: 12px 16px; }
  .editor-body { padding: 12px 16px; }
  .toolbar { gap: 12px; }
  .editor-title .app-title { font-size: 17px; }
}
