/* StoryMates CSS-tyylit */

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	min-height: 100vh;
	color: #333;
	padding-top: 60px;
	/* Tilaa headerille */
}

/* Poista ylätila kirjautumissivuilta */
body.auth-page {
	padding-top: 0;
}

/* Main Header */
.main-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	background: rgba(255, 255, 255, 0.95);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
	z-index: 1000;
	height: 60px;
}

.header-content {
	display: flex;
	justify-content: space-between;
	align-items: center;
	height: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 20px;
}

.header-left .logo {
	text-decoration: none;
	color: #667eea;
}

.header-left .logo h1 {
	font-size: 1.8em;
	font-weight: 300;
	margin: 0;
}

.header-right {
	display: flex;
	align-items: center;
	gap: 15px;
}

.language-btn {
	text-decoration: none;
	font-size: 1.2em;
	padding: 8px 12px;
	border-radius: 8px;
	background: rgba(102, 126, 234, 0.1);
	transition: background 0.3s;
}

.language-btn:hover {
	background: rgba(102, 126, 234, 0.2);
}

/* Hamburger Menu */
.hamburger-menu {
	position: relative;
}

.hamburger-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	display: flex;
	flex-direction: column;
	gap: 3px;
	border-radius: 4px;
	transition: background 0.3s;
}

.hamburger-btn:hover {
	background: rgba(0, 0, 0, 0.05);
}

.hamburger-btn span {
	width: 20px;
	height: 2px;
	background: #667eea;
	transition: all 0.3s;
	border-radius: 1px;
}

.menu-dropdown {
	position: absolute;
	top: 100%;
	right: 0;
	background: white;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
	min-width: 200px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-10px);
	transition: all 0.3s;
	margin-top: 8px;
}

.menu-dropdown.show {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.menu-section {
	padding: 12px 0;
	border-bottom: 1px solid #f0f0f0;
}

.menu-section:last-child {
	border-bottom: none;
}

.user-info {
	padding: 0 16px;
	color: #667eea;
	font-size: 0.9em;
}

.menu-item {
	display: block;
	padding: 8px 16px;
	text-decoration: none;
	color: #333;
	transition: background 0.2s;
	font-size: 0.9em;
}

.menu-item:hover {
	background: #f8f9fa;
}

.menu-item.logout {
	color: #dc3545;
}

.menu-item.logout:hover {
	background: #ffe6e6;
}

/* Mobile responsive */
@media (max-width: 768px) {
	.header-content {
		padding: 0 15px;
	}

	.header-left .logo h1 {
		font-size: 1.5em;
	}

	.menu-dropdown {
		min-width: 180px;
	}
}

.container {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	padding: 20px;
}

.auth-box {
	background: white;
	padding: 40px;
	border-radius: 15px;
	box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
	width: 100%;
	max-width: 400px;
}

.auth-box h1 {
	text-align: center;
	color: #667eea;
	margin-bottom: 10px;
	font-size: 2.5em;
	font-weight: 300;
}

.auth-box h2 {
	text-align: center;
	margin-bottom: 30px;
	color: #555;
	font-weight: 400;
}

.form-group {
	margin-bottom: 20px;
}

label {
	display: block;
	margin-bottom: 5px;
	font-weight: 500;
	color: #555;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
	width: 100%;
	padding: 12px;
	border: 2px solid #e1e5e9;
	border-radius: 8px;
	font-size: 16px;
	transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: #667eea;
}

.btn-primary {
	padding: 12px 24px;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: white;
	border: none;
	border-radius: 8px;
	font-size: 16px;
	cursor: pointer;
	transition: transform 0.2s;
	text-decoration: none;
	display: inline-block;
}

.btn-primary:hover {
	transform: translateY(-2px);
}

/* Form-sisällä olevat primary-napit ovat koko levyisiä */
form .btn-primary {
	width: 100%;
}

.btn-secondary {
	padding: 12px 24px;
	background: #6c757d;
	color: white;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	text-decoration: none;
	display: inline-block;
	margin: 5px;
	font-size: 16px;
	transition: background 0.2s;
}

.btn-secondary:hover {
	background: #5a6268;
}

/* Header-linkeissä olevat napit samankokoisiksi */
.header-links .btn-primary,
.header-links .btn-secondary {
	padding: 8px 16px;
	font-size: 16px;
	margin: 0;
	border-radius: 5px;
}

.auth-link {
	text-align: center;
	margin-top: 20px;
	color: #666;
}

.auth-link a {
	color: #667eea;
	text-decoration: none;
}

.auth-link a:hover {
	text-decoration: underline;
}

.auth-container {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	padding: 20px;
}

.auth-form {
	background: white;
	padding: 40px;
	border-radius: 15px;
	box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
	width: 100%;
	max-width: 500px;
}

.auth-form h2 {
	text-align: center;
	color: #667eea;
	margin-bottom: 30px;
	font-size: 2em;
	font-weight: 400;
}

.auth-links {
	text-align: center;
	margin-top: 20px;
}

.auth-links a {
	color: #667eea;
	text-decoration: none;
}

.auth-links a:hover {
	text-decoration: underline;
}

.error-message {
	background: #f8d7da;
	color: #721c24;
	padding: 10px;
	border-radius: 5px;
	margin-bottom: 20px;
	border: 1px solid #f5c6cb;
}

.success-message {
	background: #d4edda;
	color: #155724;
	padding: 10px;
	border-radius: 5px;
	margin-bottom: 20px;
	border: 1px solid #c3e6cb;
}

/* Dashboard tyylit */
.dashboard {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
}

.dashboard-content {
	background: white;
	padding: 30px;
	border-radius: 15px;
	box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
	margin-bottom: 30px;
}

.dashboard-content h1 {
	color: #667eea;
	margin-bottom: 20px;
	text-align: center;
	font-size: 2em;
}

.header-links {
	display: flex;
	gap: 10px;
	align-items: center;
	justify-content: center;
}

.profile-btn {
	background: #6c757d;
	color: white;
	padding: 8px 16px;
	border: none;
	border-radius: 5px;
	text-decoration: none;
	cursor: pointer;
}

.profile-btn:hover {
	background: #5a6268;
}

.superadmin-btn {
	background: #ff6b6b;
	color: white;
	padding: 8px 16px;
	border: none;
	border-radius: 5px;
	text-decoration: none;
	cursor: pointer;
}

.superadmin-btn:hover {
	background: #ff5252;
}

.logout-btn {
	background: #dc3545;
	color: white;
	padding: 8px 16px;
	border: none;
	border-radius: 5px;
	text-decoration: none;
	cursor: pointer;
}

.logout-btn:hover {
	background: #c82333;
}

.stories-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 20px;
}

.story-card {
	background: white;
	padding: 20px;
	border-radius: 10px;
	/* margin-bottom: 20px; */
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.story-card h3 {
	color: #667eea;
	margin-bottom: 10px;
}

.story-card p {
	color: #666;
	margin-bottom: 15px;
}

.story-actions {
	display: flex;
	gap: 10px;
}

.create-story-btn {
	display: inline-block;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: white;
	padding: 15px 30px;
	border-radius: 10px;
	text-decoration: none;
	margin-bottom: 30px;
	font-size: 18px;
}

.create-story-btn:hover {
	transform: translateY(-2px);
}

/* Tarinan luominen */
.story-form {
	background: white;
	padding: 30px;
	border-radius: 10px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	max-width: 800px;
	margin: 20px auto;
}

.character-list,
.place-list {
	margin: 20px 0;
}

.character-item,
.place-item {
	background: #f8f9fa;
	padding: 10px;
	margin: 10px 0;
	border-radius: 5px;
	border-left: 4px solid #667eea;
}

.add-btn {
	background: #28a745;
	color: white;
	border: none;
	padding: 8px 16px;
	border-radius: 5px;
	cursor: pointer;
	margin: 10px 0;
	font-size: 14px;
	transition: background 0.2s;
}

.add-btn:hover {
	background: #218838;
}

/* Tarinan kirjoittaminen */
.story-writing {
	max-width: 1000px;
	margin: 0 auto;
	padding: 20px;
}

.story-header {
	background: white;
	padding: 20px;
	border-radius: 10px;
	margin-bottom: 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.story-header h1 {
	color: #667eea;
	margin: 0;
	font-size: 1.8em;
}

.story-controls {
	display: flex;
	gap: 10px;
	align-items: center;
}

.view-toggle-btn {
	background: #667eea;
	color: white;
	border: none;
	padding: 10px 15px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 0.9em;
	transition: background 0.3s;
	text-decoration: none;
	display: inline-block;
}

.view-toggle-btn:hover {
	background: #5a6fd8;
}

@media (max-width: 768px) {
	.story-header {
		flex-direction: column;
		gap: 15px;
		text-align: center;
	}

	.story-header h1 {
		font-size: 1.5em;
	}
}

.story-turns {
	background: white;
	padding: 20px;
	border-radius: 10px;
	margin-bottom: 20px;
	max-height: 600px;
	overflow-y: auto;
	scroll-behavior: smooth;
	padding-right: 10px;
	position: relative;
}

/* Lomakkeiden keskitys story-turns sisällä */
.story-turns form {
	max-width: 500px;
	margin: 0 auto;
}

.story-turns .error-message,
.story-turns .success-message {
	max-width: 500px;
	margin: 0 auto 20px auto;
}

/* Poista scroll-rajoitukset lomakesivuilta */
.form-page .story-turns {
	max-height: none;
	overflow-y: visible;
	max-width: none;
}

.form-page .story-turns form {
	max-width: none;
	margin: 0;
}

.form-page .story-turns .error-message,
.form-page .story-turns .success-message {
	max-width: none;
	margin-bottom: 20px;
}


.turn {
	margin-bottom: 20px;
	padding: 15px;
	border-left: 4px solid #667eea;
	background: #f8f9fa;
	position: relative;
}

.insert-btn-wrapper {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 20px;
	position: relative;
	margin: -10px 0;
}

.insert-btn {
	display: none;
	position: absolute;
	top: -14px;
	z-index: 2;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #e1e5e9;
	color: #667eea;
	border: 2px solid #e1e5e9;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.07);
	font-size: 20px;
	cursor: pointer;
	transition: background 0.2s, color 0.2s, border 0.2s;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.insert-btn:hover {
	background: #667eea;
	color: #fff;
	border: 2px solid #667eea;
}

.turn:hover+.insert-btn-wrapper .insert-btn,
.insert-btn-wrapper:hover .insert-btn,
.insert-btn-wrapper:focus-within .insert-btn {
	display: flex;
}

/* Näytä myös viimeisen rivin jälkeen kun hoverissa tai napin päällä */
.turn:last-child+.insert-btn-wrapper .insert-btn,
.insert-btn-wrapper:last-child:hover .insert-btn,
.insert-btn-wrapper:last-child:focus-within .insert-btn {
	display: flex;
}

.turn-info {
	font-size: 12px;
	color: #666;
	margin-bottom: 5px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.edit-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.btn-edit,
.turn-info .btn-delete,
.btn-insert {
	padding: 6px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	min-width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, transform 0.1s;
}

.btn-edit {
	background: #007bff;
	color: white;
}

.btn-edit:hover {
	background: #0056b3;
	transform: scale(1.1);
}

.turn-info .btn-delete {
	background: #dc3545;
	color: white;
}

.turn-info .btn-delete:hover {
	background: #c82333;
	transform: scale(1.1);
}

.btn-insert {
	background: #28a745;
	color: white;
	padding: 8px 12px;
	margin: 5px 0;
}

.btn-insert:hover {
	background: #218838;
}

.turn-actions {
	display: none;
}

.edit-form {
	margin-top: 10px;
	padding: 15px;
	background: #e9ecef;
	border-radius: 5px;
}

.writing-form {
	background: white;
	padding: 20px;
	border-radius: 10px;
	margin-bottom: 20px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.writing-controls {
	display: flex;
	gap: 15px;
	margin-bottom: 15px;
	flex-wrap: wrap;
}

.writing-controls select {
	flex: 1;
	min-width: 150px;
}

textarea {
	min-height: 150px;
	/* resize: none; */
	/* Poistetaan manuaalinen koon säätäminen, koska käytetään automaattista */
	/* overflow: hidden; */
	/* Piilotetaan vierityspalkki automaattisen koon vuoksi */
	transition: height 0.2s ease;
	/* Sujuva siirtymä korkeuden muutoksessa */
}

/* Kirjoituslomakkeen textarea erityisesti */
.writing-form textarea {
	min-height: 120px;
	/* max-height: 400px; */
	/* Maksimikorkeus ettei kasva liian suureksi */
}

/* Hahmojen ja paikkojen kuvausten textarea */
.character-input textarea,
.place-input textarea,
.edit-form textarea {
	min-height: 60px;
	/* max-height: 200px; */
	/* Pienempi maksimikorkeus kuin kirjoituslomakkeessa */
	/* resize: none; */
	/* overflow: hidden; */
	transition: height 0.2s ease;
}

/* Lukunäkymä */
.reading-mode {
	font-family: 'Georgia', 'Times New Roman', serif;
	line-height: 1.8;
	font-size: 16px;
	max-height: none;
}

.story-content {
	max-width: 800px;
	margin: 0 auto;
}

.reading-turn {
	margin-bottom: 20px;
}

.narrator-text {
	color: #555;
	text-align: justify;
	margin: 15px 0;
	padding: 10px 0;
}

.character-speech {
	margin: 15px 0;
}

.character-name {
	color: #667eea;
	font-weight: bold;
	font-size: 17px;
}

.place-name {
	color: #888;
	font-size: 14px;
	margin-left: 10px;
}

.speech-content {
	margin-top: 5px;
	text-align: justify;
	padding-left: 20px;
	border-left: 3px solid #e1e5e9;
	margin-left: 10px;
}

/* Kursiiviteksti lukunäkymässä */
.reading-italic {
	font-style: italic;
	/* font-weight: 500; */
}

@media (max-width: 768px) {
	.stories-grid {
		grid-template-columns: 1fr;
	}

	.writing-controls {
		flex-direction: column;
		gap: 15px;
	}

	.writing-controls select {
		flex: none;
		min-width: auto;
		width: 100%;
	}

	/* Mobiilioptimoidut pudotusvalikot */
	.writing-controls .form-group {
		margin-bottom: 15px;
	}

	.writing-controls .form-group label {
		font-size: 0.9em;
		margin-bottom: 5px;
	}

	.writing-controls select {
		width: 100%;
		padding: 10px 8px;
		font-size: 16px;
		/* Estää zoomauksen iOS:ssä */
		border: 1px solid #ddd;
		border-radius: 6px;
		background: white;
		-webkit-appearance: none;
		-moz-appearance: none;
		appearance: none;
		background-image: url("data:image/svg+xml;utf8,<svg fill='%23666' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
		background-repeat: no-repeat;
		background-position: right 8px center;
		background-size: 16px;
	}

	/* Kompaktimpi layout kolmelle pudotusvalikkolle */
	@media (max-width: 480px) {
		.writing-controls {
			display: grid;
			grid-template-columns: 1fr 1fr;
			gap: 10px;
		}

		.writing-controls .form-group:first-child {
			grid-column: 1 / -1;
			/* Tyyppi-valikko koko leveydeltä */
		}

		.writing-controls .form-group label {
			font-size: 0.8em;
			margin-bottom: 3px;
		}

		.writing-controls select {
			padding: 8px 6px;
			font-size: 14px;
		}

		/* Kirjoituskenttä pienemmäksi mobiilissa */
		.writing-form textarea {
			min-height: 100px;
			font-size: 16px;
			/* Estää zoomauksen iOS:ssä */
		}

		.writing-form .form-group {
			margin-bottom: 10px;
		}
	}

	.auth-box {
		padding: 20px;
	}
}

/* Hahmojen ja paikkojen kuvat */
.character-image,
.place-image {
	width: 100px;
	height: 100px;
	object-fit: cover;
	border-radius: 8px;
	float: left;
	margin-right: 15px;
	margin-bottom: 10px;
	border: 2px solid #e1e5e9;
}

.character-image-small,
.place-image-small {
	width: 50px;
	height: 50px;
	object-fit: cover;
	border-radius: 6px;
	float: left;
	margin-right: 10px;
	margin-bottom: 5px;
	border: 1px solid #e1e5e9;
}

.character-item,
.place-item {
	background: #f8f9fa;
	border: 1px solid #e1e5e9;
	border-radius: 8px;
	padding: 15px;
	margin-bottom: 15px;
	overflow: hidden;
}

.character-info,
.place-info {
	overflow: hidden;
	margin-bottom: 10px;
}

.character-actions,
.place-actions {
	clear: both;
	margin-top: 10px;
}

.character-actions form,
.place-actions form {
	display: inline-block;
	margin-right: 5px;
}

.edit-form {
	background: #fff;
	border: 2px solid #667eea;
	border-radius: 8px;
	padding: 15px;
	margin-top: 10px;
	box-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
}

.edit-actions button {
	margin-right: 10px;
}

/* Piilota file input */
input[type="file"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

/* Kuvat */
.character-image,
.place-image {
	max-width: 200px;
	max-height: 150px;
	width: auto;
	height: auto;
	border-radius: 8px;
	margin-bottom: 10px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	object-fit: cover;
}

.character-image-small,
.place-image-small {
	max-width: 60px;
	max-height: 60px;
	width: auto;
	height: auto;
	border-radius: 6px;
	margin-right: 10px;
	float: left;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
	object-fit: cover;
}

.character-actions,
.place-actions {
	margin-top: 10px;
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	align-items: center;
}

.character-actions form,
.place-actions form {
	margin: 0;
}

.character-actions input[type="file"],
.place-actions input[type="file"] {
	display: none;
}

.character-item,
.place-item {
	clear: both;
	overflow: hidden;
	margin-bottom: 15px;
	padding-bottom: 15px;
	border-bottom: 1px solid #eee;
}

.character-item:last-child,
.place-item:last-child {
	border-bottom: none;
}

/* Tarinaosion skrollaus poistettu - yhdistetty ylempään */

.story-turns.reading-mode {
	max-height: 600px;
	overflow-y: auto;
	scroll-behavior: smooth;
	padding-right: 20px;
}

/* Lukunäkymän kirjoituslomake */
.reading-writing-section .writing-form {
	/* background: #f8f9fa; */
	border: 1px solid #dee2e6;
	border-radius: 8px;
	padding: 20px;
	margin: 0;
	margin-bottom: 20px;
}

/* Skrollauspalkin tyylittely */
.story-turns::-webkit-scrollbar {
	width: 8px;
}

.story-turns::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 4px;
}

.story-turns::-webkit-scrollbar-thumb {
	background: #c1c1c1;
	border-radius: 4px;
}

.story-turns::-webkit-scrollbar-thumb:hover {
	background: #a8a8a8;
}

/* Kielenvaihtotyylit */
.language-selector {
	display: flex;
	flex-direction: column;
	gap: 15px;
	margin-bottom: 30px;
}

.language-option {
	display: flex;
	align-items: center;
	gap: 15px;
	padding: 15px 20px;
	background: #f8f9fa;
	border: 2px solid #e9ecef;
	border-radius: 8px;
	text-decoration: none;
	color: #495057;
	transition: all 0.3s ease;
	position: relative;
}

.language-option:hover {
	background: #e9ecef;
	border-color: #667eea;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.language-option.active {
	background: #667eea;
	border-color: #667eea;
	color: white;
}

.language-option.active:hover {
	background: #5a67d8;
	border-color: #5a67d8;
}

.flag {
	font-size: 24px;
	width: 32px;
	height: 24px;
	display: inline-block;
	text-align: center;
	line-height: 24px;
}

.flag-fi::before {
	content: "🇫🇮";
}

.flag-en::before {
	content: "🇬🇧";
}

.flag-it::before {
	content: "🇮🇹";
}

.current-indicator {
	margin-left: auto;
	font-weight: bold;
	font-size: 18px;
}

.language-btn {
	background: #28a745;
	color: white;
	padding: 8px 16px;
	border: none;
	border-radius: 5px;
	text-decoration: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-family: inherit;
	font-size: inherit;
}

.language-btn:hover {
	background: #218838;
}

/* Varmistetaan että button-elementit näyttävät samalta kuin linkit */
button.language-btn,
button.profile-btn,
button.logout-btn,
button.superadmin-btn {
	font-family: inherit;
	font-size: inherit;
}

/* Responsiivinen kielivalikko */
@media (max-width: 768px) {

	/* Ylävalikon responsiivisuus */
	.header-links {
		flex-wrap: wrap;
		gap: 8px;
		justify-content: center;
	}

	.language-btn,
	.profile-btn,
	.logout-btn,
	.superadmin-btn,
	.btn-primary,
	.btn-secondary,
	.btn-delete,
	#view-toggle,
	.header-links .btn-primary,
	.header-links .btn-secondary {
		padding: 6px 12px;
		font-size: 14px;
		white-space: nowrap;
		min-width: auto;
	}

	.language-option {
		padding: 12px 15px;
		gap: 10px;
	}

	.flag {
		font-size: 20px;
		width: 28px;
		height: 20px;
		line-height: 20px;
	}

	/* Muokkaustilan optimointi mobiilille */
	.edit-form .form-group {
		margin-bottom: 12px;
	}

	.edit-form select {
		width: 100%;
		padding: 8px;
		font-size: 16px;
		border: 1px solid #ddd;
		border-radius: 4px;
		-webkit-appearance: none;
		-moz-appearance: none;
		appearance: none;
		background: white;
		background-image: url("data:image/svg+xml;utf8,<svg fill='%23666' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
		background-repeat: no-repeat;
		background-position: right 8px center;
		background-size: 16px;
	}

	.edit-form label {
		font-size: 0.9em;
		margin-bottom: 4px;
	}

	/* Muokkauslomakkeen writing-controls mobiilissa */
	.edit-form .writing-controls {
		flex-direction: column;
		gap: 12px;
	}

	.edit-form .writing-controls .form-group {
		margin-bottom: 10px;
	}

	.edit-form .writing-controls select {
		flex: none;
		min-width: auto;
		width: 100%;
	}

	/* Edit-actions napit mobiilissa */
	.edit-actions .btn-primary,
	.edit-actions .btn-secondary,
	.edit-actions .btn-delete {
		padding: 6px 12px;
		font-size: 14px;
		margin: 2px;
	}

	/* Lukuvälilehdet mobiilissa */
	.chapters-tabs {
		flex-wrap: wrap;
		gap: 6px;
		padding: 10px;
	}

	.chapter-tab {
		padding: 10px 16px;
		font-size: 13px;
		min-width: 100px;
	}

	/* Kompakti layout pienkenkoisille näytöille */
	@media (max-width: 480px) {

		/* Ylävalikon erittäin kompakti versio */
		.header-links {
			gap: 6px;
		}

		.language-btn,
		.profile-btn,
		.logout-btn,
		.superadmin-btn,
		.btn-primary,
		.btn-secondary,
		.btn-delete,
		#view-toggle,
		.header-links .btn-primary,
		.header-links .btn-secondary {
			padding: 4px 8px;
			font-size: 12px;
		}

		.edit-form .form-group.inline-group {
			display: grid;
			grid-template-columns: 1fr 1fr;
			gap: 8px;
		}

		.edit-form .form-group.inline-group .form-group {
			margin-bottom: 0;
		}

		/* Muokkauslomakkeen erittäin kompakti versio pienille näytöille */
		.edit-form .writing-controls {
			gap: 8px;
		}

		.edit-form .writing-controls .form-group {
			margin-bottom: 8px;
		}

		.edit-form .writing-controls select {
			padding: 6px;
			font-size: 14px;
			flex: none;
			min-width: auto;
			width: 100%;
		}

		.edit-form .writing-controls label {
			font-size: 0.8em;
			margin-bottom: 2px;
		}

		/* Edit-actions napit erittäin pienissä näytöissä */
		.edit-actions .btn-primary,
		.edit-actions .btn-secondary,
		.edit-actions .btn-delete {
			padding: 4px 8px;
			font-size: 12px;
			margin: 1px;
		}

		/* Lukuvälilehdet mobiilissa */
		.chapters-tabs {
			flex-wrap: wrap;
			gap: 4px;
			padding: 8px;
		}

		.chapter-tab {
			padding: 8px 12px;
			font-size: 12px;
			min-width: 80px;
			flex: 1;
		}

		.chapter-count {
			font-size: 0.8em;
		}

		/* Superadmin-sivun erittäin pienet näytöt */
		.stats-grid {
			grid-template-columns: 1fr 1fr;
			gap: 10px;
		}

		.stat-card {
			padding: 10px;
		}

		.stat-number {
			font-size: 1.3em;
		}

		.management-section h2 {
			font-size: 1.3em;
			margin-bottom: 15px;
		}

		.user-table,
		.story-table {
			font-size: 12px;
		}

		.user-table th,
		.user-table td,
		.story-table th,
		.story-table td {
			padding: 6px 4px;
		}

		.btn-small {
			padding: 4px 6px;
			font-size: 10px;
			min-width: 60px;
		}

		.story-header h1 {
			font-size: 1.3em;
		}

		.story-header .btn-secondary {
			padding: 6px 10px;
			font-size: 12px;
		}

		/* Modaali erittäin pienille näytöille */
		#passwordResetModal>div {
			min-width: 95% !important;
			padding: 20px !important;
		}

		#passwordResetModal h3 {
			font-size: 1.2em;
			margin-bottom: 15px;
		}
	}
}

/* Rooli-badget */
.role-badge {
	display: inline-block;
	padding: 4px 8px;
	border-radius: 12px;
	font-size: 0.8em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-left: 8px;
}

.role-badge.owner {
	background-color: #ff6b6b;
	color: white;
}

.role-badge.admin {
	background-color: #4ecdc4;
	color: white;
}

.role-badge.writer {
	background-color: #45b7d1;
	color: white;
}

.role-badge.reader {
	background-color: #96ceb4;
	color: white;
}

.role-select {
	padding: 4px 8px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 0.9em;
	margin-left: 8px;
	background-color: white;
}

/* Osallistujien parempi layout */
.participant-info {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 5px;
}

.participant-actions {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid #eee;
}

.btn-delete {
	background: #dc3545;
	color: white;
	border: none;
	padding: 12px 24px;
	border-radius: 8px;
	font-size: 16px;
	cursor: pointer;
	transition: background 0.2s;
	text-decoration: none;
	display: inline-block;
	margin: 5px;
}

.btn-delete:hover {
	background: #c82333;
}

/* Skrollausnappi */
.scroll-to-bottom-btn {
	position: fixed;
	bottom: 20px;
	right: 20px;
	background: #667eea;
	color: white;
	border: none;
	border-radius: 50%;
	width: 45px;
	height: 45px;
	font-size: 18px;
	cursor: pointer;
	box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
	z-index: 1000;
	transition: all 0.3s ease;
	opacity: 0.8;
}

.scroll-to-bottom-btn:hover {
	opacity: 1;
	transform: scale(1.1);
	box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Lukujen välilehdet */
.chapters-container {
	background: white;
	border-radius: 10px;
	margin-bottom: 20px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	overflow: hidden;
}

.chapters-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	padding: 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.chapter-tab {
	background: #f8f9fa;
	border: none;
	padding: 12px 20px;
	cursor: pointer;
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
	min-width: 120px;
	justify-content: center;
	border-bottom: 3px solid transparent;
	font-size: 14px;
	color: #6c757d;
}

.chapter-tab:hover {
	background: #e9ecef;
	color: #495057;
}

.chapter-tab.active {
	background: #667eea;
	color: white;
	/* border-bottom-color: #5a67d8; */
	font-weight: 600;
}

.chapter-tab.add-chapter {
	background: #28a745;
	color: white;
	font-weight: 600;
}

.chapter-tab.add-chapter:hover {
	background: #218838;
}

.chapter-title {
	cursor: pointer;
	padding: 2px 4px;
	border-radius: 3px;
	transition: background 0.2s;
}

.chapter-title:hover {
	background: rgba(255, 255, 255, 0.2);
}

.chapter-count {
	font-size: 0.85em;
	opacity: 0.8;
	font-weight: normal;
}

/* Hakuominaisuus */
.search-container {
	margin: 20px 0;
	background: white;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	padding: 15px;
}

.search-input-container {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
}

.search-input {
	flex: 1;
	min-width: 200px;
	padding: 10px;
	border: 2px solid #e1e5e9;
	border-radius: 5px;
	font-size: 14px;
	transition: border-color 0.3s;
}

.search-input:focus {
	outline: none;
	border-color: #007bff;
}

.search-btn,
.clear-search-btn {
	padding: 10px 15px;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	font-size: 14px;
	transition: background-color 0.3s;
}

.search-btn {
	background: #007bff;
	color: white;
}

.search-btn:hover {
	background: #0056b3;
}

.clear-search-btn {
	background: #6c757d;
	color: white;
}

.clear-search-btn:hover {
	background: #545b62;
}

.search-results {
	margin-top: 15px;
	border-top: 1px solid #e1e5e9;
	padding-top: 15px;
}

.search-results h4 {
	margin: 0 0 10px 0;
	color: #333;
	font-size: 16px;
}

.search-result-item {
	background: #f8f9fa;
	border: 1px solid #e1e5e9;
	border-radius: 5px;
	padding: 10px;
	margin-bottom: 8px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.search-result-content {
	flex: 1;
	margin-right: 10px;
}

.search-result-preview {
	font-size: 14px;
	color: #555;
	line-height: 1.4;
}

.search-highlight {
	background: #fff3cd;
	padding: 1px 3px;
	border-radius: 2px;
	font-weight: bold;
}

.search-result-meta {
	font-size: 12px;
	color: #6c757d;
	margin-top: 5px;
}

.jump-btn {
	background: #28a745;
	color: white;
	border: none;
	padding: 5px 10px;
	border-radius: 3px;
	cursor: pointer;
	font-size: 12px;
	white-space: nowrap;
}

.jump-btn:hover {
	background: #218838;
}

.no-results {
	text-align: center;
	color: #6c757d;
	font-style: italic;
	padding: 20px;
}

/* Korostus hakutuloksille */
.turn-highlighted,
.reading-turn.turn-highlighted {
	background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
	border-left: 4px solid #ffc107;
	animation: highlight-pulse 2s ease-in-out;
}

@keyframes highlight-pulse {

	0%,
	100% {
		transform: scale(1);
	}

	50% {
		transform: scale(1.02);
	}
}

/* Mobiili */
@media (max-width: 768px) {
	.search-input-container {
		flex-direction: column;
		align-items: stretch;
	}

	.search-input {
		min-width: auto;
		margin-bottom: 10px;
	}

	.search-result-item {
		flex-direction: column;
		align-items: stretch;
	}

	.search-result-content {
		margin-right: 0;
		margin-bottom: 10px;
	}
}

/* Notifikaatio-animaatiot */
@keyframes slideIn {
	from {
		transform: translateX(100%);
		opacity: 0;
	}

	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes slideOut {
	from {
		transform: translateX(0);
		opacity: 1;
	}

	to {
		transform: translateX(100%);
		opacity: 0;
	}
}

/* Lataus-indikaattori napin sisällä */
.btn-loading {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.btn-loading::before {
	content: '';
	width: 16px;
	height: 16px;
	border: 2px solid transparent;
	border-top: 2px solid currentColor;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* Mobiililaitteiden tuki - Näytä insert-painikkeet aina näkyvissä */
@media (max-width: 768px) {
	.insert-btn {
		display: flex !important;
		opacity: 0.7;
		background: #f8f9fa;
		border: 2px solid #667eea;
		color: #667eea;
	}

	.insert-btn:active {
		background: #667eea;
		color: #fff;
		opacity: 1;
	}

	/* Pienennä painiketta hieman mobiilissa */
	.insert-btn {
		width: 24px;
		height: 24px;
		font-size: 14px;
		top: -12px;
	}

	/* Lisää tilaa insert-painikkeiden ympärille */
	.insert-btn-wrapper {
		height: 20px;
		margin: -10px 0;
	}
}

/* Tablettien tuki */
@media (max-width: 1024px) and (min-width: 769px) {
	.insert-btn {
		display: flex !important;
		opacity: 0.5;
	}

	.insert-btn:hover,
	.insert-btn:active {
		opacity: 1;
	}
}

/* Kosketusnäyttöjen tuki - näytä painikkeet aina */
@media (hover: none) and (pointer: coarse) {
	.insert-btn {
		display: flex !important;
		opacity: 0.8;
		background: #f8f9fa;
		border: 2px solid #667eea;
		color: #667eea;
	}

	.insert-btn:active {
		background: #667eea;
		color: #fff;
		opacity: 1;
		transform: scale(0.95);
	}

	/* Muokkauspainikkeet mobiilissa */
	.btn-edit,
	.turn-info .btn-delete {
		min-width: 32px;
		min-height: 32px;
		font-size: 14px;
		padding: 6px;
	}

	.btn-edit:active {
		transform: scale(0.95);
		background: #0056b3;
	}

	.turn-info .btn-delete:active {
		transform: scale(0.95);
		background: #c82333;
	}

	/* Turn-info alue mobiilissa */
	.turn-info {
		min-height: 44px;
		padding: 8px 12px;
	}

	.edit-actions {
		gap: 8px;
	}
}

/* Tyhjien kappaleiden tyylit */
.empty-paragraph {
	height: 40px;
	min-height: 40px;
	background: #f8f9fa;
	border: 2px dashed #ccc;
	border-radius: 5px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #999;
	font-style: italic;
	margin: 10px 0;
	font-size: 14px;
}

.empty-paragraph::after {
	content: '— Tyhjä kappale —';
}

.empty-paragraph-reading {
	height: 60px;
	min-height: 60px;
	background: transparent;
	margin: 30px 0;
	position: relative;
}

.empty-paragraph-reading::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 200px;
	height: 1px;
	background: linear-gradient(to right, transparent, #ddd, transparent);
}

.empty-paragraph-reading::after {
	content: '✦';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: white;
	padding: 0 15px;
	color: #ddd;
	font-size: 18px;
}

/* Superadmin-sivun tyylit */
.stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 20px;
	margin-bottom: 30px;
}

.stat-card {
	background: white;
	padding: 20px;
	border-radius: 10px;
	text-align: center;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.stat-number {
	font-size: 2em;
	font-weight: bold;
	color: #667eea;
}

.management-section {
	background: white;
	padding: 20px;
	border-radius: 10px;
	margin-bottom: 20px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Taulukkojen vieritys */
.table-container {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-table,
.story-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 15px;
}

.user-table th,
.user-table td,
.story-table th,
.story-table td {
	padding: 10px;
	border: 1px solid #ddd;
	text-align: left;
}

.user-table th,
.story-table th {
	background: #f5f5f5;
}

.superadmin-badge {
	background: #ff6b6b;
	color: white;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 0.8em;
}

.action-buttons {
	display: flex;
	gap: 8px;
	justify-content: center;
}

.btn-small {
	padding: 8px 12px;
	font-size: 14px;
	text-decoration: none;
	border-radius: 4px;
	border: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
}

.btn-danger {
	background: #ff6b6b;
	color: white;
}

.btn-warning {
	background: #ffa502;
	color: white;
}

.btn-success {
	background: #2ed573;
	color: white;
}

.btn-info {
	background: #3742fa;
	color: white;
}

/* Reports-sivun tyylit */
.reports-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 15px;
	margin-bottom: 30px;
}

.stat-label {
	color: #666;
	margin-top: 5px;
}

.reports-filters {
	background: white;
	padding: 20px;
	border-radius: 10px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	margin-bottom: 30px;
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
	align-items: end;
}

/* Varmistetaan että form-page:ssa on riittävästi tilaa suodattimien jälkeen */
.form-page .reports-filters {
	margin-bottom: 40px !important;
}

.filter-group {
	flex: 1;
	min-width: 150px;
}

.filter-group:last-child {
	flex: 0 0 auto;
	min-width: 120px;
}

.filter-group label {
	display: block;
	margin-bottom: 5px;
	font-weight: 600;
	color: #333;
}

.filter-group select,
.filter-group button {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #ddd;
	border-radius: 6px;
	font-size: 14px;
	background: white;
	cursor: pointer;
}

.filter-group button {
	background: #667eea;
	color: white;
	border-color: #667eea;
}

.filter-group button:hover {
	background: #5a6fd8;
	border-color: #5a6fd8;
}

.filter-group select:focus {
	outline: none;
	border-color: #667eea;
	box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.reports-table {
	background: white;
	border-radius: 10px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	overflow: hidden;
}

.reports-table table {
	width: 100%;
	border-collapse: collapse;
}

.reports-table th,
.reports-table td {
	padding: 12px;
	text-align: left;
	border-bottom: 1px solid #eee;
}

.reports-table th {
	background: #f8f9fa;
	font-weight: 600;
}

.priority-badge,
.status-badge,
.type-badge {
	padding: 4px 8px;
	border-radius: 12px;
	font-size: 0.8em;
	font-weight: 600;
	text-transform: uppercase;
}

.priority-critical {
	background: #dc3545;
	color: white;
}

.priority-high {
	background: #fd7e14;
	color: white;
}

.priority-medium {
	background: #ffc107;
	color: black;
}

.priority-low {
	background: #28a745;
	color: white;
}

.status-open {
	background: #6c757d;
	color: white;
}

.status-in_progress {
	background: #007bff;
	color: white;
}

.status-resolved {
	background: #28a745;
	color: white;
}

.status-closed {
	background: #6f42c1;
	color: white;
}

.type-bug {
	background: #dc3545;
	color: white;
}

.type-feedback {
	background: #17a2b8;
	color: white;
}

.type-suggestion {
	background: #28a745;
	color: white;
}

.report-details {
	max-width: 300px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.btn-view {
	background: #007bff;
	color: white;
}

.btn-edit {
	background: #28a745;
	color: white;
}

.modal {
	display: none;
	position: fixed;
	z-index: 1000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
	background-color: white;
	margin: 5% auto;
	padding: 30px;
	border-radius: 10px;
	width: 90%;
	max-width: 800px;
	max-height: 80vh;
	overflow-y: auto;
}

.close {
	color: #aaa;
	float: right;
	font-size: 28px;
	font-weight: bold;
	cursor: pointer;
}

.close:hover {
	color: black;
}

/* Responsiivinen suodatusikkuna */
@media (max-width: 768px) {
	.reports-filters {
		flex-direction: column;
		align-items: stretch;
	}

	.filter-group {
		min-width: 100%;
	}

	.reports-table {
		overflow-x: auto;
	}

	.reports-table table {
		min-width: 800px;
	}

	/* Superadmin-sivun mobiilituki */
	.stats-grid {
		grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
		gap: 15px;
	}

	.stat-card {
		padding: 15px;
	}

	.stat-number {
		font-size: 1.5em;
	}

	.management-section {
		padding: 15px;
		overflow-x: auto;
	}

	.user-table,
	.story-table {
		min-width: 800px;
		font-size: 14px;
	}

	.user-table th,
	.user-table td,
	.story-table th,
	.story-table td {
		padding: 8px 6px;
		white-space: nowrap;
	}

	.action-buttons {
		flex-direction: column;
		gap: 4px;
		min-width: 100px;
	}

	.btn-small {
		padding: 6px 8px;
		font-size: 12px;
		min-width: 80px;
		height: auto;
	}

	.superadmin-badge {
		font-size: 0.7em;
		padding: 1px 6px;
	}

	/* Header-actions mobiilissa */
	.story-header .header-actions {
		flex-direction: column;
		gap: 8px;
		align-items: stretch;
	}

	.story-header .btn-secondary {
		padding: 8px 12px;
		font-size: 14px;
		text-align: center;
	}

	/* Modaali mobiilissa */
	#passwordResetModal>div {
		min-width: 90% !important;
		max-width: 400px !important;
		margin: 0 20px !important;
	}
}

/* Edit Story -sivun välilehdet */
.edit-tabs-container {
	background: white;
	border-radius: 10px;
	margin-bottom: 20px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	overflow: hidden;
}

.edit-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	padding: 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.edit-tab {
	background: #f8f9fa;
	border: none;
	padding: 15px 20px;
	cursor: pointer;
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
	min-width: 150px;
	justify-content: center;
	border-bottom: 3px solid transparent;
	font-size: 14px;
	color: #6c757d;
	font-weight: 500;
}

.edit-tab:hover {
	background: #e9ecef;
	color: #495057;
}

.edit-tab.active {
	background: #667eea;
	color: white;
	border-bottom-color: #5a67d8;
	font-weight: 600;
}

.tab-content {
	display: block;
}

/* Responsiivinen edit-tabs */
@media (max-width: 768px) {
	.edit-tabs {
		flex-direction: column;
	}

	.edit-tab {
		min-width: 100%;
		padding: 12px 15px;
		font-size: 13px;
		border-bottom: 1px solid #e9ecef;
		border-radius: 0;
	}

	.edit-tab.active {
		border-bottom: 1px solid #e9ecef;
		border-left: 4px solid #667eea;
	}
}

@media (max-width: 480px) {
	.edit-tab {
		padding: 10px 12px;
		font-size: 12px;
	}

	.edit-tabs-container {
		margin-bottom: 15px;
	}
}

/* Pillerimäiset valitsimet */
.pill-selectors {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 15px;
	align-items: center;
	position: relative;
}

/* Työpöytä ja tabletti - normaalit pillerit */
@media (min-width: 769px) {
	.pill-selectors {
		position: relative;
		top: auto;
		right: auto;
		background: none;
		border-radius: 0;
		padding: 0;
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}

	.pill-text,
	.pill-arrow {
		display: inline;
	}

	.writing-form textarea {
		padding-top: initial;
	}
}

.pill-selector {
	position: relative;
	display: inline-block;
}

.pill-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	background: #f8f9fa;
	border: 2px solid #e9ecef;
	border-radius: 20px;
	padding: 8px 12px;
	cursor: pointer;
	font-size: 14px;
	transition: all 0.2s ease;
	min-height: 36px;
	color: #495057;
	font-family: inherit;
}

.pill-btn:hover {
	background: #e9ecef;
	border-color: #667eea;
	transform: translateY(-1px);
}

.pill-btn:active {
	transform: translateY(0);
}

.pill-icon {
	font-size: 16px;
	line-height: 1;
}

.pill-text {
	font-weight: 500;
	white-space: nowrap;
}

.pill-arrow {
	font-size: 10px;
	transition: transform 0.2s ease;
	margin-left: 2px;
}

.pill-selector.active .pill-arrow {
	transform: rotate(180deg);
}

.pill-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	background: white;
	border: 1px solid #e9ecef;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	min-width: 180px;
	z-index: 1000;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-5px);
	transition: all 0.2s ease;
	margin-top: 4px;
}

.pill-dropdown.show {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.pill-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	cursor: pointer;
	transition: background 0.2s ease;
	border-bottom: 1px solid #f8f9fa;
}

.pill-option:last-child {
	border-bottom: none;
}

.pill-option:hover {
	background: #f8f9fa;
}

.pill-option:first-child {
	border-radius: 8px 8px 0 0;
}

.pill-option:last-child {
	border-radius: 0 0 8px 8px;
}

.option-icon {
	font-size: 14px;
	width: 16px;
	text-align: center;
}

.option-text {
	font-size: 14px;
	color: #495057;
}

/* Aktiivisten pillerien tyylit */
.pill-selector[data-selected="true"] .pill-btn,
.pill-btn.pill-active {
	background: #667eea;
	border-color: #667eea;
	color: white;
}

.pill-selector[data-selected="true"] .pill-btn:hover,
.pill-btn.pill-active:hover {
	background: #5a67d8;
	border-color: #5a67d8;
}

/* Mobiilituki pillerimäisille valitsimille */
@media (max-width: 768px) {
	.pill-selectors {
		position: absolute;
		top: 10px;
		right: 10px;
		flex-direction: row;
		gap: 6px;
		z-index: 10;
		background: rgba(255, 255, 255, 0.9);
		border-radius: 20px;
		padding: 4px;
		-webkit-backdrop-filter: blur(5px);
		backdrop-filter: blur(5px);
	}

	.pill-btn {
		width: 32px;
		height: 32px;
		min-height: 32px;
		padding: 0;
		border-radius: 50%;
		font-size: 11px;
		background: #f8f9fa;
		border: 1px solid #e9ecef;
		justify-content: center;
		align-items: center;
	}

	.pill-btn:hover {
		background: #e9ecef;
		transform: scale(1.1);
	}

	.pill-text,
	.pill-arrow {
		display: none;
	}

	.pill-icon {
		font-size: 14px;
	}

	.pill-dropdown {
		min-width: 140px;
		right: 0;
		left: auto;
		transform: translateX(10px);
	}

	/* Kirjoituslomakkeiden container pitää olla relative mobiilissa */
	.writing-form {
		position: relative;
	}

	/* Varmista että textarea ei mene valitsimien alle */
	.writing-form textarea {
		padding-top: 15px;
	}
}

@media (max-width: 480px) {
	.pill-selectors {
		top: 8px;
		right: 8px;
		gap: 4px;
		padding: 3px;
	}

	.pill-btn {
		width: 28px;
		height: 28px;
		min-height: 28px;
		font-size: 10px;
	}

	.pill-icon {
		font-size: 12px;
	}

	.pill-dropdown {
		min-width: 120px;
		font-size: 13px;
	}

	.pill-option {
		padding: 8px 10px;
	}

	.option-icon {
		font-size: 12px;
	}

	.option-text {
		font-size: 13px;
	}
}

/* Pillereiden animaatiot */
@keyframes pillPulse {

	0%,
	100% {
		transform: scale(1);
	}

	50% {
		transform: scale(1.05);
	}
}

.pill-btn:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}