﻿/* iOS Dark Theme */

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #000;
  color: #fff;
  height: 100vh;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.2) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(134, 205, 255, 0.16) 0 1.4px, transparent 1.8px),
    radial-gradient(circle, rgba(255, 255, 255, 0.11) 0 0.8px, transparent 1.2px),
    radial-gradient(circle, rgba(156, 230, 255, 0.1) 0 1px, transparent 1.5px);
  background-size: 6px 6px, 6px 6px, 6px 6px, 6px 6px;
  background-position: 50% 50%, 50% 50%, 50% 50%, 50% 50%;
  opacity: 0;
  mix-blend-mode: screen;
  animation:
    asciiParticleSpread 4.8s cubic-bezier(0.16, 1, 0.3, 1) forwards,
    asciiParticleFastDrift 16s linear 4.8s infinite;
}

body::after {
  content: ".  ·    .   .     ·   .    .  ·     .     .  ·";
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10000;
  width: 220vw;
  height: 220vh;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.075);
  font-family: "Cascadia Mono", "Fira Code", "Consolas", "Courier New", monospace;
  font-size: 11px;
  line-height: 34px;
  letter-spacing: 18px;
  white-space: pre-wrap;
  word-break: break-all;
  opacity: 0;
  transform: translate3d(44vw, 42vh, 0) scale(0.08) rotate(-6deg);
  animation:
    asciiParticleTextSpread 5.8s cubic-bezier(0.16, 1, 0.3, 1) forwards,
    asciiParticleTextDrift 34s linear 5.8s infinite;
}

@keyframes asciiParticleSpread {
  0% {
    opacity: 0;
    background-size: 6px 6px, 6px 6px, 6px 6px, 6px 6px;
    background-position: 50% 50%, 50% 50%, 50% 50%, 50% 50%;
  }
  45% { opacity: 0.28; }
  100% {
    opacity: 0.42;
    background-size: 43px 47px, 79px 83px, 31px 37px, 113px 107px;
    background-position: 0 0, 18px 24px, 11px 7px, 42px 16px;
  }
}

@keyframes asciiParticleFastDrift {
  from { background-position: 0 0, 18px 24px, 11px 7px, 42px 16px; }
  to { background-position: 86px 94px, 97px 107px, 135px 155px, 155px 123px; }
}

@keyframes asciiParticleTextSpread {
  0% {
    opacity: 0;
    transform: translate3d(44vw, 42vh, 0) scale(0.08) rotate(-6deg);
  }
  52% { opacity: 0.32; }
  100% {
    opacity: 0.58;
    transform: translate3d(-18px, -18px, 0) scale(1) rotate(-6deg);
  }
}

@keyframes asciiParticleTextDrift {
  from { transform: translate3d(-18px, -18px, 0) rotate(-6deg); }
  to { transform: translate3d(-86px, -62px, 0) rotate(-6deg); }
}

/* Screens */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
}

/* Login Screen */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 20px;
  background: #000;
}

.login-header {
  text-align: center;
  margin-bottom: 40px;
}

.login-header h1 {
  font-size: 32px;
  margin: 0;
  font-weight: 600;
}

.login-header p {
  font-size: 16px;
  color: #999;
  margin: 8px 0 0 0;
}

.login-form {
  width: 100%;
  max-width: 300px;
}

.login-form input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: none;
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  font-size: 16px;
}

.login-form input::placeholder {
  color: #666;
}

.error-message {
  color: #ff3b30;
  font-size: 13px;
  margin-top: 8px;
  text-align: center;
}

/* App Layout */
.app-container {
  --sidebar-width: 360px;
  display: grid;
  grid-template-columns: var(--sidebar-width) 8px 1fr;
  grid-template-rows: 1fr;
  height: 100vh;
  background: #000;
}

.top-right-controls {
  position: fixed;
  right: 12px;
  top: 10px;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sidebar-top-right-actions {
  display: flex;
  gap: 8px;
  padding: 0 12px 10px;
}

.sidebar-top-right-actions .server-status-music {
  flex: 0 0 40px;
}

.sidebar-top-right-actions .server-status-logout {
  flex: 1 1 auto;
}

.header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 16px;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
  height: 56px;
}

.header-title {
  min-width: 0;
}

.header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.header-title p {
  margin: 1px 0 0 0;
  color: #8f8f8f;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar */
.sidebar {
  grid-row: 1;
  grid-column: 1;
  position: relative;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border-right: 1px solid #333;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar-resize-handle {
  grid-row: 1;
  grid-column: 2;
  cursor: col-resize;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border-left: 1px solid #1e1e1e;
  border-right: 1px solid #1e1e1e;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
  background: linear-gradient(to right, rgba(10, 132, 255, 0.18), rgba(10, 132, 255, 0.35), rgba(10, 132, 255, 0.18));
}

.mobile-sidebar-toggle {
  display: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0;
}

.sidebar-header-actions {
  display: flex;
  width: 100%;
  gap: 8px;
}

.sidebar-header-actions > .btn {
  flex: 1 1 0;
}

.sidebar-title-row {
  position: relative;
  padding: 12px 12px 10px;
  border-bottom: 1px solid #333;
  overflow: hidden;
  background: transparent;
}

.sidebar-search {
  flex: 1;
  min-width: 0;
  border: 1px solid #2a2a2a;
  background: #111;
  color: #ddd;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  -webkit-user-select: text;
  user-select: text;
}

.sidebar-search-title {
  position: relative;
  z-index: 1;
  display: block;
  margin: 0;
  font-family: "Cascadia Mono", "Fira Code", "Consolas", "Courier New", monospace;
  font-weight: 700;
  font-size: 13.86px;
  line-height: 1.05;
  letter-spacing: 0;
  text-transform: none;
  white-space: pre;
  border: 0;
  background-color: transparent;
  color: #ffffff;
  padding: 0;
  height: auto;
  min-height: 0;
  box-shadow: none;
  text-shadow: none;
  filter: none;
  animation: none;
  transition: none;
}

.notes-logo-cell {
  display: inline-block;
  width: 1ch;
  color: #ffffff;
  text-shadow: none;
  animation: notesLogoBlockHighlight 4.4s ease-in-out infinite;
  animation-delay: var(--notes-logo-delay, 0ms);
  will-change: color, text-shadow, filter;
}

@media (max-width: 768px) {
  .sidebar-title-row {
    padding: 5px 8px 3px;
  }

  .sidebar-search.sidebar-search-title {
    padding: 1px 2px;
  }

  .sidebar-search-title {
    font-size: 4.2px;
    line-height: 1;
  }
}

#attachmentsOverviewBtn,
#newFolderBtn {
  border-radius: 10px;
  border-color: #37506f;
  background: linear-gradient(180deg, #17324c 0%, #12263a 100%);
  color: #e3f0ff;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 14px rgba(5, 13, 23, 0.28);
  transition: transform 0.14s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

#attachmentsOverviewBtn:hover,
#newFolderBtn:hover {
  border-color: #5b83b3;
  background: linear-gradient(180deg, #20456a 0%, #16304b 100%);
  box-shadow: 0 0 0 1px rgba(106, 171, 236, 0.24), 0 8px 16px rgba(7, 19, 33, 0.34);
}

#attachmentsOverviewBtn:active,
#newFolderBtn:active {
  transform: translateY(1px) scale(0.99);
}

@keyframes notesLogoBlockHighlight {
  0%, 18%, 100% {
    color: #ffffff;
    text-shadow: none;
    filter: none;
  }
  7% {
    color: #ffffff;
    text-shadow:
      0 0 5px rgba(255, 255, 255, 0.95),
      0 0 13px rgba(255, 255, 255, 0.72),
      0 0 24px rgba(255, 255, 255, 0.42);
    filter: brightness(1.42);
  }
}

.btn-square {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
}

.server-status-panel {
  position: relative;
  z-index: 2;
  width: calc(100% - 12px);
  margin: 8px 6px 10px;
  padding: 6px 8px 8px;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  background: rgba(16, 16, 16, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  color: #ddd;
  font-size: 11px;
  transition: width 0.18s ease, height 0.18s ease, padding 0.18s ease;
}

.server-status-panel.is-foreground {
  z-index: 200;
}

.server-status-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.server-status-collapse {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #b9d7f5;
  font-size: 14px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.server-status-toggle {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #d8e6f8;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.server-status-toggle:hover,
.server-status-collapse:hover,
.server-status-music:hover,
.server-status-logout:hover {
  background: #1a2633;
}

@media (hover: none) and (pointer: coarse) {
  .server-status-toggle:hover,
  .server-status-collapse:hover,
  .server-status-music:hover,
  .server-status-logout:hover {
    background: transparent;
  }

  .server-status-toggle:active,
  .server-status-collapse:active,
  .server-status-music:active,
  .server-status-logout:active {
    background: #1a2633;
  }
}

.server-status-logout {
  min-height: 40px;
  height: 40px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #111;
  color: #d8e6f8;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  cursor: pointer;
  white-space: nowrap;
}

.server-status-music {
  width: 40px;
  min-width: 40px;
  height: 40px;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  background: #111;
  color: #d8e6f8;
  font-size: 17px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.server-status-music:focus {
  outline: none;
}

#serverStatusPanel #musicPlayerBtn {
  position: static;
  display: inline-flex !important;
  margin: 0 !important;
  box-shadow: none;
}

.server-status-music-floating {
  position: static !important;
  display: inline-flex !important;
  margin: 0 !important;
  transform: none;
}

.server-status-panel.collapsed {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.server-status-panel.collapsed:not(.hover-locked):hover,
.server-status-panel:not(.collapsed) {
  width: calc(100% - 12px);
  height: auto;
  padding: 6px 8px 8px;
  display: block;
}

.server-status-panel.collapsed .server-status-title,
.server-status-panel.collapsed .status-row {
  display: none;
}

.server-status-panel.collapsed .server-status-toggle {
  display: inline-flex;
  transform: translateY(5px);
}

.server-status-panel.collapsed .server-status-collapse {
  display: none;
}

.server-status-panel.collapsed:not(.hover-locked):hover .server-status-toggle,
.server-status-panel:not(.collapsed) .server-status-toggle {
  display: none;
}

.server-status-panel.collapsed:not(.hover-locked):hover .server-status-collapse,
.server-status-panel:not(.collapsed) .server-status-collapse {
  display: inline-flex;
}

.server-status-panel.collapsed:not(.hover-locked):hover .server-status-controls,
.server-status-panel:not(.collapsed) .server-status-controls {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.server-status-panel.collapsed .server-status-logout {
  display: none;
}

.server-status-panel.collapsed .server-status-music {
  display: inline-flex;
}

.server-status-panel.collapsed:not(.hover-locked):hover .server-status-logout,
.server-status-panel.collapsed:not(.hover-locked):hover .server-status-music,
.server-status-panel:not(.collapsed) .server-status-music,
.server-status-panel:not(.collapsed) .server-status-logout {
  display: inline-flex;
  margin-top: 0;
}

.server-status-panel.collapsed:not(.hover-locked):hover .server-status-title,
.server-status-panel.collapsed:not(.hover-locked):hover .status-row {
  display: grid;
}

.server-status-panel.collapsed:not(.hover-locked):hover .server-status-title {
  display: block;
}

.server-status-title {
  margin-bottom: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.status-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 78px;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.status-row span {
  color: #9a9a9a;
}

.status-row strong {
  text-align: right;
  color: #dfefff;
  font-weight: 700;
}

.status-row-meta strong {
  font-size: 10px;
  color: #c7d9ef;
}

.status-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #252525;
}

.status-bar div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a84ff, #3b9cff);
  transition: width 0.45s ease;
}

.sidebar-search::placeholder {
  color: #7a7a7a;
}

.btn-ghost {
  background: #111;
  color: #b9c6d9;
  border: 1px solid #273445;
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
}

#attachmentsOverviewBtn,
#newFolderBtn {
  padding: 12px 14px;
  font-size: 15px;
}

.file-tree {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}

.sidebar-footer-actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid #333;
}

.sidebar-footer-actions > .btn {
  flex: 1 1 0;
}

.tree-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 220px;
  padding: 5px 14px;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  border-left: 3px solid transparent;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.tree-item.active {
  border-left-color: #49b0ff;
  background: linear-gradient(90deg, #0d1f31 0%, #101b27 64%, #12171d 100%);
  color: #d8eeff;
  box-shadow: inset 0 0 0 1px rgba(73, 176, 255, 0.34);
}

.tree-item.active .tree-item-name {
  font-weight: 600;
  letter-spacing: 0.01em;
  text-shadow: 0 0 10px rgba(73, 176, 255, 0.32);
}

.tree-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.tree-item.folder:hover {
  background: rgba(255, 255, 255, 0.12);
}

.tree-item.active:hover {
  background: linear-gradient(90deg, #0b1b2b 0%, #0e1823 64%, #10151b 100%);
}

.tree-item.folder {
  font-weight: 500;
  cursor: grab;
  padding-left: 10px;
}

.tree-item.folder.dragging {
  opacity: 0.45;
}

.tree-item.file.dragging {
  opacity: 0.45;
}

.tree-item.folder.drop-before {
  box-shadow: inset 0 2px 0 #0a84ff;
}

.tree-item.file.drop-before {
  box-shadow: inset 0 2px 0 #0a84ff;
}

.tree-item.folder.drop-after {
  box-shadow: inset 0 -2px 0 #0a84ff;
}

.tree-item.file.drop-after {
  box-shadow: inset 0 -2px 0 #0a84ff;
}

.tree-item-icon {
  width: 20px;
  text-align: center;
}

.folder-icon {
  position: relative;
  overflow: visible;
}

.folder-icon-emoji {
  display: inline-block;
}

.folder-share-badge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  font-size: 11px;
  line-height: 1;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.9));
  pointer-events: none;
}

.folder-share-badge.is-hidden {
  display: none;
}

.tree-item-toggle {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  color: #a8b8cc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease;
  transform-origin: center center;
  flex-shrink: 0;
}

.tree-item-toggle::before {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 0 4px 7px;
  border-color: transparent transparent transparent #a8b8cc;
  transform-origin: center center;
}

.tree-item.folder:not(.collapsed) .tree-item-toggle {
  transform: rotate(90deg);
}

.tree-item-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-open-count {
  flex: 0 0 auto;
  min-width: 38px;
  text-align: right;
  font-size: 11px;
  line-height: 1;
  color: #8ea2ba;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.14s ease;
}

.tree-item.folder:hover .folder-open-count,
.tree-item.folder.active .folder-open-count {
  opacity: 0.9;
  visibility: visible;
}

.tree-item-spacer {
  flex: 1 1 auto;
}

.tree-item-menu {
  opacity: 0;
  font-size: 16px;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 6px;
}

.tree-item-action {
  opacity: 0;
  font-size: 16px;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 6px;
}

.tree-item-action:hover,
.tree-item-menu:hover {
  background: rgba(255, 255, 255, 0.1);
}

.search-meta {
  padding: 8px 16px;
  font-size: 12px;
  color: #88a0b8;
}

.search-result {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.search-result-compact {
  min-height: 28px;
  padding-top: 4px;
  padding-bottom: 4px;
  gap: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.tree-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 170px;
  padding: 6px;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  background: #151515;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

.tree-context-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.25em;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #f2f2f2;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.tree-context-menu button:hover {
  background: rgba(10, 132, 255, 0.18);
}

.tree-context-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  min-width: 1.25em;
  line-height: 1;
  font-size: 15px;
}

.tree-context-menu-separator {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin: 4px 4px;
}

.sidebar-tree-search-input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(73, 176, 255, 0.35);
  background: linear-gradient(180deg, #12263d 0%, #0f1e30 100%);
  color: #d8eeff;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
}

.sidebar-tree-search-input::placeholder {
  color: #90a8c4;
}

.sidebar-tree-search-input:focus {
  border-color: rgba(73, 176, 255, 0.8);
  box-shadow: 0 0 0 2px rgba(73, 176, 255, 0.25);
}

.editor-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}

.editor-header-top h2 {
  flex: 1;
  margin: 0;
  font-size: 18px;
}

#publicLinkBtn {
  background: transparent;
  border: none;
  color: #f2f2f2;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 150ms ease;
  opacity: 0.9;
  filter: brightness(1.15);
  pointer-events: auto;
}

.editor-header:hover #publicLinkBtn {
  opacity: 1;
}

#publicLinkBtn:hover {
  background: rgba(10, 132, 255, 0.2);
  transform: scale(1.1);
}

.search-result .tree-item-name {
  width: 100%;
}

.search-path {
  font-size: 11px;
  color: #7294b8;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-snippet {
  font-size: 11px;
  color: #969696;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-item:hover .tree-item-menu {
  opacity: 1;
}

.tree-item:hover .tree-item-action {
  opacity: 1;
}

.tree-children {
  padding-left: 0;
  margin-left: 20px;
  border-left: 1.5px solid rgba(168, 184, 204, 0.12);
  overflow: hidden;
}

.tree-children .tree-item.file {
  font-size: 12.5px;
  padding: 3px 10px 3px 12px;
  color: #b0bec8;
}

.tree-children .tree-item.file.active {
  color: #0a84ff;
}

/* Editor Container */
.editor-container {
  grid-row: 1;
  grid-column: 3;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
}

.editor-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #333;
  background: #1a1a1a;
}

.editor-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 700;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-header-top h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-file-meta {
  margin: 4px 0 0;
  color: #9aa4b2;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-line;
  overflow: visible;
  text-overflow: clip;
}

.editor-header-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.note-token-copy-trigger {
  appearance: none;
  border: 0;
  background: transparent;
  color: #cfe6ff;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.12s ease, transform 0.12s ease, filter 0.12s ease, text-shadow 0.12s ease;
}

.note-token-copy-trigger:hover {
  color: #ffffff;
  background: transparent;
  box-shadow: none;
}

.note-token-copy-trigger:active {
  transform: scale(0.92);
  filter: brightness(0.78);
}

.note-token-copy-trigger.is-emoji-glow {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.85), 0 0 16px rgba(10, 132, 255, 0.55);
  background: transparent;
  box-shadow: none;
}

.editor-controls {
  display: flex;
  gap: 8px;
}

.editor-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.format-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #333;
  background: #111;
  overflow-x: auto;
}

.format-toolbar .btn {
  min-width: 48px;
  padding: 6px 10px;
}

.attachment-chip {
  display: inline-flex;
  position: relative;
  top: 2px;
  align-items: center;
  min-height: 17px;
  gap: 3px;
  max-width: min(100%, 520px);
  padding: 1px 9px 3px 6px;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid rgba(91, 147, 207, 0.38);
  background: linear-gradient(180deg, rgba(27, 43, 62, 0.96), rgba(14, 24, 37, 0.96));
  color: #d7eaff;
  cursor: pointer;
  text-decoration: none;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  user-select: text;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.attachment-chip:hover {
  background: linear-gradient(180deg, rgba(33, 58, 84, 0.98), rgba(17, 34, 54, 0.98));
  border-color: rgba(123, 187, 247, 0.55);
}

.internal-ref-chip {
  border-color: rgba(109, 173, 117, 0.38);
  background: linear-gradient(180deg, rgba(29, 54, 33, 0.96), rgba(15, 31, 19, 0.96));
  color: #dff3d8;
}

.internal-ref-chip:hover {
  background: linear-gradient(180deg, rgba(36, 72, 42, 0.98), rgba(19, 43, 25, 0.98));
  border-color: rgba(142, 212, 151, 0.58);
}

.attachment-chip-emoji {
  font-size: 11px;
  line-height: 1;
}

.markdown-preview {
  flex: 1;
  overflow: auto;
  padding: 16px 22px 32px;
  line-height: 1.55;
  color: #f2f2f2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.github-editor {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: #0a0a0a;
  overflow: hidden;
}

.rich-main-editor {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)),
    #050505;
}

.markdown-state {
  display: none !important;
}

#currentFileName.is-focus-flash {
  color: #9ecbff;
  text-shadow: 0 0 12px rgba(10, 132, 255, 0.6);
}

.github-editor-tabs {
  min-height: 48px;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid #2a2a2a;
  background: #111;
}

.github-editor-toolbar {
  display: none;
}

.github-floating-toolbar {
  position: absolute;
  bottom: 18px;
  left: 50%;
  top: auto;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 28px);
  padding: 7px 10px;
  background: rgba(12, 14, 17, 0.92);
  border: 1px solid rgba(134, 163, 194, 0.22);
  border-radius: 8px;
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  z-index: 100;
  cursor: grab;
  user-select: none;
  pointer-events: auto;
  white-space: nowrap;
}

.github-floating-toolbar:active {
  cursor: grabbing;
}

.github-toolbar-drag-handle {
  padding: 4px 8px;
  cursor: grab;
  color: #7f8a96;
  font-size: 16px;
  line-height: 1;
}

.github-floating-toolbar:active .github-toolbar-drag-handle {
  cursor: grabbing;
}

.github-tab {
  min-width: 66px;
  padding: 0 16px;
  border: 0;
  border-right: 1px solid transparent;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: #9a9a9a;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.github-tab:focus-visible,
.github-tool:focus-visible,
.github-file-trigger:focus-visible {
  outline: 2px solid #0a84ff;
  outline-offset: -2px;
}

.github-tab.is-active {
  margin-bottom: -1px;
  background: #000;
  color: #f0f6fc;
  border-right-color: #2a2a2a;
  border-bottom-color: #000;
}

.github-toolbar {
  min-width: 0;
  flex: 1;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 3px;
  padding: 0;
  overflow-x: auto;
}

.github-tool {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #c3cfdd;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.github-tool.github-tool-text {
  width: auto;
  min-width: unset;
  padding: 0 10px;
  justify-content: flex-start;
}

.github-tool:hover,
.github-file-trigger:hover {
  color: #ffffff;
  background: rgba(87, 152, 216, 0.14);
  border-color: rgba(119, 180, 237, 0.28);
}

.github-tool-divider {
  width: 1px;
  height: 20px;
  background: #2a2a2a;
  margin: 0 6px;
  flex: 0 0 auto;
}

.github-editor-body {
  --preview-width: 65%;
  position: relative;
  flex: 1;
  min-height: 160px;
  display: flex;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.github-preview-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  border-right: 0;
  overflow: auto;
}

.github-preview {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  padding: clamp(28px, 5vw, 68px) clamp(18px, 7vw, 92px) 96px;
  background: transparent;
  color: #eef3f8;
  font-size: 16px;
  line-height: 1.64;
  -webkit-user-select: text;
  user-select: text;
}

.markdown-preview[contenteditable="true"] {
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

.github-preview:empty::before {
  content: attr(data-placeholder);
  color: #8b949e;
}

.plain-note-editor-shell {
  background: #050505;
}

.plain-note-editor-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.note-plain-editor {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  display: block;
  resize: none;
  border: 0;
  outline: 0;
  padding: clamp(28px, 5vw, 68px) clamp(12px, 2.2vw, 24px) 24px;
  background: transparent;
  color: #eef3f8;
  caret-color: #eef3f8;
  font: 16px/1.26 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre;
  overflow-wrap: normal !important;
  word-break: keep-all !important;
  tab-size: 2;
  -webkit-user-select: text;
  user-select: text;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.note-plain-editor::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.note-plain-editor::placeholder {
  color: #8b949e;
}

.note-plain-editor::selection {
  background: rgba(56, 139, 253, 0.38);
  color: #eef3f8;
}

.plain-token-links {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

.plain-token-link-button {
  position: absolute;
  transform: translateX(1px);
  pointer-events: auto;
  touch-action: none;
  min-height: 17px;
  border: 1px solid rgba(120, 164, 214, 0.45);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  max-width: none;
  min-width: 0;
  font-size: 12px;
  gap: 6px;
  padding: 0 1px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 0;
  isolation: isolate;
}

.plain-token-link-button .plain-token-label {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.plain-token-insert-handle {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 1px solid rgba(130, 182, 240, 0.6);
  border-radius: 4px;
  background: rgba(14, 32, 52, 0.95);
  color: #d7ebff;
  font-size: 10px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  padding: 0;
}

.plain-token-insert-handle-after {
  left: auto;
  right: 2px;
}

.plain-token-link-button.show-insert-handle .plain-token-insert-handle:not(.plain-token-insert-handle-after),
.plain-token-link-button.show-insert-handle-after .plain-token-insert-handle-after,
.plain-token-link-button.show-insert-handle-after .plain-token-insert-handle-after {
  opacity: 1;
  pointer-events: auto;
}

.plain-token-link-button:hover {
  filter: brightness(1.12);
  box-shadow:
    0 0 0 1px rgba(153, 205, 255, 0.28),
    0 0 12px rgba(108, 174, 246, 0.22);
}

.plain-token-link-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(42px 28px at var(--token-hover-x, 22%) var(--token-hover-y, 35%), rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.06) 52%, transparent 76%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.02) 46%, rgba(0, 0, 0, 0.05));
  mix-blend-mode: screen;
  transition: opacity 120ms ease;
}

.plain-token-link-button:hover::after {
  opacity: 1;
}

.plain-token-link-button.plain-token-kind-note {
  border-color: rgba(123, 187, 247, 0.55);
  background: linear-gradient(180deg, rgba(33, 58, 84, 0.98), rgba(17, 34, 54, 0.98));
  color: #d7eaff;
}

.plain-token-link-button.plain-token-kind-folder {
  border-color: rgba(109, 173, 117, 0.38);
  background: linear-gradient(180deg, rgba(29, 54, 33, 0.96), rgba(15, 31, 19, 0.96));
  color: #dff3d8;
}

.plain-note-editor-body .plain-token-link-button .attachment-chip-emoji {
  font-size: 14px;
}

.plain-token-link-button.plain-file-kind-audio {
  border-color: rgba(141, 160, 255, 0.52);
  background: linear-gradient(180deg, rgba(40, 53, 102, 0.96), rgba(20, 30, 68, 0.96));
  color: #dfe5ff;
}

.plain-token-link-button.plain-file-kind-image {
  border-color: rgba(120, 199, 187, 0.55);
  background: linear-gradient(180deg, rgba(28, 78, 72, 0.96), rgba(15, 46, 43, 0.96));
  color: #dbf7f2;
}

.plain-token-link-button.plain-file-kind-video {
  border-color: rgba(235, 158, 98, 0.54);
  background: linear-gradient(180deg, rgba(102, 61, 36, 0.96), rgba(64, 36, 18, 0.96));
  color: #ffe9d8;
}

.plain-token-link-button.plain-file-kind-pdf {
  border-color: rgba(225, 111, 111, 0.6);
  background: linear-gradient(180deg, rgba(98, 37, 37, 0.96), rgba(60, 21, 21, 0.96));
  color: #ffe2e2;
}

.plain-token-link-button.plain-file-kind-archive {
  border-color: rgba(186, 151, 255, 0.58);
  background: linear-gradient(180deg, rgba(63, 45, 102, 0.96), rgba(36, 24, 66, 0.96));
  color: #efe6ff;
}

.plain-token-link-button.plain-file-kind-code {
  border-color: rgba(113, 191, 255, 0.56);
  background: linear-gradient(180deg, rgba(31, 68, 98, 0.96), rgba(18, 41, 62, 0.96));
  color: #dff2ff;
}

.plain-token-link-button.plain-file-kind-text {
  border-color: rgba(145, 186, 133, 0.52);
  background: linear-gradient(180deg, rgba(48, 74, 40, 0.96), rgba(28, 45, 23, 0.96));
  color: #e7f4e2;
}

.plain-token-link-button.plain-file-kind-sheet {
  border-color: rgba(102, 202, 130, 0.58);
  background: linear-gradient(180deg, rgba(30, 87, 44, 0.96), rgba(17, 52, 25, 0.96));
  color: #dcffe6;
}

.plain-token-link-button.plain-file-kind-slides {
  border-color: rgba(255, 176, 95, 0.6);
  background: linear-gradient(180deg, rgba(96, 62, 30, 0.96), rgba(58, 36, 15, 0.96));
  color: #fff0de;
}

.plain-token-link-button.plain-file-kind-other {
  border-color: rgba(143, 167, 194, 0.5);
  background: linear-gradient(180deg, rgba(39, 52, 68, 0.96), rgba(23, 31, 43, 0.96));
  color: #e4edf7;
}

.plain-note-toolbar {
  z-index: 4;
  bottom: 18px;
}

.plain-token-link-button.is-token-flash {
  filter: brightness(1.32) saturate(1.22);
  box-shadow: none;
}

.plain-token-link-button.is-selected {
  border-color: rgba(152, 201, 255, 0.9);
  box-shadow:
    0 0 0 1px rgba(126, 181, 242, 0.38),
    0 0 16px rgba(102, 163, 230, 0.26);
  filter: brightness(1.18) saturate(1.1);
  color: #ffffff;
}

.plain-token-link-button.internal-ref-chip.is-selected {
  border-color: rgba(170, 224, 176, 0.92);
  box-shadow:
    0 0 0 1px rgba(142, 212, 151, 0.34),
    0 0 16px rgba(110, 192, 124, 0.24);
}

.plain-token-link-button.plain-token-kind-note.is-selected {
  border-color: rgba(120, 188, 255, 0.92);
  box-shadow:
    0 0 0 1px rgba(122, 185, 255, 0.4),
    0 0 16px rgba(90, 160, 235, 0.28);
}

.plain-token-link-button.plain-token-kind-folder.is-selected {
  border-color: rgba(150, 225, 162, 0.92);
  box-shadow:
    0 0 0 1px rgba(132, 212, 145, 0.38),
    0 0 16px rgba(104, 188, 118, 0.26);
}

.plain-token-link-button.is-token-missing {
  border-color: rgba(231, 96, 96, 0.9) !important;
  background: linear-gradient(180deg, rgba(78, 28, 28, 0.96), rgba(50, 18, 18, 0.96)) !important;
  color: #ffdede !important;
  box-shadow: none !important;
}

.token-hover-preview {
  position: fixed;
  z-index: 2500;
  max-width: 208px;
  max-height: 172px;
  padding: 5px;
  border: 1px solid rgba(86, 121, 157, 0.65);
  border-radius: 10px;
  background: rgba(10, 18, 28, 0.94);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.token-hover-preview.token-hover-preview-audio {
  max-height: none;
}

.token-hover-loader {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(255, 255, 255, 0.9);
  animation: token-hover-spin 0.8s linear infinite;
  margin: 10px auto;
}

.token-hover-missing {
  min-width: 160px;
  max-width: 196px;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid rgba(170, 80, 80, 0.55);
  background: rgba(58, 18, 18, 0.78);
  color: #ffd6d6;
  font-size: 12px;
  line-height: 1.3;
}

.token-hover-info {
  min-width: 180px;
  max-width: 220px;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid rgba(120, 188, 255, 0.45);
  background: rgba(20, 44, 69, 0.82);
  color: #d9ecff;
  font-size: 12px;
  line-height: 1.3;
}

.token-hover-preview.token-hover-info-note .token-hover-info {
  border-color: rgba(120, 188, 255, 0.45);
  background: rgba(20, 44, 69, 0.82);
  color: #d9ecff;
}

.token-hover-preview.token-hover-info-folder .token-hover-info {
  border-color: rgba(132, 212, 145, 0.5);
  background: rgba(24, 52, 31, 0.84);
  color: #ddf5e1;
}

@keyframes token-hover-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.token-hover-preview img,
.token-hover-preview video {
  display: block;
  max-width: 196px;
  max-height: 148px;
  border-radius: 6px;
  object-fit: cover;
}

.token-hover-pdf-frame {
  display: block;
  width: 196px;
  height: 148px;
  border: 0;
  border-radius: 6px;
  background: #0d1622;
}

.token-hover-audio-details {
  min-width: 180px;
  max-width: 240px;
}

.token-hover-audio-cover {
  display: block;
  max-width: 196px;
  max-height: 148px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(86, 121, 157, 0.55);
}

.token-hover-audio-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: fit-content;
  max-width: 196px;
}

.token-hover-audio-inline {
  color: #e6f0fb;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  width: 100%;
  max-width: 196px;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.token-hover-audio-title {
  color: #e6f0fb;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.token-hover-audio-meta {
  margin-top: 4px;
  color: #9eb4ca;
  font-size: 11px;
  line-height: 1.25;
  word-break: break-word;
}

.tree-item.folder.is-token-target-flash {
  background: linear-gradient(90deg, rgba(138, 221, 153, 0.22), rgba(138, 221, 153, 0.06));
  box-shadow: inset 2px 0 0 rgba(155, 236, 170, 0.9);
}

.tree-item.file.is-token-target-flash {
  background: linear-gradient(90deg, rgba(143, 196, 255, 0.22), rgba(143, 196, 255, 0.06));
  box-shadow: inset 2px 0 0 rgba(164, 210, 255, 0.95);
}

.tree-item.is-token-hover-highlight {
  background: linear-gradient(90deg, rgba(122, 185, 255, 0.26), rgba(122, 185, 255, 0.08));
  box-shadow: inset 2px 0 0 rgba(160, 210, 255, 0.9);
}

.tree-item.is-token-hover-highlight-note {
  background: linear-gradient(90deg, rgba(122, 185, 255, 0.38), rgba(122, 185, 255, 0.14)) !important;
  box-shadow: inset 3px 0 0 rgba(160, 210, 255, 0.98) !important;
}

.tree-item.is-token-hover-highlight-folder {
  background: linear-gradient(90deg, rgba(132, 212, 145, 0.38), rgba(132, 212, 145, 0.14)) !important;
  box-shadow: inset 3px 0 0 rgba(145, 228, 160, 0.98) !important;
}

.tree-item.folder.active {
  background: linear-gradient(90deg, rgba(122, 185, 255, 0.26), rgba(122, 185, 255, 0.08));
  box-shadow: inset 2px 0 0 rgba(160, 210, 255, 0.92);
}

.tree-item.folder.active.is-token-hover-highlight-folder {
  background: linear-gradient(90deg, rgba(132, 212, 145, 0.26), rgba(132, 212, 145, 0.1));
  box-shadow: inset 2px 0 0 rgba(145, 228, 160, 0.95);
}

.github-editor-footer {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 16px;
  border-top: 1px solid #2a2a2a;
  color: #d6d6d6;
  font-size: 13px;
  font-weight: 600;
}

.github-footer-item {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
}

.github-markdown-hint {
  padding-right: 14px;
  color: #f0f6fc;
}

.github-file-trigger {
  padding: 0 0 0 14px;
  border: 0;
  border-left: 1px solid #2a2a2a;
  background: transparent;
  color: #f0f6fc;
  cursor: pointer;
  font: inherit;
}

.github-folder-trigger {
  margin-left: 12px;
  padding: 0 0 0 12px;
  border: 0;
  border-left: 1px solid #2a2a2a;
  background: transparent;
  color: #f0f6fc;
  cursor: pointer;
  font: inherit;
}

.github-folder-trigger:hover {
  color: #f0f6fc;
  background: #1f1f1f;
}

.github-folder-trigger:focus-visible {
  outline: 2px solid #0a84ff;
  outline-offset: -2px;
}

.text-file-preview {
  margin: 0;
  width: 100%;
  min-width: 0;
  max-height: calc(1.45em * 10 + 20px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  color: #d6deea;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

.zip-preview {
  margin: 0;
  max-height: 380px;
  overflow: auto;
  white-space: pre;
  color: #d6deea;
  background: #0a0a0a;
  border: 1px solid #242424;
  border-radius: 8px;
  padding: 10px;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

.folder-tree-preview {
  margin: 0;
  max-height: 380px;
  overflow: auto;
  white-space: pre;
  color: #d6deea;
  background: #0a0a0a;
  border: 1px solid #242424;
  border-radius: 8px;
  padding: 10px;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

.markdown-preview[contenteditable="true"] {
  outline: none;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

.markdown-preview[contenteditable="true"] p {
  margin: 0.45em 0;
  line-height: inherit;
}

.markdown-preview[contenteditable="true"] p:last-child {
  margin-bottom: 0;
}

.markdown-preview[contenteditable="true"] p:empty {
  min-height: 1.35em;
}

.markdown-preview[contenteditable="true"]:focus {
  box-shadow: none;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
  color: #ffffff;
  margin: 1.25em 0 0.45em;
  line-height: 1.12;
  letter-spacing: 0;
}

.markdown-preview h1 {
  font-size: 2rem;
}

.markdown-preview h2 {
  font-size: 1.45rem;
}

.markdown-preview blockquote {
  margin: 1em 0;
  padding: 0.05em 0 0.05em 1em;
  border-left: 3px solid rgba(125, 178, 228, 0.56);
  color: #cbd8e7;
}

.markdown-preview ul,
.markdown-preview ol {
  padding-left: 1.45em;
  margin: 0.65em 0;
}

.markdown-preview li {
  margin: 0.22em 0;
}

.markdown-preview a,
.markdown-preview a:visited {
  color: #0a84ff;
  cursor: pointer;
}

.markdown-preview code {
  background: #111820;
  border: 1px solid #273543;
  border-radius: 6px;
  padding: 1px 6px;
  color: #d9e8f7;
  font-size: 0.93em;
}

.markdown-preview pre {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
}

.code-block-shell {
  margin: 18px 0;
  position: relative;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(19, 19, 19, 0.98), rgba(10, 10, 10, 0.98));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.code-block-shell__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  color: #8e98a7;
  user-select: none;
}

.code-block-shell__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.code-block-copy {
  border: 1px solid #2f3742;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  color: #dce6f2;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.code-block-copy:hover {
  background: rgba(10, 132, 255, 0.12);
  border-color: rgba(10, 132, 255, 0.45);
  color: #ffffff;
}

.code-block-copy:active {
  transform: translateY(1px);
}

.code-block-copy.is-copied {
  background: rgba(10, 132, 255, 0.18);
  border-color: rgba(10, 132, 255, 0.65);
  color: #d8ebff;
}

.code-block-shell pre {
  position: relative;
  margin: 0;
  padding: 16px 16px 18px 22px;
  background: #0d0d0d;
  border-radius: 0 0 14px 14px;
  border: 0;
  overflow-x: auto;
  scrollbar-gutter: stable both-edges;
  color: #d5deeb;
  line-height: 1.6;
  font-size: 13px;
}

.code-block-shell pre code {
  display: block;
  background: transparent;
  border: 0;
  padding: 0 34px 0 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  width: max-content;
  min-width: 100%;
  box-sizing: border-box;
  -webkit-user-select: text;
  user-select: text;
}

.code-block-shell pre {
  -webkit-user-select: text;
  user-select: text;
}

.code-block-scroll-fade {
  position: absolute;
  top: 0;
  right: -18px;
  bottom: 0;
  width: 72px;
  pointer-events: none;
  background: linear-gradient(to left, rgba(13, 13, 13, 1) 58%, rgba(13, 13, 13, 0));
}

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  text-align: center;
  padding: 20px;
}

.ace_gutter {
  background: #0a0a0a !important;
  color: #666 !important;
}

.ace_cursor {
  color: #0a84ff !important;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1400;
}

.modal-content {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 20px;
  width: min(360px, calc(100% - 32px));
  border: 1px solid #2a2a2a;
}

.modal-content h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-content input {
  width: 100%;
  padding: 12px;
  margin-bottom: 16px;
  border: none;
  border-radius: 8px;
  background: #0a0a0a;
  color: #fff;
  font-size: 16px;
  -webkit-user-select: text;
  user-select: text;
}

.modal-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-buttons.single-close {
  display: flex;
  justify-content: center;
}

.modal-buttons.single-close .btn {
  min-width: 180px;
}

.modal-buttons-triple {
  grid-template-columns: 1fr 1fr 1fr;
}

.upload-modal-content {
  max-width: min(560px, calc(100% - 32px));
}

#uploadModal .upload-modal-content {
  width: min(560px, calc(100% - 32px));
}

.ascii-modal-content {
  width: min(920px, calc(100% - 24px));
  position: relative;
}

.ascii-modal-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 1px solid #2f4661;
  border-radius: 7px;
  background: #111b28;
  color: #d8e9fb;
  font-size: 17px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ascii-modal-close-btn:hover {
  background: #1a2a3f;
}

.ascii-preview-list {
  margin-top: 10px;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #2d3440;
  border-radius: 8px;
  background: #0e131a;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.ascii-preview-item {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-align: left;
  border: 1px solid #2a3647;
  border-radius: 8px;
  background: #101a25;
  color: #dceaff;
  cursor: pointer;
  padding: 8px;
  overflow-x: auto;
  overflow-y: hidden;
}

.ascii-preview-item:hover {
  background: #152538;
  box-shadow: 0 0 0 1px rgba(109, 173, 255, 0.35);
}

.ascii-preview-item-title {
  display: block;
  font-size: 12px;
  color: #9ec8ff;
  margin-bottom: 6px;
}

.ascii-preview-item pre {
  margin: 0;
  display: inline-block;
  width: max-content;
  min-width: 100%;
  max-width: none;
  white-space: pre;
  overflow: visible;
  word-break: normal;
  padding-right: 18px;
  font: 14px/1.0 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.ascii-preview-item pre::-webkit-scrollbar {
  height: 10px;
}

.ascii-preview-item pre::-webkit-scrollbar-thumb {
  background: #3a4e66;
  border-radius: 6px;
}

.ascii-preview-item pre::-webkit-scrollbar-track {
  background: #131d29;
}

.ascii-modal-content .modal-buttons {
  margin-top: 16px;
}

.folder-share-panel {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  background: #121212;
}

.folder-share-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d7e7fb;
  font-size: 13px;
  line-height: 1.2;
}

.folder-share-toggle-label input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: #0a84ff;
  margin: 0;
  flex: 0 0 auto;
  transform: translateY(1px);
}

.folder-share-link-wrap {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.folder-share-link-wrap input {
  margin: 0;
  height: 36px;
  font-size: 13px;
  padding: 8px 10px;
}

#folderShareDisableText {
  margin-bottom: 16px;
}

.upload-progress-modal-content {
  max-width: min(440px, calc(100% - 32px));
}

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

.upload-progress-header h3 {
  margin: 0;
}

.upload-progress-close {
  width: 30px;
  height: 30px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #111;
  color: #d8e6f8;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.upload-progress-close:hover {
  background: #1a2633;
}

.upload-progress-track {
  width: 100%;
  height: 12px;
  border: 1px solid #2a2a2a;
  border-radius: 999px;
  background: #0f0f0f;
  overflow: hidden;
}

.upload-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a84ff, #3b9cff);
  transition: width 0.14s ease;
}

.upload-progress-meta {
  margin: 10px 0 0 0;
  text-align: right;
  color: #c8d9ee;
  font-size: 12px;
  font-weight: 600;
}

.upload-info-text {
  margin: 0 0 12px 0;
  color: #a9b8c8;
  font-size: 13px;
  line-height: 1.4;
}

.upload-preview-area {
  min-height: 100px;
  max-height: 48vh;
  overflow: auto;
  border: 1px solid #2a2a2a;
  background: #0f0f0f;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 14px;
}

.upload-confirm-all-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 12px;
  color: #cfe4ff;
  font-size: 13px;
  line-height: 1.2;
  user-select: none;
}

.upload-confirm-all-wrap input[type='checkbox'] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #0a84ff;
}

.upload-preview-area img,
.upload-preview-area video {
  max-width: 100%;
  max-height: 42vh;
  border-radius: 8px;
}

.upload-preview-area > img {
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.upload-preview-area audio {
  width: 100%;
}

.upload-preview-area audio + .upload-music-panel {
  margin-top: 16px;
}

.upload-preview-area .upload-music-toggle {
  margin-top: 8px;
}

.upload-music-panel {
  border: 1px solid #232323;
  border-radius: 10px;
  background: #0f1115;
  padding: 8px;
  margin-top: 10px;
  margin-bottom: 12px;
  display: grid;
  gap: 8px;
}

.upload-music-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #11161e;
  padding: 8px 10px;
  color: #dce9f8;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.upload-music-toggle input {
  width: 16px;
  height: 16px;
  accent-color: #0a84ff;
  margin: 0;
  flex: 0 0 auto;
  align-self: center;
}

.upload-music-question {
  display: inline-block;
  transform: none;
}

.upload-music-fields {
  display: grid;
  gap: 8px;
}

.upload-music-top-row {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 8px;
  align-items: center;
}

#uploadPreviewArea .upload-music-top-row {
  margin-top: 3px;
}

.upload-music-cover-preview {
  width: 36px;
  height: 36px;
  min-width: 36px;
  max-width: 36px;
  min-height: 36px;
  max-height: 36px;
  aspect-ratio: 1 / 1;
  flex: 0 0 36px;
  display: block;
  border-radius: 7px;
  object-fit: cover;
  object-position: center center;
  background: #0c1118;
  border: 1px solid #2d3f55;
  align-self: center;
}

.upload-music-top-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px 30px 30px;
  gap: 4px;
  align-items: center;
  padding-right: 0;
}

.upload-music-top-controls.has-track-link-btn {
  grid-template-columns: minmax(0, 1fr) 30px 30px 30px 30px;
}

.upload-music-top-controls input[type="text"] {
  height: 34px;
  min-width: 0;
  padding: 0 8px;
  line-height: normal;
  align-self: center;
  margin-top: 0;
  font-size: 13px;
}

#uploadModal .upload-music-top-row {
  gap: 10px;
  align-items: center;
}

#uploadModal .upload-music-top-controls {
  grid-template-columns: minmax(0, 1fr) 34px 34px 34px;
  gap: 6px;
  align-items: center;
}

#uploadModal .upload-music-top-controls.has-track-link-btn {
  grid-template-columns: minmax(0, 1fr) 34px 34px 34px 34px;
}

#uploadModal .upload-music-top-controls input[type="text"] {
  height: 34px;
  margin: 0;
  transform: none;
  align-self: center;
}

#uploadModal .upload-music-cover-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  left: 0;
}

.upload-music-cover-btn {
  min-height: 30px;
  min-width: 30px;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  left: -1px;
}

.upload-music-cover-remove-btn {
  color: #ffd3b2;
}

.upload-music-cover-remove-btn:hover {
  color: #ffe5d3;
}

.upload-music-fields input[type="text"],
.upload-music-fields input[type="file"] {
  width: 100%;
  background: #0d1117;
  color: #d8e6f7;
  border: 1px solid #29405a;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
}

.upload-music-help {
  margin: 0;
  font-size: 11px;
  color: #88a3bf;
}

.upload-music-panel.is-saving {
  opacity: 0.96;
}

.music-track-save-progress {
  display: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #0d1117;
  border: 1px solid #29405a;
  overflow: hidden;
}

.music-track-save-progress.is-visible {
  display: block;
}

.music-track-save-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a84ff 0%, #4fb3ff 100%);
  transition: width 0.16s ease;
}

.music-track-save-progress-meta {
  display: none;
  margin: -2px 0 0;
  font-size: 11px;
  color: #88a3bf;
}

.music-track-save-progress.is-visible + .music-track-save-progress-meta {
  display: block;
}

.upload-multi-summary {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #2b3d52;
  border-radius: 8px;
  background: rgba(16, 24, 36, 0.72);
}

.upload-multi-summary-title {
  font-size: 11px;
  color: #9ab0c7;
  margin-bottom: 6px;
}

.upload-multi-summary-row {
  font-size: 12px;
  color: #d6e6f7;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-multi-summary-row.is-current {
  color: #ffffff;
  font-weight: 600;
}

.upload-preview-fallback {
  color: #9a9a9a;
  font-size: 13px;
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.attachment-list-row {
  width: 100%;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #121212;
  color: #d5dde7;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.attachment-list-search-shell {
  width: 100%;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #121212;
  padding: 8px 10px;
  box-sizing: border-box;
  margin-bottom: 8px;
}

.attachment-list-search {
  display: block;
  flex: 1 1 auto;
  min-width: 100%;
  width: 100%;
  margin: 0;
  height: 52px;
  border: 1px solid #355071;
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(27, 43, 63, 0.94), rgba(18, 30, 45, 0.94));
  color: #e4f0ff;
  font-size: 14px;
  letter-spacing: 0.01em;
  padding: 0 18px;
  box-sizing: border-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 6px 16px rgba(4, 10, 18, 0.34);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.attachment-window__preview.is-attachment-list .attachment-list-search {
  align-self: stretch;
}

.attachment-list-search::placeholder {
  color: #9db4cd;
}

.attachment-list-search:hover {
  border-color: #4a6b93;
  background:
    linear-gradient(180deg, rgba(30, 49, 72, 0.96), rgba(21, 35, 53, 0.96));
}

.attachment-list-search:focus {
  outline: none;
  border-color: #6ea5dd;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 2px rgba(80, 152, 221, 0.24),
    0 8px 18px rgba(8, 20, 35, 0.4);
}

.attachment-list-row:hover {
  background: #1a1a1a;
}

.attachment-list-main {
  font-size: 13px;
  font-weight: 600;
}

.attachment-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.attachment-list-actions {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-right: 6px;
}

.attachment-jump-btn {
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  background: #0a84ff;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
}

.attachment-jump-btn:hover {
  background: #0d6fd1;
}

.attachment-copy-btn {
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  background: #0f0f0f;
  color: #cfe4fb;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
}

.attachment-copy-btn:hover {
  background: #1a2633;
}

.attachment-delete-btn {
  border: 1px solid rgba(218, 70, 70, 0.65);
  border-radius: 6px;
  background: rgba(218, 70, 70, 0.2);
  color: #ffd6d6;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
}

.attachment-delete-btn:hover {
  background: rgba(218, 70, 70, 0.3);
}

.attachment-list-source {
  font-size: 12px;
  color: #8ea4bb;
}

.attachment-list-meta {
  font-size: 11px;
  color: #9aa8b8;
  line-height: 1.35;
  white-space: pre-line;
}

.attachment-list-usage {
  font-size: 11px;
  color: #8a959f;
}

.attachment-list-row.unassigned {
  border-color: rgba(219, 90, 90, 0.45);
  background: rgba(219, 90, 90, 0.12);
}

.attachment-window-layer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
}

.attachment-window {
  position: fixed;
  width: min(560px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #171717;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  overflow: hidden;
  transition: opacity 140ms ease, filter 140ms ease;
}

.attachment-window.is-background-dimmed {
  opacity: 0.72;
  filter: blur(1.8px);
}

.attachment-window.is-background-dimmed:has(.is-attachment-list) {
  opacity: 0.88;
  filter: blur(0.9px);
}

@media (max-width: 768px) {
  .attachment-window-layer:has(.attachment-window) {
    background: rgba(0, 0, 0, 0.45);
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .attachment-window {
    position: static;
    width: min(560px, calc(100vw - 24px));
    max-height: calc(100dvh - 48px);
    left: unset !important;
    top: unset !important;
  }

  .attachment-window__titlebar {
    cursor: default;
  }
}

.attachment-window.is-focus-flash {
  border-color: #0a84ff;
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.55), 0 18px 50px rgba(0, 0, 0, 0.55);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.attachment-window__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #101010;
  border-bottom: 1px solid #2a2a2a;
  cursor: move;
}

.attachment-window__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #e2edf9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-window__close {
  width: 30px;
  height: 30px;
  border: 1px solid #33465d;
  border-radius: 8px;
  background: #152131;
  color: #d9e8fb;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.attachment-window__close:hover {
  background: #20314a;
}

.attachment-window__meta-row {
  margin: 10px 12px 8px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
}

.attachment-window__meta {
  margin: 0;
  white-space: pre-line;
  flex: 1;
  min-width: 0;
}

.attachment-window__meta-download {
  flex: 0 0 auto;
  min-width: 48px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  background: #2a2a2a;
  color: #e2e2e2;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.attachment-window__meta-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.attachment-window__meta-actions:empty {
  display: none;
}

.attachment-window__meta-zoom {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #33465d;
  border-radius: 8px;
  background: #152131;
  color: #d9e8fb;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
}

.attachment-window__meta-zoom:hover {
  background: #20314a;
}

.attachment-window__meta-zoom:focus-visible {
  outline: 2px solid #0a84ff;
  outline-offset: 2px;
}

.attachment-window__preview {
  margin: 0 12px 10px;
  max-height: min(60vh, 620px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-window__preview.is-media-expanded {
  max-height: none;
  height: 100%;
  flex: 1 1 auto;
}

.attachment-window__preview.is-media-expanded .attachment-media-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.attachment-window__preview.is-media-expanded .attachment-media-frame > img,
.attachment-window__preview.is-media-expanded .attachment-media-frame > video,
.attachment-window__preview.is-media-expanded .attachment-media-frame > iframe {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.attachment-window__preview.is-media-expanded iframe {
  height: 100% !important;
  flex: 1 1 auto;
}

.attachment-window__preview.is-attachment-list {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding-top: 6px;
}

.attachment-window__preview > video,
.attachment-window__preview > img,
.attachment-window__preview > iframe {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.attachment-window__preview:has(> audio) {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
}

.attachment-window__preview:has(> audio) .upload-music-panel {
  margin: 0;
}

.attachment-media-frame {
  display: inline-block;
  max-width: 100%;
}

.attachment-media-frame:has(> iframe) {
  display: block;
  width: 100%;
}

.attachment-media-frame > img,
.attachment-media-frame > video,
.attachment-media-frame > iframe {
  display: block;
}

.attachment-window__actions {
  margin: 0 12px 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, max-content));
  justify-content: start;
}

.attachment-window__jump-btn {
  font-weight: 500;
}

.attachment-window__jump-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.attachment-list-row.unassigned .attachment-list-usage {
  color: #ff9b9b;
}

.attachment-list-row.missing-source {
  border-color: rgba(219, 90, 90, 0.45);
  background: rgba(219, 90, 90, 0.12);
}

.attachment-list-row.missing-source .attachment-list-source {
  color: #ff9b9b;
}

.music-player-panel {
  --music-glow-rgb: 10, 132, 255;
  position: fixed;
  left: 84px;
  top: 82px;
  z-index: 980;
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  background: #171717;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transition: box-shadow 260ms ease, border-color 260ms ease;
}

.music-player-panel.is-background-dimmed {
  opacity: 0.58;
  filter: blur(0.8px);
}

.music-cover-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  border-radius: 12px;
  background: #0d131b;
  opacity: 0.72;
  pointer-events: none;
  filter: saturate(1.12) brightness(0.78);
}

.music-player-panel > :not(.music-cover-overlay) {
  position: relative;
  z-index: 1;
}

.music-player-panel.is-cover-expanded {
  border-color: rgba(145, 208, 255, 0.62);
  box-shadow:
    0 0 0 1px rgba(145, 208, 255, 0.25),
    0 20px 60px rgba(0, 0, 0, 0.64),
    0 0 40px rgba(var(--music-glow-rgb, 10, 132, 255), 0.22);
}

.music-player-panel.is-cover-expanded .music-player-header,
.music-player-panel.is-cover-expanded .music-playlist-bar,
.music-player-panel.is-cover-expanded .music-volume-row,
.music-player-panel.is-cover-expanded .music-controls button,
.music-player-panel.is-cover-expanded .music-progress-shell {
  border-color: rgba(190, 226, 255, 0.45);
  background: rgba(6, 10, 15, 0.42);
  -webkit-backdrop-filter: blur(10px) saturate(1.18);
  backdrop-filter: blur(10px) saturate(1.18);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 12px 30px rgba(0, 0, 0, 0.28);
}

.music-player-panel.is-cover-expanded .music-progress-shell {
  background: rgba(5, 9, 14, 0.24);
}

.music-player-panel.is-cover-expanded .music-waveform-bar {
  background: rgba(235, 246, 255, 0.52);
}

.music-player-panel.is-cover-expanded .music-waveform-fill .music-waveform-bar {
  background: linear-gradient(180deg, #ffffff, #8ed6ff 46%, #1aa0ff);
}

.music-player-panel.is-cover-expanded .music-now-playing {
  background: rgba(6, 10, 15, 0.34);
  border-color: rgba(190, 226, 255, 0.28);
  -webkit-backdrop-filter: blur(8px) saturate(1.14);
  backdrop-filter: blur(8px) saturate(1.14);
}

.music-player-panel.is-cover-expanded .music-now-title,
.music-player-panel.is-cover-expanded .music-player-header strong {
  color: #f3f9ff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}

.music-player-panel.is-cover-expanded .music-now-sub,
.music-player-panel.is-cover-expanded .music-time-row,
.music-player-panel.is-cover-expanded .music-volume-label,
.music-player-panel.is-cover-expanded .music-volume-value {
  color: rgba(230, 243, 255, 0.86);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

.music-player-panel.is-focus-flash {
  border-color: #0a84ff;
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.55), 0 18px 50px rgba(0, 0, 0, 0.55);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.music-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #101010;
  border-bottom: 1px solid #2a2a2a;
  cursor: move;
  touch-action: none;
}

.music-player-header strong {
  color: #e2edf9;
  font-size: 15px;
  font-weight: 700;
}

.music-player-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 0 1 auto;
}

.music-track-search-input {
  flex: 0 1 190px;
  min-width: 140px;
  max-width: 190px;
  height: 30px;
  border: 1px solid #33465d;
  border-radius: 8px;
  background: #152131;
  color: #d9e8fb;
  font-size: 12px;
  padding: 0 9px;
  -webkit-user-select: text;
  user-select: text;
}

.music-track-search-input::placeholder {
  color: #90a3b7;
}

.music-player-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
  min-width: 0;
}

.music-list-toggle {
  width: 30px;
  height: 30px;
  border: 1px solid #33465d;
  border-radius: 8px;
  background: #152131;
  color: #d9e8fb;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.music-list-toggle:hover {
  background: #20314a;
}

.music-player-header-actions button {
  width: 30px;
  height: 30px;
  border: 1px solid #33465d;
  border-radius: 8px;
  background: #152131;
  color: #d9e8fb;
  cursor: pointer;
}

.music-player-header-actions button:hover {
  background: #20314a;
  box-shadow: none;
}

.music-player-body {
  display: grid;
  gap: 8px;
  padding: 12px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(120% 80% at 10% 0%, rgba(var(--music-glow-rgb, 18, 34, 51), 0.16), rgba(var(--music-glow-rgb, 18, 34, 51), 0) 52%),
    radial-gradient(110% 70% at 100% 100%, rgba(var(--music-glow-rgb, 10, 132, 255), 0.12), rgba(var(--music-glow-rgb, 10, 132, 255), 0) 58%);
}

.music-playlist-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px 30px 30px 30px;
  align-items: center;
  gap: 6px;
}

.music-native-select-hidden {
  display: none;
}

.music-custom-select {
  position: relative;
  min-width: 0;
}

.music-custom-select-modal {
  width: 100%;
}

.music-custom-select-btn {
  width: 100%;
  min-width: 0;
  height: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  border: 1px solid #33465d;
  border-radius: 8px;
  background: linear-gradient(180deg, #1d3148 0%, #111d2c 100%);
  color: #d9e8fb;
  font-size: 12px;
  padding: 0 10px;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 22px rgba(0, 0, 0, 0.18);
}

.music-custom-select-btn:hover,
.music-custom-select.is-open .music-custom-select-btn {
  border-color: #56799d;
  background: linear-gradient(180deg, #25405d 0%, #17283c 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 22px rgba(0, 0, 0, 0.18);
}

.music-custom-select-btn:focus-visible {
  outline: 2px solid rgba(10, 132, 255, 0.65);
  outline-offset: 2px;
}

.music-custom-select-btn span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-custom-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 1200;
  max-height: min(220px, 38vh);
  overflow: auto;
  padding: 4px;
  border: 1px solid #36516d;
  border-radius: 10px;
  background: linear-gradient(180deg, #142235 0%, #0e1826 100%);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  scrollbar-width: thin;
  scrollbar-color: #34506c transparent;
}

.music-custom-select-menu::-webkit-scrollbar {
  width: 6px;
}

.music-custom-select-menu::-webkit-scrollbar-track {
  background: transparent;
}

.music-custom-select-menu::-webkit-scrollbar-thumb {
  background: #34506c;
  border-radius: 999px;
}

.music-custom-select-option {
  width: calc(100% - 4px);
  min-height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #dbeeff;
  cursor: pointer;
  display: block;
  font-size: 12px;
  line-height: 1.15;
  margin: 1px 2px;
  padding: 4px 8px;
  text-align: left;
}

.music-custom-select-option:hover,
.music-custom-select-option.is-selected {
  background: #2a4564;
  color: #ffffff;
}

.music-playlist-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #33465d;
  border-radius: 8px;
  background: #152131;
  color: #d9e8fb;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}

.music-playlist-btn:hover {
  background: #20314a;
  box-shadow: none;
}

.music-playlist-danger {
  color: #ffb4b4;
}

.music-playlist-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.music-playlist-track-modal-content {
  display: grid;
  gap: 10px;
}

.music-playlist-track-label {
  color: #8ea6c0;
  font-size: 12px;
}

.music-playlist-track-select {
  width: 100%;
  font-size: 13px;
  height: 36px;
}

.music-playlist-name-modal-content {
  display: grid;
  gap: 10px;
}

.music-playlist-name-input {
  width: 100%;
  height: 38px;
  border: 1px solid #33465d;
  border-radius: 8px;
  background: linear-gradient(180deg, #162538 0%, #101a29 100%);
  color: #d9e8fb;
  font-size: 14px;
  padding: 0 11px;
}

.music-playlist-name-input:focus-visible {
  outline: 2px solid rgba(10, 132, 255, 0.65);
  outline-offset: 2px;
}

.music-playlist-name-error {
  color: #ffb4b4;
  margin: 0;
}

.music-track-list {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
  direction: ltr;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #3b5168 transparent;
}

.music-track-list::-webkit-scrollbar {
  width: 10px;
}

.music-track-list::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.music-track-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #4f6984, #35485c);
  border-radius: 999px;
  border: 2px solid #171717;
}

.music-track-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #6791b8, #44617f);
}

.music-track-list.is-collapsed {
  display: none;
}

.music-track-item {
  width: 100%;
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #121212;
  color: #d5dde7;
  padding: 9px 10px 9px 12px;
  cursor: pointer;
  user-select: none;
}

.music-track-item:hover {
  background: #1a1a1a;
}

.music-track-item.is-active {
  border-color: #0a84ff;
  box-shadow: 0 0 0 1px rgba(10, 132, 255, 0.35);
}

.music-track-item.is-locate-pulse {
  animation: musicLocatePulse 1.15s ease-out;
}

@keyframes musicLocatePulse {
  0% {
    border-color: #70b9ff;
    background: #173552;
    box-shadow: none;
  }

  55% {
    box-shadow: none;
  }

  100% {
    box-shadow: none;
  }
}

.music-track-thumb {
  width: 52px;
  height: 52px;
  border-radius: 9px;
  object-fit: cover;
  background: #0c1118;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  transform-origin: center center;
}

.music-track-item:hover .music-track-thumb,
.music-track-item:focus-within .music-track-thumb {
  transform: scale(1.12);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(120, 180, 245, 0.35);
  filter: saturate(1.05) brightness(1.03);
}

.music-track-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.music-track-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.music-track-actions {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
  flex: 0 0 auto;
  opacity: 0;
  pointer-events: none;
  transform: translateX(3px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.music-track-item:hover .music-track-actions,
.music-track-item:focus-within .music-track-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.music-track-hover-card {
  position: fixed;
  z-index: 2600;
  max-width: 280px;
  border: 1px solid #3a516b;
  border-radius: 10px;
  background: rgba(14, 22, 33, 0.96);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  padding: 8px 10px;
  pointer-events: none;
}

.music-track-hover-title {
  color: #e7f1fc;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.music-track-hover-meta {
  margin-top: 4px;
  color: #a3b6cb;
  font-size: 11px;
  line-height: 1.25;
}

.music-track-hover-source {
  margin-top: 3px;
  color: #8fa4ba;
  font-size: 11px;
  line-height: 1.25;
}

.music-track-action-btn {
  min-width: 28px;
  height: 24px;
  border: 1px solid #33465d;
  border-radius: 6px;
  background: #152131;
  color: #d9e8fb;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}

.music-track-settings-panel {
  margin: 0 12px 12px;
  padding: 10px;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  background: #10151c;
  display: grid;
  gap: 10px;
}

.music-track-action-btn:hover {
  background: #20314a;
}

.music-track-item.is-dragging {
  opacity: 0.4;
  border-style: dashed;
}

.music-track-item.is-drag-over-top {
  border-top: 2px solid #0a84ff;
  margin-top: -1px;
}

.music-track-item.is-drag-over-bottom {
  border-bottom: 2px solid #0a84ff;
  margin-bottom: -1px;
}

/* Cover picker modal */
.cover-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-picker-dialog {
  background: #131d2a;
  border: 1px solid #2a3f57;
  border-radius: 14px;
  width: min(680px, 94vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.cover-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #1e3248;
  flex-shrink: 0;
}

.cover-picker-title {
  font-weight: 700;
  font-size: 14px;
  color: #d9e8fb;
}

.cover-picker-close {
  background: none;
  border: none;
  color: #8ea4bb;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.cover-picker-close:hover { background: #1e3248; color: #fff; }

.cover-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.cover-picker-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #0e1621;
  border: 1px solid #233244;
  border-radius: 10px;
  padding: 8px 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.cover-picker-cell:hover {
  background: #1a2e45;
  border-color: #3a7fc1;
}

.cover-picker-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  background: #0a1420;
}

.cover-picker-label {
  font-size: 11px;
  color: #9ab;
  text-align: center;
  word-break: break-all;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.music-track-title {
  font-size: 12px;
  font-weight: 600;
  color: #c9d7e5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 170ms ease, text-shadow 170ms ease, letter-spacing 170ms ease, filter 170ms ease;
}

.music-track-item:hover .music-track-title,
.music-track-item:focus-within .music-track-title {
  color: #e8f3ff;
  text-shadow: 0 0 8px rgba(132, 191, 255, 0.45);
  letter-spacing: 0.01em;
  filter: brightness(1.06);
}

.music-track-meta {
  font-size: 11px;
  color: #8998a8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-track-source {
  font-size: 11px;
  color: #7f92a6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-now-playing {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  align-items: center;
}

.music-cover-wrap {
  position: relative;
  width: 112px;
  height: 112px;
}

.music-cover-wrap.is-cover-expanded {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1200;
  pointer-events: none;
}

.music-cover-wrap.is-cover-expanded .music-cover {
  pointer-events: auto;
}

.music-cover-star-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: 1px solid #2f4661;
  border-radius: 7px;
  background: rgba(17, 27, 40, 0.92);
  color: #d8e9fb;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transform: none;
}

.music-cover-star-glyph {
  display: inline-block;
  transform: translateY(-1px);
}

.music-cover-star-btn:hover {
  background: #1a2a3f;
  box-shadow: 0 0 0 1px rgba(95, 162, 232, 0.35), 0 6px 14px rgba(16, 34, 54, 0.34);
}

.music-cover {
  width: 112px;
  height: 112px;
  min-width: 112px;
  min-height: 112px;
  max-width: 112px;
  max-height: 112px;
  border-radius: 12px;
  object-fit: cover;
  background: #0d131b;
  border: 1px solid rgba(var(--music-glow-rgb, 45, 63, 85), 0.62);
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: auto;
  transition: none;
  transform: none;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 10px rgba(var(--music-glow-rgb, 10, 132, 255), 0.18);
}

.music-cover.is-expanded {
  position: absolute;
  z-index: 1200;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  object-fit: cover;
  transform: none;
  border-radius: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.music-now-playing {
  position: relative;
  overflow: visible;
}

.music-player-panel {
  position: relative;
}

.music-now-playing:hover .music-cover {
  z-index: 1;
  box-shadow: none;
}

.music-now-title {
  margin: 0;
  color: #e2efff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: text-shadow 220ms ease-out, letter-spacing 260ms ease-out, filter 220ms ease-out;
}

.music-now-title.is-reactive {
  text-shadow: 0 0 calc(2px + (var(--music-title-energy, 0.15) * 5px)) rgba(226, 239, 255, 0.28);
}

.music-now-title.is-reactive.is-mid-song {
  letter-spacing: calc(0.01em + (var(--music-effect-stage, 0.1) * 0.02em));
  filter: saturate(calc(1 + (var(--music-title-energy, 0.15) * 0.12)));
}

.music-cover.is-reactive {
  transform: none;
  transition: none;
  box-shadow:
    0 0 0 1px rgba(var(--music-glow-rgb, 10, 132, 255), 0.28),
    0 0 calc(8px + (var(--music-title-energy, 0.2) * 12px)) rgba(var(--music-glow-rgb, 10, 132, 255), 0.34);
}

.music-cover.is-reactive {
  box-shadow:
    0 0 0 1px rgba(var(--music-glow-rgb, 10, 132, 255), 0.28),
    0 0 calc(8px + (var(--music-title-energy, 0.2) * 12px)) rgba(var(--music-glow-rgb, 10, 132, 255), 0.34);
  animation: musicCoverPulse 1.8s ease-in-out infinite;
}

.music-now-sub.is-reactive {
  transition: text-shadow 160ms ease-out, filter 160ms ease-out;
}

.music-now-sub.is-reactive.is-mid-song {
  animation: musicTitleMidSongGlow 940ms ease-in-out infinite alternate;
}

@keyframes musicTitleMidSongGlow {
  from {
    text-shadow: 0 0 0 rgba(255, 255, 255, 0);
    filter: saturate(1);
  }
  to {
    text-shadow: 0 0 calc(6px + (var(--music-title-energy, 0.2) * 8px)) rgba(255, 255, 255, 0.52);
    filter: saturate(calc(1 + (var(--music-title-energy, 0.2) * 0.16)));
  }
}

@keyframes musicCoverPulse {
  0% { box-shadow: 0 0 0 1px rgba(var(--music-glow-rgb, 10, 132, 255), 0.22), 0 0 8px rgba(var(--music-glow-rgb, 10, 132, 255), 0.2); }
  50% { box-shadow: 0 0 0 1px rgba(var(--music-glow-rgb, 10, 132, 255), 0.36), 0 0 16px rgba(var(--music-glow-rgb, 10, 132, 255), 0.34); }
  100% { box-shadow: 0 0 0 1px rgba(var(--music-glow-rgb, 10, 132, 255), 0.22), 0 0 8px rgba(var(--music-glow-rgb, 10, 132, 255), 0.2); }
}

.music-now-sub {
  margin: 4px 0 0;
  color: #8ea6c0;
  font-size: 12px;
}

.music-show-in-list {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #87bfff;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.music-show-in-list:hover {
  color: #cde7ff;
  text-decoration: underline;
}

.music-show-in-list:focus-visible {
  border-radius: 4px;
  outline: 2px solid rgba(10, 132, 255, 0.7);
  outline-offset: 3px;
}

.music-copy-token-btn {
  display: block;
  width: fit-content;
  margin-top: 8px;
  padding: 5px 10px;
  border: 1px solid #2f4661;
  border-radius: 8px;
  background: linear-gradient(180deg, #1a2b3f 0%, #132133 100%);
  color: #d8e9fb;
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 160ms ease, border-color 160ms ease, filter 160ms ease;
}

.music-copy-token-btn:hover {
  background: linear-gradient(180deg, #233a55 0%, #182a3f 100%);
  text-decoration: none;
  box-shadow: 0 0 0 1px rgba(95, 162, 232, 0.3), 0 6px 16px rgba(16, 34, 54, 0.35);
}

.music-copy-token-btn:active {
  transform: translateY(1px) scale(0.985);
  filter: brightness(0.95);
}

.music-copy-token-btn.is-copied {
  border-color: #6fb6ff;
  box-shadow:
    0 0 0 1px rgba(111, 182, 255, 0.45),
    0 0 16px rgba(73, 150, 230, 0.5),
    0 0 28px rgba(73, 150, 230, 0.22);
  animation: musicCopyPulse 620ms ease;
}

@keyframes musicCopyPulse {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.035); filter: brightness(1.12); }
  100% { transform: scale(1); filter: brightness(1); }
}

.music-show-in-list[hidden] {
  display: none;
}

.music-progress-shell {
  position: relative;
  height: 54px;
  border: 1px solid #263b4f;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(12, 18, 26, 0.94), rgba(8, 12, 18, 0.96)),
    #0c121a;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transition: box-shadow 260ms ease, border-color 220ms ease;
}

.music-progress-shell.is-playing {
  animation: musicProgressPulse 1.5s ease-in-out infinite;
}

.music-waveform {
  --music-progress-pct: 0%;
  --music-reactive-energy: 0.08;
  --music-effect-stage: 0.1;
  position: absolute;
  inset: 7px 9px;
}

.music-waveform::after {
  content: "";
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: var(--music-progress-pct, 0%);
  width: 2px;
  border-radius: 999px;
  background: #f6fbff;
  box-shadow: none;
  transform: translateX(-1px);
  pointer-events: none;
}

.music-progress-shell.is-playing .music-waveform::after {
  box-shadow: 0 0 10px rgba(var(--music-glow-rgb, 10, 132, 255), 0.42);
}

@keyframes musicProgressPulse {
  0% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 10px 24px rgba(0, 0, 0, 0.18),
      0 0 10px rgba(var(--music-glow-rgb, 10, 132, 255), 0.1);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 10px 24px rgba(0, 0, 0, 0.18),
      0 0 18px rgba(var(--music-glow-rgb, 10, 132, 255), 0.2);
  }
  100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.04),
      0 10px 24px rgba(0, 0, 0, 0.18),
      0 0 10px rgba(var(--music-glow-rgb, 10, 132, 255), 0.1);
  }
}

.music-waveform-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}

.music-waveform-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  width: var(--music-progress-pct, 0%);
  overflow: hidden;
  pointer-events: none;
}

.music-waveform-fill .music-waveform-layer {
  width: var(--music-waveform-width, 100%);
}

.music-waveform-bar {
  flex: 1 1 0;
  min-width: 2px;
  height: max(5px, calc(var(--bar-level, 0.2) * 100%));
  border-radius: 999px;
  background: linear-gradient(180deg, #5f7488, #2d4051);
  opacity: 0.72;
}

.music-waveform-fill .music-waveform-bar {
  background: linear-gradient(180deg, #ffffff, #28a8ff 46%, #0a84ff);
  opacity: 1;
}

.music-waveform.is-loading .music-waveform-bar {
  opacity: 0.46;
}

.music-waveform.is-reactive .music-waveform-bar {
  transform-origin: center;
  animation: musicWaveBarPulse 420ms ease-in-out infinite alternate;
  animation-delay: calc(var(--bar-index, 0) * 8ms);
}

.music-waveform.is-reactive::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at calc(var(--music-progress-pct, 0%) + 8px) 42%, rgba(112, 201, 255, 0.28), transparent 24px),
    radial-gradient(circle at calc(var(--music-progress-pct, 0%) - 12px) 58%, rgba(10, 132, 255, 0.2), transparent 28px);
  opacity: 0;
  pointer-events: none;
  filter: none;
}

.music-waveform.is-reactive ~ .music-progress {
  cursor: pointer;
}

@keyframes musicWaveBarPulse {
  from { transform: scaleY(calc(1 + (var(--music-reactive-energy, 0.08) * 0.18))); }
  to { transform: scaleY(calc(1 + (var(--music-reactive-energy, 0.08) * 0.44))); }
}

.music-progress {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.music-time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #9ab0c7;
  font-size: 11px;
}

.music-time-badge {
  flex: 0 1 auto;
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: #839bb4;
  border: 1px solid rgba(52, 80, 108, 0.18);
  border-radius: 999px;
  padding: 0 6px;
  background: rgba(18, 30, 44, 0.2);
  opacity: 0.82;
}

.music-volume-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #243449;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(16, 22, 31, 0.92), rgba(12, 16, 22, 0.92));
}

.music-volume-label,
.music-volume-value {
  color: #8ea6c0;
  font-size: 12px;
  white-space: nowrap;
}

.music-volume {
  width: 100%;
  min-width: 0;
  accent-color: #0a84ff;
}

.music-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding-top: 6px;
}

.music-controls button {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid #2d4258;
  border-radius: 9px;
  background: linear-gradient(180deg, #17293c 0%, #101d2b 100%);
  color: #dcecff;
  min-height: 36px;
  cursor: pointer;
  overflow: visible;
}

.music-controls button:hover {
  background: linear-gradient(180deg, #213a55 0%, #17283c 100%);
}

.music-controls button.is-active {
  border-color: #0a84ff;
  background: #1e3350;
  color: #eaf4ff;
  box-shadow: none;
}

.music-controls button.is-idle-selected {
  border-color: #0a84ff;
  background: #1b2f49;
  box-shadow: none;
}

.music-control-btn::before,
.music-control-btn::after {
  content: "";
  display: block;
}

.music-control-play::before {
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid currentColor;
  transform: translate(1px, 3px);
}

.music-control-play.is-playing::before,
.music-control-play.is-playing::after {
  width: 5px;
  height: 16px;
  background: currentColor;
  border: 0;
  border-radius: 1px;
  position: absolute;
}

.music-control-play.is-playing::before {
  transform: translate(-5px, 0);
}

.music-control-play.is-playing::after {
  transform: translate(5px, 0);
}

.music-control-stop::before {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  background: currentColor;
  transform: translateY(4px);
}

.music-control-prev::before,
.music-control-next::before {
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.music-control-prev::before {
  border-right: 12px solid currentColor;
  transform: translateX(-2px);
}

.music-control-next::before {
  border-left: 12px solid currentColor;
  transform: translateX(2px);
}

.music-control-prev::after,
.music-control-next::after {
  position: absolute;
  width: 3px;
  height: 16px;
  border-radius: 1px;
  background: currentColor;
}

.music-control-prev::after {
  transform: translateX(-9px);
}

.music-control-next::after {
  transform: translateX(9px);
}

.music-control-repeat {
  --repeat-icon: #dcecff;
}

.music-control-repeat.is-active {
  --repeat-icon: #eaf4ff;
}

.music-control-repeat::before {
  width: 20px;
  height: 15px;
  background:
    linear-gradient(var(--repeat-icon), var(--repeat-icon)) 5px 2px / 10px 2px no-repeat,
    linear-gradient(var(--repeat-icon), var(--repeat-icon)) 5px 11px / 10px 2px no-repeat,
    linear-gradient(var(--repeat-icon), var(--repeat-icon)) 5px 2px / 2px 6px no-repeat,
    linear-gradient(var(--repeat-icon), var(--repeat-icon)) 13px 7px / 2px 6px no-repeat;
  border-radius: 2px;
  transform: translateY(3px);
}

.music-control-repeat::after {
  position: absolute;
  width: 6px;
  height: 6px;
  border-top: 2px solid var(--repeat-icon);
  border-right: 2px solid var(--repeat-icon);
  transform: translate(7px, -4px) rotate(45deg);
  box-shadow: -13px 13px 0 -2px transparent;
}

@media (max-width: 768px) {
  .plain-token-link-button {
    transform: translate(1px, -4px);
    max-width: none;
    width: max-content;
    min-height: 20px;
    line-height: 1.2;
    padding-top: 2px;
    padding-bottom: 3px;
  }

  .plain-token-link-button .plain-token-label {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }

  .plain-token-link-button .plain-token-label {
    line-height: 1.2;
  }

  #serverStatusPanel #musicPlayerBtn,
  .server-status-music-floating {
    right: auto !important;
    top: auto !important;
  }

  .music-player-panel {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(380px, calc(100vw - 8px));
    max-height: calc(100dvh - 10px);
  }

  .music-player-header {
    flex-shrink: 0;
    gap: 8px;
  }

  .music-player-title-wrap strong {
    font-size: 14px;
  }

  .music-track-search-input {
    flex-basis: 128px;
    min-width: 108px;
    max-width: 128px;
  }

  .music-player-body {
    padding: 7px;
  }

  .music-playlist-bar {
    grid-template-columns: minmax(0, 1fr) 28px 28px 28px 28px;
  }

  .music-track-list {
    max-height: min(40dvh, 220px);
    padding-right: 12px;
  }

  .music-track-item {
    width: calc(100% - 2px);
  }

  .music-track-actions {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .music-now-playing {
    grid-template-columns: 96px 1fr;
    gap: 6px;
  }

  .music-cover-wrap {
    width: 96px;
    height: 96px;
  }

  .music-cover {
    width: 96px;
    height: 96px;
    min-width: 96px;
    min-height: 96px;
    max-width: 96px;
    max-height: 96px;
  }

  .music-cover-star-btn {
    top: 3px;
    right: 3px;
    width: 21px;
    height: 21px;
  }

  .music-controls {
    gap: 6px;
  }

  .music-controls button {
    min-height: 32px;
  }

  .music-volume-row {
    display: none;
  }
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  border: 2px solid rgba(10, 132, 255, 0.85);
  pointer-events: none;
}

.drop-overlay-panel {
  width: min(420px, calc(100% - 40px));
  border: 1px solid #2f7dcc;
  border-radius: 12px;
  background: #111;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
  padding: 22px;
  text-align: center;
}

.drop-overlay-panel h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #fff;
}

.drop-overlay-panel p {
  margin: 0;
  color: #a9b8c8;
  font-size: 13px;
  line-height: 1.45;
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #0a84ff;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: opacity 0.2s;
}

.btn:active {
  opacity: 0.8;
}

.btn-icon {
  padding: 8px 12px;
  background: transparent;
  color: #0a84ff;
  font-size: 16px;
}

.btn-small {
  padding: 8px 12px;
  font-size: 12px;
}

.btn-secondary {
  background: #3a3a3a;
  color: #fff;
}

#noteDetailsUploadBtn {
  transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

#noteDetailsUploadBtn:hover {
  background: #4a4a4a;
  box-shadow: 0 0 0 1px rgba(140, 188, 255, 0.28), 0 0 10px rgba(79, 156, 255, 0.2);
}

#renameCurrentNoteBtn {
  background: #2f3f24;
  border: 1px solid #5a7a45;
  color: #d9f2c4;
  transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

#renameCurrentNoteBtn:hover {
  background: #3b5130;
  border-color: #7aa95c;
  box-shadow: 0 0 0 1px rgba(152, 222, 112, 0.3), 0 0 10px rgba(112, 190, 76, 0.22);
}

#closeCurrentNoteBtn {
  background: rgba(255, 59, 48, 0.16);
  border: 1px solid rgba(255, 59, 48, 0.46);
  color: #ffb3ad;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.2;
}

#closeCurrentNoteBtn:hover {
  background: rgba(255, 59, 48, 0.26);
  border-color: rgba(255, 59, 48, 0.62);
  box-shadow: 0 0 0 1px rgba(255, 59, 48, 0.3), 0 0 10px rgba(255, 59, 48, 0.22);
}

.btn-danger {
  background: transparent;
  color: #ff3b30;
  padding: 6px 10px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/* Responsive */
@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(100vh - env(safe-area-inset-top, 0px));
  }

  .sidebar {
    position: absolute;
    left: 0;
    top: env(safe-area-inset-top, 0px);
    width: 100%;
    height: calc(100vh - env(safe-area-inset-top, 0px));
    z-index: 50;
    max-width: min(86vw, 320px);
    transform: translateX(0);
    transition: transform 0.22s ease;
  }

  .sidebar-search {
    font-size: 12px;
    padding: 7px 9px;
  }

  .sidebar-search.sidebar-search-title {
    font-size: 10.8px !important;
    line-height: 1 !important;
    padding: 1px 2px !important;
  }

  .sidebar-search::placeholder {
    font-size: 11px;
  }

  .sidebar-footer-actions {
    padding: 8px 10px 6px;
  }

  .file-tree {
    overflow-x: hidden;
  }

  .tree-item {
    min-width: 0;
    width: 100%;
    padding: 4px 9px;
  }

  .tree-item-name,
  .search-path,
  .search-snippet {
    min-width: 0;
    max-width: 100%;
  }

  .editor-header h2 {
    font-size: 20px;
    line-height: 1.2;
  }

  .markdown-preview {
    padding: 12px 14px 28px;
  }

  .markdown-preview pre,
  .code-block-shell pre {
    overflow-x: hidden;
    scrollbar-gutter: auto;
  }

  .markdown-preview code {
    white-space: break-spaces;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .code-block-shell pre code {
    width: 100%;
    min-width: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    padding-right: 0;
  }

  .attachment-chip {
    top: 2px;
    margin: 2px 2px;
  }

  .app-container.mobile-sidebar-collapsed .sidebar {
    transform: translateX(calc(-100% - 12px));
  }

  .server-status-panel {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    transform: none;
    width: calc(100% - 12px);
    margin: 4px 8px 4px;
  }

  .top-right-controls {
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    right: 8px;
    gap: 6px;
  }

  .server-status-controls {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 2px;
  }

  .server-status-panel .server-status-logout {
    align-self: auto;
    margin-left: 0;
  }

  .sidebar-top-right-actions {
    padding: 2px 8px 8px;
    gap: 6px;
  }

  .sidebar-top-right-actions .server-status-music {
    flex: 0 0 40px;
  }

  .sidebar-top-right-actions .server-status-logout {
    min-width: 0;
  }

  .editor-container {
    grid-column: 1;
  }

  .sidebar-resize-handle {
    display: none;
  }

  .github-preview-wrap {
    flex: 1 1 auto;
    min-width: auto;
    border-right: 0;
  }

  .github-floating-toolbar {
    display: none;
    position: fixed;
    left: 50%;
    top: auto;
    bottom: auto;
    transform: translateX(-50%);
    max-width: calc(100% - 20px);
    padding: 6px 8px;
    gap: 2px;
    border-radius: 10px;
  }

  .github-floating-toolbar.is-visible-mobile {
    display: flex;
  }

  .github-toolbar {
    gap: 2px;
    padding: 4px 6px;
    justify-content: center;
  }

  .github-tool {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .github-tool.github-tool-text {
    padding: 0 8px;
    font-size: 12px;
  }

  .github-toolbar-drag-handle {
    display: none;
  }

  .mobile-sidebar-toggle {
    display: inline-flex;
    position: fixed;
    left: calc(var(--sidebar-width) + 8px - 1px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 70;
    width: 22px;
    height: 54px;
    border: 1px solid #2a2a2a;
    border-left: 0;
    border-radius: 0 10px 10px 0;
    background: #111;
    color: #d7e8ff;
    opacity: 0.5;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.18s ease;
  }

  .app-container.mobile-sidebar-collapsed .mobile-sidebar-toggle {
    left: 0;
  }

  .mobile-sidebar-toggle:active {
    opacity: 0.9;
  }
}

/* iPhone notch support */
@supports (padding: max(0px)) {
  .header {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .sidebar { padding-bottom: env(safe-area-inset-bottom); }
}

