:root {
    --primary-color: #1e3a5f;
    --secondary-color: #2d5a87;
    --accent-color: #f5a623;
    --accent-light: #ffc107;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 2rem;
    color: var(--accent-color);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.header-action-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.header-action-btn:nth-child(2):hover {
    background: rgba(220, 38, 38, 0.8);
}

.nav-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-btn.active {
    background: var(--accent-color);
    color: var(--primary-color);
}

.main-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
}

.hero-section {
    text-align: center;
    margin-bottom: 3rem;
}

.hero-section h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.hero-section p {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.mode-card {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.card-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: white;
}

.lottery-icon {
    background: linear-gradient(135deg, #f5a623 0%, #f0932b 100%);
}

.roll-call-icon {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.number-icon {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.mode-card h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.mode-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.lottery-container,
.roll-call-container,
.number-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.lottery-main,
.roll-call-main,
.number-main {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.lottery-sidebar,
.roll-call-sidebar,
.number-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.lottery-display {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, rgba(245, 166, 35, 0.1) 0%, rgba(255, 193, 7, 0.1) 100%);
    border-radius: 1rem;
    margin-bottom: 2rem;
    border: 3px solid var(--accent-color);
}

.lottery-text {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    animation: lotteryPulse 0.5s ease-in-out infinite;
}

@keyframes lotteryPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.lottery-text.rolling {
    animation: lotteryRoll 0.1s ease-in-out infinite;
}

@keyframes lotteryRoll {
    0% { opacity: 1; transform: translateY(0); }
    50% { opacity: 0.5; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.lottery-status {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.lottery-btn {
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-light) 100%);
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    display: block;
    margin: 0 auto;
}

.lottery-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.lottery-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.result-display {
    background: linear-gradient(135deg, rgba(245, 166, 35, 0.1) 0%, rgba(255, 193, 7, 0.1) 100%);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    margin-top: 1rem;
}

.result-display h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.result-content {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.prize-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

.prize-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 0.5rem;
}

.prize-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 0.75rem;
}

.prize-info {
    flex: 1;
}

.prize-info .name {
    font-weight: 600;
    color: var(--text-primary);
}

.prize-info .detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.prize-actions {
    display: flex;
    gap: 0.5rem;
}

.prize-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.prize-action-btn.delete {
    background: #fee2e2;
    color: #dc2626;
}

.prize-action-btn.delete:hover {
    background: #fecaca;
}

.add-btn,
.import-btn,
.sample-btn,
.save-btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

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

.add-btn:hover {
    background: var(--secondary-color);
}

.import-btn {
    background: var(--accent-color);
    color: var(--primary-color);
}

.import-btn:hover {
    background: var(--accent-light);
}

.sample-btn {
    background: var(--bg-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.sample-btn:hover {
    background: var(--border-color);
}

.save-btn {
    background: #10b981;
    color: white;
}

.save-btn:hover {
    background: #059669;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.history-item .prize {
    font-weight: 600;
    color: var(--accent-color);
}

.history-item .time {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.name-display {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(41, 128, 185, 0.1) 100%);
    border-radius: 1rem;
    margin-bottom: 2rem;
}

.name-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.name-cell {
    min-width: 100px;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    box-shadow: var(--shadow);
    animation: pulse 0.5s ease-in-out infinite;
}

.name-cell.rolling {
    animation: roll 0.1s ease-in-out infinite;
}

.name-cell.final {
    animation: none;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes roll {
    0% { opacity: 1; transform: translateY(0); }
    50% { opacity: 0.5; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.name-status {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.roll-call-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.roll-call-btn {
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.roll-call-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.reset-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    border-color: #dc2626;
    color: #dc2626;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.selected-names {
    margin-top: 1rem;
}

.selected-names h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.selected-tag {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
}

.name-input {
    width: 100%;
    height: 150px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    resize: vertical;
    font-family: inherit;
}

.name-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.name-actions {
    display: flex;
    gap: 0.75rem;
}

.name-count {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.number-display {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.1) 0%, rgba(142, 68, 173, 0.1) 100%);
    border-radius: 1rem;
    margin-bottom: 2rem;
}

.number-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.number-cell {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 1rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    box-shadow: var(--shadow);
    animation: numberPulse 0.2s ease-in-out infinite;
}

@keyframes numberPulse {
    0%, 100% { transform: scale(1); box-shadow: var(--shadow); }
    50% { transform: scale(1.1); box-shadow: var(--shadow-xl); }
}

.number-cell.final {
    animation: none;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    transform: scale(1.1);
}

.number-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.number-btn {
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.number-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.drawn-numbers {
    margin-top: 1rem;
}

.drawn-numbers h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.drawn-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.drawn-tag {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.setting-group {
    margin-bottom: 1rem;
}

.setting-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.setting-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.setting-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.range-info {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 0.5rem;
}

.toggle-section-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border: none;
    background: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-section-btn:hover {
    color: var(--secondary-color);
}

.toggle-section-btn i:last-child {
    transition: transform 0.3s ease;
}

.toggle-section-btn.active i:last-child {
    transform: rotate(180deg);
}

.section-content {
    display: none;
}

.section-content.active {
    display: block;
}

.pick-count-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(52, 152, 219, 0.1);
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.selector-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.count-adjust-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: white;
    color: #3498db;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.count-adjust-btn:hover {
    background: #3498db;
    color: white;
    transform: scale(1.1);
}

.count-display {
    width: 40px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #3498db;
}

.custom-status {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-color);
    border-radius: 0.5rem;
}

.footer {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    margin-top: 8rem;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

.footer-links span {
    color: rgba(255, 255, 255, 0.5);
}

.copyright {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}

.modal-content h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.cancel-btn,
.confirm-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cancel-btn {
    background: var(--bg-color);
    color: var(--text-secondary);
}

.cancel-btn:hover {
    background: var(--border-color);
}

.confirm-btn {
    background: var(--accent-color);
    color: var(--primary-color);
}

.confirm-btn:hover {
    background: var(--accent-light);
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    .hero-section h2 {
        font-size: 1.75rem;
    }

    .mode-cards {
        grid-template-columns: 1fr;
    }

    .lottery-container,
    .roll-call-container,
    .number-container {
        grid-template-columns: 1fr;
    }

    .wheel {
        width: 280px;
        height: 280px;
    }

    .current-name {
        font-size: 2.5rem;
    }

    .nav-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .page-header h2 {
        font-size: 1.5rem;
    }

    .wheel {
        width: 250px;
        height: 250px;
    }

    .current-name {
        font-size: 2rem;
    }

    .number-cell {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}