:root {
  --bg: #0a0a0b;
  --surface: #18181b;
  --surface-2: #111216;
  --border: #27272a;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #258cf4;
  --danger: #ef4444;
  --snap-red: #c45c5c;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

body[data-theme="light"] {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --text: #0f1012;
  --muted: #6b7280;
  --accent: #258cf4;
  --danger: #dc2626;
  --snap-red: #c45c5c;
  --shadow: 0 20px 40px rgba(15, 16, 18, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 6px;
}

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

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

.hidden {
  display: none !important;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
  font-size: 18px;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.mobile-header {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.mobile-brand {
  font-size: 20px;
  font-style: italic;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mobile-brand .accent {
  color: #3b82f6;
}

.mobile-brand .domain {
  font-size: 12px;
  opacity: 0.6;
}

.mobile-brand-logo {
  width: 168px;
  height: auto;
  display: block;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 18px;
}

.brand-logo {
  width: 210px;
  height: auto;
  display: block;
}

.brand .accent {
  color: var(--snap-red);
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-card {
  width: min(420px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}

.auth-copy {
  color: var(--muted);
  font-size: 14px;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.ghost {
  background: transparent;
}

button.small {
  font-size: 12px;
  padding: 6px 10px;
}

button.icon {
  padding: 6px 8px;
}

button.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.sidebar {
  width: 260px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.hashtags {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--muted);
}

.tag-item .tag-label::before {
  content: "# ";
  color: var(--muted);
}

.tag-item.all .tag-label::before {
  content: "";
}

.tag-item.active {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px;
  min-width: 0;
  overflow: hidden;
}

.main-header {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.add-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.add-image-btn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #c45c5c;
  border: none;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 24px rgba(196, 92, 92, 0.25);
}

.add-image-btn .material-symbols-outlined {
  font-size: 24px;
}

.add-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px 8px;
  background: var(--surface-2);
  flex: 1;
  height: 48px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.add-bar input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0 10px;
  font-size: 14px;
}

.add-bar .material-symbols-outlined {
  color: var(--muted);
}

.add-bar button.primary.add-link-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-expand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  width: 36px;
  transition: width 0.25s ease;
  overflow: hidden;
}

.search-expand:focus-within {
  width: 240px;
}

.search-expand .material-symbols-outlined {
  font-size: 18px;
}

.search-expand input {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  width: 100%;
  padding: 0;
}

.search-expand input::placeholder {
  color: var(--muted);
}

.sort-toggle {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  padding: 6px 10px;
  gap: 6px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 10px;
}

.type-toggle {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  padding: 6px 10px;
  gap: 6px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 10px;
}

.feed {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 20px;
  overflow: auto;
  padding-right: 4px;
}

.note-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.note-card:hover {
  border-color: rgba(37, 140, 244, 0.4);
  box-shadow: 0 0 16px rgba(37, 140, 244, 0.12);
}

.note-card.is-processing .note-media img {
  filter: blur(4px);
}

.card-aspect {
  aspect-ratio: 1 / 1.1;
}

.note-media {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.note-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.note-card:hover .note-media::after {
  opacity: 1;
}

.note-media.media-link {
  background: linear-gradient(135deg, rgba(37, 140, 244, 0.12), rgba(196, 92, 92, 0.08));
}

.note-media.media-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.link-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
}

.link-icon-wrap img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.card-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.processing-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  z-index: 2;
}

.note-card:hover .card-actions {
  opacity: 1;
  transform: translateY(0);
}

.card-action {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-action.delete {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.35);
}

.note-meta-body {
  padding: 14px;
  background: rgba(10, 10, 11, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-card .note-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}

.processing-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(226, 232, 240, 0.92);
  font-weight: 600;
}

.processing-title .material-symbols-outlined {
  font-size: 15px;
  color: rgba(148, 163, 184, 0.92);
}

.note-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.tag-pill {
  font-size: 12px;
  font-weight: 600;
}

.tag-pill.image {
  color: #c45c5c;
}

.tag-pill.link {
  color: #7dd3fc;
}

.meta-dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}

.note-date-small {
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-card {
  position: relative;
  z-index: 2;
  width: min(520px, 92vw);
  max-height: 85vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal-card.small {
  width: min(520px, 92vw);
}

.note-modal {
  position: relative;
  z-index: 2;
  width: min(780px, 94vw);
  max-height: 94vh;
  overflow: hidden;
  background: #161b22;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.note-modal[data-kind="image"] {
  background: #0a0a0b;
}

.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.note-delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #f87171;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
}

.note-date-header {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 600;
}

.note-close {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  width: 34px;
  height: 34px;
}

.note-scroll {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  max-height: calc(94vh - 58px);
}

.note-content {
  padding: 16px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-title-input {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  background: transparent;
  border: none;
  padding: 0;
  resize: none;
  line-height: 1.2;
  min-height: 0;
  height: auto;
  display: block;
  min-height: 36px;
  overflow: hidden;
}

.note-modal[data-kind="image"] .note-title-input {
  font-size: 32px;
  line-height: 1.15;
}

.note-tags-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.note-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.note-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
}

.note-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.note-modal[data-kind="image"] .note-url-row {
  display: none;
}

.note-modal[data-kind="image"] .note-source-label {
  display: none;
}

.note-source-label {
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 700;
}

.note-url {
  flex: 1;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-url-actions {
  display: flex;
  gap: 6px;
}

.note-url-actions .ghost {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
}

.note-summary-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-summary-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.note-summary-label {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 700;
  text-transform: uppercase;
}

.note-summary-label .material-symbols-outlined {
  font-size: 12px;
  opacity: 0.55;
}

.note-regenerate {
  justify-self: center;
  border-radius: 999px;
  border: 1px solid rgba(37, 140, 244, 0.35);
  background: rgba(37, 140, 244, 0.12);
  color: #93c5fd;
  height: 28px;
  padding: 0 10px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  gap: 4px;
}

.note-regenerate .material-symbols-outlined {
  font-size: 14px;
}

.note-edit-summary {
  display: none;
  justify-self: end;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0;
  gap: 4px;
}

.note-edit-summary .material-symbols-outlined {
  font-size: 14px;
}

.note-summary-input {
  width: 100%;
  min-height: 200px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
  line-height: 1.6;
  resize: none;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.note-modal[data-kind="image"] .note-summary-input {
  min-height: 260px;
}

.note-save-btn {
  display: none;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(37, 140, 244, 0.25);
  background: rgba(37, 140, 244, 0.12);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
}

.pill.system {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.55);
}

.note-tags .pill .material-symbols-outlined {
  opacity: 0.7;
  font-size: 14px;
}

.note-tag-add {
  border: 1px dashed rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.55);
  background: transparent;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  height: 26px;
}

.note-notes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-notes-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  padding: 0;
  font-size: 13px;
  cursor: pointer;
}

.note-notes-toggle:hover {
  color: #93c5fd;
}

.note-notes-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-notes textarea {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
}

.note-preview {
  margin-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b0f14;
}

.note-preview-img {
  width: 100%;
  display: block;
  object-fit: cover;
  background: #0b0f14;
}

.note-modal[data-kind="image"] .note-preview-img {
  max-height: 520px;
}

.note-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 24px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.note-footer .danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
}

.note-footer .primary {
  padding: 10px 18px;
}

.delete-confirm-card {
  position: relative;
  z-index: 2;
  width: min(380px, 90vw);
  background: #121418;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
}

.delete-confirm-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 700;
  margin-bottom: 12px;
}

.delete-confirm-title .material-symbols-outlined {
  color: #ef4444;
  font-size: 20px;
}

.delete-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.delete-confirm-actions button {
  flex: 0 0 auto;
  height: 36px;
  min-width: 110px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
}

.delete-confirm-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.delete-solid {
  background: #ef4444;
  border: 1px solid #ef4444;
  color: #fff;
}

.delete-solid:hover {
  background: #f87171;
  border-color: #f87171;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(12, 14, 18, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  letter-spacing: 0.2px;
  opacity: 0;
  pointer-events: none;
}

.toast.show {
  animation: toast-in-out 1.4s ease;
}

@keyframes toast-in-out {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }

  15%,
  80% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(6px);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 6px;
}

.title-input {
  font-size: 18px;
  font-weight: 600;
}

.note-input {
  margin-bottom: 16px;
}

.chat {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  margin-bottom: 10px;
}

.chat-bubble {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  line-height: 1.4;
}

.chat-bubble.user {
  align-self: flex-end;
  background: #1f2937;
}

.chat-input {
  display: flex;
  gap: 8px;
}

.tags-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.tag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

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

.tag-row-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tag-create {
  display: flex;
  gap: 8px;
}

.mobile-tabbar {
  display: none;
}

.mobile-add-layer,
.mobile-link-layer,
.mobile-tags-layer,
.mobile-filter-layer {
  display: none;
}

@media (max-width: 900px) {
  /* Mobile feed-first layout for iPhone-sized screens. Desktop layout stays unchanged. */
  .app {
    max-width: 430px;
    margin: 0 auto;
  }

  .mobile-header {
    display: flex;
    position: fixed;
    top: 0;
    left: 50%;
    right: auto;
    width: 100%;
    max-width: 430px;
    transform: translateX(-50%);
    height: 56px;
    padding: 0 16px;
    background: rgba(17, 17, 18, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 50;
  }

  .layout {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 72px 16px 92px;
    overflow: visible;
  }

  .main-header {
    gap: 12px;
  }

  .add-row {
    display: none;
  }

  .controls-row {
    align-items: flex-start;
  }

  .controls {
    display: none;
  }

  body.mobile-search-open .controls {
    display: flex;
    width: 100%;
    justify-content: flex-start;
  }

  body.mobile-search-open .search-expand {
    width: 100%;
    max-width: 360px;
  }

  body.mobile-search-open .type-toggle,
  body.mobile-search-open .sort-toggle {
    display: none;
  }

  body.mobile-add-open,
  body.mobile-tags-open,
  body.mobile-filter-open,
  body.mobile-link-sheet-open,
  body.note-open {
    overflow: hidden;
  }

  .section-heading {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
  }

  .feed {
    margin-top: 0;
    grid-template-columns: 1fr;
    gap: 12px;
    overflow: visible;
    padding-right: 0;
  }

  .card-aspect {
    aspect-ratio: auto;
  }

  .note-card {
    border-radius: 8px;
    border-color: rgba(255, 255, 255, 0.08);
    background: #1c1c1e;
    box-shadow: none;
  }

  .note-card:hover {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
  }

  .note-media {
    height: 180px;
    flex: none;
  }

  .note-media::after,
  .card-actions {
    display: none;
  }

  .note-meta-body {
    padding: 12px;
    background: #1c1c1e;
    gap: 8px;
  }

  .note-card .note-title {
    font-size: 17px;
    min-height: 46px;
    line-height: 1.25;
    font-weight: 700;
  }

  .note-meta-line {
    font-size: 12px;
    color: #94a3b8;
  }

  .tag-pill.image,
  .tag-pill.link {
    color: #258cf4;
  }

  .meta-dot {
    background: #475569;
  }

  .note-date-small {
    color: #94a3b8;
  }

  #note-modal.modal {
    z-index: 85;
    align-items: stretch;
    justify-content: center;
  }

  #note-modal .modal-backdrop {
    display: none;
  }

  #note-modal .note-modal {
    width: 100%;
    max-width: 430px;
    max-height: none;
    height: 100dvh;
    margin: 0 auto;
    border-radius: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 0;
    border-bottom: 0;
    background: #0a0b0f;
    box-shadow: none;
  }

  #note-modal .note-header {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 10px 14px;
    min-height: 54px;
    background: rgba(10, 11, 15, 0.82);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  #note-modal .note-close {
    order: 1;
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: #9aa4b2;
    padding: 0;
  }

  #note-modal .note-delete {
    order: 3;
    color: #ef4444;
    font-size: 14px;
    font-weight: 700;
    gap: 4px;
    padding: 0;
  }

  #note-modal .note-delete .material-symbols-outlined {
    font-size: 18px;
  }

  #note-modal .note-date-header {
    order: 2;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.56);
  }

  #note-modal .note-scroll {
    max-height: none;
    height: calc(100dvh - 54px);
    padding-bottom: 114px;
  }

  #note-modal .note-content {
    padding: 18px 16px 0;
    gap: 14px;
  }

  #note-modal .note-title-input {
    font-size: 41px;
    line-height: 1.08;
    min-height: 0;
    letter-spacing: -0.01em;
  }

  #note-modal .note-tags-wrap {
    gap: 8px;
  }

  #note-modal .note-kind {
    display: none;
  }

  #note-modal .note-tags .pill {
    padding: 6px 12px;
    font-size: 12px;
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.16);
    color: #60a5fa;
  }

  #note-modal .note-tag-add {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 999px;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.14);
    color: #94a3b8;
  }

  #note-modal .note-tag-add-label {
    display: none;
  }

  #note-modal .note-tag-add .material-symbols-outlined {
    margin: 0;
    font-size: 18px;
  }

  #note-modal .note-source-label {
    margin-top: 2px;
    font-size: 10px;
    letter-spacing: 0.12em;
    color: rgba(148, 163, 184, 0.72);
  }

  #note-modal .note-url-row {
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  #note-modal .note-url-row > .material-symbols-outlined {
    color: #3b82f6;
    font-size: 18px;
  }

  #note-modal .note-url {
    font-size: 12px;
    color: rgba(148, 163, 184, 0.96);
    font-weight: 600;
  }

  #note-modal .note-url-actions {
    gap: 4px;
  }

  #note-modal #note-open {
    display: none;
  }

  #note-modal .note-url-actions .ghost {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: #9ca3af;
  }

  #note-modal .note-summary-block {
    gap: 8px;
  }

  #note-modal .note-summary-head {
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    padding: 0 1px;
  }

  #note-modal .note-summary-label {
    font-size: 10px;
    letter-spacing: 0.12em;
    color: rgba(148, 163, 184, 0.8);
  }

  #note-modal .note-summary-label .material-symbols-outlined {
    color: #3b82f6;
    opacity: 1;
  }

  #note-modal .note-regenerate {
    height: 24px;
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    padding: 0 9px;
    font-size: 9px;
    letter-spacing: 0.09em;
  }

  #note-modal .note-regenerate .material-symbols-outlined {
    font-size: 12px;
  }

  #note-modal .note-edit-summary {
    display: inline-flex;
    color: #8fa0b8;
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  #note-modal .note-edit-summary .material-symbols-outlined {
    font-size: 13px;
  }

  #note-modal .note-summary-input {
    min-height: 150px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    color: rgba(226, 232, 240, 0.92);
    padding: 14px;
    font-size: 16px;
    line-height: 1.42;
  }

  #note-modal .note-preview {
    margin-top: 16px;
    border-top: 0;
    background: transparent;
    padding: 0 16px;
  }

  #note-modal .note-preview-img {
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 260px;
  }

  #note-modal .note-save-btn {
    display: inline-flex;
    position: absolute;
    right: 16px;
    bottom: calc(22px + env(safe-area-inset-bottom));
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: #3b82f6;
    color: #fff;
    padding: 0 28px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    box-shadow: 0 10px 22px rgba(59, 130, 246, 0.32);
    z-index: 6;
  }

  #note-modal .note-save-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
  }

  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 50%;
    right: auto;
    width: 100%;
    max-width: 430px;
    transform: translateX(-50%);
    bottom: 0;
    height: 72px;
    padding: 0 10px;
    align-items: center;
    justify-content: space-between;
    background: #1a1a1c;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 60;
  }

  .mobile-add-layer {
    position: fixed;
    inset: 0;
    z-index: 55;
  }

  body.mobile-add-open .mobile-add-layer {
    display: block;
  }

  .mobile-add-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .mobile-add-actions {
    position: absolute;
    left: 50%;
    bottom: 132px;
    transform: translateX(-50%);
    display: flex;
    gap: 48px;
    align-items: center;
  }

  .mobile-add-action {
    border: 0;
    width: 72px;
    min-width: 72px;
    height: 72px;
    border-radius: 999px;
    background: #c45c5c;
    color: #fff;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
    position: relative;
  }

  .mobile-add-action.link {
    background: #3b82f6;
  }

  .mobile-add-action .material-symbols-outlined {
    font-size: 34px;
  }

  .mobile-add-action-label {
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff;
  }

  .mobile-link-layer {
    position: fixed;
    inset: 0;
    z-index: 70;
  }

  body.mobile-link-sheet-open .mobile-link-layer {
    display: block;
  }

  .mobile-link-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.6);
  }

  .mobile-link-sheet {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 100%;
    max-width: 430px;
    transform: translateX(-50%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 0;
    border-radius: 40px 40px 0 0;
    background: rgba(26, 23, 23, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 14px 16px 22px;
    box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.55);
  }

  .mobile-link-handle {
    width: 42px;
    height: 6px;
    border-radius: 999px;
    margin: 0 auto 14px;
    background: rgba(255, 255, 255, 0.24);
  }

  .mobile-link-close {
    position: absolute;
    right: 16px;
    top: 16px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 0;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-link-close .material-symbols-outlined {
    font-size: 30px;
  }

  .mobile-link-head {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: rgba(255, 255, 255, 0.66);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 11px;
    font-weight: 700;
  }

  .mobile-link-head .material-symbols-outlined {
    font-size: 20px;
    color: #3b82f6;
  }

  .mobile-link-input {
    width: 100%;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(40, 30, 30, 0.9);
    color: #fff;
    font-size: 16px;
    padding: 14px 24px;
    margin-bottom: 18px;
  }

  .mobile-link-input::placeholder {
    color: rgba(255, 255, 255, 0.52);
  }

  .mobile-link-submit {
    width: 100%;
    border-radius: 999px;
    border: 0;
    height: 56px;
    background: #3b82f6;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 12px 22px rgba(59, 130, 246, 0.26);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  .mobile-link-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
  }

  .mobile-link-submit .material-symbols-outlined {
    font-size: 28px;
  }

  body.mobile-link-sheet-open .mobile-tabbar {
    display: none;
  }

  .mobile-filter-layer {
    position: fixed;
    inset: 0;
    z-index: 71;
  }

  body.mobile-filter-open .mobile-filter-layer {
    display: block;
  }

  .mobile-filter-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .mobile-filter-sheet {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: 0;
    width: 100%;
    max-width: 430px;
    transform: translateX(-50%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 1px solid rgba(255, 255, 255, 0.04);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 30px 30px 0 0;
    background: rgba(26, 26, 26, 0.98);
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -16px 38px rgba(0, 0, 0, 0.55);
  }

  .mobile-filter-handle {
    width: 40px;
    height: 4px;
    margin: 0 auto 20px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.26);
  }

  .mobile-filter-group {
    margin-bottom: 22px;
  }

  .mobile-filter-title {
    margin: 0 0 10px;
    padding: 0 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #94a3b8;
  }

  .mobile-filter-segment {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: #262626;
  }

  .mobile-filter-segment.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-filter-option {
    border: 0;
    min-height: 38px;
    border-radius: 12px;
    background: transparent;
    color: #94a3b8;
    font-size: 21px;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .mobile-filter-option .material-symbols-outlined {
    font-size: 16px;
  }

  .mobile-filter-option.is-active {
    background: #c45c5c;
    color: #fff;
    box-shadow: 0 6px 16px rgba(196, 92, 92, 0.28);
  }

  .mobile-filter-apply {
    width: 100%;
    min-height: 54px;
    border: 0;
    border-radius: 15px;
    background: #c45c5c;
    color: #fff;
    font-size: 17px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 12px 22px rgba(196, 92, 92, 0.32);
  }

  .mobile-filter-home-indicator {
    width: 124px;
    height: 5px;
    border-radius: 999px;
    margin: 18px auto 0;
    background: #1f3260;
  }

  .mobile-tags-layer {
    position: fixed;
    inset: 0;
    z-index: 72;
  }

  body.mobile-tags-open .mobile-tags-layer {
    display: block;
  }

  .mobile-tags-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .mobile-tags-drawer {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(285px, 88vw);
    display: flex;
    flex-direction: column;
    background: #0f1013;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 18px 0 44px rgba(0, 0, 0, 0.5);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }

  body.mobile-tags-open .mobile-tags-drawer {
    transform: translateX(0);
  }

  .mobile-tags-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 16px 10px;
  }

  .mobile-tags-title {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #6b7280;
    font-weight: 700;
  }

  .mobile-tags-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #9ca3af;
    padding: 0;
  }

  .mobile-tags-close .material-symbols-outlined {
    font-size: 24px;
  }

  .mobile-tags-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 16px;
  }

  .mobile-hashtags-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .mobile-hashtags-list .tag-item {
    border: 0;
    border-radius: 12px;
    min-height: 48px;
    color: #9ca3af;
    background: transparent;
    padding: 0 12px;
  }

  .mobile-hashtags-list .tag-item .tag-label {
    font-size: 30px;
    line-height: 1;
    transform-origin: left center;
    transform: scale(0.56);
    letter-spacing: 0.01em;
    font-weight: 600;
  }

  .mobile-hashtags-list .tag-item .tag-count {
    font-size: 15px;
    color: #6b7280;
    min-width: 20px;
    text-align: right;
  }

  .mobile-hashtags-list .tag-item.active {
    position: relative;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
  }

  .mobile-hashtags-list .tag-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: #ef4444;
  }

  .mobile-hashtags-list .tag-item.active .tag-count {
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    min-width: 26px;
    text-align: center;
    padding: 2px 6px;
    font-size: 13px;
    font-weight: 600;
  }

  .mobile-hashtags-more {
    width: 100%;
    border: 0;
    background: transparent;
    color: #ef4444;
    font-size: 15px;
    font-weight: 600;
    margin-top: 2px;
    min-height: 42px;
    justify-content: flex-start;
    padding: 0 12px;
  }

  .mobile-manage-tags {
    width: 100%;
    margin-top: 18px;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: #e5e7eb;
    font-size: 16px;
    font-weight: 600;
    gap: 8px;
  }

  .mobile-manage-tags .material-symbols-outlined {
    font-size: 18px;
  }

  .mobile-tags-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  }

  .mobile-tags-settings {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 12px;
    justify-content: flex-start;
    color: #c0c6d2;
    gap: 10px;
    padding: 0 12px;
    background: transparent;
  }

  .mobile-tags-settings .material-symbols-outlined {
    font-size: 20px;
  }

  body.mobile-tags-open .mobile-tabbar {
    display: none;
  }

  body.mobile-filter-open .mobile-tabbar {
    display: none;
  }

  body.note-open .mobile-tabbar {
    display: none;
  }

  .mobile-tab {
    border: none;
    background: transparent;
    color: #64748b;
    min-width: 56px;
    padding: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
  }

  .mobile-tab .material-symbols-outlined {
    font-size: 23px;
  }

  .mobile-tab.active .material-symbols-outlined,
  .mobile-tab.active span:last-child {
    color: #258cf4;
  }

  .mobile-tab-add {
    margin-top: -22px;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: #c45c5c;
    color: #fff;
    border: 2px solid #1a1a1c;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  }

  .mobile-tab-add.is-open {
    background: #d66666;
  }

  .mobile-tab-add .material-symbols-outlined {
    font-size: 30px;
  }
}
