:root {
  --bg: #060d18;
  --panel: rgba(8, 19, 37, 0.88);
  --panel-border: rgba(131, 239, 255, 0.18);
  --text: #ecf4ff;
  --muted: #97a9c4;
  --accent: #00d1ff;
  --accent2: #80ff8d;
  --danger: #ff6b86;
  --radius-lg: 24px;
  --radius-md: 14px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(circle at 5% 5%, rgba(0, 209, 255, 0.15), transparent 30%),
    radial-gradient(circle at 94% 7%, rgba(128, 255, 141, 0.15), transparent 34%),
    linear-gradient(160deg, #02060f 0%, #071024 45%, #08172d 100%);
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

.ambient {
  position: fixed;
  pointer-events: none;
  filter: blur(72px);
  border-radius: 999px;
  z-index: 0;
}

.ambient-a {
  right: -120px;
  top: -140px;
  width: 330px;
  height: 330px;
  background: rgba(0, 209, 255, 0.3);
}

.ambient-b {
  left: -130px;
  bottom: -170px;
  width: 340px;
  height: 340px;
  background: rgba(128, 255, 141, 0.22);
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(250px, 300px) 1fr;
  gap: 20px;
  padding: 20px;
}

.sidebar,
.main-panel {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(9px);
}

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

.brand {
  border-radius: 16px;
  border: 1px solid rgba(128, 255, 141, 0.24);
  background: linear-gradient(140deg, rgba(10, 34, 59, 0.94), rgba(9, 43, 33, 0.76));
  padding: 12px;
}

.brand-kicker {
  color: var(--accent2);
  letter-spacing: 0.15em;
  font-size: 0.7rem;
  margin-bottom: 6px;
}

.brand h1 {
  font-family: "Sora", sans-serif;
  font-size: 1.36rem;
}

.viewer-name {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 6px;
}

.sidebar-card {
  border: 1px solid rgba(151, 169, 196, 0.2);
  border-radius: 14px;
  background: rgba(9, 22, 42, 0.72);
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subtle p {
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.9rem;
}

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

.preset-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-item-btn {
  width: 100%;
  text-align: left;
  background: rgba(6, 16, 30, 0.68);
  color: var(--text);
  border: 1px solid rgba(151, 169, 196, 0.26);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
}

.preset-item-btn:hover,
.preset-item-btn:focus-visible {
  border-color: rgba(0, 209, 255, 0.55);
}

.preset-item-btn.active {
  border-color: rgba(128, 255, 141, 0.85);
  background: linear-gradient(130deg, rgba(10, 35, 32, 0.92), rgba(8, 22, 42, 0.9));
}

.main-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.clip-row {
  flex: 1;
  min-width: 250px;
  display: flex;
  gap: 10px;
}

input[type="url"],
input[type="text"],
select {
  width: 100%;
  border: 1px solid rgba(151, 169, 196, 0.3);
  border-radius: 10px;
  background: rgba(5, 15, 31, 0.94);
  color: var(--text);
  padding: 10px 12px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(0, 209, 255, 0.55);
  outline-offset: 1px;
}

button {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px 12px;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  color: #001321;
  font-weight: 700;
}

.ghost-btn {
  background: rgba(8, 20, 38, 0.75);
  border-color: rgba(151, 169, 196, 0.28);
  color: var(--text);
}

.share-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
}

.board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
}

.board-head h2 {
  font-family: "Sora", sans-serif;
  font-size: clamp(1.2rem, 2.6vw, 2rem);
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
}

.pad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.pad {
  border: 1px solid rgba(151, 169, 196, 0.2);
  border-radius: 14px;
  padding: 11px;
  min-height: 152px;
  background: linear-gradient(155deg, rgba(6, 18, 35, 0.95), rgba(5, 11, 23, 0.95));
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 120ms ease, border-color 120ms ease;
}

.pad:hover {
  transform: translateY(-2px);
}

.pad.dragging {
  opacity: 0.45;
}

.pad.drop-target {
  border-color: rgba(128, 255, 141, 0.9);
}

.pad-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pad-key {
  color: var(--accent2);
  font-size: 0.74rem;
  letter-spacing: 0.07em;
}

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

.pad-share,
.pad-delete {
  border: 1px solid rgba(151, 169, 196, 0.3);
  background: rgba(7, 18, 34, 0.8);
  color: var(--text);
  font-size: 0.76rem;
  padding: 4px 8px;
}

.pad-delete {
  border-color: rgba(255, 107, 134, 0.5);
  color: #ffdbe3;
}

.pad-title {
  font-family: "Sora", sans-serif;
  font-size: 1rem;
}

.pad-meta {
  font-size: 0.84rem;
  color: var(--muted);
}

.pad-play {
  margin-top: auto;
  width: 100%;
  border: 1px solid rgba(0, 209, 255, 0.5);
  background: rgba(0, 209, 255, 0.15);
  color: var(--text);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 5;
  padding: 16px;
  background: rgba(2, 6, 12, 0.72);
  display: grid;
  place-items: center;
}

.modal-content {
  width: min(1200px, 100%);
  max-height: 100%;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(145deg, rgba(5, 13, 26, 0.98), rgba(8, 22, 40, 0.97));
  box-shadow: var(--shadow);
  padding: 14px;
}

.prepare-content {
  width: min(520px, 100%);
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(145deg, rgba(5, 13, 26, 0.98), rgba(8, 22, 40, 0.97));
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 12px;
}

.prepare-content h2 {
  font-family: "Sora", sans-serif;
}

.prepare-status {
  color: var(--muted);
}

.prepare-progress {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(151, 169, 196, 0.26);
  background: rgba(2, 8, 18, 0.9);
  overflow: hidden;
}

.prepare-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00d1ff, #80ff8d);
  transition: width 220ms ease;
}

.prepare-percent {
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}

.share-modal-content {
  width: min(820px, 100%);
  max-height: 100%;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(145deg, rgba(5, 13, 26, 0.98), rgba(8, 22, 40, 0.97));
  box-shadow: var(--shadow);
  padding: 14px;
}

.share-modal-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 1fr);
}

.share-preview-card,
.share-save-card {
  border: 1px solid rgba(151, 169, 196, 0.22);
  border-radius: 12px;
  background: rgba(6, 16, 32, 0.72);
  padding: 12px;
}

.share-preview-card {
  display: grid;
  gap: 8px;
  align-content: start;
}

.share-preview-card h3 {
  font-family: "Sora", sans-serif;
}

#sharePreviewAudio {
  width: 100%;
}

.share-save-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.share-save-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

.share-actions {
  margin-top: 2px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-grid {
  display: grid;
  grid-template-columns: minmax(240px, 350px) 1fr;
  gap: 14px;
}

.preview-col,
.edit-col {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

#clipPreview {
  width: 100%;
  min-height: 210px;
  border-radius: 12px;
  border: 1px solid rgba(151, 169, 196, 0.3);
  background: #02060f;
}

.file-picker {
  border: 1px dashed rgba(0, 209, 255, 0.5);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-picker span {
  color: var(--muted);
  font-size: 0.84rem;
}

.tiny-note {
  color: var(--muted);
  font-size: 0.77rem;
}

#waveCanvas {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(151, 169, 196, 0.3);
  background: linear-gradient(180deg, rgba(10, 24, 45, 0.95), rgba(5, 14, 30, 0.95));
}

.trim-controls,
.save-grid {
  display: grid;
  gap: 10px;
}

.trim-controls label,
.save-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

input[type="range"] {
  width: 100%;
}

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

#trimTimeLabel {
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}

.save-grid {
  grid-template-columns: 1fr 1fr;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 7;
  border-radius: 12px;
  border: 1px solid rgba(128, 255, 141, 0.55);
  background: rgba(9, 30, 23, 0.95);
  color: #e1ffe7;
  padding: 10px 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

@media (max-width: 1080px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 8px;
    z-index: 2;
  }
}

@media (max-width: 860px) {
  .modal-grid {
    grid-template-columns: 1fr;
  }

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

  .save-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 10px;
    gap: 10px;
  }

  .sidebar,
  .main-panel {
    border-radius: 16px;
    padding: 12px;
  }

  .clip-row {
    flex-direction: column;
  }

  .pad-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  }
}
