.preview-container {
  flex: 1;
  height: 100%;
  overflow: auto;
  background: linear-gradient(135deg, #f0e6ff 0%, #fce4f0 50%, #e4f0ff 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px;
  gap: 20px;
}

#app-sidebar {
  transition: width 0.2s ease;
}

body.design-sidebar-open #app-sidebar {
  width: 430px !important;
}

.mode-landscape #preview-target {
  width: 1200px;
  height: 675px;
}

.mode-portrait #preview-target {
  width: 675px;
  height: 1200px;
}

.preview-wrapper {
  position: absolute;
  inset: 0 auto auto 0;
  transform-origin: top left;
  transition: transform 0.2s ease;
}

.mode-landscape .preview-wrapper {
  width: 1200px;
  height: 675px;
}

.mode-portrait .preview-wrapper {
  width: 675px;
  height: 1200px;
}

.preview-stage {
  position: relative;
  flex: 0 0 auto;
  transition: width 0.2s ease, height 0.2s ease;
}

.mode-portrait #preview-days {
  flex-direction: column;
  padding-bottom: 1rem !important;
}

.schedule-layer {
  --schedule-card-opacity: 1;
  z-index: 10;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  transform-origin: center;
}

.schedule-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 1.5rem;
  overflow: hidden;
  border-radius: 1.75rem;
}

.schedule-panel-background-image {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.schedule-panel-background-image[hidden] {
  display: none;
}

.schedule-panel > :not(.schedule-panel-background-image) {
  position: relative;
  z-index: 1;
}

.mode-portrait .schedule-panel {
  margin: 1.25rem;
}

.character-image {
  position: absolute;
  z-index: 20;
  display: block;
  width: auto;
  height: 85%;
  max-width: none;
  max-height: none;
  pointer-events: none;
  transform-origin: center;
  user-select: none;
  -webkit-user-drag: none;
}

.character-image[hidden] {
  display: none;
}

.mode-portrait .character-image {
  height: 65%;
}

body.schedule-layout-editing .character-image:not([hidden]) {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

body.schedule-layout-editing .character-image.is-dragging {
  cursor: grabbing;
}

body.schedule-layout-editing #design-modal {
  pointer-events: auto;
  background: #fff;
  backdrop-filter: none;
  padding-left: 0;
}

body.schedule-layout-editing #design-modal > div {
  pointer-events: auto;
  width: 100%;
}

body.schedule-layout-editing .schedule-layer {
  cursor: grab;
  touch-action: none;
}

body.schedule-layout-editing .schedule-layer.is-dragging {
  cursor: grabbing;
}

.mode-portrait .day-card {
  flex-direction: row !important;
  min-height: 0;
  flex: 1;
}

.day-card {
  --theme-color: #e9d5ff;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: rgb(255 255 255 / var(--schedule-card-opacity));
  border: 1.5px solid rgba(220, 200, 240, 0.4);
  border-radius: 1.25rem;
  box-shadow: 0 2px 12px rgba(180, 140, 220, 0.1);
}

.day-card.has-schedule {
  border-color: color-mix(in srgb, var(--theme-color) 50%, transparent);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--theme-color) 32%, transparent), 0 2px 8px rgba(180, 140, 220, 0.15);
}

.day-header {
  flex-shrink: 0;
  padding: 1.25rem 0;
  text-align: center;
  background: rgb(250 247 255 / var(--schedule-card-opacity));
  border-bottom: 1.5px solid color-mix(in srgb, var(--theme-color) 25%, transparent);
}

.day-name {
  color: var(--day-color);
  font-size: 1.6rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
}

.day-date {
  margin-top: 0.2rem;
  color: #a78bca;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.day-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 180px;
  padding: 1.25rem 0.65rem 1.5rem;
  position: relative;
}

.schedule-item:not(.is-compact) {
  display: contents;
}

.schedule-item.is-compact {
  --item-color: var(--theme-color);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding: 0.55rem 0;
}

.schedule-item.is-compact + .schedule-item.is-compact {
  border-top: 1px solid rgba(167, 139, 202, 0.2);
}

.schedule-item .genre-badge {
  background: var(--item-color, var(--theme-color));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--item-color, var(--theme-color)) 38%, transparent);
}

.has-multiple-schedules .day-body {
  justify-content: stretch;
  padding-top: 0.65rem;
  padding-bottom: 0.9rem;
}

.has-multiple-schedules .genre-badge {
  width: min(100%, 6.5rem);
  margin-bottom: 0.35rem;
  padding: 0.32rem 0.45rem;
  font-size: 0.66rem;
}

.has-multiple-schedules .day-time-box {
  margin-bottom: 0.35rem;
}

.has-multiple-schedules .time-start {
  font-size: 1.25rem;
}

.has-multiple-schedules .time-separator,
.has-multiple-schedules .time-end {
  font-size: 0.7rem;
}

.has-multiple-schedules .day-title-box {
  font-size: 0.78rem;
  line-height: 1.3;
  -webkit-line-clamp: 2;
}

.genre-badge {
  width: min(100%, 7rem);
  flex-shrink: 0;
  margin-bottom: 0.85rem;
  padding: 0.45rem 0.5rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  background: var(--theme-color);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--theme-color) 38%, transparent);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-time-box {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: nowrap;
  width: 100%;
  flex-shrink: 0;
  margin-bottom: 0.85rem;
  color: #3b0764;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
}

.time-start {
  font-size: 1.55rem;
}

.time-separator,
.time-end {
  color: #7c3aed;
  font-size: 0.82rem;
}

.time-separator {
  margin: 0 0.08rem;
  opacity: 0.55;
}

.day-title-box {
  display: -webkit-box;
  width: 100%;
  overflow: hidden;
  color: #6d28d9;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-align: center !important;
  white-space: pre-wrap;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.day-title-box.is-long {
  font-size: 0.86rem;
}

.day-closed-icon {
  font-size: 2.5rem;
  opacity: 0.4;
}

.day-closed-label {
  margin-top: 0.5rem;
  color: #c4b5d4;
  font-size: 1.1rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.day-empty {
  color: rgba(180, 150, 220, 0.2);
  font-size: 1.1rem;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  transform: rotate(-8deg);
}

.day-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 2;
  width: 100%;
  height: 7px;
  background: linear-gradient(90deg, var(--theme-color), color-mix(in srgb, var(--theme-color) 67%, transparent));
}

.day-bottom-bar.is-muted {
  background: rgba(220, 200, 240, 0.3);
}

.mode-portrait .day-header {
  width: 110px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-bottom: none !important;
  border-right: 1px solid rgba(180, 160, 200, 0.25) !important;
  justify-content: center;
}

.mode-portrait .day-body {
  flex: 1;
  flex-direction: row !important;
  justify-content: flex-start !important;
  align-items: center !important;
  padding: 0 1rem !important;
  min-height: 0 !important;
  gap: 0.75rem;
}

.mode-portrait .has-multiple-schedules .day-body {
  flex-direction: column !important;
  gap: 0;
  padding: 0 !important;
}

.mode-portrait .schedule-item.is-compact {
  flex-direction: row;
  gap: 0.45rem;
  height: 50%;
  padding: 0 0.65rem;
}

.mode-portrait .schedule-item.is-compact + .schedule-item.is-compact {
  border-top: 1px solid rgba(167, 139, 202, 0.2);
  border-left: 0;
}

.mode-portrait .has-multiple-schedules .genre-badge {
  width: 72px;
}

.mode-portrait .has-multiple-schedules .day-time-box {
  width: 112px;
}

.mode-portrait .has-multiple-schedules .time-start {
  font-size: 1.35rem;
}

.mode-portrait .has-multiple-schedules .day-title-box {
  padding-left: 0.35rem;
  font-size: 0.82rem;
  -webkit-line-clamp: 2;
}

.schedule-editor-section {
  padding: 1rem;
  border: 1px solid #e0e7ff;
  border-radius: 1rem;
  background: #fafaff;
}

.schedule-editor-heading {
  margin-bottom: 0.75rem;
  color: #4338ca;
  font-size: 0.75rem;
  font-weight: 900;
}

.schedule-editor-fields {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 0.65fr;
  gap: 0.75rem;
}

.schedule-editor-label {
  display: block;
  margin-bottom: 0.35rem;
  color: #9ca3af;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.schedule-editor-input,
.schedule-editor-title {
  width: 100%;
  border: 2px solid #f3f4f6;
  border-radius: 0.75rem;
  background: #fff;
  outline: none;
  font-weight: 700;
  transition: border-color 0.2s ease;
}

.schedule-editor-input {
  padding: 0.65rem;
}

.schedule-editor-title {
  padding: 0.75rem;
  resize: none;
}

.schedule-editor-input:focus,
.schedule-editor-title:focus {
  border-color: #6366f1;
}

.schedule-editor-color {
  width: 100%;
  height: 2.75rem;
  padding: 0.2rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #fff;
  cursor: pointer;
}

.add-schedule-button {
  width: 100%;
  padding: 0.75rem;
  border: 1px dashed #a5b4fc;
  border-radius: 0.75rem;
  color: #6366f1;
  font-size: 0.75rem;
  font-weight: 900;
  transition: background-color 0.2s ease;
}

.add-schedule-button:hover {
  background: #eef2ff;
}

.design-setting-label {
  display: block;
  margin-bottom: 0.45rem;
  color: #6b7280;
  font-size: 0.7rem;
  font-weight: 900;
}

.design-sidebar {
  position: fixed;
  top: var(--app-header-height, 65px);
  bottom: 0;
  left: 0;
  z-index: 40;
  width: 430px;
  background: #fff;
  box-shadow: 12px 0 32px rgba(76, 29, 149, 0.12);
  transform: translateX(-12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.design-sidebar.opacity-100 {
  transform: translateX(0);
}

.design-sidebar-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff;
}

.design-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f3f4f6;
  background: #f9fafb;
}

.design-tab-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  flex: 0 0 auto;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid #eef2ff;
  background: #fff;
}

.design-tab-button {
  padding: 0.55rem 0.25rem;
  border-radius: 0.65rem;
  color: #9ca3af;
  font-size: 0.7rem;
  font-weight: 900;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.design-tab-button:hover {
  background: #f5f3ff;
  color: #6366f1;
}

.design-tab-button.is-active {
  background: #eef2ff;
  color: #4f46e5;
}

.design-sidebar-content {
  flex: 1 1 auto;
  min-height: 0;
  padding: 1.25rem;
  overflow-y: auto;
}

.design-sidebar-footer {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.design-sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 0.65rem;
}

.design-sidebar-actions > button {
  width: 100%;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
}

.background-decoration {
  opacity: var(--background-decoration-opacity, 0.4);
}

.design-setting-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #f3f4f6;
  border-radius: 0.75rem;
  background: #f9fafb;
  outline: none;
  font-weight: 700;
  transition: border-color 0.2s ease;
}

.design-setting-input:focus {
  border-color: #6366f1;
}

.design-setting-color {
  width: 100%;
  height: 2.9rem;
  padding: 0.2rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #fff;
  cursor: pointer;
}

.design-setting-value {
  color: #6366f1;
  font-size: 0.7rem;
  font-weight: 700;
}

.design-range-control {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}

.design-range-control > input[type="range"] {
  flex: 1;
  min-width: 0;
}

.design-range-number {
  width: 4.75rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid #d8d9e8;
  border-radius: 0.55rem;
  background: #fff;
  color: #4f46e5;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: right;
}

.design-range-number:focus {
  border-color: #818cf8;
  outline: 2px solid rgba(129, 140, 248, 0.18);
}

.background-file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 0.75rem;
  background: #eef2ff;
  color: #4f46e5;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 900;
}

.preview-background-image {
  z-index: 0;
  display: block;
}

.preview-background-image[hidden] {
  display: none;
}

.mode-portrait .genre-badge {
  margin-bottom: 0 !important;
  width: 92px;
  flex-shrink: 0;
  text-align: center;
}

.mode-portrait .day-time-box {
  width: 150px;
  flex-shrink: 0;
  margin-bottom: 0;
  text-align: center;
}

.mode-portrait .time-start {
  font-size: 2rem;
}

.mode-portrait .time-separator,
.mode-portrait .time-end {
  font-size: 1rem;
}

.mode-portrait .day-title-box {
  flex: 1;
  text-align: left !important;
  padding-left: 1rem;
  -webkit-line-clamp: 3;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 10px;
}

body.shoot-mode #app-header,
body.shoot-mode #app-sidebar,
body.shoot-mode #orientation-switcher,
body.shoot-mode #design-modal {
  display: none !important;
}

body.shoot-mode #main-preview-area {
  background: linear-gradient(135deg, #f0e6ff 0%, #fce4f0 50%, #e4f0ff 100%);
  padding: 0;
  overflow: hidden;
  position: relative;
}

body.shoot-mode .preview-stage {
  position: static;
  width: 0 !important;
  height: 0 !important;
}

body.shoot-mode .preview-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center !important;
  display: block;
  width: auto;
  height: auto;
  padding: 0;
  box-sizing: border-box;
  transition: none;
}

body.shoot-mode #preview-target {
  flex-shrink: 0;
}

.brand-title-gradient {
  background: linear-gradient(90deg, #c084fc, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-button-gradient {
  background: linear-gradient(90deg, #c084fc, #f472b6);
}

.orientation-switcher {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(200, 180, 220, 0.4);
}

.preview-shell {
  background: #fff;
  box-shadow: 0 20px 60px rgba(180, 120, 220, 0.2), 0 4px 16px rgba(180, 120, 220, 0.1);
  border: 1.5px solid rgba(210, 180, 240, 0.4);
}

.preview-shell.canvas-sheet {
  border-radius: 0;
}

.preview-shell.canvas-card {
  border-radius: 1.5rem;
}

.bg-orb-top-right {
  width: 55%;
  height: 55%;
  background: rgba(240, 220, 255, 0.7);
  filter: blur(50px);
}

.bg-orb-bottom-left {
  width: 55%;
  height: 55%;
  background: rgba(255, 220, 240, 0.7);
  filter: blur(50px);
}

.bg-orb-center {
  width: 40%;
  height: 40%;
  transform: translate(-50%, -50%);
  background: rgba(220, 240, 255, 0.5);
  filter: blur(40px);
}

.preview-title-gradient {
  font-size: 3.5rem;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #c084fc, #f472b6, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.preview-subtitle-wrap {
  background: rgba(200, 170, 240, 0.15);
  border: 1px solid rgba(200, 170, 240, 0.35);
}

.preview-subtitle-text {
  letter-spacing: 0.3em;
  color: #a78bca;
}

.preview-days-layout {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  gap: 0.625rem;
  overflow: hidden;
}

.preview-footer-bar {
  height: 10px;
  width: 100%;
  background: linear-gradient(to right, #c084fc, #f472b6, #60a5fa);
}
