
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f0f0f0;
}

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

.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

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

.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: 34px;
}

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

input:checked + .slider {
    background-color: #4CAF50;
}

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

h1 {
    text-align: center;
    font-size: 2.5em;
    margin: 0;
    color: #333;
    flex: 1;
}

h2 {
    text-align: center;
    font-size: 1.2em;
    margin-bottom: 30px;
    color: #666;
    font-weight: normal;
}

.parent {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 10px;
    max-width: 1400px;
    margin: 0 auto;
    height: 750px;
}

/* Add rounded corners to all grid items */
.div1, .div2, .div3, .div4, .div5, .div6, .div7, .div8 {
    border-radius: 10px;
    padding: 12px;
    background-color: white;
    border: 2px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Div1 - Uma Selection */
.div1 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.div1 label {
    font-weight: bold;
    white-space: nowrap;
}

.div1 select {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Div2 - Stats */
.stats-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 8px;
}

.stats-header {
    display: grid;
    grid-template-columns: 50px 1.3fr 70px 70px;
    gap: 12px;
    margin-bottom: 12px;
    font-weight: bold;
    text-align: center;
    padding: 8px 0;
    border-bottom: 2px solid #eee;
    align-items: center;
}

.stats-header span:first-child {
    text-align: left;
}

.stat-row {
    display: grid;
    grid-template-columns: 50px 1.3fr 70px 70px;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
    min-height: 42px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    margin: 0 auto;
    object-fit: contain;
    padding: 4px;
    background-color: transparent;
}

/* Remove the old background colors and ::before content rules since we're using images now */

.stat-input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    font-weight: bold;
}

.rating, .score {
    text-align: center;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
    font-size: 13px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 16px;
}

/* Character Info Section in Div2 */
.character-info-section {
    margin-top: 12px;
    padding-top: 8px;
}

.info-divider {
    height: 1px;
    background: linear-gradient(to right, #ddd, #bbb, #ddd);
    margin-bottom: 8px;
    border-radius: 1px;
}

.character-details, .measurements-section {
    margin-bottom: 8px;
}

.character-details h4 {
    margin: 0 0 6px 0;
    font-size: 13px;
    color: #333;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    padding-bottom: 3px;
}

.detail-row {
    display: flex;
    margin-bottom: 6px;
    font-size: 11px;
    line-height: 1.4;
    gap: 8px;
}

.detail-label {
    color: #666;
    font-weight: normal;
    flex-shrink: 0;
    min-width: 60px;
}

.detail-value {
    color: #333;
    font-weight: normal;
    flex: 1;
}

/* Total Stats Section */
.total-stats-section {
    margin-top: 8px;
}

.total-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.total-label {
    font-size: 12px;
    font-weight: bold;
    color: #495057;
}

.total-value {
    font-size: 14px;
    font-weight: bold;
    color: #007bff;
    background-color: white;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #dee2e6;
}

/* Div3 - Skills */
.skills-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

.score-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.score-section label {
    font-weight: bold;
}

.score-section input {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 80px;
}

.add-skill-btn {
    padding: 8px 16px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}

.button-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.how-to-use-btn,
.changelog-btn {
    padding: 8px 16px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    border: none;
    display: inline-block;
}

.changelog-btn {
    background: linear-gradient(45deg, #f093fb, #f5576c);
}

.how-to-use-btn:hover,
.changelog-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.how-to-use-btn:hover {
    background: linear-gradient(45deg, #5a6fd8, #6a4190);
}

.changelog-btn:hover {
    background: linear-gradient(45deg, #e082ea, #e34659);
}

.skills-list {
    flex: 1;
    overflow-y: auto;
    max-height: calc(100% - 80px);
}

.skill-row {
    display: grid;
    grid-template-columns: 80px 1fr 60px 30px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.color-select, .skill-select {
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.skill-score {
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
    background-color: #f9f9f9;
}

.remove-skill-btn {
    width: 25px;
    height: 25px;
    border: none;
    border-radius: 50%;
    background-color: #ff4444;
    color: white;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.remove-skill-btn:hover {
    background-color: #cc0000;
}

.remove-skill-btn:active {
    transform: scale(0.95);
}

/* Skill color styling */
.color-select option[value="golden"] {
    background-color: #ffd700;
    color: #333;
}

.color-select option[value="yellow"] {
    background-color: #ffeb3b;
    color: #333;
}

.color-select option[value="red"] {
    background-color: #f44336;
    color: white;
}

.color-select option[value="green"] {
    background-color: #4caf50;
    color: white;
}

.color-select option[value="blue"] {
    background-color: #2196f3;
    color: white;
}

.color-select option[value="purple"] {
    background-color: #9c27b0;
    color: white;
}

.color-select option[value="ius"] {
    background-color: #673ab7;
    color: white;
}

/* Div4 - Avatar */
.avatar-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    gap: 8px;
    padding: 5px;
}

.avatar-image {
    width: 100%;
    height: auto;
    max-height: 85%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    object-fit: contain;
}

.uma-name-display {
    font-weight: bold;
    font-size: 12px;
    color: #333;
    text-align: center;
    padding: 3px 8px;
    background: rgba(255,255,255,0.9);
    border-radius: 12px;
    border: 1px solid #ddd;
    max-width: 95%;
    word-wrap: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Div5 - Stars */
.stars-container {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 100%;
    padding: 10px;
}

.stars-label {
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

.star-rating {
    display: flex;
    gap: 8px;
    padding: 5px;
}

.star {
    font-size: 28px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    position: relative;
}

.star:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.star.active {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.star.hover {
    color: #ffed4e;
    transform: scale(1.15);
}

.star.star-clicked {
    animation: starClick 0.2s ease;
}

@keyframes starClick {
    0% { transform: scale(1.2); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1.2); }
}

/* Add sparkle effect for active stars */
.star.active::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,215,0,0.3) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    animation: sparkle 2s infinite alternate;
}

@keyframes sparkle {
    0% { opacity: 0.3; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.2); }
}

/* Div6 - Unique Skill */
.unique-skill-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.unique-skill-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.unique-skill-icon {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.unique-skill-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sparkle {
    font-size: 16px;
}

.formula {
    font-size: 12px;
    margin-top: 2px;
}

.skill-description {
    flex: 1;
}

.skill-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.skill-desc-text {
    font-size: 12px;
    color: #666;
}

.unique-level-section {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    flex-wrap: nowrap;
}

.unique-level-section label {
    font-weight: bold;
    white-space: nowrap;
}

.unique-level-section select {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-right: auto;
}

.unique-score-display {
    display: flex;
    align-items: center;
    gap: 5px;
}

.unique-score-label {
    font-size: 12px;
    font-weight: bold;
    color: #666;
}

.unique-score-value {
    font-size: 14px;
    font-weight: bold;
    color: #007bff;
    background-color: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    min-width: 50px;
    text-align: center;
}

/* Div7 - Race Config */
.race-config-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.config-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.config-label {
    font-weight: bold;
    min-width: 80px;
}

.config-options {
    display: flex;
    gap: 15px;
    flex: 1;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-item label {
    font-size: 14px;
    min-width: 50px;
}

.config-item select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 60px;
    font-size: 13px;
}

/* Div8 - Summary */
.summary-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.summary-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.summary-label {
    font-weight: bold;
    min-width: 60px;
}

.summary-value {
    flex: 1;
    padding: 8px;
    border: 2px solid #333;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
    background-color: white;
}

.rating-value {
    font-size: 2em;
}

.div2 {
    grid-row: span 6 / span 6;
}

.div3 {
    grid-column: span 2 / span 2;
    grid-row: span 6 / span 6;
}

.div4 {
    grid-row: span 4 / span 4;
    grid-row-start: 2;
}

.div5 {
    grid-row-start: 6;
}

.div6 {
    grid-row: span 2 / span 2;
    grid-row-start: 7;
}

.div7 {
    grid-column: span 2 / span 2;
    grid-row: span 2 / span 2;
    grid-row-start: 7;
}

.div8 {
    grid-row: span 2 / span 2;
    grid-column-start: 4;
    grid-row-start: 7;
}

/* Dark mode styles */
body.dark-mode .uma-name-display {
    color: #fff;
    background: rgba(0,0,0,0.7);
    border: 1px solid #555;
}

/* Responsive Design */
@media screen and (max-width: 1200px) {
    .parent {
        max-width: 100%;
        padding: 0 10px;
    }
    
    body {
        padding: 10px;
    }
}

@media screen and (max-width: 768px) {
    .parent {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
        gap: 15px;
    }
    
    .div1, .div2, .div3, .div4, .div5, .div6, .div7, .div8 {
        grid-column: 1;
        grid-row: auto;
        padding: 15px;
    }
    
    /* Header adjustments */
    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.8em;
        margin-bottom: 10px;
    }
    
    .dark-mode-toggle {
        justify-content: center;
        font-size: 16px;
        margin-top: 10px;
    }
    
    /* Stats container mobile layout */
    .stats-container {
        min-height: 0;
    }
    
    .stat-row {
        grid-template-columns: 40px 1fr 60px 60px;
        gap: 8px;
        padding: 8px 0;
    }
    
    .stat-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
    }
    
    /* Skills container mobile layout */
    .skills-container {
        min-height: 300px;
    }
    
    .skills-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .button-group {
        justify-content: center;
    }
    
    .score-section {
        text-align: center;
    }
    
    .skill-row {
        grid-template-columns: 60px 1fr 50px 30px;
        gap: 6px;
        padding: 8px 0;
    }
    
    .skill-select {
        font-size: 14px;
    }
    
    /* Avatar mobile layout */
    .avatar-container {
        text-align: center;
    }
    
    .avatar-image {
        width: 120px;
        height: 120px;
    }
    
    .uma-name-display {
        font-size: 14px;
        margin-top: 8px;
    }
    
    /* Stars mobile layout */
    .stars-container {
        justify-content: center;
        text-align: center;
    }
    
    .star-rating {
        justify-content: center;
    }
    
    /* Unique skill mobile layout */
    .unique-skill-container {
        padding: 15px;
    }
    
    .unique-skill-info {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .skill-description {
        text-align: center;
    }
    
    /* Character info mobile layout */
    .character-info-section {
        padding: 10px;
    }
    
    .character-details h4 {
        text-align: center;
        margin-bottom: 15px;
    }
    
    .detail-row {
        flex-direction: column;
        text-align: center;
        gap: 4px;
        margin-bottom: 10px;
    }
    
    .measurements-section {
        margin-top: 15px;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .parent {
        gap: 10px;
    }
    
    .div1, .div2, .div3, .div4, .div5, .div6, .div7, .div8 {
        padding: 12px;
    }
    
    .header h1 {
        font-size: 1.5em;
    }
    
    .stat-row {
        grid-template-columns: 35px 1fr 50px 50px;
        gap: 4px;
    }
    
    .stat-icon {
        width: 30px;
        height: 30px;
    }
    
    .skill-row {
        grid-template-columns: 50px 1fr 40px 25px;
        gap: 4px;
    }
    
    .button-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .how-to-use-btn,
    .changelog-btn,
    .add-skill-btn {
        width: 100%;
        text-align: center;
    }
    
    .avatar-image {
        width: 100px;
        height: 100px;
    }
    
    .star-rating .star {
        font-size: 20px;
        padding: 5px;
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Touch-friendly buttons */
    .how-to-use-btn,
    .add-skill-btn,
    .remove-skill-btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Select elements touch-friendly */
    select, input[type="number"] {
        min-height: 44px;
        touch-action: manipulation;
    }
}

/* Landscape tablet adjustments */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .parent {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
        gap: 15px;
        height: auto;
    }
    
    .div1 {
        grid-column: 1 / -1;
    }
    
    .div2 {
        grid-column: 1;
        grid-row: 2;
    }
    
    .div3 {
        grid-column: 2;
        grid-row: 2;
    }
    
    .div4 {
        grid-column: 1;
        grid-row: 3;
    }
    
    .div5 {
        grid-column: 2;
        grid-row: 3;
    }
    
    .div6 {
        grid-column: 1 / -1;
        grid-row: 4;
    }
}