:root {
  --bg: #edf5fb;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-solid: #ffffff;
  --line: #c8dceb;
  --text: #22303c;
  --muted: #61788b;
  --accent: #4a9ed8;
  --accent-dark: #2d78ad;
  --danger: #cf4d68;
  --ok: #6cae8f;
  --shadow: 0 16px 38px rgba(74, 113, 143, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", "Hiragino Sans", "Meiryo", system-ui, sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.95), transparent 36rem),
    linear-gradient(135deg, #eef8ff 0%, #f8fbff 48%, #e9f4fb 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
.file-button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 0.62rem 0.85rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

button:hover,
.file-button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(72, 134, 180, 0.14);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

button.primary {
  border-color: var(--accent-dark);
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

button.danger {
  border-color: rgba(207, 77, 104, 0.45);
  color: #fff;
  background: linear-gradient(135deg, #e56d88, var(--danger));
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 0.62rem 0.72rem;
  outline: none;
}

input[type="color"] {
  width: 100%;
  min-height: 2.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.25rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-dark);
}

textarea {
  resize: vertical;
  min-height: 5.5rem;
}

audio {
  width: 100%;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid rgba(184, 211, 230, 0.75);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
}

.app-header h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.03em;
}

.app-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.header-actions,
.button-row,
.asset-status-row,
.lyrics-toolbar,
.audio-row,
.time-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(330px, 420px) minmax(560px, 1fr) minmax(360px, 460px);
  gap: 1rem;
  padding: 1rem;
  height: calc(100dvh - 74px);
  min-height: 0;
  overflow: hidden;
}

.panel {
  min-width: 0;
  border: 1px solid rgba(190, 213, 229, 0.9);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.left-panel,
.right-panel {
  overflow: auto;
  padding: 0.8rem;
}

.center-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1rem;
}

.preview-panel {
  padding: 0.8rem;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.transport-panel {
  padding: 0.8rem;
}

details {
  border: 1px solid rgba(199, 217, 232, 0.78);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

summary {
  cursor: pointer;
  padding: 0.78rem 0.9rem;
  font-weight: 700;
  color: #25495f;
  background: linear-gradient(90deg, rgba(233, 246, 255, 0.96), rgba(255, 255, 255, 0.66));
  user-select: none;
}

.control-stack {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
}

.field {
  display: grid;
  gap: 0.32rem;
}

.field > span,
.range-head,
.hint,
.asset-status,
.progress-text,
.empty-message {
  font-size: 0.83rem;
  color: var(--muted);
}

.hint {
  margin: 0;
  line-height: 1.65;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.65rem;
}

.compact-field {
  width: 10rem;
  flex: 0 0 auto;
}

.asset-status {
  flex: 1;
  min-width: 0;
  border: 1px dashed rgba(102, 141, 169, 0.55);
  border-radius: 12px;
  padding: 0.58rem 0.7rem;
  background: rgba(245, 250, 254, 0.82);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lyrics-toolbar {
  justify-content: space-between;
}

.lyrics-button-list,
.cue-list {
  display: grid;
  gap: 0.45rem;
  max-height: 30vh;
  overflow: auto;
  padding-right: 0.2rem;
}

.lyric-button,
.cue-item {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 0.28rem;
  text-align: left;
  border: 1px solid rgba(199, 217, 232, 0.86);
  border-radius: 14px;
  background: #fff;
  padding: 0.68rem 0.75rem;
}

.lyric-button:hover,
.cue-item:hover {
  border-color: var(--accent);
}

.lyric-button.used {
  color: #8896a2;
  background: #eef2f5;
  border-color: #d2dae2;
}

.lyric-button.used .lyric-status {
  color: var(--ok);
}

.lyric-button.selected,
.cue-item.selected {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 3px rgba(74, 158, 216, 0.18);
}

.lyric-number,
.cue-time {
  font-size: 0.75rem;
  color: var(--muted);
}

.lyric-text,
.cue-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lyric-status {
  font-size: 0.75rem;
  color: var(--muted);
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.15rem 0.25rem 0.75rem;
}

.preview-toolbar strong {
  display: block;
  font-size: 0.95rem;
}

.preview-toolbar span,
.active-cue-info {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.active-cue-info {
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.canvas-shell {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  justify-self: center;
  align-self: center;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px solid rgba(168, 195, 214, 0.88);
  overflow: hidden;
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #d8e2ea 25%, transparent 25%),
    linear-gradient(-45deg, #d8e2ea 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8e2ea 75%),
    linear-gradient(-45deg, transparent 75%, #d8e2ea 75%);
  background-size: 32px 32px;
  background-position: 0 0, 0 16px, 16px -16px, -16px 0;
}

#previewCanvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: inherit;
  background: transparent;
}

.time-row {
  margin-top: 0.7rem;
  align-items: end;
}

.time-row input[type="range"] {
  flex: 1;
  min-width: 12rem;
}

.range-field {
  display: grid;
  gap: 0.28rem;
}

.range-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.58rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
}

.empty-message {
  padding: 1rem;
  line-height: 1.7;
}

.hidden {
  display: none !important;
}

@media (max-width: 1280px) {
  .app-layout {
    grid-template-columns: 360px minmax(540px, 1fr);
    grid-template-rows: auto auto;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .right-panel {
    grid-column: 1 / -1;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .check-grid {
    grid-template-columns: 1fr;
  }
}


.preset-box {
  display: grid;
  gap: 0.7rem;
  border: 1px solid rgba(122, 169, 203, 0.42);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(236, 247, 255, 0.92), rgba(255, 255, 255, 0.74));
  padding: 0.75rem;
}

.preset-title {
  font-weight: 700;
  color: #25495f;
  font-size: 0.92rem;
}


.header-language {
  min-width: 9.5rem;
}

.header-language > span {
  font-size: 0.78rem;
}

.header-language select {
  min-width: 8.5rem;
}


.custom-file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
}

.custom-file-button {
  min-height: 2.65rem;
}

.file-select-status {
  min-width: 0;
  border: 1px dashed rgba(102, 141, 169, 0.55);
  border-radius: 12px;
  padding: 0.58rem 0.7rem;
  background: rgba(245, 250, 254, 0.82);
  color: var(--muted);
  font-size: 0.83rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visually-hidden-file {
  position: absolute !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  opacity: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(28, 44, 58, 0.46);
  backdrop-filter: blur(8px);
}

.manual-modal {
  width: min(920px, 96vw);
  max-height: min(86vh, 840px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid rgba(190, 213, 229, 0.98);
  border-radius: 22px;
  background: var(--panel-solid);
  box-shadow: 0 26px 70px rgba(32, 62, 86, 0.28);
  overflow: hidden;
}

.manual-modal-header,
.manual-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(190, 213, 229, 0.8);
  background: linear-gradient(90deg, rgba(233, 246, 255, 0.96), rgba(255, 255, 255, 0.86));
}

.manual-modal-footer {
  justify-content: flex-end;
  border-top: 1px solid rgba(190, 213, 229, 0.8);
  border-bottom: 0;
}

.manual-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #25495f;
}

.modal-close-button {
  min-width: 2.4rem;
  padding: 0.4rem 0.65rem;
  font-size: 1.25rem;
  line-height: 1;
}

.manual-modal-body {
  overflow: auto;
  padding: 1.1rem 1.25rem 1.35rem;
  line-height: 1.75;
  color: var(--text);
}

.manual-modal-body h3 {
  margin: 1.25rem 0 0.35rem;
  font-size: 1rem;
  color: #25495f;
}

.manual-modal-body h3:first-child {
  margin-top: 0;
}

.manual-modal-body p {
  margin: 0.25rem 0 0.75rem;
}

.manual-modal-body ul,
.manual-modal-body ol {
  margin: 0.3rem 0 0.9rem 1.35rem;
  padding: 0;
}

.manual-modal-body li {
  margin: 0.18rem 0;
}

.manual-note {
  border: 1px solid rgba(74, 158, 216, 0.28);
  border-radius: 14px;
  background: rgba(238, 248, 255, 0.82);
  padding: 0.75rem 0.85rem;
}

@media (max-width: 900px) {
  .custom-file-row {
    grid-template-columns: 1fr;
  }

  .manual-modal {
    width: 96vw;
    max-height: 90vh;
  }
}


.canvas-shell canvas {
  width: 100%;
  height: 100%;
  object-fit: fill;
}


.inline-style-box {
  display: grid;
  gap: 0.65rem;
  border: 1px solid rgba(122, 169, 203, 0.42);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(236, 247, 255, 0.88), rgba(255, 255, 255, 0.72));
  padding: 0.75rem;
}

.inline-style-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.inline-style-head strong {
  font-size: 0.92rem;
  color: #25495f;
}

.mini-button {
  padding: 0.42rem 0.62rem;
  border-radius: 10px;
  font-size: 0.86rem;
}

.inline-style-list {
  display: grid;
  gap: 0.65rem;
}

.inline-style-item {
  display: grid;
  gap: 0.65rem;
  border: 1px solid rgba(199, 217, 232, 0.86);
  border-radius: 14px;
  background: rgba(255,255,255,0.82);
  padding: 0.7rem;
}

.inline-style-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
}

.inline-style-item-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #25495f;
}

.inline-style-empty {
  padding: 0.75rem;
  border: 1px dashed rgba(102, 141, 169, 0.45);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.83rem;
  background: rgba(245, 250, 254, 0.68);
}

.compact-range-field {
  align-self: end;
}
