BODY {
  margin: 0;
  background: #000033;
  color: #ccffcc;
  font-family: "Times New Roman", Times, serif;
}

A {
  color: #ffff66;
}

.page-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 18px auto 28px;
  text-align: left;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(760px, 1.3fr) minmax(320px, 0.7fr);
  gap: 18px;
  margin-top: 18px;
}

.layout-grid > * {
  min-width: 0;
}

.editor-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.panel {
  border: 1px solid #3355aa;
  background: #000044;
  box-shadow: 0 0 0 1px #111155 inset;
}

.panel-preview {
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 0 0 1px #111155 inset, 0 10px 24px rgba(0, 0, 0, 0.4);
}

.panel-heading {
  padding: 8px 12px;
  border-bottom: 1px solid #3355aa;
  background: #001a77;
  color: #ffff66;
  font-size: 20px;
  font-weight: bold;
}

.preview-frame {
  padding: 18px;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent),
    #000022;
}

.preview-surface {
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  background: #000066;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: auto;
}

.marquee-preview-canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  box-sizing: border-box;
  background: transparent;
}

.control-panel,
.code-panel {
  padding-bottom: 14px;
}

.subheading {
  padding: 14px 14px 0;
  color: #ffff99;
  font-size: 18px;
  font-weight: bold;
}

.subheading-output {
  padding-top: 10px;
}

.field,
.field-check {
  display: block;
  padding: 12px 14px 0;
}

.field-compact {
  padding: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.field-row-3 {
  grid-template-columns: 0.7fr 1.6fr 1fr;
}

.field-row-background {
  grid-template-columns: 0.8fr 0.8fr 1.4fr;
}

.field-row-2-equal {
  grid-template-columns: repeat(2, 1fr);
}

.field-row-3-equal {
  grid-template-columns: repeat(3, 1fr);
}

.field-row-4 {
  grid-template-columns: repeat(4, 1fr);
}

.field-row-5 {
  grid-template-columns: repeat(5, 1fr);
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: #99ccff;
  font-size: 15px;
  font-weight: bold;
}

.field-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 8px;
  border: 1px solid #5577cc;
  background: #000022;
  color: #ffffff;
  font: inherit;
}

.field-input-compact {
  width: 88px;
  min-width: 0;
  text-align: right;
}

.input-unit-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0;
  max-width: 100%;
}

.input-unit-wrap-compact {
  width: auto;
}

.input-unit-wrap .field-input {
  border-right: 0;
  border-radius: 0;
  background: #000022;
}

.input-unit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 34px;
  padding: 0 8px;
  box-sizing: border-box;
  border: 1px solid #5577cc;
  border-left: 0;
  background: #000022;
  color: #ccddff;
  font-size: 12px;
  font-weight: bold;
  position: relative;
  top: 0;
  white-space: nowrap;
}

.field-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.25;
}

.field-color {
  width: 42px;
  min-width: 42px;
  padding: 3px;
  height: 38px;
  border-radius: 2px;
  cursor: pointer;
}

.field-check {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.field-check INPUT {
  align-self: flex-start;
  width: 18px;
  height: 18px;
  margin-top: 10px;
}

.code-output {
  width: calc(100% - 28px);
  margin: 14px;
  box-sizing: border-box;
  min-height: 320px;
  padding: 12px;
  border: 1px solid #5577cc;
  background: #000022;
  color: #ccffcc;
  font: 14px/1.4 "Courier New", Courier, monospace;
  resize: vertical;
}

.code-output-secondary {
  min-height: 180px;
}

.sequence-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 0;
}

.helper-copy {
  color: #99bbdd;
  font-size: 14px;
}

.sequence-grid {
  padding: 12px 14px 0;
  overflow-x: auto;
}

.sequence-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border: 1px solid #3355aa;
  background: #000033;
}

.sequence-table TH,
.sequence-table TD {
  padding: 9px 10px;
  border: 1px solid #224499;
  vertical-align: top;
}

.sequence-table TH {
  background: #001a66;
  color: #ffff99;
  font-size: 14px;
  text-align: left;
}

.sequence-table TH:nth-child(1),
.sequence-table TD:nth-child(1) {
  width: 62px;
}

.sequence-table TH:nth-child(2),
.sequence-table TD:nth-child(2) {
  width: 92px;
}

.sequence-table TH:nth-child(4),
.sequence-table TD:nth-child(4) {
  width: 176px;
}

.sequence-table TH:nth-child(3),
.sequence-table TD:nth-child(3) {
  width: 92px;
}

.sequence-index {
  color: #ffff99;
  font-weight: bold;
}

.sequence-index-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sequence-move-controls {
  display: flex;
  flex-direction: row;
  gap: 4px;
}

.sequence-transition-select {
  width: 100%;
  min-width: 0;
  padding: 4px 22px 4px 8px;
  border: 1px solid #5577cc;
  background: linear-gradient(180deg, #001a66 0%, #000844 100%);
  color: #ccddff;
  font: 12px "Times New Roman", Times, serif;
  box-sizing: border-box;
  appearance: auto;
}

.sequence-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sequence-text-char {
  font: inherit;
}

.sequence-cell-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.default-message-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #3355aa;
  background: #000033;
}

.image-library-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #3355aa;
  background: #000033;
}

.image-library-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  flex: 1 1 auto;
}

.image-library-preview-selected {
  min-height: 46px;
}

.image-chip,
.image-chip-empty {
  width: 36px;
  height: 36px;
  border: 1px solid #5577cc;
  background: #000022;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.image-chip {
  padding: 3px;
}

.image-chip img {
  max-width: 28px;
  max-height: 28px;
}

.image-chip-empty {
  width: auto;
  padding: 0 8px;
  color: #88aadd;
  font-size: 12px;
}

.image-token {
  display: inline-block;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 1em;
  line-height: 1;
  vertical-align: middle;
}

.image-token img {
  display: block;
  width: auto;
  height: 1em;
}

.default-message-preview {
  flex: 1 1 auto;
  min-width: 0;
}

.row-button {
  padding: 5px 6px;
  border: 1px solid #6688dd;
  background: #001a66;
  color: #ffffff;
  font: bold 12px "Times New Roman", Times, serif;
  cursor: pointer;
  white-space: nowrap;
}

.sequence-move-button {
  width: 20px;
  height: 20px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #12338c 0%, #00124d 100%);
  font-size: 10px;
  line-height: 1;
}

.sequence-move-button[disabled] {
  border-color: #445588;
  background: linear-gradient(180deg, #0a1338 0%, #050a1f 100%);
  color: #5570aa;
  cursor: default;
}

.modal-shell[hidden] {
  display: none;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 40, 0.78);
}

.modal-card {
  position: relative;
  width: min(720px, calc(100% - 32px));
  margin: 48px auto;
  border: 1px solid #6688dd;
  background: #000044;
  box-shadow: 0 0 0 1px #111155 inset, 0 20px 50px rgba(0, 0, 0, 0.55);
}

.modal-card-image {
  width: min(780px, calc(100% - 32px));
}

.modal-form {
  padding-bottom: 14px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 14px 0;
}

.modal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.image-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.image-picker-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 88px;
  padding: 10px 6px;
  border: 1px solid #5577cc;
  background: #000022;
  color: #ffffff;
  cursor: pointer;
}

.image-picker-button.is-selected {
  border-color: #ffff99;
  box-shadow: inset 0 0 0 1px #ffff99;
  background: #00154d;
}

.image-picker-button img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.image-picker-label {
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  word-break: break-word;
}

.modal-color-trigger {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-color: #99bbff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.modal-color-native-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
}

.action-button {
  padding: 8px 12px;
  border: 1px solid #7799ff;
  background: #001a88;
  color: #ffffff;
  font: bold 14px "Times New Roman", Times, serif;
  cursor: pointer;
}

.action-button[disabled] {
  border-color: #4d5f9d;
  background: #0a1b55;
  color: #6c80ba;
  cursor: default;
}

.modal-row-preview {
  min-height: 72px;
  padding: 14px 16px;
  border: 1px solid #5577cc;
  background: #000066;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  color: #ffffff;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.copy-status {
  min-height: 18px;
  color: #99ff99;
  font-size: 14px;
}

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

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

  .field-row {
    grid-template-columns: 1fr;
  }

  .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-toolbar,
  .modal-actions {
    justify-content: flex-start;
  }

  .marquee-preview-canvas {
    width: 100%;
    max-width: 100%;
  }
}
