:root {
    --color-teal: #20c997;
    --color-teal-dark: #1aa882;
    --color-sea-blue: #4682b4;
    --color-sea-blue-dark: #3a709a;
    --color-light-cyan: #e0ffff;
    --color-sand: #f4a460;
    --color-dark-blue: #2c3e50;
    --color-white: #ffffff;
    --color-black: #000000;
    --color-gray: #6c757d;
    --color-light-gray: #f8f9fa;
    --color-red: #e74c3c;
    --color-red-dark: #c0392b;
    --color-pink: var(--color-teal);
    --color-purple: var(--color-sea-blue);
    --color-light-pink: var(--color-light-cyan);
    --color-dark-purple: var(--color-dark-blue);
    --font-primary: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    --font-size-small: 14px;
    --font-size-medium: 16px;
    --font-size-large: 18px;
    --font-size-xl: 24px;
    --font-size-xxl: 32px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background: linear-gradient(
        135deg,
        var(--color-light-pink) 0%,
        var(--color-purple) 100%
    );
    min-height: 100vh;
    overflow: hidden;
}

body.creator-body,
body.admin-body {
    background: var(--color-light-gray);
    color: var(--color-dark-blue);
    overflow-y: auto;
}

#app {
    height: 100vh;
    width: 100vw;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: all 0.3s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.menu-container,
.settings-container,
.history-container {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
}

.menu-container {
    max-width: 500px;
    width: 90%;
}

.game-title {
    font-size: var(--font-size-xxl);
    color: var(--color-dark-purple);
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.game-info {
    margin: 20px 0;
    color: var(--color-gray);
    line-height: 1.4;
}

.menu-buttons {
    margin: 30px 0;
}

.menu-btn {
    display: block;
    width: 100%;
    margin: 10px 0;
    min-width: 250px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: var(--font-size-medium);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    color: var(--color-white);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn--primary {
    background-color: var(--color-teal);
    box-shadow: 0 4px 12px rgba(32, 201, 151, 0.2);
}

.btn--primary:hover {
    background-color: var(--color-teal-dark);
    box-shadow: 0 6px 16px rgba(32, 201, 151, 0.4);
}

.btn--secondary {
    background-color: var(--color-sea-blue);
    box-shadow: 0 4px 12px rgba(70, 130, 180, 0.2);
}

.btn--secondary:hover {
    background-color: var(--color-sea-blue-dark);
    box-shadow: 0 6px 16px rgba(70, 130, 180, 0.4);
}

.btn--danger {
    background-color: var(--color-red);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

.btn--danger:hover {
    background-color: var(--color-red-dark);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
}

.btn--small {
    padding: 8px 16px;
    font-size: var(--font-size-small);
}

.settings-section {
    margin: 30px 0;
    text-align: left;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 10px;
    background: rgba(240, 240, 240, 0.5);
    border-radius: 8px;
}

.setting-label input[type="range"] {
    width: 100px;
    margin: 0 10px;
}

.setting-label input[type="checkbox"] {
    transform: scale(1.2);
}

.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.background-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 1s ease-in-out;
    opacity: 0;
}

.background-image.active {
    opacity: 1;
}

.characters-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.character-sprite {
    position: absolute;
    bottom: 0;
    height: 80%;
    transition: all 0.3s ease-in-out;
    filter: brightness(0.8);
    transform: translateX(-50%) scale(1);
}

.character-sprite.hidden {
    opacity: 0;
    transform: translateX(-50%) scale(0.9);
}

.character-sprite.active-speaker {
    filter: brightness(1);
    transform: translateX(-50%) scale(1.03);
    z-index: 10;
}

.character-sprite:not(.active-speaker) {
    z-index: 5;
}

.character-sprite img {
    height: 100%;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.3));
}

.dialogue-box {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: none;
    border-radius: 15px 15px 0 0;
    padding: 20px;
    box-shadow: 0 -8px 32px 0 rgba(0, 0, 0, 0.2);
    z-index: 10;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.character-name {
    background: var(--color-teal);
    color: var(--color-white);
    padding: 8px 20px;
    border-radius: 15px 15px 0 0;
    font-weight: 600;
    margin: -20px -20px 15px -20px;
    text-align: center;
    font-size: var(--font-size-large);
}

.character-name.hidden {
    display: none;
}

.dialogue-text {
    font-size: var(--font-size-large);
    line-height: 1.5;
    margin-bottom: 15px;
    color: var(--color-black);
    min-height: 60px;
}

.choices-container {
    margin: 15px 0;
}

.choices-container.hidden {
    display: none;
}

.choice-button {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 15px;
    background: var(--choice-bg);
    color: var(--color-white);
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: var(--font-size-medium);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.choice-button:hover {
    background: transparent;
    border-color: var(--choice-bg);
    color: var(--choice-bg);
    transform: translateY(-2px);
    box-shadow: none;
}

.game-ui {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 20;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ui-btn {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--color-dark-purple);
    white-space: nowrap;
}

.ui-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.history-container {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.history-content {
    margin: 20px 0;
    max-height: calc(80vh - 150px);
    overflow-y: auto;
    text-align: left;
}

.history-item {
    padding: 15px;
    margin: 10px 0;
    background: rgba(240, 240, 240, 0.5);
    border-radius: 10px;
    border-left: 4px solid var(--color-teal);
}

.history-character {
    font-weight: 600;
    color: var(--color-dark-purple);
    margin-bottom: 5px;
}

.admin-input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--color-sea-blue);
    border-radius: 10px;
    font-size: var(--font-size-medium);
    margin: 10px 0;
}

.admin-btn {
    width: 100%;
    margin-top: 15px;
}

.error-message {
    color: var(--color-red);
    padding: 10px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--color-red);
    border-radius: 5px;
    margin: 10px 0;
}

.upload-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.upload-status.success {
    background: rgba(32, 201, 151, 0.1);
    color: #1a8a6a;
    border: 1px solid #1a8a6a;
}

.upload-status.error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--color-red);
    border: 1px solid var(--color-red);
}

.back-link {
    margin-top: 20px;
}

.typing-cursor {
    animation: blink 1s infinite;
    color: var(--color-teal);
}

@keyframes blink {
    0%,
    50% {
        opacity: 1;
    }
    51%,
    100% {
        opacity: 0;
    }
}

.loading:after {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--color-sea-blue);
    border-radius: 50%;
    border-top: 2px solid transparent;
    animation: spin 1s linear infinite;
    margin-left: 5px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.click-indicator {
    position: absolute;
    bottom: 10px;
    right: 25px;
    font-size: 24px;
    color: var(--color-teal);
    animation: bounce 1.5s infinite;
}

.click-indicator.hidden {
    display: none;
}

@keyframes bounce {
    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.scenario-info {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 8px;
    color: var(--color-white);
    max-width: 600px;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#scenarioTitle {
    font-weight: 600;
    font-size: var(--font-size-medium);
    text-shadow: 1px 1px 2px var(--color-black);
}

#scenarioAuthor {
    font-size: var(--font-size-small);
    opacity: 0.8;
}

.scenario-description {
    font-weight: normal;
}

.scenario-author {
    display: block;
    margin-top: 5px;
    font-size: var(--font-size-small);
    font-style: italic;
    color: var(--color-dark-blue);
    opacity: 0.7;
}

.creator-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background: var(--color-white);
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
}

.creator-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--color-sea-blue);
    padding-bottom: 15px;
    margin-bottom: 20px;
    gap: 15px;
}

.creator-card {
    background: var(--color-white);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.creator-card h3 {
    margin-top: 0;
    color: var(--color-dark-purple);
}

.dialogue-card {
    border-left: 5px solid var(--color-teal);
    position: relative;
    padding-left: 25px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: var(--font-size-small);
}

.form-control,
.form-group input[type="text"],
.form-group textarea,
.choice-row input[type="text"],
.choice-row select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #dfe4ea;
    border-radius: 8px;
    font-size: var(--font-size-medium);
    background-color: var(--color-white);
    color: var(--color-dark-blue);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-control:focus,
.form-group input[type="text"]:focus,
.form-group textarea:focus,
.choice-row input[type="text"]:focus,
.choice-row select:focus {
    border-color: var(--color-sea-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(70, 130, 180, 0.2);
}

select.form-control,
.form-group select,
.choice-row select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236c757d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
    padding-right: 3rem;
    cursor: pointer;
}

.remove-btn {
    cursor: pointer;
    color: var(--color-red);
    font-weight: bold;
    font-size: 20px;
    line-height: 1;
    padding: 5px;
}

.dialogue-card + .dialogue-card {
    margin-top: 25px;
}

.dialogue-card + .dialogue-card::before {
    content: "";
    position: absolute;
    top: -12.5px;
    left: 25px;
    right: 20px;
    height: 1px;
    background-color: #e0e0e0;
}

.remove-dialogue-btn {
    position: absolute;
    top: 15px;
    right: 15px;
}

.creator-card h4 {
    font-size: var(--font-size-large);
    margin-top: 25px;
    margin-bottom: 15px;
    padding-top: 25px;
    border-top: 1px solid #e0e0e0;
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.choice-row .choice-text-input {
    flex-grow: 1;
}

.choice-row .choice-next-select {
    width: 200px;
    flex-shrink: 0;
}

.choice-row .remove-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #f1f1f1;
    font-size: 16px;
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.choice-row .remove-btn:hover {
    background-color: var(--color-red);
    color: var(--color-white);
}

.add-choice-btn {
    margin-top: 15px;
    align-self: flex-start;
}

.add-dialogue-wrapper {
    position: relative;
    padding-top: 25px;
    text-align: center;
}

.add-dialogue-wrapper::before {
    content: "";
    position: absolute;
    top: 12.5px;
    left: 25px;
    right: 20px;
    height: 1px;
    background-color: #e0e0e0;
}

/* Character slots styling */
.characters-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e0e0e0;
}

.characters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.characters-header h4 {
    margin: 0;
}

.characters-slots-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.character-slot {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background-color: #f9f9f9;
}

.character-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.character-slot-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.character-slot-title {
    font-weight: 600;
    color: var(--color-dark-purple);
}

.character-slot-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
}

/* Position control styles */
.position-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.move-up-btn,
.move-down-btn {
    min-width: 24px;
    width: 24px;
    height: 20px;
    padding: 0;
    font-size: 12px;
    line-height: 1;
    font-weight: bold;
}

.move-up-btn:disabled,
.move-down-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Character Creator Styles */
.pose-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.pose-slot {
    background: var(--color-white);
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    min-height: 350px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}

.pose-slot:hover {
    border-color: var(--color-teal);
    background-color: rgba(32, 201, 151, 0.02);
}

.pose-slot.filled {
    border-style: solid;
    border-color: var(--color-teal);
    background-color: rgba(32, 201, 151, 0.05);
}

.pose-slot.uploading {
    border-color: var(--color-yellow);
    background-color: rgba(255, 193, 7, 0.1);
}

.pose-placeholder {
    width: 150px;
    height: 200px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.pose-placeholder::before {
    content: "+";
    font-size: 2rem;
    color: #6c757d;
    font-weight: bold;
}

.pose-slot:hover .pose-placeholder {
    border-color: var(--color-teal);
    background-color: rgba(32, 201, 151, 0.1);
}

.pose-slot:hover .pose-placeholder::before {
    color: var(--color-teal);
}

.pose-image-wrapper {
    width: 150px;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
    position: relative;
    flex-shrink: 0;
}

.pose-preview {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
}

.pose-label {
    font-weight: bold;
    color: var(--color-dark-purple);
    margin-bottom: 10px;
    font-size: var(--font-size-large);
    text-transform: capitalize;
}

.file-input-hidden {
    display: none;
}

.upload-btn {
    background: var(--color-teal);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--font-size-base);
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.upload-btn:hover {
    background: var(--color-teal-dark);
}

.upload-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.pose-status {
    font-size: var(--font-size-small);
    margin-top: 10px;
    padding: 5px 10px;
    border-radius: 4px;
}

.pose-status.success {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.pose-status.error {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.pose-status.uploading {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.char-color-input {
    width: 60px;
    height: 40px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.char-color-input:hover {
    border-color: var(--color-teal);
}

/* Upload Progress */
.upload-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 300px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: var(--color-teal);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-weight: 500;
    color: var(--color-dark-purple);
}

/* Custom Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.7) translateY(-50px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 25px 30px 0;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 0;
}

.modal-title {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-dark-purple);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.modal-icon.success {
    background: #d4edda;
    color: #155724;
}

.modal-icon.error {
    background: #f8d7da;
    color: #721c24;
}

.modal-icon.warning {
    background: #fff3cd;
    color: #856404;
}

.modal-icon.info {
    background: #d1ecf1;
    color: #0c5460;
}

.modal-body {
    padding: 20px 30px;
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text);
}

.modal-footer {
    padding: 0 30px 25px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #dfe4ea;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #ffffff;
    color: #333;
    margin-top: 15px;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: #20c997;
    box-shadow: 0 0 0 3px rgba(32, 201, 151, 0.2);
}

.modal-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.modal-button.primary {
    background: var(--color-teal);
    color: white;
}

.modal-button.primary:hover {
    background: var(--color-teal-dark);
    transform: translateY(-1px);
}

.modal-button.secondary {
    background: #6c757d;
    color: white;
}

.modal-button.secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.modal-button.danger {
    background: #dc3545;
    color: white;
}

.modal-button.danger:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    border-left: 4px solid;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: #28a745;
}

.toast.error {
    border-left-color: #dc3545;
}

.toast.warning {
    border-left-color: #ffc107;
}

.toast.info {
    border-left-color: #17a2b8;
}

.toast-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast.success .toast-icon {
    background: #d4edda;
    color: #155724;
}

.toast.error .toast-icon {
    background: #f8d7da;
    color: #721c24;
}

.toast.warning .toast-icon {
    background: #fff3cd;
    color: #856404;
}

.toast.info .toast-icon {
    background: #d1ecf1;
    color: #0c5460;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--color-dark-purple);
    font-size: var(--font-size-base);
}

.toast-message {
    font-size: var(--font-size-small);
    color: var(--color-text);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #666;
}

.controls-wrapper {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.controls-card .creator-card-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.controls-card h3 {
    margin: 0;
}

.admin-login-container {
    max-width: 400px;
    width: 90%;
    background: var(--color-white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: none;
}
.admin-login-container .back-link a {
    color: var(--color-gray);
    text-decoration: none;
    font-size: var(--font-size-small);
}
.admin-login-container .back-link a:hover {
    text-decoration: underline;
}

.admin-container-new {
    width: 100%;
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

.admin-header-new {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.admin-header-new h1 {
    font-size: var(--font-size-xxl);
    color: var(--color-dark-blue);
}

.admin-main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.content-card {
    background: var(--color-white);
    border-radius: 12px;
    padding: 20px 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.card-header h2 {
    margin: 0;
    font-size: var(--font-size-xl);
    color: var(--color-dark-purple);
}

.card-header .stat-value {
    font-size: var(--font-size-large);
    font-weight: 600;
}

.card-body {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-input-wrapper {
    flex-grow: 1;
    position: relative;
}

.file-input-hidden {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.file-input-label {
    display: block;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    cursor: pointer;
    background-color: #f8f9fa;
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-input-label:hover {
    background-color: #e9ecef;
}

.file-input-label span {
    font-size: var(--font-size-medium);
    color: var(--color-gray);
}

.admin-login-container {
    padding: 35px 40px;
    text-align: left;
    border-radius: 12px;
}

.admin-login-container h1 {
    font-size: var(--font-size-xxl);
    color: var(--color-dark-blue);
    margin-bottom: 30px;
    font-weight: 700;
}

.admin-login-container .form-group {
    margin-bottom: 20px;
}

.admin-login-container .form-group label {
    display: block;
    font-size: var(--font-size-small);
    color: var(--color-gray);
    font-weight: 600;
    margin-bottom: 8px;
}

.admin-login-container .admin-input {
    border: 2px solid #dfe4ea;
    border-radius: 12px;
    padding: 12px 15px;
    margin: 0;
    transition: border-color 0.2s ease;
}

.admin-login-container .admin-input:focus {
    border-color: var(--color-sea-blue);
    outline: none;
}

.admin-login-container .admin-btn {
    margin-top: 10px;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
}

.admin-login-container .back-link {
    text-align: center;
    margin-top: 25px;
}

.audio-control-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.audio-control-wrapper select {
    flex-grow: 1;
}

.audio-control-wrapper .audio-preview-btn {
    flex-shrink: 0;
    width: 42px;
    padding: 8px 12px;
}

.btn.btn--disabled {
    background-color: #ced4da !important; /* !important, чтобы перебить другие стили кнопок */
    color: #6c757d !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Asset Editor Styles */
.asset-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.asset-description {
    color: #666;
    font-size: 0.9rem;
    margin: 0 0 20px 0;
}

.assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.scenes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.asset-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.asset-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #20c997;
}

.asset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.asset-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #333;
    word-break: break-word;
}

.asset-actions {
    display: flex;
    gap: 5px;
}

.asset-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: #666;
}

.asset-path {
    font-family: monospace;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    word-break: break-all;
}

.asset-size {
    font-weight: 500;
}

/* Audio asset specific */
.audio-asset .asset-controls {
    margin-top: 15px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.volume-control label {
    font-weight: 500;
    color: #555;
}

.volume-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #20c997;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #20c997;
    cursor: pointer;
    border: none;
}

.volume-value {
    font-weight: 500;
    color: #20c997;
    min-width: 40px;
}

/* Location asset specific */
.location-asset {
    position: relative;
}

.location-preview {
    width: 100%;
    height: 150px;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.location-asset:hover .location-image {
    transform: scale(1.05);
}

/* Location preview modal */
.location-preview-content {
    max-width: 80vw;
    max-height: 90vh;
    width: auto;
}

.location-preview-body {
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 70vh;
    overflow: hidden;
}

.location-preview-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Button states for asset actions */
.play-btn.playing {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.play-btn.playing::after {
    content: "⏸️";
}

.btn--small {
    padding: 4px 8px;
    font-size: 0.8rem;
    min-width: auto;
}

/* Empty state */
.assets-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.assets-empty::before {
    content: "📁";
    display: block;
    font-size: 3rem;
    margin-bottom: 10px;
}

/* Upload progress for assets */
.asset-uploading {
    opacity: 0.6;
    position: relative;
}

.asset-uploading::after {
    content: "⏳";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 50%;
}

.char-color-input {
    width: 100%;
    height: 42px;
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
    cursor: pointer;
}

.pose-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.pose-slot {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: border-color 0.3s;
}

.pose-slot.filled {
    border-color: var(--color-teal);
    border-style: solid;
}

.pose-slot img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    background-color: #f0f0f0;
    margin-bottom: 10px;
    display: none;
}

.pose-slot.filled img {
    display: block;
}

.pose-slot .pose-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--color-dark-purple);
}

.pose-slot .file-input-label {
    padding: 8px 12px;
}

.controls-card {
    padding: 0;
    overflow: hidden;
}

.controls-card .creator-card-header {
    padding: 20px;
}

.controls-card .creator-card-header h3 {
    margin: 0;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0;
    background-color: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.control-group {
    padding: 20px;
    background-color: var(--color-white);
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-group:last-child {
    border-right: none;
}

.control-group h4 {
    margin: 0 0 10px 0;
    font-size: var(--font-size-large);
    color: var(--color-dark-purple);
    font-weight: 600;
}

.control-group .btn,
.control-group .form-control {
    width: 100%;
    margin: 0;
}

.contributors {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--color-gray);
}

.contributors-title {
    font-size: var(--font-size-small);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.contributor-links {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.contributor {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--color-dark-blue);
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.contributor:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.contributor .github-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.voice-female {
    color: #e0609c;
    font-weight: 500;
}

.voice-male {
    color: #5294db;
    font-weight: 500;
}

.location-asset .asset-header {
    position: relative;
    z-index: 2;
    background-color: #f8f9fa;
}

#location-preview-overlay {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#location-preview-overlay.show {
    opacity: 1;
    visibility: visible;
}

#location-preview-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2.5rem;
    font-weight: 300;
    line-height: 1;
    color: #888;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #000;
}

.location-preview-body {
    padding: 0 !important;
}

.location-preview-content .modal-header {
    padding-bottom: 20px;
}

.location-preview-content {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;

    display: flex;
    flex-direction: column;
}

.location-preview-body {
    flex: 1;
    min-height: 0;

    display: flex;
    justify-content: center;
    align-items: center;
}

.location-preview-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

@media (max-width: 768px) {
    .menu-container,
    .settings-container,
    .history-container {
        width: 95%;
        padding: 20px;
    }
    .game-title {
        font-size: var(--font-size-xl);
    }
    .dialogue-box {
        width: 95%;
        padding: 15px;
    }
    .dialogue-text {
        font-size: var(--font-size-medium);
    }
    .character-sprite {
        height: 60%;
    }
    .game-ui {
        top: 10px;
        right: 10px;
        flex-direction: column;
    }
    .admin-header-new {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .menu-btn {
        min-width: 200px;
    }
    .dialogue-text {
        font-size: var(--font-size-small);
    }
    .character-sprite {
        height: 50%;
    }
}

.scenario-description-standalone {
    margin: 20px 0;
    color: var(--color-gray);
    line-height: 1.5;
    font-size: var(--font-size-medium);
}

.scenario-author-standalone {
    margin-bottom: 30px;
    font-size: var(--font-size-medium);
    font-style: normal;
    font-weight: 600;
    color: var(--color-dark-blue);
}
