:root {
	--accent-color: rgb(255 100 50);
	--accent-gradient: linear-gradient(135deg, rgb(255 120 70), rgb(255 80 40));
	--bg-panel: rgb(0 0 0 / 40%);
	--border-light: rgb(255 255 255 / 10%);
	--text-white: white;
	--text-muted: rgba(255, 255, 255, 0.5);
	--font-main: 'Archivo', sans-serif
}

.story-container {
	font-family: var(--font-main);
	color: var(--text-white);
	min-height: 100vh;
	padding: 2rem;
	position: relative
}

.header-section {
	text-align: center;
	margin-top: 0;
	padding: 2rem 0 4rem;
}

.header-label {
	text-transform: uppercase;
	letter-spacing: 3px;
	opacity: .4;
	font-size: .85rem;
	margin-bottom: .8rem;
	display: block
}

.header-label-icon {
	margin-right: 8px
}

.header-title {
	font-size: 2.8rem;
	font-weight: 600;
	margin: 0;
	background: linear-gradient(180deg, #fff, #888);
	-webkit-background-clip: text;
	-webkit-text-fill-color: #fff0;
	letter-spacing: -.5px
}

.header-subtitle {
	font-size: 1.1rem;
	opacity: .5;
	max-width: 600px;
	margin: 1rem auto 0;
	line-height: 1.6
}

#storyGenerator {
	display: flex;
	gap: 2rem;
	padding-bottom: 4rem;
	flex-direction: row-reverse;
}

.col-left {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	width: 100%
}

.col-right {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	width: 100%;
	gap: 2rem;
}

.step-section {
	margin-bottom: 0
}

.section-title {
	font-size: 1.1rem;
	font-weight: 500;
	margin: 0 0 1.2rem 0;
	display: flex;
	align-items: center;
	gap: .6rem
}

.section-number {
	opacity: .4;
	font-size: .9rem
}

.section-icon {
	opacity: .6
}

.required-indicator {
	color: var(--accent-color);
	font-size: .8rem
}

.mode-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.2rem
}

.card-selector {
	transition: all 0.3s ease
}

.card-selector:hover {
	border-color: rgb(255 255 255 / 30%) !important;
	filter: brightness(1.5) !important
}

.card-selector.selected {
	border-color: #ffffff !important;
	filter: brightness(2) !important
}

.mode-card {
	border: 1px solid var(--border-light);
	background: radial-gradient(transparent, rgb(255 255 255 / 2%)), linear-gradient(45deg, rgb(255 255 255 / 2%), rgb(255 255 255 / 6%));
	border-radius: 16px;
	padding: 1.5rem;
	cursor: pointer;
	backdrop-filter: blur(8px) saturate(.75)
}

.mode-card-header {
	display: flex;
	align-items: center;
	gap: .8rem;
	margin-bottom: 1rem
}

.mode-card-icon {
	font-size: 1.3rem;
	opacity: .7
}

.mode-card-title {
	margin: 0;
	font-weight: 500;
	font-size: 1.1rem
}

.mode-card-desc {
	margin: 0;
	font-size: .9rem;
	opacity: .55;
	line-height: 1.5
}

.source-tabs {
	background: rgb(255 255 255 / 5%);
	border-radius: 14px;
	padding: 5px;
	display: flex;
	border: 1px solid rgb(255 255 255 / 8%);
}

.source-tab {
	flex: 1;
	background: #fff0;
	border: none;
	color: #fff;
	opacity: .5;
	padding: .9rem 1.5rem;
	border-radius: 10px;
	font-size: 1rem;
	cursor: pointer;
	font-weight: 500;
	transition: all 0.3s ease;
	font-family: inherit
}

.source-tab:hover {
	opacity: .8
}

.source-tab.active {
	background: rgb(255 255 255 / 12%);
	border: 1px solid rgb(255 255 255 / 15%);
	opacity: 1
}

.tab-icon {
	margin-right: 8px
}

.prompt-section-grid {
	display: grid;
	height: 100%;
}

.script-section-flex {
	display: none;
	flex-direction: column
}

.script-inner-wrapper {
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	gap: 1rem
}

.right-col-offset {
	/*padding-top: calc(27px + 1.2rem)*/
}

.textarea-wrapper {
	position: relative;
	flex-grow: 1;
	height: 100%
}

.prompt-textarea {
	width: 100%;
	height: 100%;
	min-height: 220px;
	background: var(--bg-panel);
	border: 1px solid var(--border-light);
	border-radius: 16px;
	padding: 1.5rem;
	padding-bottom: 3.5rem;
	color: #fff;
	font-family: var(--font-main);
	font-size: 1.05rem;
	resize: none;
	outline: none;
	transition: border-color 0.3s, box-shadow 0.3s;
	line-height: 1.6;
	background: rgb(255 255 255 / 5%);
	border: 1px solid rgb(255 255 255 / 8%);
	border-color: rgb(255 100 50 / 15%);
}

.prompt-textarea:focus {
	border-color: rgb(255 100 50 / 50%);
	box-shadow: 0 0 20px rgb(255 100 50 / 10%)
}

.prompt-textarea::placeholder {
	color: rgb(255 255 255 / 35%)
}

.textarea-controls {
	position: absolute;
	bottom: 1rem;
	right: 1rem;
	display: flex;
	gap: .6rem;
	align-items: center
}

.char-counter {
	font-size: .85rem;
	opacity: .5;
	transition: all 0.3s
}

.char-counter.warning {
	color: #ffb432;
	opacity: 1
}

.char-counter.error {
	color: #ff5050;
	opacity: 1
}

.char-counter.valid {
	color: #64ff96;
	opacity: .8
}

.random-btn {
	background: rgb(255 255 255 / 8%);
	border: 1px solid rgb(255 255 255 / 15%);
	color: #fff;
	width: 42px;
	height: 42px;
	border-radius: 10px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s
}

.random-btn:hover {
	background: rgb(255 100 50 / 20%);
	border-color: rgb(255 100 50 / 50%)
}

.upload-zone {
	border: 2px dashed rgb(255 255 255 / 15%);
	border-radius: 16px;
	padding: 3rem 2rem;
	text-align: center;
	transition: all 0.3s ease;
	cursor: pointer;
	background: rgb(0 0 0 / 20%)
}

.upload-zone:hover,
.upload-zone.dragover {
	border-color: rgb(255 100 50 / 60%);
	background: rgb(255 100 50 / 5%)
}

.upload-zone.has-file {
	border-color: rgb(100 255 150 / 50%);
	background: rgb(100 255 150 / 5%)
}

.upload-content {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 1rem
}

.upload-icon {
	font-size: 2.5rem;
	opacity: .4;
	margin-bottom: 1rem;
	display: block
}

.file-ready-icon {
	font-size: 2rem;
	color: #64ff96;
	margin-bottom: .5rem;
	display: block
}

.upload-title {
	margin: 0 0 .5rem 0;
	font-size: 1.1rem;
	font-weight: 500
}

.upload-subtitle {
	margin: 0;
	opacity: .5;
	font-size: .9rem
}

.file-name {
	margin: 0;
	font-weight: 500
}

.file-meta {
	margin: 0;
	opacity: .6;
	font-size: .8rem
}

.file-action-link {
	margin: .5rem 0 0 0;
	opacity: .5;
	font-size: .75rem;
	text-decoration: underline
}

.script-divider {
	text-align: center;
	opacity: .5;
	font-size: .9rem
}

.validation-message {
	display: flex;
	align-items: center;
	gap: .5rem;
	font-size: .9rem;
	margin-top: -4rem;
    margin-left: 1rem;
	opacity: 0;
	transition: opacity 0.3s
}

.validation-message.show {
	opacity: 1
}

.validation-message.error {
	color: #ff6464
}

.validation-message.success {
	color: #64ff96
}

.tips-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}

.tip-card {
	background: rgb(255 255 255 / 3%);
	border: 1px solid rgb(255 255 255 / 8%);
	border-radius: 12px;
	padding: 1rem 1.2rem;
	font-size: .9rem;
	opacity: .7;
	line-height: 1.5;
	transition: all 0.3s
}

.tip-card:hover {
	background: rgb(255 255 255 / 5%);
	opacity: .9
}

.tip-icon-lightbulb {
	color: #ffc864;
	margin-right: 8px
}

.tip-icon-magic {
	color: #b464ff;
	margin-right: 8px
}

.create-section {
	margin-top: auto
}

.tos-wrapper {
	display: flex;
	align-items: center;
	gap: .8rem;
	margin-bottom: 1.5rem;
	padding: .5rem;
	cursor: pointer;
	opacity: .8;
	transition: opacity 0.3s
}

.tos-wrapper:hover {
	opacity: 1
}

.tos-checkbox {
	appearance: none;
	width: 20px;
	height: 20px;
	border: 1px solid rgb(255 255 255 / .3);
	border-radius: 6px;
	background: rgb(255 255 255 / .05);
	cursor: pointer;
	position: relative;
	transition: all 0.2s
}

.tos-checkbox:checked {
	background: var(--accent-color);
	border-color: var(--accent-color);
	box-shadow: 0 0 10px rgb(255 100 50 / 50%)
}

.tos-checkbox:checked::after {
	content: '\2713';
	position: absolute;
	color: #000;
	font-size: 14px;
	font-weight: 700;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%)
}

.tos-label {
	font-size: .9rem;
	user-select: none
}

.tos-label a {
	color: #fff;
	text-decoration: underline;
	text-decoration-color: rgb(255 255 255 / .3)
}

.swipe-wrapper {
	margin: 0 auto;
	width: 100%
}

.swipe-track {
	position: relative;
	background: rgb(255 255 255 / 8%);
	border-radius: 60px;
	height: 70px;
	overflow: hidden;
	border: 1px solid rgb(255 255 255 / 10%)
}

.swipe-track.disabled {
	opacity: .4;
	pointer-events: none
}

.swipe-fill {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, rgb(255 100 50 / 50%), #ff6432);
	box-shadow: 0 0 15px rgb(255 100 50 / 40%);
	border-radius: 60px;
	transition: width 0.1s ease-out
}

.swipe-handle {
	position: absolute;
	left: 6px;
	top: 50%;
	transform: translateY(-50%);
	width: 58px;
	height: 58px;
	background: linear-gradient(135deg, #ff7846, #ff5028);
	border-radius: 50%;
	cursor: grab;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 15px rgb(255 100 50 / 40%);
	transition: box-shadow 0.3s;
	z-index: 2;
	user-select: none
}

.swipe-handle:active {
	transform: translateY(-50%) scale(1.1);
	box-shadow: 0 0 30px rgb(255 255 255 / .8);
	cursor: grabbing
}

.handle-icon {
	color: #fff;
	font-size: 1.2rem;
	transition: transform 0.3s
}

.swipe-text {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	font-size: 1.1rem;
	font-weight: 500;
	opacity: .6;
	pointer-events: none;
	white-space: nowrap
}

.status-wrapper {
	display: none;
	justify-content: center;
	gap: 2rem;
	margin-top: 1.5rem;
	opacity: .4;
	font-size: .9rem
}

.status-item {
	display: flex;
	align-items: center;
	gap: 6px
}

.status-dot {
	width: 6px;
	height: 6px;
	background: #64ff64;
	border-radius: 50%;
}

@keyframes pulse {

	0%,
	100% {
		opacity: .6
	}

	50% {
		opacity: 1;
	}
}

.generating {
	animation: pulse 1.5s ease-in-out infinite;
}

.hidden {
	display: none;
}

.fade-out-hidden {
	opacity: 0;
	height: 0;
	overflow: hidden;
	margin: 0 !important;
	padding: 0 !important;
	pointer-events: none;
	transition: all 0.3s ease
}

.fade-in-visible {
	opacity: 1;
	height: auto;
	transition: all 0.3s ease;
}

@media (max-width:900px) {
	#storyGenerator {
		flex-direction: column-reverse;
	}

	.right-col-offset {
		padding-top: 0 !important;
	}

	.col-right {
		height: 100%;
	}

	.header-label,
	.header-title,
	.header-subtitle {
		text-align: left;
	}
}

.mode-card.coming-soon {
	position: relative;
	overflow: hidden;
	pointer-events: none;
	opacity: .6;
}

.mode-card.coming-soon .mode-card-header,
.mode-card.coming-soon .mode-card-desc {
	opacity: .4;
}

.coming-soon-ribbon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) rotate(-15deg);
	width: 140%;
	height: 50px;
	background: radial-gradient(transparent, rgb(0 0 0 / 25%)), linear-gradient(0deg, rgb(255 255 255 / 5%), transparent, rgb(255 255 255 / 25%)), linear-gradient(90deg, #4f4120, #ffd165, #4f4120);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 10;
	border: 4px solid rgb(255 205 115 / 30%);
	box-shadow: 0 5px 15px 10px rgb(0 0 0 / 30%);
}

.coming-soon-text {
	color: rgb(0 0 0 / 90%);
	font-size: 1.15rem;
	font-weight: 600;
	letter-spacing: 2px;
	text-transform: uppercase;
	filter: drop-shadow(0 4px 3px rgb(0 0 0 / 50%));
}

/* --- INFO TOOLTIPS --- */
.info-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgb(255 255 255 / 8%);
    border: 1px solid rgb(255 255 255 / 15%);
    font-size: 0.7rem;
    opacity: 0.5;
    cursor: help;
    transition: all 0.2s ease;
    position: relative;
}

.info-trigger .fa-solid {
	top: -1px;
    position: relative;
    transform: scale(0.8);
}

.info-trigger:hover {
  opacity: 1;
  background: rgb(255 255 255 / 15%);
  border-color: rgb(255 255 255 / 30%);
}

.info-trigger .tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: rgb(30 30 30 / 98%);
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  width: 260px;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.5;
  color: rgb(255 255 255 / 85%);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
  box-shadow: 0 10px 40px rgb(0 0 0 / 50%);
  z-index: 5;
  text-align: left;
}

.info-trigger .tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: rgb(30 30 30 / 98%);
}

.info-trigger:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

.tooltip-title {
  font-weight: 600;
  color: white;
  margin-bottom: 0.4rem;
  display: block;
}

/* --- CREATE BUTTON (replacing swipe) --- */
.create-btn {
    width: 100%;
    height: 60px;
    background: linear-gradient(0deg, transparent, transparent, rgb(255 255 255 / 20%)), linear-gradient(0deg, rgb(255 0 200 / 10%), transparent), radial-gradient(transparent, rgb(255 100 50 / 35%), rgb(255 100 50 / 70%)), radial-gradient(rgb(255 140 90 / 25%), transparent), linear-gradient(0deg, rgb(0 0 0 / 50%), transparent), radial-gradient(transparent, transparent, rgb(68 18 0)), linear-gradient(0deg, transparent, rgb(255 100 50 / 25%));
    border: none;
    border-radius: 16px;
    color: white;
    font-family: var(--font-main);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: inset 0px 0px 0px 2px rgb(255 255 255 / 10%);
    filter: contrast(1.05) brightness(1.1) saturate(1.1) drop-shadow(0px 4px 20px rgb(255 100 50 / 25%)) drop-shadow(0px 4px 5px rgb(255 100 50 / 40%)) hue-rotate(10deg);
}

.create-btn:hover:not(:disabled,.inactive) {
  transform: translateY(-2px);
  filter: contrast(1.05) brightness(1.2) saturate(1.1) drop-shadow(0px 4px 20px rgb(255 100 50 / 50%)) drop-shadow(0px 4px 5px rgb(255 100 50 / 60%)) hue-rotate(10deg);
}

.create-btn:active:not(:disabled) {
  transform: translateY(0);
}

.create-btn:disabled {
  background: linear-gradient(0deg, rgb(255 255 255 / 10%), rgb(255 255 255 / 20%));
  box-shadow: inset 0px 0px 0px 2px rgb(255 255 255 / 10%);
  cursor: not-allowed;
  opacity: 0.5;
  filter: none;
}

.create-btn .btn-icon {
  font-size: 1rem;
  transition: transform 0.3s ease;
  top: 2px;
  position: relative;
}

.create-btn:hover:not(:disabled) .btn-icon {
  transform: translateX(4px);
}

.create-btn.loading {
  pointer-events: none;
}

.create-btn.loading .btn-icon {
  animation: spin 1s linear infinite;
}

.create-btn.success {
  background: linear-gradient(135deg, rgb(74 222 128), rgb(34 197 94));
  box-shadow: 0 4px 20px rgb(74 222 128 / 30%);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* --- STEP INDICATORS --- */
.step-indicator {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(255 255 255 / 15%);
  transition: all 0.3s ease;
}

.step-dot.active {
  background: var(--accent-color);
  box-shadow: 0 0 10px rgb(255 100 50 / 50%);
}

.step-dot.completed {
  background: rgb(74 222 128);
}

.create-btn:disabled {
  background: rgb(255 255 255 / 10%);
  box-shadow: none;
  cursor: pointer; /* Changed from not-allowed */
  opacity: 0.5;
  pointer-events: auto; /* Allow clicks */
}

.create-btn:disabled:hover {
  opacity: 0.65;
}

.create-btn:disabled:active {
  transform: scale(0.98);
}

.create-btn.inactive {
	background: linear-gradient(0deg, rgb(255 255 255 / 10%), rgb(255 255 255 / 15%));
    cursor: help;
    opacity: 0.5;
    filter: none;
    box-shadow: inset 0px 0px 0px 2px rgb(255 255 255 / 10%);
}

.create-btn.inactive:hover {
  opacity: 0.65;
}

.create-btn.inactive:active {
  transform: scale(0.98);
}

.create-btn.inactive .btn-icon {
  transform: none !important;
}

/* AI Note Link Hover Effect */
.ai-disclosure-link {
    color: #bbb;
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.3);
    transition: color 0.2s;
}
.ai-disclosure-link:hover {
    color: #fff;
    text-decoration-color: #fff;
}

/* --- AI DATA NOTE --- */
.ai-note {
    padding: .5rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #bbb;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.4;
}

.ai-note-icon {
    font-size: 1.1em;
    margin-top: 2px;
    flex-shrink: 0;
    opacity: 0.5;
}

.ai-note-link {
    color: #bbb;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.ai-note-link:hover {
    color: #fff;
    text-decoration-color: #fff;
}