:root {
    --primary: #7b2cbf;
    --primary-dark: #5a189a;
    --secondary: #ff9e00;
    --dark: #240046;
    --light: #f8f9fa;
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.18);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: var(--light);
    line-height: 1.6;
    background-attachment: fixed;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 20px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, var(--secondary), #ff3e9d);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 20px rgba(255, 158, 0, 0.3);
}

.tagline {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
}

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

.elements-section {
    background: rgba(15, 12, 41, 0.6);
    border-radius: 15px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
}

.elements-section h2 {
    margin-bottom: 15px;
    color: var(--secondary);
}

.elements-section p {
    margin-bottom: 25px;
    color: rgba(255, 255, 255, 0.8);
}

.elements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    max-height: 400px;
    overflow-y: auto;
}

.element-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.element-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.element-card.selected {
    background: rgba(123, 44, 191, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(123, 44, 191, 0.5);
}

.element-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.element-name {
    font-size: 0.9rem;
    text-align: center;
}

.selected-elements {
    text-align: center;
    margin-top: 20px;
}

.selected-elements h3 {
    margin-bottom: 20px;
    color: var(--light);
}

.generate-btn {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(90, 24, 154, 0.4);
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 24, 154, 0.6);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.save-load-section {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.save-btn, .load-btn {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(90, 24, 154, 0.4);
}

.save-btn:hover, .load-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 24, 154, 0.6);
}

.saved-characters-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 350px;
    background: rgba(36, 0, 70, 0.95);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    padding: 20px;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
}

.saved-characters-panel.hidden {
    transform: translateX(100%);
}

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

.close-panel {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.saved-character-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.card-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.load-character-btn, .delete-character-btn {
    padding: 5px 10px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
}

.load-character-btn {
    background: var(--primary);
    color: white;
}

.delete-character-btn {
    background: #ff3e3e;
    color: white;
}

.no-saved-characters {
    text-align: center;
    margin-top: 30px;
    color: rgba(255, 255, 255, 0.7);
}

.character-elements {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.character-element {
    background: rgba(123, 44, 191, 0.3);
    border-radius: 15px;
    padding: 2px 8px;
    font-size: 0.8rem;
}

.result-section {
    background: rgba(15, 12, 41, 0.6);
    border-radius: 15px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    margin-top: 20px;
}

.result-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

@media (min-width: 768px) {
    .result-container {
        flex-direction: row;
    }
}

.character-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.character-image img {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.loading-image {
    width: 300px;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(36, 0, 70, 0.5);
    border-radius: 10px;
}

.character-details {
    flex: 2;
}

.character-details h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--secondary);
    text-shadow: 0 0 10px rgba(255, 158, 0, 0.3);
}

.character-section {
    margin-bottom: 25px;
}

.character-section h3 {
    color: var(--primary);
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.character-section ul {
    padding-left: 20px;
}

.character-section li {
    margin-bottom: 8px;
}

.new-fusion-btn {
    background: linear-gradient(to right, var(--secondary), #ff5e62);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 40px auto 0;
    box-shadow: 0 4px 15px rgba(255, 94, 98, 0.4);
}

.new-fusion-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 94, 98, 0.6);
}

.gender-section {
    margin-top: 20px;
    border-top: 1px solid var(--card-border);
    padding-top: 20px;
}

.gender-section h3 {
    margin-bottom: 15px;
    color: var(--secondary);
}

.gender-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.gender-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gender-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.gender-card.selected {
    background: rgba(123, 44, 191, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(123, 44, 191, 0.5);
}

.gender-icon {
    font-size: 1.2rem;
}

.story-mode-toggle {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--secondary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.story-settings {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.story-setting-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.story-setting-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.story-setting-card.selected {
    background: rgba(123, 44, 191, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(123, 44, 191, 0.5);
}

.story-setting-card h4 {
    margin-bottom: 8px;
    color: var(--secondary);
}

.story-content {
    margin-top: 30px;
    background: rgba(36, 0, 70, 0.3);
    border-radius: 10px;
    padding: 20px;
}

.story-content h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--secondary);
}

.story-chapter {
    margin-bottom: 25px;
}

.story-chapter h3 {
    color: var(--primary);
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.next-adventure {
    font-style: italic;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 158, 0, 0.1);
    border-left: 3px solid var(--secondary);
    border-radius: 0 5px 5px 0;
}

.canon-toggle-btn {
    background: linear-gradient(to right, var(--secondary), #ff5e62);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 94, 98, 0.4);
    margin-top: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.canon-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 94, 98, 0.6);
}

.canon-panel {
    background: rgba(15, 12, 41, 0.6);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    margin-top: 20px;
}

.series-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.series-tab {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50px;
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.series-tab.active {
    background: var(--primary);
    color: white;
}

.canon-characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.canon-character-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.canon-character-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.canon-character-card.selected {
    background: rgba(123, 44, 191, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(123, 44, 191, 0.5);
}

.character-traits {
    margin-top: 10px;
}

.character-trait {
    background: rgba(36, 0, 70, 0.5);
    border-radius: 15px;
    padding: 2px 8px;
    font-size: 0.75rem;
    margin: 2px 0;
    display: inline-block;
}

.selected-canon-chars {
    margin-top: 15px;
}

.selected-canon-chip {
    background: rgba(255, 158, 0, 0.2);
    border: 1px solid var(--secondary);
    border-radius: 50px;
    padding: 5px 10px;
    margin: 0 5px 5px 0;
    display: inline-block;
    font-size: 0.8rem;
}

.battle-mode-toggle {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.battle-type-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.battle-type-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.battle-type-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.battle-type-card.selected {
    background: rgba(123, 44, 191, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(123, 44, 191, 0.5);
}

.battle-type-card h4 {
    margin-bottom: 8px;
    color: var(--secondary);
}

.battle-settings {
    margin-top: 15px;
}

.battle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.battle-setting-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.battle-setting-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.battle-setting-card.selected {
    background: rgba(123, 44, 191, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(123, 44, 191, 0.5);
}

.battle-setting-card h4 {
    margin-bottom: 8px;
    color: var(--secondary);
}

.canon-opponent-selection, 
.saved-opponent-selection {
    margin-bottom: 25px;
    background: rgba(15, 12, 41, 0.6);
    border-radius: 10px;
    padding: 15px;
}

.saved-opponents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.saved-opponent-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.saved-opponent-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.saved-opponent-card.selected {
    background: rgba(123, 44, 191, 0.4);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(123, 44, 191, 0.5);
}

.opponent-mini-image {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 5px;
}

.no-saved-opponents {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.battle-section {
    margin-top: 30px;
    background: rgba(36, 0, 70, 0.6);
    border-radius: 10px;
    padding: 20px;
}

.battle-btn {
    background: linear-gradient(to right, #ff5e62, var(--secondary));
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto 20px;
    box-shadow: 0 4px 15px rgba(255, 94, 98, 0.4);
}

.battle-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 94, 98, 0.6);
}

.battle-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.opponent-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 30px;
}

@media (min-width: 768px) {
    .opponent-container {
        flex-direction: row;
    }
}

.opponent-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.opponent-image img {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.opponent-details {
    flex: 2;
}

.opponent-section {
    margin-top: 15px;
}

.opponent-section h4 {
    color: var(--primary);
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.battle-result {
    margin-top: 30px;
    background: rgba(15, 12, 41, 0.6);
    border-radius: 10px;
    padding: 20px;
}

.battle-result h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--secondary);
}

.battle-round {
    margin-bottom: 25px;
}

.battle-round h3 {
    color: var(--primary);
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.battle-winner {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 158, 0, 0.1);
    border-left: 3px solid var(--secondary);
    border-radius: 0 5px 5px 0;
}

footer {
    text-align: center;
    margin-top: 60px;
    padding: 20px 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .elements-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .character-image img {
        max-width: 100%;
    }
    
    .saved-characters-panel {
        width: 100%;
    }
}

.battle-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.attack-svg {
    width: 100%;
    height: 100%;
}

.battle-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    opacity: 0;
    z-index: 1000;
    pointer-events: none;
    animation: flash 0.3s ease-out;
}

@keyframes flash {
    0% { opacity: 0; }
    50% { opacity: 0.7; }
    100% { opacity: 0; }
}

.screen-shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.battle-health-bar {
    background: rgba(15, 12, 41, 0.8);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.health-bars-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 20px;
}

.health-bar-label {
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: var(--light);
}

.health-bar-container {
    height: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 5px;
}

.health-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 100%;
    transition: width 0.5s ease-out;
}

.health-bar-text {
    font-size: 0.8rem;
    text-align: right;
    color: var(--light);
}

.critical-health-pulse {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.replay-battle-btn {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    margin: 15px 0;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.animation-round-title {
    text-align: center;
    color: var(--secondary);
    margin: 15px 0;
    animation: fadeIn 0.5s ease-in;
}

.move-description, .counter-description {
    text-align: center;
    padding: 8px;
    background: rgba(36, 0, 70, 0.5);
    border-radius: 5px;
    margin: 10px 0;
    animation: slideIn 0.5s ease-out;
}

.counter-description {
    background: rgba(90, 24, 154, 0.5);
}

.final-move {
    text-align: center;
    padding: 12px;
    background: linear-gradient(to right, rgba(255, 158, 0, 0.3), rgba(255, 62, 157, 0.3));
    border-radius: 8px;
    margin: 20px 0;
    font-size: 1.1rem;
    animation: glow 2s infinite;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(255, 158, 0, 0.5); }
    50% { box-shadow: 0 0 15px rgba(255, 158, 0, 0.8); }
    100% { box-shadow: 0 0 5px rgba(255, 158, 0, 0.5); }
}

.victory-animation, .defeat-animation {
    position: relative;
    margin: 30px auto;
    width: 200px;
    height: 200px;
    animation: scaleIn 0.5s ease-out;
}

.victory-text, .defeat-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    font-weight: bold;
    text-align: center;
    text-shadow: 0 0 10px currentColor;
}

.victory-text {
    color: var(--secondary);
}

.defeat-text {
    color: #ff3e3e;
}

.victory-svg, .defeat-svg {
    width: 100%;
    height: 100%;
}

@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.victory-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    top: 50%;
    animation: particle 1.5s ease-out forwards;
}

@keyframes particle {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-100px); opacity: 0; }
}

.battle-animations-container {
    position: relative;
    min-height: 200px;
    margin: 20px 0;
    background: rgba(36, 0, 70, 0.3);
    border-radius: 10px;
    padding: 15px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .health-bars-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .battle-animation {
        transform: scale(0.8);
    }
    
    .victory-animation, .defeat-animation {
        width: 150px;
        height: 150px;
    }
    
    .victory-text, .defeat-text {
        font-size: 1.5rem;
    }
}

.tier-section {
    margin-bottom: 20px;
}

.tier-display {
    background: linear-gradient(to right, rgba(123, 44, 191, 0.2), rgba(255, 158, 0, 0.2));
    border-radius: 10px;
    padding: 10px 15px;
    margin-top: 5px;
}

.tier-name {
    font-weight: bold;
    color: var(--secondary);
    font-size: 1.1rem;
    margin-right: 10px;
}

.tier-description {
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
}

.saved-character-card .tier-name {
    font-size: 0.9rem;
    display: inline-block;
    background: rgba(123, 44, 191, 0.3);
    padding: 2px 8px;
    border-radius: 15px;
    margin-top: 5px;
}

.random-btn {
    background: linear-gradient(to right, #ff9e00, var(--primary));
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 158, 0, 0.4);
    margin-top: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.random-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 158, 0, 0.6);
}

.random-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.how-to-play-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(90, 24, 154, 0.4);
    z-index: 1000;
}

.how-to-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 24, 154, 0.6);
}

.how-to-play-screen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: var(--dark);
    border-radius: 15px;
    z-index: 1200;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.6);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.how-to-play-screen.visible {
    display: flex;
    animation: scaleIn 0.3s ease;
}

.how-to-play-header {
    padding: 15px 20px;
    background: var(--primary-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.how-to-play-header h2 {
    margin: 0;
    color: white;
    font-size: 1.4rem;
}

.close-how-to-play {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.how-to-play-content {
    padding: 20px;
    overflow-y: auto;
}

.instruction-section {
    margin-bottom: 25px;
}

.instruction-section h3 {
    color: var(--secondary);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 5px;
}

.instruction-section p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.feature-list {
    list-style: none;
    padding: 0;
}

.feature-list li {
    margin-bottom: 12px;
    padding-left: 25px;
    position: relative;
}

.feature-list li::before {
    content: '✨';
    position: absolute;
    left: 0;
    color: var(--secondary);
}

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

.gameplay-mode-card {
    background: rgba(36, 0, 70, 0.5);
    border-radius: 10px;
    padding: 15px;
}

.gameplay-mode-card h4 {
    color: var(--secondary);
    margin-bottom: 10px;
}

.gameplay-mode-card p {
    font-size: 0.9rem;
    margin: 0;
}

.quick-tips {
    background: rgba(255, 158, 0, 0.1);
    border-left: 3px solid var(--secondary);
    padding: 15px;
    margin-top: 20px;
    border-radius: 0 10px 10px 0;
}

.quick-tips h4 {
    color: var(--secondary);
    margin: 0 0 10px 0;
}

.tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tips-list li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
    font-size: 0.9rem;
}

.tips-list li::before {
    content: '💡';
    position: absolute;
    left: 0;
}

@media (max-width: 768px) {
    .how-to-play-screen {
        width: 95%;
        max-height: 90vh;
    }
    
    .gameplay-modes {
        grid-template-columns: 1fr;
    }
}