:root {
  color-scheme: dark;
  --bg: #16151b;
  --panel: #211f29;
  --panel-2: #292632;
  --line: #3b3747;
  --line-soft: #312e3a;
  --text: #f2eff8;
  --muted: #aaa5b7;
  --accent: #8b5cf6;
  --accent-2: #6d3ee0;
  --cyan: #33c3ff;
  --good: #59d29c;
  --bad: #ff7272;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 0; min-height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 12px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  overflow: auto;
  user-select: none;
}
button, input, select { font: inherit; }
button, label, select, input[type="checkbox"], input[type="color"] { cursor: pointer; }
input[type="text"], input[type="number"] { cursor: text; user-select: text; }

.app { min-height: 100vh; padding: 10px 10px 104px; }
.app-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -10px -10px 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(22, 21, 27, .97);
}
.logo {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #7651ce;
  border-radius: 9px;
  background: linear-gradient(145deg, #8b5cf6, #4c2b9e);
  color: white;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -1px;
  box-shadow: 0 4px 16px rgba(90, 51, 178, .28);
}
.head-copy { min-width: 0; flex: 1; }
.title { font-size: 14px; font-weight: 700; white-space: nowrap; }
.subtitle { color: var(--muted); font-size: 10px; }
.edition {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
}
.edition.pro { border-color: #7952d4; color: #d8c7ff; }
.header-icon { width: 29px; height: 29px; padding: 5px; position: relative; }
.header-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.notification-badge { position: absolute; right: -4px; top: -5px; min-width: 15px; padding: 0 3px; background: var(--accent); color: white; border-radius: 9px; font-size: 9px; }
.overlay[hidden], [hidden] { display: none !important; }
.overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 12px; overflow: auto; background: rgba(10,8,15,.9); }
.notification-overlay { z-index: 210; }
.dialog { width: 100%; max-width: 500px; max-height: calc(100vh - 24px); overflow: auto; padding: 15px; border: 1px solid #59416e; border-radius: 10px; background: var(--panel); box-shadow: 0 20px 55px #0009; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialog h2 { font-size: 15px; margin: 0; }
.dialog p { color: var(--muted); line-height: 1.6; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.dialog-note { font-size: 10px; }
.license-locked .card, .license-locked .bottom-dock { pointer-events: none; opacity: .4; }
.notification-banner { display: flex; align-items: flex-start; gap: 8px; padding: 9px; margin: 0 0 9px; border: 1px solid #6d5290; border-radius: 7px; background: #30223f; }
.notification-banner > div { flex: 1; min-width: 0; }
.notification-banner p { margin: 4px 0; color: var(--muted); }
.notifications-list { display: grid; gap: 8px; max-height: 58vh; overflow: auto; }
.notification-item { border: 1px solid var(--line); border-radius: 7px; padding: 10px; }
.notification-item.unread { border-color: var(--accent); }
.notification-item h3 { margin: 6px 0; font-size: 12px; }
.notification-item p { margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.notification-meta { color: var(--muted); font-size: 9px; text-transform: uppercase; }

.card {
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: visible;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line-soft);
  color: #e8e3f3;
  font-weight: 700;
}
.collapsible-head { padding: 0; }
.card-collapse-toggle {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  color: #e8e3f3;
  font-weight: 700;
  text-align: left;
}
.card-collapse-toggle:hover { background: rgba(255, 255, 255, .025); }
.card-collapse-toggle:focus { outline: 0; box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .48); }
.collapse-label { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.collapse-chevron { color: #8f889b; transition: transform .15s ease; }
.card-collapse-toggle[aria-expanded="true"] .collapse-chevron { transform: rotate(180deg); }
.collapsible-card.collapsed .card-head { border-bottom-color: transparent; }
.collapsible-card.collapsed .card-collapse-toggle { border-radius: var(--radius); }
.card-body[hidden] { display: none !important; }
.card-body { padding: 9px; }
.card-note { color: var(--muted); font-size: 10px; font-weight: 400; }

.grid4, .grid3, .grid2 { display: grid; gap: 7px; }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: grid; gap: 7px; }
.field { min-width: 0; }
.field > label, .field-title {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
input[type="text"], input[type="number"], select, .blend-button, .theme-select-button, .preset-name {
  width: 100%;
  min-width: 0;
  height: 29px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: #17161c;
  color: var(--text);
}
input:focus, select:focus, .blend-button:focus, .theme-select-button:focus { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(139, 92, 246, .28); }
input.invalid { border-color: var(--bad); }
input[type="checkbox"] { width: 14px; height: 14px; margin: 0 6px 0 0; accent-color: var(--accent); vertical-align: -2px; }
.checks { display: flex; flex-wrap: wrap; gap: 7px 12px; }
.check { display: inline-flex; align-items: center; color: #d8d3e2; min-height: 22px; }
.check.disabled { opacity: .4; }

.btn {
  min-height: 29px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #2a2733;
  color: var(--text);
  font-weight: 600;
}
.btn:hover { border-color: #625b72; background: #322e3e; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  border-color: #8d64eb;
  background: linear-gradient(180deg, #8b5cf6, #7042db);
  color: white;
}
.btn.primary:hover { background: linear-gradient(180deg, #9b71fa, #7c4ce7); }
.btn.ghost { background: transparent; }
.btn.tiny { min-height: 24px; padding: 3px 7px; font-size: 10px; }
.wide { width: 100%; min-height: 36px; }
.action-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; }

.status {
  min-height: 30px;
  margin-top: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #121116;
  color: var(--muted);
  word-break: break-word;
}
.status.success { border-color: rgba(89, 210, 156, .35); color: var(--good); }
.status.error { border-color: rgba(255, 114, 114, .42); color: var(--bad); }

.upgrade {
  padding: 9px;
  border: 1px solid #473b64;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(139, 92, 246, .11), rgba(51, 195, 255, .04));
  color: #c8c0d8;
  font-size: 10px;
}

.theme-select { position: relative; min-width: 0; }
.theme-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  text-align: left;
}
.theme-select-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-select-chevron { color: #8f889b; transition: transform .15s ease; }
.theme-select-button[aria-expanded="true"] .theme-select-chevron { transform: rotate(180deg); }
.theme-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 190px;
  overflow: auto;
  padding: 4px;
  border: 1px solid #514b5e;
  border-radius: 7px;
  background: #1d1b23;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
}
.theme-select-menu.hidden { display: none; }
.theme-select-option {
  width: 100%;
  min-height: 27px;
  padding: 4px 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #ddd7e8;
  text-align: left;
}
.theme-select-option:hover { background: #302b3b; color: white; }
.theme-select-option.active { background: rgba(139, 92, 246, .22); color: #e7dcff; font-weight: 700; }

.gradient-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 28px minmax(0, 1fr); gap: 7px; align-items: end; }
.color-field { min-width: 0; }
.color-pair { display: grid; grid-template-columns: 29px 1fr; gap: 5px; }
input[type="color"] { width: 29px; height: 29px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: #17161c; }
.gradient-row.disabled .color-field, .gradient-row.disabled .swap { opacity: .38; }

.sound-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.sound-card {
  position: relative;
  min-width: 0;
  height: 55px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #18171e;
  color: var(--muted);
  overflow: hidden;
}
.sound-card:hover { border-color: #6f6190; background: #211e2b; }
.sound-card.selected { border-color: var(--accent); color: white; box-shadow: inset 0 0 0 1px rgba(139,92,246,.3); }
.sound-card input { position: absolute; opacity: 0; pointer-events: none; }
.sound-check { position: absolute; top: 3px; right: 4px; opacity: 0; color: #d9ccff; font-size: 10px; }
.sound-card.selected .sound-check { opacity: 1; }
.wave { height: 16px; display: flex; gap: 2px; align-items: center; }
.wave i { width: 2px; border-radius: 2px; background: currentColor; }
.wave i:nth-child(1), .wave i:nth-child(5) { height: 5px; }
.wave i:nth-child(2), .wave i:nth-child(4) { height: 11px; }
.wave i:nth-child(3) { height: 16px; }
.sound-name { font-size: 9px; font-weight: 700; }
.sound-options { margin-top: 7px; }

.preview-stage {
  position: relative;
  min-height: 94px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px solid #373242;
  border-radius: 7px;
  background:
    linear-gradient(45deg, #1b1a20 25%, transparent 25%),
    linear-gradient(-45deg, #1b1a20 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1b1a20 75%),
    linear-gradient(-45deg, transparent 75%, #1b1a20 75%), #141319;
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  overflow: hidden;
}
.preview-toolbar { display: flex; justify-content: flex-end; margin-bottom: 7px; }
.preview-value {
  max-width: 100%;
  color: white;
  font-size: 34px;
  font-weight: 700;
  text-align: center;
  white-space: pre;
  line-height: 1.05;
}
.preview-time { position: absolute; right: 6px; bottom: 4px; color: #777183; font-size: 9px; }

.edit-state { margin-bottom: 7px; padding: 7px 8px; border-radius: 6px; background: #18171e; color: var(--muted); }
.edit-state.editing { color: #d9ccff; border-left: 2px solid var(--accent); }

.preset-controls { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.preset-list { display: grid; gap: 5px; margin-top: 7px; }
.preset-item { display: grid; grid-template-columns: 1fr auto; gap: 5px; }
.preset-item .btn:first-child { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); font-size: 10px; padding: 4px 0; }

.options-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.option-item {
  width: 100%;
  min-height: 31px;
  padding: 4px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #1a181f;
}
.option-item.check { display: flex; justify-content: flex-start; }
.option-item:hover { border-color: #50495d; background: #211e28; }
.option-with-input { display: grid; grid-template-columns: minmax(0, 1fr) 58px; gap: 7px; align-items: center; }
.option-with-input input[type="number"] { height: 25px; text-align: center; }
.blend-option-row { grid-column: 1 / -1; display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 7px; align-items: center; }

.blend-wrap { position: relative; min-width: 150px; width: min(210px, 100%); }
.blend-button { display: flex; align-items: center; justify-content: space-between; text-align: left; }
.blend-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 4px);
  z-index: 50;
  max-height: 220px;
  overflow: auto;
  padding: 4px;
  border: 1px solid #514b5e;
  border-radius: 7px;
  background: #1d1b23;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.blend-menu.hidden { display: none; }
.blend-row { display: grid; grid-template-columns: 1fr 27px; gap: 3px; align-items: center; }
.blend-choice, .blend-pin {
  min-height: 25px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #ddd7e8;
}
.blend-choice { text-align: left; padding: 4px 6px; }
.blend-pin { color: #81798e; padding: 0; }
.blend-row:hover { background: #2a2733; }
.blend-row.active .blend-choice { color: white; font-weight: 700; }
.blend-pin.pinned { color: #c8adff; }
.blend-divider { height: 1px; margin: 4px 2px; background: var(--line); }
.post-items-option { grid-column: 1 / -1; display: block; overflow: visible; }
.post-items-option-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; flex-wrap: wrap; }
.post-items-picker-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.post-items-selected { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.post-items-selected.disabled { opacity: .5; }
.post-item-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 6px; border: 1px solid #55406f; border-radius: 5px; background: #2c233c; }
.post-item-chip > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.post-item-chip button { border: 0; background: transparent; color: #c9b7e2; font-size: 15px; padding: 0 2px; }
.post-items-count {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 99px;
  background: #292532;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}
.post-items-count.has-items { background: rgba(139, 92, 246, .22); color: #e7dcff; }
.post-items-body { margin-top: 7px; padding: 7px; border: 1px solid var(--line); border-radius: 6px; background: #1b1822; }
.post-items-body.hidden { display: none; }
.post-items-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto 29px; gap: 5px; padding-top: 7px; }
.post-items-tools .btn { min-width: 0; }
.post-items-tools .icon-btn { width: 29px; padding: 3px; font-size: 15px; line-height: 1; }
.post-items-list {
  max-height: 230px;
  margin-top: 6px;
  overflow: auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #15141a;
}
.post-item-row {
  min-height: 31px;
  display: grid;
  grid-template-columns: 14px 46px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 4px 5px;
  border-radius: 4px;
  color: #ddd7e8;
}
.post-item-row:hover { background: #2a2733; }
.post-item-row.selected { background: rgba(139, 92, 246, .13); color: white; }
.post-item-row input { margin: 0; }
.post-item-kind {
  padding: 2px 4px;
  border: 1px solid #494253;
  border-radius: 4px;
  color: #aaa3b8;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
}
.post-item-row.selected .post-item-kind { border-color: #7651ce; color: #d9ccff; }
.post-item-copy { min-width: 0; }
.post-item-name, .post-item-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-item-name { font-size: 10px; font-weight: 650; }
.post-item-meta { color: #817b8d; font-size: 8px; }
.post-items-list .empty { padding: 8px 6px; }
.post-items-list .error-text { color: var(--bad); }
.hidden { display: none !important; }
.native-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pro-actions { display: flex; flex-wrap: wrap; align-items: stretch; }
.pro-actions #counterCreateBtn { flex: 1 1 150px; }
.pro-actions .btn:not(#counterCreateBtn) { flex: 0 0 auto; }
.pro-actions .wide { width: auto; }

.bottom-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  background: rgba(22, 21, 27, .98);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, .28);
}
.bottom-dock .status { min-height: 27px; margin-top: 6px; padding: 5px 8px; }

@media (max-width: 390px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gradient-row { grid-template-columns: auto 1fr 28px 1fr; }
  .gradient-row > .field-title { display: none; }
  .sound-grid { grid-template-columns: repeat(3, 1fr); }
  .blend-option-row { grid-template-columns: 105px minmax(0, 1fr); }
  .option-item { padding-left: 5px; padding-right: 5px; font-size: 11px; }
}
