
:root {
  color-scheme: dark;

  --bg: #0c0c13;
  --sidebar: #11111b;
  --surface: #171722;
  --surface-2: #1d1d2b;
  --surface-3: #252538;

  --border: #303044;
  --border-light: #3b3b53;

  --text: #f4f2ff;
  --muted: #9291aa;
  --muted-2: #6e6d84;

  --primary: #9565ff;
  --primary-light: #b18aff;
  --secondary: #e96acb;

  --success: #45d6a0;
  --danger: #ff647c;
  --warning: #ffc76b;

  --radius: 12px;
  --sidebar-width: 235px;

  font-family:
    Inter,
    "Segoe UI",
    Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;

  background: var(--bg);
  color: var(--text);

  font-size: 13px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

input,
select {
  color: var(--text);
}

/* APP SHELL */

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* SIDEBAR */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);

  display: flex;
  flex-direction: column;

  padding: 22px 15px;

  background: var(--sidebar);
  border-right: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 0 8px 27px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 43px;
  height: 43px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 13px;

  background:
    linear-gradient(
      135deg,
      var(--primary),
      var(--secondary)
    );

  color: white;
  font-size: 27px;
  font-weight: 800;

  box-shadow:
    0 5px 20px rgba(149, 101, 255, 0.2);
}

.sidebar-brand h1 {
  margin: 0;

  font-size: 13px;
  font-weight: 750;
}

.sidebar-brand span {
  display: block;
  margin-top: 4px;

  color: var(--primary-light);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 2px;
}

.sidebar-section {
  margin-top: 28px;
}

.sidebar-label {
  display: block;

  margin: 0 10px 12px;

  color: var(--muted-2);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 1.2px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;

  margin-bottom: 5px;
  padding: 11px 12px;

  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;

  color: var(--muted);

  text-align: left;
  font-size: 12px;

  cursor: pointer;
  transition: 0.15s ease;
}

.nav-item span {
  width: 17px;
  font-size: 16px;
  text-align: center;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: rgba(149, 101, 255, 0.13);
  border-color: rgba(149, 101, 255, 0.2);

  color: var(--primary-light);
  font-weight: 700;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 15px 8px 0;

  border-top: 1px solid var(--border);
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;

  color: var(--muted);
  font-size: 10px;
}

.online-dot {
  width: 7px;
  height: 7px;

  border-radius: 50%;
  background: var(--success);

  box-shadow:
    0 0 9px rgba(69, 214, 160, 0.5);
}

.sidebar-version {
  display: block;
  margin-top: 10px;

  color: var(--muted-2);
  font-size: 9px;
}

/* MAIN AREA */

.main-area {
  flex: 1;
  min-width: 0;

  display: flex;
  flex-direction: column;
}

/* TOPBAR */

.topbar {
  min-height: 76px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  padding: 12px 24px;

  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  min-width: 150px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;

  color: var(--muted);
  font-size: 10px;
}

.breadcrumb strong {
  color: var(--text);
  font-weight: 600;
}

.project-title {
  margin-top: 5px;
}

.project-title input {
  width: 230px;
  max-width: 100%;

  padding: 2px 0;

  background: transparent;
  border: none;

  color: var(--text);
  font-size: 15px;
  font-weight: 750;
}

.project-title input:focus {
  outline: none;
  border-bottom: 1px solid var(--primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.top-button {
  min-height: 34px;

  padding: 7px 11px;

  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;

  color: var(--muted);
  font-size: 10px;
  font-weight: 650;

  cursor: pointer;
  transition: 0.15s ease;
}

.top-button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--text);
}

.top-button.primary {
  background: rgba(149, 101, 255, 0.15);
  border-color: rgba(149, 101, 255, 0.35);
  color: var(--primary-light);
}

.top-button.export {
  background:
    linear-gradient(
      110deg,
      var(--primary),
      #bd65e8
    );

  border-color: transparent;
  color: white;
}

/* WORKSPACE */

.workspace {
  display: grid;
  grid-template-columns:
    minmax(330px, 1fr)
    minmax(350px, 1fr);

  gap: 15px;

  padding: 18px 20px;
}

.editor-panel,
.preview-panel {
  min-width: 0;
  min-height: 500px;

  display: flex;
  flex-direction: column;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);

  overflow: hidden;
}

/* PANEL HEADER */

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;

  padding: 17px 17px 14px;

  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  margin: 0;

  font-size: 14px;
  font-weight: 750;
}

.panel-header p {
  margin: 5px 0 0;

  color: var(--muted);
  font-size: 10px;
}

.preview-badge {
  padding: 6px 8px;

  border-radius: 6px;

  background: rgba(69, 214, 160, 0.1);
  color: var(--success);

  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.8px;
}

/* EDITOR MODE */

.editor-mode {
  display: flex;
  gap: 3px;

  padding: 3px;

  background: var(--bg);
  border-radius: 8px;
}

.mode-button {
  padding: 7px 11px;

  background: transparent;
  border: none;
  border-radius: 6px;

  color: var(--muted);
  font-size: 10px;
  font-weight: 700;

  cursor: pointer;
}

.mode-button.active {
  background: var(--surface-3);
  color: var(--primary-light);
}

/* EDITOR TOOLBAR */

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;

  padding: 12px 14px;

  border-bottom: 1px solid var(--border);
}

.editor-toolbar button {
  padding: 7px 9px;

  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;

  color: var(--muted);
  font-size: 9px;
  font-weight: 650;

  cursor: pointer;
}

.editor-toolbar button:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

/* SEARCH */

.editor-search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 11px 14px;

  border-bottom: 1px solid var(--border);
}

.editor-search input {
  flex: 1;
  min-width: 0;

  padding: 8px 10px;

  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;

  color: var(--text);
  font-size: 10px;
}

.editor-search span {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

/* LYRICS CONTAINER */

.lyrics-container {
  flex: 1;
  min-height: 270px;
  max-height: 540px;

  overflow-y: auto;
  padding: 13px;
}

.lyrics-container::-webkit-scrollbar {
  width: 6px;
}

.lyrics-container::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 5px;
}

.empty-state {
  min-height: 250px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  text-align: center;
}

.empty-icon {
  width: 58px;
  height: 58px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 14px;

  background: rgba(149, 101, 255, 0.1);
  border: 1px solid rgba(149, 101, 255, 0.2);
  border-radius: 17px;

  color: var(--primary-light);
  font-size: 29px;
}

.empty-state h3 {
  margin: 0;
  font-size: 13px;
}

.empty-state p {
  max-width: 230px;

  margin: 8px 0 15px;

  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.primary-button {
  padding: 10px 14px;

  background: var(--primary);
  border: none;
  border-radius: 8px;

  color: white;
  font-size: 10px;
  font-weight: 700;

  cursor: pointer;
}

.primary-button:hover {
  filter: brightness(1.15);
}

/* EDITOR ROWS - FOR APP.JS */

.lyric-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 9px;

  margin-bottom: 9px;
  padding: 10px;

  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;

  cursor: pointer;
  transition: 0.15s ease;
}

.lyric-row:hover {
  border-color: var(--border-light);
}

.lyric-row.selected {
  background: rgba(149, 101, 255, 0.1);
  border-color: var(--primary);
}

.lyric-time {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;

  color: var(--primary-light);
  font-size: 9px;
  font-weight: 700;
}

.lyric-content {
  min-width: 0;
}

.lyric-text-input {
  width: 100%;
  min-width: 0;

  padding: 5px 6px;

  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;

  color: var(--text);
  font-size: 12px;
}

.lyric-text-input:focus {
  background: var(--bg);
  border-color: var(--primary);
  outline: none;
}

.lyric-time-inputs {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}

.lyric-time-inputs input {
  width: 75px;
  max-width: 50%;

  padding: 5px;

  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;

  color: var(--muted);
  font-size: 9px;
}

/* WORD ROW */

.word-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
}

.word-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;

  padding: 7px;

  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;

  cursor: pointer;
}

.word-chip.selected {
  background: rgba(149, 101, 255, 0.13);
  border-color: var(--primary);
}

.word-chip input {
  width: 75px;
  max-width: 100%;

  padding: 4px;

  background: transparent;
  border: none;

  color: var(--text);
  font-size: 10px;
}

.word-chip input:focus {
  outline: none;
  border-bottom: 1px solid var(--primary);
}

.word-chip small {
  color: var(--muted);
  font-size: 8px;
}

/* EDITOR FOOTER */

.editor-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;

  padding: 11px 14px;

  border-top: 1px solid var(--border);

  color: var(--muted);
  font-size: 9px;
}

/* MEDIA UPLOAD */

.media-upload-area {
  padding: 13px 15px;
}

.upload-button {
  width: 100%;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;

  padding: 12px;

  background: var(--surface-2);
  border: 1px dashed var(--border-light);
  border-radius: 9px;

  cursor: pointer;
}

.upload-button:hover {
  border-color: var(--primary);
}

.upload-icon {
  width: 32px;
  height: 32px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(149, 101, 255, 0.14);
  border-radius: 9px;

  color: var(--primary-light);
  font-size: 20px;
}

.upload-button strong {
  display: block;
  font-size: 10px;
}

.upload-button small {
  display: block;
  margin-top: 4px;

  color: var(--muted);
  font-size: 9px;
}

.media-file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  margin-top: 9px;
  padding: 9px;

  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;

  font-size: 10px;
}

.media-file-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-file-info button {
  background: transparent;
  border: none;

  color: var(--danger);
  font-size: 18px;

  cursor: pointer;
}

.media-file-info[hidden] {
  display: none;
}

/* VIDEO */

.video-container {
  position: relative;

  width: calc(100% - 30px);
  min-height: 185px;
  aspect-ratio: 16 / 9;

  margin: 0 15px;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;

  background: #050508;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.video-container video {
  width: 100%;
  height: 100%;

  object-fit: contain;
}

.video-placeholder {
  position: absolute;
  inset: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;

  background:
    radial-gradient(
      circle at center,
      #29213d,
      #09090e 75%
    );

  color: var(--muted);
}

.video-placeholder[hidden] {
  display: none;
}

.placeholder-icon {
  width: 46px;
  height: 46px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(149, 101, 255, 0.16);
  border: 1px solid rgba(149, 101, 255, 0.3);
  border-radius: 50%;

  color: var(--primary-light);
  font-size: 17px;
}

.video-placeholder strong {
  color: var(--text);
  font-size: 11px;
}

.video-placeholder span {
  font-size: 9px;
}

/* SUBTITLE OVERLAY */

.subtitle-overlay {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 12%;

  z-index: 2;

  color: white;
  text-align: center;
  font-size: 28px;
  font-weight: 750;

  text-shadow:
    0 2px 3px #000,
    0 3px 8px #000;

  pointer-events: none;
}

.subtitle-overlay.position-center {
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

.subtitle-overlay.position-top {
  top: 10%;
  bottom: auto;
}

/* PLAYER */

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;

  padding: 12px 10px 5px;
}

.player-controls button {
  padding: 6px 9px;

  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;

  color: var(--muted);
  font-size: 10px;

  cursor: pointer;
}

.player-controls button:hover {
  color: var(--text);
  border-color: var(--primary);
}

.player-controls .play-button {
  width: 34px;
  height: 34px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--primary);
  border: none;
  border-radius: 50%;

  color: white;
  font-size: 13px;
}

.time-display {
  color: var(--text);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.time-separator {
  color: var(--muted);
}

/* SEEK */

.seek-container {
  padding: 0 18px 12px;
}

.seek-container input {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

/* TIMELINE */

.timeline-section {
  margin-top: auto;
  padding: 14px 15px;

  border-top: 1px solid var(--border);
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 11px;
}

.timeline-header h3 {
  margin: 0;
  font-size: 11px;
}

.timeline-tools {
  display: flex;
  align-items: center;
  gap: 9px;

  color: var(--muted);
  font-size: 9px;
}

.timeline-tools button {
  width: 22px;
  height: 22px;

  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;

  cursor: pointer;
}

.timeline-ruler {
  display: flex;
  justify-content: space-between;

  padding: 0 3px 7px;

  color: var(--muted);
  font-size: 8px;
}

.timeline-track {
  min-height: 67px;

  display: flex;

  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;

  overflow: hidden;
}

.timeline-label {
  width: 55px;
  min-width: 55px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--surface-2);
  border-right: 1px solid var(--border);

  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
}

.timeline-content {
  position: relative;

  flex: 1;
  min-width: 0;
  min-height: 67px;

  overflow-x: auto;
}

.timeline-empty {
  height: 67px;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--muted-2);
  font-size: 9px;
}

.timeline-block {
  position: absolute;
  top: 14px;

  min-width: 4px;
  height: 35px;

  display: flex;
  align-items: center;

  overflow: hidden;

  padding: 0 6px;

  background: rgba(149, 101, 255, 0.3);
  border: 1px solid var(--primary);
  border-radius: 5px;

  color: var(--primary-light);
  font-size: 8px;

  white-space: nowrap;
  cursor: pointer;
}

.timeline-block.selected {
  background: rgba(233, 106, 203, 0.3);
  border-color: var(--secondary);
  color: #ffb8e9;
}

/* BOTTOM PANEL */

.bottom-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;

  padding: 0 20px 20px;
}

.bottom-card {
  padding: 15px;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.bottom-card-header {
  margin-bottom: 13px;
}

.bottom-card-header h3 {
  margin: 0;
  font-size: 11px;
}

/* CONTROLS */

.timing-controls,
.subtitle-settings {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.timing-controls label,
.subtitle-settings label {
  display: flex;
  flex-direction: column;
  gap: 6px;

  color: var(--muted);
  font-size: 9px;
}

.timing-controls input,
.subtitle-settings input,
.subtitle-settings select {
  width: 110px;
  max-width: 100%;

  padding: 8px;

  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;

  color: var(--text);
  font-size: 10px;
}

.subtitle-settings input[type="color"] {
  height: 34px;
  padding: 3px;
}

.timing-controls button {
  padding: 9px 12px;

  background: rgba(149, 101, 255, 0.15);
  border: 1px solid rgba(149, 101, 255, 0.3);
  border-radius: 7px;

  color: var(--primary-light);
  font-size: 9px;
  font-weight: 700;

  cursor: pointer;
}

/* DIALOG */

dialog {
  width: min(430px, calc(100% - 30px));

  padding: 0;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;

  color: var(--text);

  box-shadow:
    0 20px 70px rgba(0, 0, 0, 0.55);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 18px;

  border-bottom: 1px solid var(--border);
}

.dialog-header h2 {
  margin: 0;
  font-size: 15px;
}

.dialog-close {
  width: 29px;
  height: 29px;

  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;

  color: var(--muted);
  font-size: 18px;

  cursor: pointer;
}

dialog > p {
  margin: 16px 18px;

  color: var(--muted);
  font-size: 11px;
}

.export-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;

  padding: 0 18px 18px;
}

.export-option {
  display: flex;
  flex-direction: column;
  gap: 6px;

  padding: 13px;

  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;

  text-align: left;
  cursor: pointer;
}

.export-option:hover {
  border-color: var(--primary);
  background: rgba(149, 101, 255, 0.1);
}

.export-option strong {
  color: var(--primary-light);
  font-size: 13px;
}

.export-option span {
  color: var(--muted);
  font-size: 9px;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;

  padding: 12px 18px;

  border-top: 1px solid var(--border);
}

.secondary-button {
  padding: 8px 13px;

  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;

  color: var(--muted);
  font-size: 10px;

  cursor: pointer;
}

/* TOAST */

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;

  z-index: 100;

  max-width: min(350px, calc(100vw - 40px));

  padding: 12px 16px;

  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 9px;

  color: var(--text);
  font-size: 11px;

  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.3);

  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);

  transition: 0.2s ease;

  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* RESPONSIVE */

@media (max-width: 1050px) {
  :root {
    --sidebar-width: 190px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .editor-panel,
  .preview-panel {
    min-height: 450px;
  }
}

@media (max-width: 720px) {
  .sidebar {
    width: 60px;
    min-width: 60px;
    padding: 15px 7px;
  }

  .sidebar-brand {
    justify-content: center;
    padding: 0 0 17px;
  }

  .sidebar-brand > div:last-child,
  .sidebar-label,
  .nav-item:not(.active),
  .nav-item.active {
    font-size: 0;
  }

  .sidebar-brand h1,
  .sidebar-brand span,
  .sidebar-bottom {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 10px 5px;
  }

  .nav-item span {
    font-size: 17px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .workspace {
    padding: 12px;
  }

  .bottom-panel {
    grid-template-columns: 1fr;
    padding: 0 12px 12px;
  }
}

@media (max-width: 450px) {
  .topbar {
    padding: 12px;
  }

  .top-button {
    font-size: 9px;
  }

  .editor-toolbar button {
    flex: 1;
  }

  .panel-header {
    align-items: flex-start;
  }

  .preview-badge {
    font-size: 7px;
  }

  .player-controls {
    gap: 7px;
  }

  .time-display {
    font-size: 8px;
  }

  .subtitle-overlay {
    font-size: 20px;
  }
}
