/* base.css */

:root {
  --bg: #0d0d0d;
  --surface: rgba(28, 28, 28, .72);
  --surface-solid: #1b1b1b;
  --surface-2: rgba(255, 255, 255, .05);
  --surface-3: rgba(255, 255, 255, .09);
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .2);
  --text: #fff;
  --muted: #a8a8a8;
  --muted-2: #7c7c7c;
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, .12);
  --accent: #e8e8e8;
  --radius-xs: 8px;
  --radius-sm: 11px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, .25);
  --ring: 0 0 0 3px rgba(255, 255, 255, .22);
  --ease: cubic-bezier(.2, .8, .3, 1);
  --nav-h: 66px;
  --font: Comfortaa, ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 99px;
  background: rgba(255, 255, 255, .14);
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .26);
  background-clip: content-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, .07), transparent 30%),
    radial-gradient(circle at 85% 90%, rgba(255, 255, 255, .05), transparent 30%),
    var(--bg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -.5px;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* layout */

.shell {
  width: calc(100% - 30px);
  max-width: 1100px;
  margin-inline: auto;
}

.page {
  padding-bottom: 90px;
}

/* navbar */

.navbar {
  position: sticky;
  top: 15px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: calc(100% - 30px);
  max-width: 1240px;
  margin: 15px auto 0;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.5px;
}

.nav-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
}

.nav-link {
  color: var(--muted);
  font-size: 14px;
  transition: color .18s var(--ease);
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--text);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* surfaces */

.glass {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.card {
  padding: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 21px;
}


/* buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease), opacity .18s var(--ease);
}

.btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-3);
  transform: translateY(-1px);
}

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

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

.btn-primary {
  border-color: transparent;
  background: rgba(255, 255, 255, .16);
}

.btn-primary:hover:not(:disabled) {
  background: rgba(255, 255, 255, .24);
}

.btn-danger {
  border-color: transparent;
  background: var(--danger-soft);
  color: #ffd9d9;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(255, 107, 107, .22);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.btn-sm {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}


/* forms */

.field {
  margin-bottom: 15px;
}

.field:last-child {
  margin-bottom: 0;
}

.field > label:not(.switch),
.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .2px;
}

.field-hint {
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.5;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input:not([type]),
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  color: var(--text);
  background: rgba(0, 0, 0, .32);
  transition: border-color .18s var(--ease), background .18s var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: #6b6b6b;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-strong);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(255, 255, 255, .34);
  background: rgba(0, 0, 0, .45);
}

textarea {
  min-height: 150px;
  line-height: 1.65;
  resize: vertical;
}

select {
  appearance: none;
  padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, #9a9a9a 50%), linear-gradient(135deg, #9a9a9a 50%, transparent 50%);
  background-position: calc(100% - 19px) calc(50% + 1px), calc(100% - 14px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

select option {
  background: var(--surface-solid);
  color: var(--text);
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 22px;
}

.form-actions .btn {
  flex: 1;
}

.char-count {
  float: right;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 400;
}

/* switch */

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: rgba(0, 0, 0, .4);
  transition: background .2s var(--ease), border-color .2s var(--ease);
}

.switch-track::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #bdbdbd;
  content: "";
  transition: transform .2s var(--ease), background .2s var(--ease);
}

.switch input:checked + .switch-track {
  border-color: rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .16);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
  background: #fff;
}

.switch input:focus-visible + .switch-track {
  box-shadow: var(--ring);
}

.switch:hover .switch-track {
  border-color: var(--border-strong);
}

.qb-hint {
  color: var(--muted-2);
  font-size: 11.5px;
  font-weight: 400;
}

/* badges + chips */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: var(--radius-xs);
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-secure {
  color: #ffe6a7;
  background: rgba(255, 200, 80, .12);
}

.badge-accent {
  color: #d8f0ff;
  background: rgba(120, 190, 255, .12);
}


.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 11px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface-2);
  font-size: 12.5px;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}

.chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.chip-remove {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255, 255, 255, .1);
  font-size: 12px;
  line-height: 1;
  transition: background .18s var(--ease), color .18s var(--ease);
}

.chip-remove:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .22);
}

.chip-static {
  padding-right: 11px;
}

.tag-input-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

/* entries */

.entry {
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}

.entry + .entry {
  margin-top: 12px;
}

.entry:hover {
  border-color: rgba(255, 255, 255, .13);
  background: rgba(255, 255, 255, .045);
}

.entry-title {
  font-size: 18px;
  word-break: break-word;
}

.entry-content {
  margin-top: 12px;
  color: #c6c6c6;
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.entry-content.is-locked {
  color: var(--muted-2);
  font-style: italic;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 11px;
}

.entry-to {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px dashed rgba(255, 255, 255, .09);
}

.entry-to-label {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.entry-flash {
  animation: flash 1.6s var(--ease);
}

@keyframes flash {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
  25% {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .3);
  }
}

/* states */

.empty {
  padding: 40px 16px;
  color: var(--muted-2);
  text-align: center;
}

.empty-title {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 15px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px;
  color: var(--muted-2);
  font-size: 13px;
}

.loader {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, .16);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.message {
  min-height: 18px;
  margin-top: 12px;
  color: var(--muted-2);
  font-size: 13px;
}

.message.is-error {
  color: #ffb3b3;
}

.message.is-success {
  color: #b7f0c4;
}

/* modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .74);
  backdrop-filter: blur(10px);
  animation: fade .18s var(--ease);
}

.modal-card {
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 40px);
  padding: 26px;
  overflow-y: auto;
  animation: pop .2s var(--ease);
}

.modal-card-sm {
  max-width: 420px;
}

.modal-title {
  margin-bottom: 18px;
  font-size: 21px;
}

.modal-text {
  color: var(--muted);
  line-height: 1.7;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(.98);
  }
}

/* toasts */

.toast-host {
  position: fixed;
  bottom: 22px;
  left: 50%;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 11px 17px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: rgba(30, 30, 30, .94);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in .22s var(--ease);
}

.toast-error {
  border-color: rgba(255, 107, 107, .4);
  color: #ffd0d0;
}

.toast-success {
  border-color: rgba(120, 220, 150, .35);
  color: #c9f5d6;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* quiz */

.quiz-question {
  margin-bottom: 16px;
  color: #d6d6d6;
  line-height: 1.65;
}

.quiz-options {
  display: grid;
  gap: 9px;
}

.quiz-option {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-2);
  text-align: left;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}

.quiz-option:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.quiz-builder {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, .22);
}

.quiz-options-editor {
  display: grid;
  gap: 9px;
}

.quiz-option-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.quiz-option-row input[type="text"] {
  flex: 1;
}

.quiz-correct-toggle {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}

.quiz-correct-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.quiz-correct-toggle::after {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  content: "";
  transition: background .18s var(--ease);
}

.quiz-correct-toggle:hover {
  border-color: rgba(255, 255, 255, .4);
}

.quiz-correct-toggle:has(input:checked) {
  border-color: #fff;
  background: rgba(255, 255, 255, .16);
}

.quiz-correct-toggle:has(input:checked)::after {
  background: #fff;
}

.quiz-correct-toggle:has(input:focus-visible) {
  box-shadow: var(--ring);
}

/* corner auth link */

.corner-link {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 40;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted-2);
  background: rgba(20, 20, 20, .7);
  backdrop-filter: blur(12px);
  font-size: 12.5px;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}

.corner-link:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: rgba(35, 35, 35, .85);
}

/* responsive */

@media (max-width: 650px) {
  .shell,
  .navbar {
    width: calc(100% - 22px);
  }

  .card {
    padding: 18px;
  }

  .form-row {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}