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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: #f8f9fa;
    color: #333;
}

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

header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

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

.search-container {
    display: flex;
    position: relative;
    max-width: 300px;
    flex-grow: 1;
}

#character-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

#search-button {
    background: none;
    border: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666;
}

#search-button:hover {
    color: #333;
}

.search-no-results {
    animation: shake 0.5s;
    border-color: #ff4d4d !important;
    background-color: #fff0f0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

/* Special theme styling */
.scholar-page-mode {
    background-color: #fbf3e2;
    background-image: url('data:image/png;base64,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');
}

.scholar-page-mode .container {
    font-family: 'Times New Roman', serif;
}

.scholar-page-mode h1,
.scholar-page-mode h2,
.scholar-page-mode h3 {
    font-family: 'Times New Roman', serif;
    font-style: italic;
}

.scholar-page-mode .character-card {
    background-color: #f8f0dd;
    border: 1px solid #d0b275;
    box-shadow: 0 2px 8px rgba(139, 0, 0, 0.2);
}

/* Chicken mode styling */
.chicken-page-mode {
    background-color: #f8f9e4;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(222, 230, 176, 0.5) 10px, rgba(222, 230, 176, 0.5) 20px);
    animation: chickenBackground 60s linear infinite;
}

@keyframes chickenBackground {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 1000px 1000px;
    }
}

.chicken-page-mode .container {
    font-family: 'Comic Sans MS', cursive, sans-serif;
}

.chicken-page-mode h1,
.chicken-page-mode h2,
.chicken-page-mode h3 {
    font-family: 'Comic Sans MS', cursive, sans-serif;
}

.chicken-page-mode h1 {
    color: #8a6e00;
    text-shadow: 1px 1px 0px #f7e262;
    position: relative;
    display: inline-block;
}

.chicken-page-mode h1::before {
    content: "🐔";
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 32px;
}

.chicken-page-mode h1::after {
    content: "🥚";
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
}

.chicken-page-mode .character-card {
    background-color: #fcfcf5;
    border: 3px dashed #c4b568;
    box-shadow: 0 5px 10px rgba(158, 136, 4, 0.1);
    transform: rotate(-0.5deg);
    position: relative;
}

.chicken-page-mode .character-card:nth-child(odd) {
    transform: rotate(0.7deg);
}

.chicken-page-mode .character-card::before {
    content: "🐾";
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    opacity: 0.5;
    transform: rotate(30deg);
}

.chicken-page-mode .character-description {
    font-size: 1.1em;
}

.chicken-page-mode .character-name {
    color: #8a6e00;
}

.chicken-mode h3 {
    background-color: #f7e262;
    color: #5c4c00;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    font-weight: bold;
    padding: 4px 10px;
    border: 2px dotted #c4b568;
    transform: rotate(-1deg);
}

.chicken-page-mode .attribute {
    animation: chickenWiggle 2s ease-in-out infinite;
    animation-delay: calc(var(--chicken-delay, 0) * 0.5s);
}

.chicken-page-mode .attribute:nth-child(1) { --chicken-delay: 0; }
.chicken-page-mode .attribute:nth-child(2) { --chicken-delay: 1; }
.chicken-page-mode .attribute:nth-child(3) { --chicken-delay: 2; }
.chicken-page-mode .attribute:nth-child(4) { --chicken-delay: 3; }
.chicken-page-mode .attribute:nth-child(5) { --chicken-delay: 4; }

@keyframes chickenWiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-2deg); }
    75% { transform: rotate(2deg); }
}

.scholar-page-mode .character-name {
    color: #8b0000;
}

.scholar-page-mode .character-description,
.scholar-page-mode .character-detail p,
.chicken-page-mode .character-description,
.chicken-page-mode .character-detail p {
    font-style: italic;
    line-height: 1.8;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 30;
    outline: none;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: #333;
    transition: all 0.3s ease;
}

.controls {
    display: flex;
    gap: 20px;
    z-index: 20;
}

.chapter-selector, .sort-selector, .affiliation-selector, .view-mode-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Mobile styles - Total rewrite */
@media (max-width: 768px) {
    /* Structure changes */
    header {
        position: relative;
    }

    .header-top {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    /* Menu toggle button */
    .menu-toggle {
        display: block !important;
        background: none;
        border: none;
        padding: 10px;
        cursor: pointer;
    }

    /* Hamburger icon */
    .bar {
        display: block;
        width: 25px;
        height: 3px;
        margin: 5px 0;
        background-color: #333;
        transition: all 0.3s ease;
    }

    /* Controls container */
    .controls {
        display: none;
        width: 100%;
        padding: 15px;
        margin-top: 10px;
        background-color: #f0f0f0;
        border-radius: 5px;
    }

    /* Override */
    .controls.active {
        display: block !important;
    }

    /* Form elements */
    .chapter-selector, .sort-selector, .affiliation-selector, .view-mode-toggle {
        margin-bottom: 20px;
        display: block;
        width: 100%;
    }

    .view-mode-toggle {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
    }

    select, input {
        margin-top: 8px;
        width: 100%;
    }

    label {
        display: block;
        margin-bottom: 5px;
        font-weight: bold;
    }

    /* Hamburger animation */
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}

select {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background-color: white;
    font-size: 16px;
}

.scheduled-chapter {
    color: #999;
    font-style: italic;
}

.available-chapter {
    color: #28a745;
    font-weight: bold;
}

/* Custom styling for optgroup in select */
optgroup {
    font-weight: bold;
    margin-top: 8px;
}

/* Add a countdown timer container */
.chapter-countdown {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    display: none; /* Hidden by default */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #dee2e6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeIn 0.5s ease-in-out;
}

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

.chapter-countdown.active {
    display: block;
}

.countdown-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #495057;
    font-size: 16px;
}

#countdown-chapter-title {
    margin-bottom: 12px;
    font-size: 18px;
    color: #343a40;
    font-weight: 600;
}

.countdown-timer {
    font-size: 1.5em;
    font-family: monospace;
    background-color: #212529;
    color: #ffffff;
    padding: 10px 15px;
    border-radius: 4px;
    display: inline-block;
    letter-spacing: 2px;
    margin-top: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#characters-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

@media (max-width: 768px) {
    #characters-container {
        grid-template-columns: 1fr;
    }

    .character-card {
        max-width: 100%;
    }

    .image-container {
        height: 250px;
    }

    /* On mobile, always show the hover message */
    .image-hover-message {
        transform: translateY(0);
        opacity: 0.9;
        padding: 8px;
        font-size: 11px;
    }

    .image-container:hover .character-image {
        transform: none;
    }

    /* Always show carousel controls on mobile */
    .carousel-button {
        opacity: 0.8;
        width: 35px;
        height: 35px;
    }

    .carousel-dot {
        width: 10px;
        height: 10px;
    }

    /* Mobile chicken mode adjustments */
    .chicken-page-mode h1::before {
        left: -30px;
        font-size: 24px;
    }

    .chicken-page-mode h1::after {
        right: -30px;
        font-size: 18px;
    }

    .chicken-page-mode .character-card::before {
        font-size: 18px;
        top: 8px;
        right: 8px;
    }
}

.character-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.character-card:hover {
    transform: translateY(-5px);
}

.highlighted-character {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.7); /* Golden glow */
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.9);
    }
    100% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
    }
}

.image-container {
    position: relative;
    overflow: hidden;
    height: 200px;
}

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

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    z-index: 1;
}

.carousel-slide.active {
    opacity: 1;
    z-index: 2;
}

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

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 36px;
    text-align: center;
    z-index: 3;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.carousel-button:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.carousel-button.prev {
    left: 10px;
}

.carousel-button.next {
    right: 10px;
}

.image-container:hover .carousel-button {
    opacity: 1;
}

.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 3;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.carousel-dot.active {
    background-color: white;
    transform: scale(1.2);
}

.image-hover-message {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    font-size: 12px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    text-align: center;
    line-height: 1.4;
    z-index: 4;
}

.image-container:hover .image-hover-message {
    transform: translateY(0);
}

.image-container:hover .character-image {
    transform: scale(1.05);
}

.expandable {
    cursor: zoom-in;
}

.expanded-image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.expanded-image-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.expanded-image-container {
    max-width: 90%;
    max-height: 90vh;
    position: relative;
}

.expanded-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.close-expanded-image {
    position: absolute;
    top: -40px;
    right: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s ease;
}

.close-expanded-image:hover {
    background-color: rgba(255, 0, 0, 0.7);
}

.character-info {
    padding: 20px;
}

.character-name {
    font-size: 20px;
    margin-bottom: 10px;
    color: #333;
}

.character-alias {
    font-size: 16px;
    font-weight: normal;
    color: #666;
    font-style: italic;
    display: inline-block;
    margin-left: 8px;
}

.character-description {
    margin-bottom: 15px;
    color: #555;
}

.character-detail {
    margin-bottom: 15px;
}

.character-detail h3 {
    font-size: 16px;
    color: #444;
    margin-bottom: 5px;
}

.character-detail p {
    color: #555;
    font-size: 14px;
    line-height: 1.4;
}

.chapter-intro {
    text-align: center;
    margin: 15px 0 10px;
}

.character-affiliation {
    text-align: center;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

/* Compact mode styling */
.compact-mode #characters-container {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.compact-mode .character-card {
    font-size: 0.9em;
}

.compact-mode .image-container {
    height: 140px;
}

.compact-mode .character-info {
    padding: 12px;
}

.compact-mode .character-name {
    font-size: 16px;
    margin-bottom: 6px;
}

.compact-mode .character-alias {
    font-size: 14px;
}

.compact-mode .character-description {
    margin-bottom: 10px;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    transition: max-height 0.3s ease, -webkit-line-clamp 0.3s ease;
}

.compact-mode .character-card:hover .character-description {
    max-height: 300px;
    -webkit-line-clamp: 15;
    line-clamp: 15;
}

.compact-mode .character-detail {
    margin-bottom: 10px;
}

.compact-mode .character-attributes {
    gap: 6px;
}

.compact-mode .attribute {
    padding: 3px 6px;
    font-size: 12px;
}

.affiliation-label {
    font-weight: 500;
    font-size: 14px;
    color: #555;
}

.affiliation-value {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    transition: all 0.3s ease;
    cursor: default;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    text-shadow: 1px 0px 2px rgba(0, 0, 0, 1), 0px 2px 2px rgba(0, 0, 0, 1);
}

.affiliation-value:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.hue {
    background: linear-gradient(
        270deg,
        #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff
    );
    background-size: 1400% 1400%;
    animation: kaleidoscope-hue 15s ease infinite, pulse-hue 2s ease-in-out infinite alternate;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 8px rgba(0, 0, 0, 0.8);
    transform-origin: center;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 2px 10px;
    font-size: 12px;
    position: relative;
}

@keyframes kaleidoscope-hue {
    0% { background-position: 0% 50% }
    25% { background-position: 50% 100% }
    50% { background-position: 100% 50% }
    75% { background-position: 50% 0% }
    100% { background-position: 0% 50% }
}

@keyframes pulse-hue {
    0% {
        box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.6), 0 0 20px rgba(0, 0, 0, 0.4);
        transform: scale(1.03);
    }
}

.eue {
    background: linear-gradient(135deg, #224119, #41692e);
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.freelance {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.underground {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.unknown {
    background: linear-gradient(135deg, #9E9E9E, #757575);
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.none {
    background: linear-gradient(135deg, #9E9E9E, #757575);
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.other {
    background: linear-gradient(135deg, #607D8B, #455A64);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.chapter-intro h3 {
    display: inline-block;
    background-color: #4d94ff;
    color: white;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 20px;
    margin: 0;
    min-width: 180px;
    text-shadow: 1px 0px 2px rgba(0, 0, 0, 1), 0px 2px 2px rgba(0, 0, 0, 1);
}

/* Chinese scholar mode styling */
.scholar-mode h3 {
    background-color: #8b0000;
    font-family: 'Times New Roman', serif;
    font-style: italic;
    background-image: linear-gradient(rgba(139, 0, 0, 0.9), rgba(87, 0, 0, 0.9));
    border: 1px solid #ffd700;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.character-attributes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    position: relative; /* Added to ensure tooltips have proper positioning context */
}

.attribute {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    cursor: help;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 1), 0 -1px 2px rgba(0, 0, 0, 1);
}

.attribute:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 5px rgba(0,0,0,0.1);
}

.chicken-page-mode .attribute:hover {
    transform: scale(1.1) rotate(0deg) !important;
    box-shadow: 0 3px 5px rgba(158, 136, 4, 0.2);
    animation-play-state: paused;
}

/* CSS tooltip hidden since we're using JS tooltips */
.attribute::after {
    display: none;
}

/* Make attributes look clickable */
.attribute {
    cursor: pointer;
}

/* Make sure tooltips don't get cut off at screen edges */
.attribute:hover::after {
    left: 50%;
    transform: translateX(-50%);
}

/* Adjust tooltip position for attributes at the edges */
.attribute:nth-child(2n+1):hover::after {
    left: 0;
    transform: translateX(0);
}

.attribute:nth-child(2n):hover::after {
    left: auto;
    right: 0;
    transform: translateX(0);
}

/* Real tooltips for better mobile support */
.power-tooltip {
    position: fixed;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px;
    border-radius: 5px;
    font-size: 14px;
    line-height: 1.5;
    max-width: 300px;
    width: 80vw;
    text-align: center;
    z-index: 2000;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

@media (max-width: 768px) {
    .power-tooltip {
        padding: 20px;
        font-size: 16px;
        line-height: 1.6;
        width: 90vw;
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* Default attribute colors (fallback) */
.power-color-0 {
    background-color: #ffd700;  /* Radiant gold */
    color: #333;
}

.power-color-1 {
    background-color: #ff4d4d;  /* Red */
    color: white;
}

.power-color-2 {
    background-color: #4d94ff;  /* Blue */
    color: white;
}

.power-color-3 {
    background-color: #4dcd5a;  /* Green */
    color: white;
}

.power-color-4 {
    background-color: #a6a6a6;  /* Gray */
    color: white;
}

.power-color-5 {
    background-color: #222222;  /* Black */
    color: white;
}

/* Mind attributes (blue shades) */
.power-blue-1 {
    background-color: #2196F3; /* Blue */
    color: white;
}

.power-blue-2 {
    background-color: #1976D2; /* Darker blue */
    color: white;
}

.power-blue-3 {
    background-color: #0D47A1; /* Deepest blue */
    color: white;
}

/* Red powers (red shades) */
.power-red-1 {
    background-color: #F44336; /* Red */
    color: white;
}

.power-red-2 {
    background-color: #D32F2F; /* Darker red */
    color: white;
}

.power-red-3 {
    background-color: #B71C1C; /* Deepest red */
    color: white;
}

.power-green-1 {
    background-color: #4CAF50; /* Green */
    color: white;
}

.power-green-2 {
    background-color: #388E3C; /* Darker green */
    color: white;
}

.power-orange-1 {
    background-color: #FF9800; /* Orange */
    color: white;
}

.power-orange-2 {
    background-color: #F57C00; /* Darker orange */
    color: white;
}

.power-purple-1 {
    background-color: #9C27B0; /* Purple */
    color: white;
}

.power-purple-2 {
    background-color: #7B1FA2; /* Darker purple */
    color: white;
}

.power-yellow-1 {
    background-color: #FFC107; /* Yellow */
    color: #333;
}

.power-yellow-2 {
    background-color: #FFA000; /* Darker yellow */
    color: #333;
}

.power-black {
    background-color: #000000; /* Black */
    color: white;
}

.power-gradient-gold {
    background: linear-gradient(135deg, #FFD700, #FF9800, #FFEB3B);
    color: white;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.power-special {
    background: linear-gradient(135deg, #FF5722, #FF9800, #FFEB3B, #4CAF50, #2196F3, #673AB7, #E91E63);
    background-size: 1400% 1400%;
    animation: special-attribute 15s ease infinite;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

/* Styling for newly unlocked attributes */
.new-attribute {
    animation: new-power-glow 2s ease-in-out infinite alternate;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    border: 1px solid gold;
}



@keyframes new-power-glow {
    0% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    100% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.9);
    }
}

.update-indicator {
    color: gold;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    display: inline-block;
    animation: indicator-pulse 1s ease-in-out infinite alternate;
}

@keyframes indicator-pulse {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.2);
    }
}

@keyframes special-attribute {
    0% { background-position: 0% 50% }
    50% { background-position: 100% 50% }
    100% { background-position: 0% 50% }
}

.power-attribute {
    background: linear-gradient(135deg, #ffd700, #ff9d00);
    border: 1px solid #ffd700;
    grid-column: 1 / -1;
    margin-top: 10px;
    color: #333;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chicken-page-mode .power-attribute {
    background: linear-gradient(135deg, #f7e262, #d4b72a);
    border: 2px dotted #8a6e00;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    position: relative;
    padding-left: 30px;
}

.chicken-page-mode .power-attribute::before {
    content: "🌽";
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

/* Add New Character button styling */
.add-new-character {
    grid-column: 1 / -1;
    margin: 20px auto 40px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;  /* Added to ensure tooltips position correctly */
}

.add-new-character:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.add-new-character:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.add-new-character-icon {
    font-size: 20px;
}

/* Style for Scholar mode */
.scholar-page-mode .add-new-character {
    background-color: #8b0000;
    border: 1px solid #ffd700;
    font-family: 'Times New Roman', serif;
    font-style: italic;
}

.scholar-page-mode .add-new-character:hover {
    background-color: #a00000;
}

/* Style for Chicken mode */
.chicken-page-mode .add-new-character {
    background-color: #f7e262;
    color: #5c4c00;
    border: 2px dashed #c4b568;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    transform: rotate(-1deg);
}

.chicken-page-mode .add-new-character:hover {
    background-color: #f9e980;
    transform: rotate(1deg);
}

.chicken-page-mode .add-new-character:active {
    transform: rotate(0) scale(0.98);
}
