@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
    --bg-color: #2c3e50;
    --card-bg-color: rgba(255, 255, 255, 0.1);
    --text-color: #ecf0f1;
    --primary-color: #3498db;
    --secondary-color: #3b9abad7;
    --border-color: rgba(255, 255, 255, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.2);
    --font-family: 'Noto Sans SC', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-image: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 25%, #3a3a3a 50%, #2d2d2d 75%, #1a1a1a 100%);
    background-attachment: fixed;
}

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

header h1 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px var(--shadow-color);
}

.card {
    background: var(--card-bg-color);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    padding: 25px;
    margin-bottom: 25px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px 0 var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.3);
}

h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-top: 0;
    text-align: center;
    margin-bottom: 20px;
}

h3 {
    color: var(--secondary-color);
}

.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

label {
    font-weight: 500;
}

input[type="number"] {
    width: 80px;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.2);
    color: var(--text-color);
    font-family: var(--font-family);
}

button {
    cursor: pointer;
    font-family: var(--font-family);
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease, border-color 0.3s ease;
    border: none;
    background-color: transparent;
    color: white;
}

#draw-characters, #reset-game {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

#draw-characters {
    background: rgba(52, 152, 219, 0.2);
    border-color: rgba(52, 152, 219, 0.5);
}

#reset-game {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.5);
}

#draw-characters:hover, #reset-game:hover {
    transform: scale(1.05);
}

#draw-characters:hover {
     background: rgba(52, 152, 219, 0.4);
}

#reset-game:hover {
    background: rgba(231, 76, 60, 0.4);
}

button:active {
    transform: scale(0.98);
}

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

.character-card {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    text-align: center;
    background: rgba(0,0,0,0.2);
    animation: fadeIn 0.5s ease-in-out;
}

.character-card.used {
    opacity: 0.5;
    border-color: #e74c3c;
}

.character-card.used::after {
    content: '未使用';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-20deg);
    background: rgba(231, 76, 60, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 14px;
}

.full-character-list .character-card.banned {
    opacity: 0.4;
    filter: grayscale(100%);
}

.full-character-list .character-card.banned::after {
    content: '禁用';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(192, 57, 43, 0.9);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 16px;
    text-align: center;
    width: 80%;
    box-sizing: border-box;
}


.character-card img {
    width: 100%;
    height: auto;
    display: block;
}

.character-card .name {
    padding: 8px;
    font-weight: 500;
    background: rgba(0,0,0,0.4);
}

.character-card .star-five {
    border-color: #f39c12;
    box-shadow: 0 0 10px #f39c12;
}

.character-card .star-four {
    border-color: #9b59b6;
    box-shadow: 0 0 10px #9b59b6;
}

.skill-ban-section {
    margin-top: 20px;
}

.result-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    min-height: 54px; /* To prevent layout shift */
    box-sizing: border-box;
}

#character-result-text, #skill-ban-result {
    font-size: 1.1em;
    font-weight: 500;
    flex-grow: 1;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.icon-copy-btn {
    background: none;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-copy-btn svg {
    width: 22px;
    height: 22px;
    position: absolute;
}

.icon-copy-btn .copy-icon {
    fill: var(--text-color);
    transition: opacity 0.2s ease;
}

.icon-copy-btn .checkmark-icon {
    fill: white;
    transform: scale(0);
    opacity: 0;
    display: none; /* Initially hidden */
}

.icon-copy-btn.copied {
    background-color: #27ae60;
    border-color: #27ae60;
}

.icon-copy-btn.copied .copy-icon {
    opacity: 0;
}

.icon-copy-btn.copied .checkmark-icon {
    display: block; /* Make it visible for animation */
    animation: checkmark-animation 0.4s forwards;
}

@keyframes checkmark-animation {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: var(--card-bg-color);
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

#ban-list-container {
    max-height: 300px;
    overflow-y: auto;
}

#ban-list-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#ban-list-table th, #ban-list-table td {
    padding: 10px;
    border: 1px solid var(--border-color);
    text-align: left;
}

#ban-list-table th {
    background-color: rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
}

#ban-list-table td:first-child {
    width: 60px;
    text-align: center;
    font-weight: bold;
}

.rule-mode {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(0,0,0,0.1);
}

.rule-mode h3 {
    margin-top: 0;
    color: var(--secondary-color);
    text-align: center;
}

.rule-mode ol {
    padding-left: 20px;
}

.rule-mode li {
    margin-bottom: 10px;
}

.rule-tip {
    background: rgba(52, 152, 219, 0.15);
    border-left: 4px solid var(--primary-color);
    padding: 10px 15px;
    margin-top: 15px;
    border-radius: 5px;
}

.rule-tip p {
    margin: 0;
}

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

/* Responsive Design for Mobile */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2em;
    }

    .card {
        padding: 15px;
    }

    .character-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .character-card .name {
        font-size: 0.8em;
        padding: 5px;
    }

    .character-card.used::after {
        font-size: 12px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    input[type="number"] {
        width: 100%;
        box-sizing: border-box;
    }
}
