:root {
  --bg: #f4f0fb;
  --panel: #ffffff;
  --text: #2f3552;
  --muted: #7d84a3;
  --accent: #8a8df5;
  --accent-dim: #6f74dd;
  --danger: #ee7f98;
  --border: #e3e1f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: linear-gradient(180deg, #f7f4ff 0%, #f2edff 100%);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(300px, 1fr);
  gap: 1.1rem;
  align-items: start;
  margin-top: 1rem;
}

.settings-column {
  min-width: 0;
}

.settings-column .toolbar {
  flex-direction: column;
  align-items: stretch;
  margin: 0;
}

.settings-column .toolbar-group.block,
.settings-column .toolbar-group.grow {
  flex: none;
  width: 100%;
  max-width: 100%;
}

.settings-column .settings-row .toolbar-group.block,
.settings-column .settings-row .toolbar-group.grow {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
}

.settings-column .toolbar-row.playback-row {
  align-items: stretch;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  align-items: stretch;
}

.settings-row-first .toolbar-group.block {
  flex: 1 1 calc(50% - 0.4rem);
  min-width: 140px;
}

.settings-row-second .toolbar-group.block.grow {
  flex: 1 1 200px;
  min-width: 160px;
}

.settings-column .page-controls.page-controls-inline {
  flex: 1 1 180px;
  width: auto;
  min-width: 0;
  max-width: 100%;
  padding: 0.65rem 0.75rem;
  gap: 0.65rem 0.85rem;
  align-items: flex-end;
}

.settings-column .page-controls.page-controls-inline .field-page {
  min-width: 0;
  gap: 0.3rem;
}

.settings-column .page-controls.page-controls-inline .field-page-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.settings-column .page-controls.page-controls-inline .input-page {
  width: 3.75rem;
  padding: 0.35rem 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 8px;
}

.settings-column .page-controls.page-controls-inline .btn-page-action {
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.playback-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preview-column {
  min-width: 0;
  position: sticky;
  top: 0.75rem;
}

.preview-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.preview-note {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.preview-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(125, 132, 163, 0.08);
}

.preview-toolbar-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
}

.preview-toolbar-hints .intro-hint {
  flex: 1 1 10rem;
  min-width: 0;
}

.beat-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.beat-input {
  width: 4.2rem;
  padding: 0.28rem 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
}

.beat-reco {
  color: var(--muted);
  font-size: 0.8rem;
}

.preview-toolbar-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.preview-toolbar-actions::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.preview-toolbar-actions .btn {
  flex-shrink: 0;
}

.compact-icon-btn {
  width: 2.1rem;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
}

.btn.speed-active {
  background: #dfe5ff;
  border-color: #aeb9ff;
  color: #33407c;
  font-weight: 800;
}

.btn.mute-active {
  background: #eceff7;
  border-color: #b8bfd6;
  color: #4e5a80;
}

.preview-record-status {
  flex: 1 1 5rem;
  min-width: 0;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-toolbar-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.page-controls.page-controls-preview {
  margin: 0 0 0.65rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  gap: 0.65rem 0.85rem;
  align-items: flex-end;
}

.page-controls.page-controls-preview .field-page {
  min-width: 0;
  gap: 0.3rem;
}

.page-controls.page-controls-preview .field-page-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-controls.page-controls-preview .input-page {
  width: 3.75rem;
  padding: 0.35rem 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 8px;
}

.page-controls.page-controls-preview .btn-page-action {
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.page-controls-topline {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  align-items: center;
}

.page-controls-topline .field-page,
.page-controls-topline .btn-page-action {
  flex: 0 0 auto;
}

.page-controls-topline .btn-page-action {
  width: auto !important;
  margin-top: 0 !important;
}

.page-controls-topline #btnLoadProgress {
  margin-left: 0.65rem;
}

#levelControlsBox.is-disabled {
  opacity: 0.62;
  background: linear-gradient(180deg, rgba(90, 96, 110, 0.28) 0%, rgba(52, 56, 66, 0.5) 100%);
  border-color: rgba(130, 138, 154, 0.35);
}

#levelControlsBox {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.38rem 0.55rem;
  align-items: end;
  padding: 0.5rem 0.6rem;
}

#levelControlsBox > .radio-inline {
  grid-column: 1 / -1;
  margin-bottom: 0.15rem;
}

#levelControlsBox .field-page {
  min-width: 0;
  gap: 0.2rem;
}

#levelControlsBox .field-page-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#levelControlsBox .input-page {
  width: 3.15rem;
  padding: 0.28rem 0.32rem;
  font-size: 0.92rem;
  border-radius: 9px;
}

@media (max-width: 900px) {
  #levelControlsBox {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.field-page-buttons {
  min-width: 230px;
}

.edit-page-buttons {
  display: grid;
  grid-template-columns: repeat(6, minmax(2rem, 1fr));
  gap: 0.28rem;
}

.edit-page-buttons.single-line {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.22rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}

.edit-page-buttons.single-line .edit-page-btn {
  min-width: 1.75rem;
  flex: 0 0 auto;
  height: 1.6rem;
  font-size: 0.68rem;
  border-radius: 6px;
}

.edit-page-btn {
  height: 1.95rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f6f5ff;
  color: var(--text);
  font-size: 0.78rem;
  cursor: pointer;
}

.edit-page-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: #ffffff;
  font-weight: 700;
}

.edit-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.preview-column .stage-wrap {
  margin-top: 0;
  max-width: 100%;
}

.preview-column .stage {
  max-width: 100%;
}

.header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.header .header-title {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.header-dev-link {
  flex-shrink: 0;
  padding: 0.4rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  background: #f1f0ff;
  border: 1px solid #d6d3f8;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}

.header-dev-link:hover {
  background: #e8e6ff;
  border-color: var(--accent);
}

a.header-dev-link {
  text-decoration: none;
  display: inline-block;
}

.header-title-wrap {
  flex: 1 1 200px;
  min-width: 0;
}

.experimental-sub {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
  max-width: 52rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.text-preset-panel {
  margin-top: 1rem;
  padding: 1rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fcfbff;
}

.preset-panel-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 800;
}

.preset-panel-lead {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.preset-emphasis {
  color: var(--accent-dim);
  font-weight: 800;
}

.preset-summary-card {
  padding: 0.65rem 0.7rem;
  margin-bottom: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8f7ff;
}

.preset-field {
  display: block;
  margin-bottom: 0.65rem;
}

#textPresetSelect {
  width: 100%;
  max-width: 100%;
}

.preset-meta {
  margin: 0.45rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.preset-meta-line {
  margin: 0.25rem 0;
}

.preset-meta .preset-muted {
  color: var(--muted);
}

.preset-word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.8rem 0.85rem;
  margin-bottom: 0.85rem;
}

@media (min-width: 900px) {
  .preset-word-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.preset-word-cell {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.45rem;
  padding: 0.72rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fcfbff;
}

.preset-word-cell.is-hidden {
  display: none;
}

.preset-letter {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  grid-column: 1;
  grid-row: 1;
  margin-right: 0.25rem;
}

.preset-word-input {
  width: 100% !important;
  min-width: 0;
  max-width: none;
  font-size: 1.02rem;
  padding-left: 0.82rem;
  padding-right: 0.82rem;
  height: 2.9rem;
  line-height: 1.3;
  grid-column: 1 / -1;
}

.preset-word-input::placeholder {
  color: #b8bdd4;
}

.preset-type-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.28rem;
  width: 100%;
  padding: 0.18rem;
  border: 1px solid #dddaf8;
  border-radius: 10px;
  background: #f3f1ff;
  grid-column: 2;
  grid-row: 1;
}

.preset-radio {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  flex: 1 1 0;
  justify-content: center;
  gap: 0;
  padding: 0.34rem 0.2rem;
  border-radius: 8px;
  color: #7076a1;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.preset-radio input {
  display: none;
}

.preset-radio.is-active {
  background: #ffffff;
  color: #49508a;
  box-shadow: 0 1px 4px rgba(101, 108, 166, 0.2);
}

.preset-mode-input.hidden {
  display: none;
}

.preset-mode-input {
  grid-column: 1 / -1;
}

.preset-image-btn {
  padding: 0.38rem 0.6rem;
  align-self: flex-start;
  width: fit-content;
}

.preset-image-name {
  margin-left: 0;
  font-size: 0.78rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.1rem;
  width: 100%;
}

.preset-image-thumb {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #cfcaf3;
  background: #fff;
}

.preset-image-file {
  display: inline-block;
  max-width: 7.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-mode-image {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  min-height: 2.9rem;
  padding: 0.55rem 0.7rem;
  border: 1.5px dashed #cfcaf5;
  border-radius: 10px;
  background: #f9f8ff;
  gap: 0.45rem;
}

.preset-mode-image.is-dragover {
  background: #eeebff;
  border-color: var(--accent);
}

.preset-emoji-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  width: 100%;
}

.preset-emoji-row .preset-word-input {
  flex: 1 1 auto;
}

.preset-emoji-open {
  flex: 0 0 auto;
  min-width: 4.8rem;
  padding: 0.45rem 0.55rem;
  font-size: 0.76rem;
}

.preset-emoji-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.6rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid #d8d5f6;
  border-radius: 8px;
  background: #fff;
  color: #6a7098;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.preset-emoji-current.is-empty {
  font-size: 0.86rem;
  line-height: 1.3;
  white-space: normal;
  word-break: keep-all;
}

.preset-emoji-palette {
  margin-top: 0.35rem;
  border: 1px solid #dddaf8;
  background: #f8f7ff;
  border-radius: 10px;
  padding: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  max-height: 7.8rem;
  overflow-y: auto;
}

.preset-emoji-palette.hidden {
  display: none;
}

.preset-emoji-pick {
  border: 1px solid #d5d1f8;
  background: #fff;
  border-radius: 7px;
  width: 2.05rem;
  height: 2.05rem;
  line-height: 1;
  font-size: 1.1rem;
  cursor: pointer;
}

.preset-emoji-modal-dialog {
  width: min(100%, 40rem);
}

.preset-emoji-modal-body {
  padding: 0.85rem 1rem 1rem;
}

.preset-emoji-modal-target {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-dim);
}

.preset-emoji-search {
  width: 100%;
  border: 1px solid #d8d5f6;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.6rem;
  font-size: 0.92rem;
  color: var(--text);
  background: #faf9ff;
}

.preset-emoji-modal-grid {
  border: 1px solid #dddaf8;
  background: #f8f7ff;
  border-radius: 10px;
  padding: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  max-height: 18rem;
  overflow-y: auto;
}

.preset-apply-btn {
  background: linear-gradient(180deg, #f7d2db 0%, #f1bdcb 100%);
  border-color: #e79aaf;
  color: #7a2f45;
  font-weight: 800;
  padding: 0.62rem 1.15rem;
  border-radius: 10px;
}

.preset-action-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.preset-action-row .btn {
  flex: 1 1 0;
  margin-top: 0;
}

.preset-controls-folded .preset-summary-card,
.preset-controls-folded .preset-word-grid,
.preset-controls-folded #btnApplyTextPreset {
  display: none;
}

.preset-fold-btn {
  border-color: #d5d2f8;
  background: #f3f2ff;
  color: #4e5586;
  font-weight: 700;
}

.preset-apply-btn:hover:not(:disabled) {
  background: #f3c1cf;
  border-color: #e88ea5;
}

#btnApplyTextPreset {
  width: 100%;
  margin-top: 0;
  background: linear-gradient(180deg, #f7d2db 0%, #f1bdcb 100%) !important;
  border: 1px solid #e79aaf !important;
  color: #7a2f45 !important;
  font-weight: 800;
}

#btnApplyTextPreset:hover:not(:disabled) {
  background: #f3c1cf !important;
  border-color: #e88ea5 !important;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin: 1.25rem 0;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(125, 132, 163, 0.08);
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.toolbar-group.block {
  flex: 1 1 auto;
  min-width: 160px;
  padding: 0.4rem 0.5rem 0.65rem;
  background: #faf8ff;
  border-radius: 10px;
  border: 1px solid #ebe8fb;
}

.toolbar-group.grow {
  flex: 1 1 220px;
  min-width: 200px;
  padding: 0.4rem 0.5rem 0.65rem;
  background: #faf8ff;
  border-radius: 10px;
  border: 1px solid #ebe8fb;
}

.group-label {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  width: 100%;
  margin-bottom: 0.45rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid #d7d5fa;
}

.radio-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  margin-right: 0.45rem;
}

.radio-inline input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.select-wide {
  min-width: 160px;
  flex: 1;
  max-width: 280px;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fcfbff;
  color: var(--text);
  font-size: 0.95rem;
}

.file-btn.small {
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  white-space: nowrap;
}

.file-btn-text {
  display: inline-block;
  max-width: 10.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}


.beat-hint {
  font-size: 0.95rem;
  color: var(--muted);
  margin-right: 0.35rem;
  white-space: nowrap;
}

.beat-hint strong {
  color: var(--accent);
  font-weight: 700;
}

.intro-hint {
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 22rem;
  line-height: 1.35;
}

.intro-hint strong {
  color: #a5f3e9;
  font-weight: 700;
}

.toolbar-row.playback-row {
  align-items: center;
  padding: 0.35rem 0;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.page-controls {
  flex: 1 1 100%;
  width: 100%;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 1rem 1.5rem;
  padding: 1rem 1.1rem;
  margin-top: 0.25rem;
  background: linear-gradient(180deg, #f6f4ff 0%, #efebff 100%);
  border-radius: 12px;
  border: 1px solid #ddd8fa;
}

.page-controls.page-controls-inline {
  flex: 1 1 auto;
  width: auto;
  margin-top: 0;
}

.field-page {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 140px;
}

.field-page-label {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
}

.input-page {
  width: 5.5rem;
  padding: 0.65rem 0.75rem;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  border-radius: 12px;
  border: 2px solid #d7d5fa;
  background: #ffffff;
  color: var(--text);
  box-shadow: inset 0 1px 3px rgba(125, 132, 163, 0.15);
}

.input-page:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(138, 141, 245, 0.2), inset 0 1px 3px rgba(125, 132, 163, 0.15);
}

.btn-page-action {
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.timing-insight-wrap {
  flex: 1 1 100%;
  width: 100%;
  margin-top: 0.15rem;
}

.timing-insight {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: #faf8ff;
  border: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.55;
  color: #596080;
}

.timing-insight .ti-line {
  margin: 0 0 0.35rem;
}

.timing-insight .ti-line:last-of-type {
  margin-bottom: 0;
}

.timing-insight .ti-k {
  display: inline-block;
  min-width: 10.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.timing-insight strong {
  color: var(--text);
  font-weight: 700;
}

.timing-insight .ti-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.timing-insight .ti-muted {
  color: var(--muted);
}

.timing-insight .ti-note {
  margin: 0.55rem 0 0;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: #f0eeff;
  border: 1px solid #dcd8ff;
  color: #545a86;
  font-size: 0.85rem;
}

.timing-insight .ti-warn {
  margin: 0.55rem 0 0;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: #fff1f5;
  border: 1px solid #ffd4e1;
  color: #b55473;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .timing-insight .ti-k {
    min-width: 0;
    display: block;
    margin-bottom: 0.15rem;
  }
}

.folder-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.75rem 0 0;
  line-height: 1.5;
}

.folder-hint code {
  font-size: 0.85em;
  color: var(--accent);
  background: #f2efff;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

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

.input-panels-preview {
  width: 100%;
  margin: 0 0 0.75rem;
}

.input-panels-preview.hidden {
  display: none;
}

.edit-panels-toggle-wrap {
  display: flex;
  justify-content: flex-start;
  margin: 0.15rem 0 0.45rem;
}

.edit-panels-toggle-btn {
  padding: 0.42rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
  background: #ffebee;
  border-color: #ef9a9a;
  color: #c62828;
}

.edit-panels-toggle-btn:hover:not(:disabled) {
  background: #ffcdd2;
}

.image-mode-panel {
  border-color: #dcd8ff;
  background: linear-gradient(180deg, #f7f5ff 0%, #eeebff 100%);
}

.image-mode-lead {
  font-size: 0.95rem;
  color: #626a8e;
  margin-bottom: 0;
}

.image-mode-lead strong {
  color: var(--accent);
  font-weight: 700;
}

.panel-preview {
  margin-top: 0;
  margin-bottom: 0;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-right: 0.15rem;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--accent-dim);
  color: #ecfdf5;
  border-radius: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.step-badge-label {
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 1.35rem;
  padding: 0.2rem 0.5rem;
  margin-right: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.panel-title-with-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  line-height: 1.35;
}

.panel-title-main {
  font-weight: 600;
}

.panel-lead {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  background: #f3f1ff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  border: 1px solid #ddd9f5;
}

.file-btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.field.compact {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

.field input[type="number"] {
  width: 4.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.btn {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f5f4ff;
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
}

.btn:hover:not(:disabled) {
  background: #eceaff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #ffffff;
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn.danger {
  border-color: #f1a3b9;
  background: #ffe9f0;
  color: #b05270;
}

.btn.danger:hover:not(:disabled) {
  filter: brightness(1.15);
}

.btn.accent {
  border-color: #c8c4fb;
  background: #ece9ff;
  color: #4f5488;
  font-weight: 600;
}

.btn.accent:hover:not(:disabled) {
  filter: brightness(1.12);
}

.select-quick-save {
  flex-shrink: 0;
  min-width: 7.2rem;
  height: 2.2rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fcfbff;
  color: var(--text);
  font-size: 0.82rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.status {
  font-size: 0.8rem;
  color: var(--danger);
  min-width: 6rem;
}

.stage-wrap {
  margin-top: 0.5rem;
  position: relative;
}

.stage {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #ddd8fa;
  box-shadow: 0 10px 26px rgba(123, 125, 178, 0.2);
  background: #f6f4ff;
}

@keyframes stage-glow {
  0%,
  100% {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(45, 212, 191, 0.15);
  }
  50% {
    box-shadow: 0 14px 48px rgba(0, 0, 0, 0.5), 0 0 28px rgba(45, 212, 191, 0.22);
  }
}

.stage.is-playing {
  animation: stage-glow 1.4s ease-in-out infinite;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.drop-layer {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

.drop-layer.disabled {
  pointer-events: none;
}

.stage-wrap:fullscreen {
  display: grid;
  place-items: center;
  background: #0f1118;
  padding: 1rem;
}

.stage-wrap:fullscreen .stage {
  width: min(96vw, calc(96vh * 16 / 9));
  max-width: none;
  border-radius: 14px;
}

.fullscreen-close-btn {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2147483000;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 800;
  background: rgba(30, 34, 48, 0.82);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.fullscreen-close-btn[hidden] {
  display: none !important;
}

.fullscreen-close-btn:hover {
  background: rgba(46, 54, 77, 0.92);
}

.fullscreen-top-controls {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 2147482999;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem;
  border-radius: 12px;
  background: rgba(18, 22, 33, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(3px);
}

.fullscreen-top-controls[hidden] {
  display: none !important;
}

.fullscreen-top-controls .btn {
  padding: 0.36rem 0.62rem;
  min-height: 2rem;
  font-size: 0.78rem;
  color: #f8fbff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.stage-wrap:fullscreen .fullscreen-top-controls {
  display: inline-flex;
}

.drop-slot {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed rgba(138, 141, 245, 0.35);
  border-radius: 8px;
  transition: background 0.15s, border-color 0.15s;
}

.drop-slot:hover:not(.disabled) {
  background: rgba(138, 141, 245, 0.1);
  border-color: rgba(138, 141, 245, 0.6);
}

.drop-slot.dragover {
  background: rgba(138, 141, 245, 0.18);
  border-color: var(--accent);
}

@keyframes slot-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.65rem;
  text-align: center;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.tips {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(125, 132, 163, 0.08);
}

.tips h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.tips ul {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.panel {
  max-width: 960px;
  margin: 1rem auto 0;
  padding: 1rem 1.1rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(125, 132, 163, 0.08);
}

.panel.panel-preview {
  margin: 0 0 0.75rem;
  max-width: 100%;
}

.input-panels-preview .text-editors {
  grid-template-columns: repeat(2, 1fr);
}

.input-panels-preview .emoji-results {
  max-height: 160px;
}

.panel.hidden {
  display: none;
}

.panel-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.text-editors {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.text-editors input {
  width: 100%;
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fcfbff;
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1.35;
  min-height: 2.75rem;
}

.text-editors .slot-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.text-editors .cell {
  display: flex;
  flex-direction: column;
}

.emoji-slot-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.emoji-slot-btn {
  min-width: 3.25rem;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #f5f3ff;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.emoji-slot-btn:hover {
  border-color: var(--accent-dim);
  background: #ece9ff;
}

.emoji-slot-btn.is-selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(138, 141, 245, 0.35);
}

.emoji-slot-status {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 500;
}

.emoji-search-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.emoji-search-wrap.is-locked {
  opacity: 0.45;
  pointer-events: none;
}

.emoji-search-wrap.is-locked .emoji-search:disabled {
  cursor: not-allowed;
}

.emoji-search {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fcfbff;
  color: var(--text);
  font-size: 1.05rem;
}

.emoji-results {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fcfbff;
  align-content: flex-start;
}

.emoji-results-hint {
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.emoji-pick {
  font-size: 1.75rem;
  line-height: 1;
  padding: 0.25rem 0.35rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s, transform 0.12s;
}

.emoji-pick:hover {
  background: rgba(45, 212, 191, 0.15);
  transform: scale(1.08);
}

.quick-save-mask {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.68);
}

.quick-save-mask[hidden] {
  display: none;
}

.quick-save-mask.is-peek {
  background: rgba(0, 0, 0, 0.12);
  align-items: flex-start;
  justify-content: flex-end;
}

.quick-save-mask.is-peek .quick-save-card {
  margin-top: 0.25rem;
  opacity: 0.92;
}

.quick-save-card {
  width: min(92vw, 24rem);
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px solid rgba(45, 212, 191, 0.4);
  background: #111827;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.quick-save-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #e6fffa;
}

.quick-save-desc {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  color: #b6c2d2;
}

.quick-save-eta {
  margin: 0;
  font-size: 0.9rem;
  color: #5eead4;
  font-weight: 700;
}

.quick-save-actions {
  margin-top: 0.7rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quick-toggle-btn {
  padding: 0.38rem 0.6rem;
  font-size: 0.82rem;
}

.quick-save-note {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: #a8b5c8;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}

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

.modal-dialog {
  width: min(100%, 28rem);
  max-height: none;
  overflow: hidden;
  background: #fffeff;
  color: #1a1d24;
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(117, 126, 156, 0.22);
  border: 1px solid #e6e2f5;
  font-family: "Pretendard", "SUIT", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.15rem 0.65rem;
  border-bottom: 1px solid #ece8f7;
}

.modal-title-text {
  margin: 0;
  font-size: 1.42rem;
  font-weight: 800;
  color: #0e8f86;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.modal-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: #f4f1fb;
  color: #6a7192;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.modal-close:hover {
  background: #e9e4f7;
  color: #3e486c;
}

.modal-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.65rem 1rem 0;
  border-bottom: 1px solid #ece8f7;
}

.modal-tab {
  flex: 1 1 auto;
  padding: 0.5rem 0.65rem;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  color: #6b7394;
  background: #f7f4fd;
  border: 1px solid #e5def6;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
}

.modal-tab:hover {
  color: #4a567f;
  background: #f2ecfb;
}

.modal-tab.is-active {
  color: #0f766e;
  border-color: #bfe6df;
  border-bottom-color: transparent;
  margin-bottom: -1px;
  background: #f2fbf9;
  box-shadow: 0 -2px 10px rgba(154, 211, 201, 0.2);
}

.modal-panels {
  padding: 1rem 1.15rem 1.25rem;
}

.modal-panel {
  font-size: 0.92rem;
  line-height: 1.55;
}

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

.modal-lead {
  margin: 0 0 0.75rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: #2c3b5f;
  line-height: 1.6;
}

.modal-p {
  margin: 0;
  color: #5a6685;
  line-height: 1.65;
}

.modal-p code {
  font-size: 0.85em;
  padding: 0.1rem 0.35rem;
  background: #f1eef8;
  border-radius: 4px;
}

.modal-dev-name {
  margin: 0 0 0.85rem;
  font-size: 1.13rem;
  font-weight: 900;
  color: #1f365f;
  letter-spacing: -0.01em;
}

.modal-dev-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.modal-dev-list li {
  position: relative;
  margin-bottom: 0.5rem;
  padding: 0.58rem 0.78rem 0.58rem 1.55rem;
  background: #f2f4f9;
  border: 1px solid #e8edf6;
  border-radius: 10px;
  color: #3a4869;
  font-size: 0.91rem;
  font-weight: 600;
}

.modal-dev-list li::before {
  content: "✦";
  position: absolute;
  left: 0.62rem;
  top: 50%;
  transform: translateY(-50%);
  color: #5ca7b9;
  font-size: 0.78rem;
}

.modal-link-inline {
  color: #2f63db;
  font-weight: 800;
  text-decoration: none;
  text-underline-offset: 2px;
}

.modal-link-inline:hover {
  text-decoration: underline;
}

.modal-contact {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e8e3f5;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}

.modal-contact-label {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-weight: 700;
  font-size: 0.88rem;
  color: #2f3b5d;
}

.modal-contact-email {
  font-size: 0.97rem;
  font-weight: 700;
  color: #2563eb;
  text-decoration: none;
}

.modal-contact-email:hover {
  text-decoration: underline;
}

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

  .preview-column {
    position: static;
  }
}

@media (max-width: 720px) {
  .page-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .field-page {
    width: 100%;
  }

  .input-page {
    width: 100%;
    max-width: 8rem;
  }

  .btn-page-action {
    width: 100%;
    margin-top: 0.25rem;
  }

  .text-editors {
    grid-template-columns: repeat(2, 1fr);
  }
}
