body.editor-page {
  min-width: 0;
}

.editor-shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.editor-header,
.editor-sidebar,
.editor-main,
.editor-section,
.stage-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.event-dialog {
  width: min(680px, calc(100vw - 28px));
  padding: 0;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

.event-dialog::backdrop {
  background: rgba(8, 12, 16, 0.62);
}

.event-dialog-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.event-dialog-form h2 {
  margin: 3px 0 0;
}

.event-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.editor-header,
.editor-panel-head,
.stage-card-head,
.editor-actions,
.stage-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-header,
.editor-panel-head,
.stage-card-head {
  justify-content: space-between;
}

.editor-header {
  position: sticky;
  top: 12px;
  z-index: 10;
  margin-bottom: 20px;
  padding: 16px 18px;
  backdrop-filter: blur(18px) saturate(1.08);
}

.editor-header h1,
.editor-panel-head h2 {
  margin: 0;
}

.editor-header h1 {
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  letter-spacing: -0.025em;
}

.editor-actions,
.stage-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.preset-json-control {
  position: relative;
}

.preset-json-menu {
  display: grid;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 144px;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}

.preset-json-menu button {
  justify-content: flex-start;
  min-height: 36px;
  padding-inline: 10px;
  text-align: left;
}

.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--button-bg);
  font-weight: 700;
  text-decoration: none;
}

.danger-button {
  border-color: rgba(255, 98, 98, 0.55);
  color: var(--danger);
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.6fr) minmax(0, 1.7fr);
  gap: 20px;
  align-items: start;
}

.editor-sidebar,
.editor-main,
.editor-section,
.stage-card {
  padding: 16px;
}

.editor-sidebar {
  position: sticky;
  top: 116px;
  max-height: calc(100dvh - 136px);
  overflow: auto;
  scrollbar-color: color-mix(in srgb, var(--accent) 52%, transparent) transparent;
}

.editor-main,
.preset-list,
.stage-list {
  display: grid;
  gap: 14px;
}

.preset-list {
  margin-top: 12px;
}

.template-import {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
}

.raid-toggle-line {
  margin-top: 12px;
}

.preset-list button {
  width: 100%;
  text-align: left;
}

.preset-list button.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.preset-list button {
  min-height: 46px;
}

.editor-section > h2,
.stage-card-head strong {
  letter-spacing: -0.012em;
}

.stage-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 38%), var(--surface);
}

.stage-card-head {
  padding-bottom: 11px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.field-wide {
  grid-column: 1 / -1;
}

.compact-grid {
  grid-template-columns: minmax(0, 1.3fr) minmax(110px, 0.65fr) minmax(110px, 0.55fr) auto;
  align-items: end;
}

.duration-field[hidden] {
  display: none;
}

.stage-card-head {
  margin-bottom: 12px;
}

.stage-index,
.count-badge,
.editor-status {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 800;
}

@media (max-width: 820px) {
  .editor-shell {
    width: min(100% - 24px, 1320px);
    padding-top: 12px;
  }

  .editor-header,
  .editor-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .editor-header {
    position: static;
  }

  .editor-sidebar {
    position: static;
    max-height: none;
  }

  .compact-grid,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }
}
