:root { 
  --glass-bg: rgba(255,255,255,0.12); 
  --glass-border: rgba(255,255,255,0.28); 
  --text: #f7f8fb; 
  --muted: #cbd2ff; 
  --btn-bg: rgba(255,255,255,0.14); 
  --btn-border: rgba(255,255,255,0.3); 
  --primary: #6e7bff; 
}

* { 
  box-sizing: border-box; 
}

html, body { 
  height: 100%; 
  margin: 0; 
  background: #0b0c12; 
  color: var(--text); 
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial; 
}

.bg { 
  position: fixed; 
  inset: 0; 
  background: radial-gradient(1200px 800px at 80% 20%, rgba(116,78,255,0.45), transparent 60%), 
              radial-gradient(900px 600px at 20% 80%, rgba(0,170,255,0.45), transparent 55%); 
  filter: blur(40px); 
}

.card { 
  position: fixed; 
  inset: 0; 
  margin: 10px; 
  border-radius: 18px; 
  backdrop-filter: blur(16px) saturate(110%); 
  background: var(--glass-bg); 
  border: 1px solid var(--glass-border); 
  display: flex; 
  flex-direction: column; 
  gap: 10px; 
  padding: 10px; 
}

.fade-in { 
  animation: fadeIn 320ms ease-out; 
}

.fade-out { 
  animation: fadeOut 240ms ease-in forwards; 
}

@keyframes fadeIn { 
  from { opacity: 0; transform: translateY(6px); } 
  to { opacity: 1; transform: translateY(0); } 
}

@keyframes fadeOut { 
  to { opacity: 0; transform: translateY(6px); } 
}

.top-row { 
  display: flex; 
  gap: 10px; 
  align-items: center; 
  flex-wrap: wrap;
}

.title { 
  flex: 1; 
  min-width: 200px;
  height: 44px; 
  border-radius: 12px; 
  border: 1px solid var(--glass-border); 
  background: rgba(255,255,255,0.08); 
  color: var(--text); 
  padding: 0 12px; 
  outline: none;
}

.title::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.actions { 
  display: flex; 
  gap: 8px; 
  flex-wrap: wrap;
}

.btn { 
  height: 44px; 
  min-width: 44px; 
  padding: 0 14px; 
  border-radius: 12px; 
  border: 1px solid var(--btn-border); 
  background: var(--btn-bg); 
  color: var(--text); 
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.btn:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary { 
  background: linear-gradient(135deg, rgba(110,123,255,0.9), rgba(185,112,255,0.9)); 
  border-color: transparent; 
}

.btn.primary:hover {
  background: linear-gradient(135deg, rgba(110,123,255,1), rgba(185,112,255,1));
}

.btn svg {
  width: 16px;
  height: 16px;
}

.editor-wrap { 
  position: relative; 
  flex: 1; 
  display: grid; 
  grid-template-columns: 1fr; 
  grid-template-rows: 1fr; 
  border-radius: 14px; 
  overflow: hidden; 
}

.editor, .preview { 
  grid-area: 1 / 1; 
  width: 100%; 
  height: 100%; 
  margin: 0; 
  border: none; 
  outline: none; 
  resize: none; 
  background: rgba(12,14,22,0.35); 
  color: var(--text); 
  padding: 12px; 
  font: 14px/1.5 "SF Mono", Menlo, Consolas, monospace; 
  border: 1px solid var(--glass-border); 
  border-radius: 14px; 
  overflow: auto;
}

.editor::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

.preview { 
  pointer-events: none; 
  opacity: 0.35; 
  color: var(--muted);
}

.bottom-row { 
  display: flex; 
  gap: 8px; 
  justify-content: flex-end; 
  flex-wrap: wrap;
}

.toast { 
  position: fixed; 
  left: 50%; 
  bottom: 16px; 
  transform: translateX(-50%); 
  background: rgba(12,14,22,0.9); 
  border: 1px solid var(--glass-border); 
  color: var(--text); 
  padding: 10px 14px; 
  border-radius: 12px; 
  opacity: 0; 
  pointer-events: none; 
  transition: opacity 200ms ease, transform 200ms ease; 
  z-index: 1000;
}

.toast.show { 
  opacity: 1; 
  transform: translateX(-50%) translateY(-4px); 
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.6);
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 24px;
  max-width: 450px;
  width: 100%;
  text-align: center;
}

.modal-content h2 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 600;
}

.modal-content p {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.modal-content input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  padding: 0 12px;
  margin-bottom: 16px;
  outline: none;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

.modal-content input:focus {
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.modal-content a {
  color: var(--primary);
  text-decoration: none;
}

.modal-content a:hover {
  text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .card {
    margin: 5px;
    padding: 8px;
    gap: 8px;
  }
  
  .top-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .title {
    width: 100%;
  }
  
  .actions {
    width: 100%;
    flex-wrap: wrap;
  }
  
  .btn {
    flex: 1;
    min-width: calc(50% - 4px);
    font-size: 13px;
    padding: 0 10px;
    justify-content: center;
  }
  
  .bottom-row {
    flex-direction: column;
  }
  
  .bottom-row .btn {
    width: 100%;
  }

  .modal-content {
    max-width: 90%;
  }
}