:root {
    --primary-color: #ffcc00;
    /* Gold */
    --secondary-color: #d32f2f;
    /* Red */
    --bg-dark: #121212;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-color: #ffffff;
    --text-muted: #aaaaaa;
    --accent-glow: 0 0 15px rgba(255, 204, 0, 0.5);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(211, 47, 47, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(255, 204, 0, 0.1) 0%, transparent 40%);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

h2 {
    margin: 0px;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    gap: 20px;
    position: relative;
    z-index: 10;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.main-header h1 {
    margin: 0;
    font-size: 1.8rem;
    background: linear-gradient(90deg, #ffd700, #ffb700);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.header-controls {
    display: flex;
    gap: 10px;
}

/* Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.glass-btn .material-symbols-outlined {
    font-size: 18px;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    /* transform: translateY(-1px); */
}

/* 圓形圖示按鈕 */
.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn .material-symbols-outlined {
    font-size: 22px;
    transition: transform 0.3s ease;
}

.icon-btn:hover {
    background: rgba(255, 204, 0, 0.2);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.3);
}

.icon-btn:hover .material-symbols-outlined {
    transform: rotate(90deg);
}

/* 危險按鈕外框樣式 */
.danger-outline {
    border-color: rgba(255, 68, 68, 0.5);
    color: #ff6b6b;
}

.danger-outline:hover {
    background: rgba(255, 68, 68, 0.15);
    border-color: #ff4444;
}

.action-btn {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.4);
    transition: transform 0.1s, box-shadow 0.1s;
    width: 100%;
    margin-top: 20px;
}

.action-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(211, 47, 47, 0.3);
}

.action-btn:disabled {
    background: #555;
    box-shadow: none;
    cursor: not-allowed;
}

/* Layout */
.main-content {
    display: flex;
    flex: 1;
    gap: 20px;
    min-height: 0;
    /* justify-content: center; REMOVED */
}

/* Left Panel */
.control-panel {
    width: 300px;
    /* Revert width if needed or keep 320px, let's keep 320 for readability */
    /* width: 320px; */
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-shrink: 0;
    height: fit-content;
}

.control-panel h2 {
    margin: 0;
    font-size: 1.5rem;
    text-align: center;
    background: linear-gradient(90deg, #ffd700, #ffb700);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

select,
input {
    padding: 12px;
    /* Bigger touch target */
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    color: white;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.prize-info {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.prize-info p {
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
}

/* Center Display */
.display-panel {
    width: 100%;
    /* flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative; */
}

.animation-container {
    width: 100%;
    height: 100%;
    max-height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 30px rgba(255, 204, 0, 0.2);
}

.slot-machine-window {
    font-size: 4rem;
    /* Bigger text */
    font-weight: bold;
    text-align: center;
    color: var(--text-color);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.winner-announcement {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 20;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    border-radius: 14px;
}

.winner-announcement h3 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.winner-prize-info {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    animation: fadeIn 0.5s ease-out;
}

.winner-prize-info .award-title {
    font-size: 2.5rem;
    color: #ffd700;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

.winner-prize-info .prize-name {
    font-size: 4.5rem;
    color: #ffffff;
    font-weight: 800;
    line-height: 1.1;
    text-shadow: 0 0 20px rgba(255, 204, 0, 0.6);
}

.winner-names-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    margin-top: 10px;
}

.winner-card {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #121212;
    padding: 40px 100px;
    border-radius: 24px;
    font-size: 6rem;
    font-weight: 900;
    box-shadow: 0 20px 50px rgba(255, 215, 0, 0.5);
    text-align: center;
    animation: glow 1.5s infinite alternate;
    border: 4px solid #fff;
    min-width: 300px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: 80%;
    max-width: 900px;
    height: 80%;
    display: flex;
    flex-direction: column;
    position: relative;
}

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

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.close-btn .material-symbols-outlined {
    font-size: 24px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
    color: white;
}

.tab-content-container {
    flex: 1;
    overflow-y: auto;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
    background: rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
}

tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Utils */
.hidden {
    display: none !important;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes glow {
    from {
        box-shadow: 0 0 10px #FFD700;
        transform: scale(1);
    }

    to {
        box-shadow: 0 0 25px #FFD700, 0 0 10px white;
        transform: scale(1.02);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Fireworks */
#fireworks-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
    transition: opacity 0.5s ease-out;
}

/* Header Separator */
.separator {
    width: 1px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 5px;
    height: 24px;
    align-self: center;
}

@keyframes flyAcross {
    0% {
        left: -150px;
        transform: translateY(-50%) rotate(10deg);
    }

    100% {
        left: 110vw;
        transform: translateY(-50%) rotate(10deg);
    }
}

/* Material Symbols 預設樣式 */
.material-symbols-outlined {
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24;
    vertical-align: middle;
}

.form-group.row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

/* Settings Modal Layout */
.settings-modal-content {
    display: flex;
    flex-direction: row;
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    padding: 0;
    overflow: hidden;
}

.settings-sidebar {
    width: 200px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    border-right: 1px solid var(--glass-border);
}

.settings-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 15px 20px;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-tab-btn .material-symbols-outlined {
    font-size: 20px;
}

.settings-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.settings-tab-btn.active {
    background: rgba(255, 204, 0, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.settings-tab-btn.active .material-symbols-outlined {
    color: var(--primary-color);
}

.settings-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.settings-view {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.settings-view.active {
    display: flex;
    animation: fadeIn 0.3s;
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.toolbar .glass-btn {
    font-size: 0.85rem;
    padding: 8px 12px;
}

.toolbar .glass-btn .material-symbols-outlined {
    font-size: 16px;
}

.primary-btn {
    background: rgba(255, 204, 0, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.primary-btn:hover {
    background: rgba(255, 204, 0, 0.25);
}

.danger-btn {
    border-color: #ff4444;
    color: #ff4444;
}

.danger-btn:hover {
    background: rgba(255, 68, 68, 0.1);
}

.table-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    background: rgba(0, 0, 0, 0.5);
    position: sticky;
    top: 0;
}

/* 表格操作按鈕 */
.table-action-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
}

.table-action-btn .material-symbols-outlined {
    font-size: 16px;
}

.table-action-btn.edit-btn:hover {
    background: rgba(255, 204, 0, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.table-action-btn.delete-btn:hover {
    background: rgba(255, 68, 68, 0.15);
    border-color: #ff4444;
    color: #ff4444;
}

/* Modal Footer */
.modal-footer {
    padding: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--glass-border);
}

.modal-footer .action-btn {
    margin-top: 0;
    width: auto;
    padding: 10px 20px;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.modal-footer .glass-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Header Icon */
.header-icon {
    vertical-align: middle;
    margin-right: 8px;
    color: var(--primary-color);
}

/* 飛機動畫 */
.fly-plane {
    position: fixed;
    font-size: 100px;
    z-index: 9999;
    pointer-events: none;
    top: 50%;
    left: -150px;
    filter: drop-shadow(0 0 10px white);
    transform: translateY(-50%);
}

.fly-plane .material-symbols-outlined {
    font-size: 80px;
    color: white;
}

.fly-plane.flying {
    animation: flyAcross 3s linear forwards;
}