:root {
  --menu-height: 66px;
  --message-height: 50px;
  --player-pane-width: 212px;
  --bg: #07141f;
  --panel: #0f2231;
  --panel-2: #132b3d;
  --panel-3: #18384f;
  --text: #eef6ff;
  --muted: #9eb8cc;
  --accent: #61d6ff;
  --accent-strong: #3ec5ff;
  --danger: #ff7f7f;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  --radius: 16px;
  --scrollbar-size: 12px;
  --scrollbar-track: rgba(255, 255, 255, 0.06);
  --scrollbar-track-edge: rgba(97, 214, 255, 0.08);
  --scrollbar-thumb: rgba(97, 214, 255, 0.5);
  --scrollbar-thumb-strong: rgba(62, 197, 255, 0.82);
  --scroll-shell-padding: 2px;
  --scroll-shell-rail-width: 10px;
  --menu-aqua-bg:
    linear-gradient(135deg, rgba(54, 198, 236, 0.42), rgba(94, 221, 247, 0.34) 48%, rgba(174, 243, 255, 0.24));
  --menu-aqua-border: rgba(168, 241, 255, 0.34);
  --player-pane-yellow-bg:
    radial-gradient(circle at top left, rgba(255, 249, 181, 0.1), transparent 48%),
    linear-gradient(180deg, rgba(255, 234, 127, 0.08), rgba(255, 203, 66, 0.05));
  --player-pane-yellow-border: rgba(255, 236, 128, 0.12);
  --player-pane-yellow-panel:
    linear-gradient(180deg, rgba(83, 57, 0, 0.06), rgba(54, 37, 0, 0.03)),
    rgba(255, 223, 92, 0.04);
  --player-pane-yellow-frame: rgba(104, 70, 0, 0.04);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(circle at top left, rgba(97, 214, 255, 0.14), transparent 35%),
    linear-gradient(180deg, #0b1a27 0%, #07141f 100%);
  color: var(--text);
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
}

body {
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

button,
input {
  font: inherit;
}

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

#background-player-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

#background-player-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(7, 20, 31, 0.22), transparent 35%),
    linear-gradient(180deg, rgba(7, 20, 31, 0.28), rgba(7, 20, 31, 0.72));
}

#app {
  height: 100vh;
  display: grid;
  grid-template-rows: var(--menu-height) minmax(0, 1fr) auto;
  position: relative;
  z-index: 1;
}

#menu-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 18px 6px;
  border-bottom: 1px solid var(--menu-aqua-border);
  background: var(--menu-aqua-bg);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 -1px 0 rgba(4, 67, 90, 0.14);
}

.menu-group {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.menu-group--search {
  flex: 1 1 auto;
  justify-content: flex-end;
}

#volume-range {
  width: 180px;
}

.volume-slider-shell {
  position: relative;
  display: flex;
  align-items: center;
  width: 184px;
  min-width: 184px;
  height: 42px;
  padding: 0 14px 0 14px;
  overflow: visible;
}

.volume-slider-shell__backdrop {
  position: absolute;
  inset: 0 0 0 6px;
  border: 1px solid rgba(230, 234, 238, 0.12);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(232, 236, 240, 0.08), rgba(126, 135, 145, 0.06) 58%),
    rgba(82, 89, 98, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 24px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
  pointer-events: none;
  z-index: 0;
}

.volume-slider-shell::before {
  content: "\1F50A";
  position: absolute;
  left: 40px;
  top: 50%;
  transform: translate(-24%, -50%);
  font-size: 2.2rem;
  line-height: 1;
  opacity: 0.3;
  color: rgba(238, 241, 244, 0.88);
  pointer-events: none;
  z-index: 1;
}

.volume-slider-shell::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 50%;
  height: 18px;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  background:
    linear-gradient(90deg, rgba(236, 239, 242, 0.32), rgba(153, 162, 172, 0.68)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(92, 100, 109, 0.22));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 14px rgba(130, 138, 148, 0.12);
  opacity: 0.82;
  pointer-events: none;
  z-index: 2;
}

#volume-range {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

#volume-range:focus {
  outline: none;
}

#volume-range::-webkit-slider-runnable-track {
  height: 18px;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

#volume-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95), rgba(203, 242, 255, 0.78) 42%, rgba(62, 197, 255, 0.82) 100%);
  box-shadow:
    0 0 0 4px rgba(97, 214, 255, 0.14),
    0 10px 22px rgba(0, 0, 0, 0.22);
}

#volume-range::-moz-range-track {
  height: 18px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#volume-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95), rgba(203, 242, 255, 0.78) 42%, rgba(62, 197, 255, 0.82) 100%);
  box-shadow:
    0 0 0 4px rgba(97, 214, 255, 0.14),
    0 10px 22px rgba(0, 0, 0, 0.22);
}

#volume-range::-moz-range-progress {
  height: 18px;
  border: none;
  border-radius: 0;
  background: transparent;
}

#search-input,
#overlap-toggle,
#stop-all-button,
#caption-toggle,
#edit-toggle {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.015);
  color: var(--text);
}

#menu-bar #search-input,
#menu-bar #overlap-toggle:not([aria-pressed="true"]),
#menu-bar #caption-toggle:not([aria-pressed="true"]),
#menu-bar #edit-toggle:not([aria-pressed="true"]) {
  border-color: rgba(7, 72, 96, 0.26);
  background: rgba(5, 48, 66, 0.28);
  color: #f3fcff;
}

#search-input {
  flex: 1 1 100px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 12px 18px;
}

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

#menu-bar #search-input::placeholder {
  color: rgba(225, 248, 255, 0.76);
}

.scroll-shell--player .player-section__title {
  color: rgba(80, 57, 0, 0.72);
}

#overlap-toggle,
#stop-all-button,
#caption-toggle,
#edit-toggle {
  position: relative;
  overflow: hidden;
  padding: 11px 18px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.menu-button__label {
  position: relative;
  z-index: 1;
}

#overlap-toggle::before,
#stop-all-button::before,
#caption-toggle::before,
#edit-toggle::before {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  font-size: 2.3rem;
  line-height: 1;
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

#overlap-toggle::before {
  content: "♫";
  color: rgba(160, 238, 255, 0.88);
}

#stop-all-button::before {
  content: "■";
  color: rgba(255, 239, 239, 0.84);
}

#caption-toggle::before {
  content: "\5B57";
  color: rgba(185, 255, 222, 0.84);
}

#edit-toggle::before {
  content: "\270E";
  color: rgba(255, 221, 176, 0.84);
}

#overlap-toggle:hover,
#stop-all-button:hover,
#caption-toggle:hover,
#edit-toggle:hover,
.clip-button:hover {
  transform: translateY(-1px);
}

#menu-bar button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

#overlap-toggle[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(97, 214, 255, 0.5), rgba(62, 197, 255, 0.34));
  color: #07202d;
  border-color: transparent;
}

#overlap-toggle[aria-pressed="true"]::before {
  color: rgba(7, 32, 45, 0.48);
}

#stop-all-button {
  background: linear-gradient(135deg, rgba(190, 40, 48, 0.3), rgba(134, 18, 28, 0.46));
  border-color: rgba(255, 126, 126, 0.42);
  color: #fff1f1;
}

#stop-all-button:hover {
  background: linear-gradient(135deg, rgba(211, 48, 58, 0.38), rgba(157, 22, 34, 0.56));
  border-color: rgba(255, 156, 156, 0.58);
}

#stop-all-button:hover::before {
  color: rgba(255, 248, 248, 0.94);
}

#caption-toggle[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(129, 240, 196, 0.66), rgba(70, 210, 174, 0.38));
  color: #06271f;
  border-color: transparent;
}

#caption-toggle[aria-pressed="true"]::before {
  color: rgba(6, 39, 31, 0.42);
}

#edit-toggle[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(255, 210, 122, 0.72), rgba(255, 176, 92, 0.42));
  color: #2a1905;
  border-color: transparent;
}

#edit-toggle[aria-pressed="true"]::before {
  content: "\1F4BE";
  color: rgba(42, 25, 5, 0.42);
}

#main-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: var(--player-pane-width) minmax(0, 1fr);
  overflow: hidden;
}

.scroll-shell {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.scroll-shell--player {
  border-right: 1px solid var(--player-pane-yellow-border);
  background: var(--player-pane-yellow-bg);
  box-shadow: inset -1px 0 0 rgba(106, 70, 0, 0.16);
}

.scroll-shell__scroller {
  height: 100%;
  min-height: 0;
  scrollbar-width: none;
}

.scroll-shell__scroller::-webkit-scrollbar {
  width: 0;
  height: 0;
}

#player-pane {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 0 var(--scroll-shell-rail-width);
}

#player-pane section {
  display: grid;
  gap: 0;
  padding: 0;
}

.player-section__title {
  margin: 0;
  padding: 0 12px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.player-section__body {
  display: grid;
  gap: 0;
  position: relative;
}

.player-card {
  width: 200px;
  margin: 0;
  border: 1px solid var(--player-pane-yellow-border);
  border-radius: 0;
  overflow: hidden;
  background: var(--player-pane-yellow-panel);
  box-shadow: var(--shadow);
}

#pool-ready-section {
  position: absolute;
  left: -9999px;
  top: 0;
  width: var(--player-pane-width);
  padding: 0;
  pointer-events: none;
}

.player-card--parked {
  position: absolute;
  left: -9999px;
  top: 0;
  pointer-events: none;
}

.player-card__meta {
  padding: 0;
  display: grid;
  gap: 0;
  background: rgba(78, 52, 0, 0.22);
}

.player-card__title {
  font-size: 0.9rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-card__status {
  font-size: 0.78rem;
  color: var(--muted);
}

.player-card__frame {
  width: 200px;
  height: 200px;
  background: var(--player-pane-yellow-frame);
}

.player-card__frame iframe {
  opacity: 0.52;
}

#player-pane iframe {
  opacity: 0.52;
}

.player-card__preview {
  width: 100%;
  height: 200px;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
  line-height: 1.5;
  color: rgba(255, 249, 223, 0.9);
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 236, 128, 0.42), transparent 42%),
    linear-gradient(180deg, rgba(102, 70, 0, 0.52), rgba(54, 37, 0, 0.38)),
    rgba(255, 219, 88, 0.58);
}

.player-card__preview::before {
  content: "BACKGROUND";
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: rgba(255, 241, 166, 0.92);
}

.background-player__mount {
  position: absolute;
  inset: 0;
}

#background-player-layer iframe {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 177.77777778vh !important;
  height: 56.25vw !important;
  min-width: 100% !important;
  min-height: 100% !important;
  border: none !important;
  opacity: 0.82;
  filter: saturate(0.92) brightness(0.56);
}

.player-card--ready .player-card__status {
  color: var(--accent);
}

.player-card--playing .player-card__status {
  color: #a7ffcf;
}

.player-card--error .player-card__status {
  color: var(--danger);
}

#button-grid {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 30px 18px 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 12px;
}

.scroll-shell__rail {
  position: absolute;
  top: var(--scroll-shell-padding);
  right: var(--scroll-shell-padding);
  bottom: var(--scroll-shell-padding);
  width: var(--scroll-shell-rail-width);
  border-radius: 999px;
  background:
    linear-gradient(180deg, var(--scrollbar-track-edge), transparent 24%, transparent 76%, var(--scrollbar-track-edge)),
    var(--scrollbar-track);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(7, 20, 31, 0.28);
  pointer-events: auto;
  transition: opacity 140ms ease;
}

.scroll-shell__thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 28px;
  border-radius: 999px;
  border: 2px solid rgba(7, 20, 31, 0.4);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 22%),
    linear-gradient(180deg, rgba(62, 197, 255, 0.46), rgba(97, 214, 255, 0.22));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.1),
    0 0 10px rgba(62, 197, 255, 0.08);
  transition:
    height 180ms ease,
    transform 180ms ease,
    background 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
  touch-action: none;
  opacity: 0.64;
}

.scroll-shell--inactive .scroll-shell__rail {
  opacity: 1;
  pointer-events: none;
}

.scroll-shell--inactive .scroll-shell__thumb {
  opacity: 0.56;
  border-color: rgba(7, 20, 31, 0.3);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(62, 197, 255, 0.38), rgba(97, 214, 255, 0.18));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.08),
    0 0 8px rgba(62, 197, 255, 0.07);
}

.scroll-shell__thumb:hover,
.scroll-shell--dragging .scroll-shell__thumb {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 22%),
    linear-gradient(180deg, rgba(140, 232, 255, 0.74), rgba(62, 197, 255, 0.48));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.16),
    0 0 16px rgba(62, 197, 255, 0.14);
  opacity: 0.88;
}

.scroll-shell--player .scroll-shell__rail {
  left: 1px;
  right: auto;
}

.clip-button {
  flex: 0 1 auto;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    linear-gradient(135deg, rgba(97, 214, 255, 0.08), transparent 60%);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  display: inline-flex;
  align-items: center;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.clip-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.clip-button:not(.clip-button--members) {
  border-color: rgba(117, 223, 255, 0.38);
  background:
    linear-gradient(180deg, rgba(196, 244, 255, 0.16), rgba(97, 214, 255, 0.05)),
    linear-gradient(135deg, rgba(97, 214, 255, 0.2), rgba(62, 197, 255, 0.04) 72%);
  color: #eefcff;
}

.clip-button__title {
  display: block;
  max-width: 100%;
  min-width: 0;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-button__body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.clip-button__meta-line {
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--muted);
  word-break: break-all;
}

.clip-button__preview-badge {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(238, 246, 255, 0.92);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}

.clip-button--preview {
  width: 100%;
  min-height: 72px;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
}

.clip-button--editing {
  width: var(--clip-edit-button-width, fit-content);
  max-width: 100%;
  min-height: 120px;
  padding: 8px 10px;
  display: grid;
  align-items: stretch;
  gap: 5px;
  cursor: pointer;
}

.clip-button--width-probe {
  position: absolute;
  left: -9999px;
  top: -9999px;
  visibility: hidden;
  pointer-events: none;
  transform: none !important;
}

.clip-button--new {
  border-style: dashed;
  border-color: rgba(255, 210, 122, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 224, 127, 0.13), rgba(255, 193, 79, 0.04)),
    linear-gradient(135deg, rgba(255, 221, 120, 0.16), transparent 62%);
}

.clip-button--invalid {
  border-color: rgba(255, 127, 127, 0.38);
}

.clip-button--delete-pending {
  border-color: rgba(255, 127, 127, 0.5);
  background:
    linear-gradient(180deg, rgba(255, 127, 127, 0.14), rgba(255, 127, 127, 0.04)),
    linear-gradient(135deg, rgba(255, 127, 127, 0.12), transparent 62%);
}

.clip-button__edit-title-row {
  min-width: 0;
  display: block;
}

.clip-button__title-input,
.clip-button__edit-input {
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 20, 31, 0.22);
  color: var(--text);
}

.clip-button__title-input {
  width: 100%;
  max-width: 100%;
  padding: 5px 5px;
  border-radius: 10px;
  font-weight: 700;
}

.clip-button__edit-input {
  padding: 4px 6px;
  border-radius: 9px;
  font-size: 0.74rem;
}

.clip-button__number-stepper {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.clip-button__number-stepper .clip-button__edit-input {
  padding-right: 21px;
  appearance: textfield;
  -moz-appearance: textfield;
}

.clip-button__number-stepper .clip-button__edit-input::-webkit-inner-spin-button,
.clip-button__number-stepper .clip-button__edit-input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.clip-button__stepper-controls {
  position: absolute;
  top: 2px;
  right: 2px;
  bottom: 2px;
  width: 14px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  pointer-events: auto;
}

.clip-button__stepper-button {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(152, 230, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(203, 246, 255, 0.24), rgba(97, 214, 255, 0.1)),
    rgba(7, 20, 31, 0.42);
  color: rgba(227, 249, 255, 0.92);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.clip-button__stepper-button--up {
  border-radius: 7px 7px 3px 3px;
}

.clip-button__stepper-button--down {
  border-radius: 3px 3px 7px 7px;
}

.clip-button__stepper-button::before {
  content: "";
  width: 0;
  height: 0;
  border-right: 3px solid transparent;
  border-left: 3px solid transparent;
}

.clip-button__stepper-button--up::before {
  border-bottom: 4px solid currentColor;
}

.clip-button__stepper-button--down::before {
  border-top: 4px solid currentColor;
}

.clip-button__stepper-button:hover,
.clip-button__stepper-button:focus-visible {
  border-color: rgba(160, 238, 255, 0.5);
  background:
    linear-gradient(180deg, rgba(203, 246, 255, 0.34), rgba(97, 214, 255, 0.2)),
    rgba(7, 20, 31, 0.54);
}

.clip-button__stepper-button:active {
  transform: scale(0.92);
}

.clip-button__edit-input[data-draft-field="startSeconds"],
.clip-button__edit-input[data-draft-field="durationSeconds"] {
  text-align: right;
}

.clip-button__title-input:focus,
.clip-button__edit-input:focus {
  outline: none;
  border-color: rgba(97, 214, 255, 0.56);
  box-shadow: 0 0 0 3px rgba(97, 214, 255, 0.12);
}

.clip-button__preview-hint {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(238, 246, 255, 0.88);
  font-size: 0.68rem;
  font-weight: 700;
}

.clip-button__edit-fields {
  width: 100%;
  max-width: 100%;
  display: grid;
  gap: 4px;
}

.clip-button__edit-field {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 4px;
}

.clip-button__edit-field--with-action {
  grid-template-columns: minmax(0, 1fr) auto;
}

.clip-button__edit-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.clip-button__edit-checkbox {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 9px;
  background: rgba(7, 20, 31, 0.2);
  color: var(--muted);
  font-size: 0.68rem;
  cursor: pointer;
}

.clip-button__edit-checkbox input {
  width: 13px;
  height: 13px;
  margin: 0;
}

.clip-button--members {
  border-color: rgba(255, 211, 95, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 224, 127, 0.16), rgba(255, 193, 79, 0.05)),
    linear-gradient(135deg, rgba(255, 221, 120, 0.18), transparent 60%);
}

.clip-button--members .clip-button__title {
  color: #fff0bf;
}

.clip-button--members .clip-button__title-input {
  color: #fff0bf;
}

.clip-button--active:not(.clip-button--members) {
  border-color: rgba(97, 214, 255, 0.55);
  background:
    linear-gradient(180deg, rgba(210, 248, 255, 0.22), rgba(97, 214, 255, 0.09)),
    linear-gradient(135deg, rgba(97, 214, 255, 0.28), rgba(62, 197, 255, 0.1) 72%);
}

.clip-editor-card {
  flex: 0 1 340px;
  width: min(340px, 100%);
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background:
    radial-gradient(circle at top left, rgba(97, 214, 255, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
    rgba(8, 19, 30, 0.42);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.clip-editor-card--new {
  border-color: rgba(255, 210, 122, 0.28);
  background:
    radial-gradient(circle at top left, rgba(255, 196, 96, 0.16), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
    rgba(8, 19, 30, 0.42);
}

.clip-editor-card__fields {
  display: grid;
  gap: 10px;
}

.clip-editor-card__field {
  display: grid;
  gap: 6px;
}

.clip-editor-card__field-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.clip-editor-card__input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.clip-editor-card__input:focus {
  outline: none;
  border-color: rgba(97, 214, 255, 0.54);
  box-shadow: 0 0 0 3px rgba(97, 214, 255, 0.12);
}

.clip-editor-card__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
}

.clip-editor-card__checkbox input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.clip-editor-card__actions {
  display: flex;
  justify-content: flex-end;
}

.clip-editor-card__action {
  min-width: 88px;
  padding: 10px 16px;
  border: 1px solid rgba(97, 214, 255, 0.24);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(97, 214, 255, 0.28), rgba(62, 197, 255, 0.14)),
    rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.clip-editor-card__action:hover {
  transform: translateY(-1px);
  border-color: rgba(97, 214, 255, 0.38);
  background:
    linear-gradient(135deg, rgba(97, 214, 255, 0.36), rgba(62, 197, 255, 0.18)),
    rgba(255, 255, 255, 0.07);
}

.clip-editor-card__action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.button-grid__empty {
  flex: 1 1 100%;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.button-grid__notice {
  flex: 1 1 100%;
  padding: 12px 16px;
  border: 1px solid rgba(129, 240, 196, 0.22);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(129, 240, 196, 0.1), transparent 64%),
    rgba(8, 19, 30, 0.2);
  color: rgba(229, 255, 244, 0.92);
  text-align: center;
}

.button-context-menu {
  position: fixed;
  z-index: 70;
  min-width: 220px;
  padding: 7px;
  border: 1px solid rgba(165, 238, 255, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(18, 50, 67, 0.42), rgba(8, 25, 38, 0.32)),
    rgba(7, 20, 31, 0.34);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  transform: translateY(-4px) scale(0.98);
  transform-origin: top left;
  opacity: 0;
  transition: opacity 90ms ease, transform 90ms ease;
}

.button-context-menu[hidden] {
  display: none;
}

.button-context-menu--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.button-context-menu__item {
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: rgba(238, 246, 255, 0.94);
  cursor: pointer;
  text-align: left;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.button-context-menu__item + .button-context-menu__item {
  margin-top: 3px;
}

.button-context-menu__item:hover,
.button-context-menu__item:focus-visible {
  border-color: rgba(97, 214, 255, 0.24);
  background:
    linear-gradient(135deg, rgba(97, 214, 255, 0.12), rgba(62, 197, 255, 0.05)),
    rgba(255, 255, 255, 0.03);
  outline: none;
}

.button-context-menu__item:active {
  transform: scale(0.98);
}

.button-context-menu__item--primary {
  color: #e9fff6;
  background:
    linear-gradient(135deg, rgba(129, 240, 196, 0.1), rgba(70, 210, 174, 0.04)),
    rgba(255, 255, 255, 0.02);
}

#message-bar {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  width: min(420px, calc(100vw - 36px));
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  pointer-events: none;
}

#message-bar.message-bar--visible {
  display: flex;
}

.message-bar__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(8, 19, 30, 0.26);
  color: var(--text);
  line-height: 1.45;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.message-bar__text {
  min-width: 0;
}

.message-bar__item--info {
  border-color: rgba(97, 214, 255, 0.24);
  background:
    linear-gradient(135deg, rgba(97, 214, 255, 0.12), transparent 65%),
    rgba(8, 19, 30, 0.26);
}

.message-bar__item--error {
  border-color: rgba(255, 127, 127, 0.32);
  background:
    linear-gradient(135deg, rgba(255, 127, 127, 0.14), transparent 65%),
    rgba(8, 19, 30, 0.26);
  color: #ffd0d0;
}

.message-bar__close {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(238, 246, 255, 0.86);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.message-bar__close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

@media (max-width: 680px) {
  #app {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  #menu-bar {
    flex-direction: column;
    align-items: stretch;
    height: auto;
  }

  .menu-group,
  .menu-group--search {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .player-section__title {
    display: none;
  }
}
