/* ==================== CSS Variables ==================== */
:root {
    --primary-gold: #d4af37;
    --primary-gold-light: #f0d77a;
    --primary-red: #c41e3a;
    --primary-red-dark: #8b0000;
    --bg-dark: #0a0a0f;
    --bg-card: rgba(20, 20, 30, 0.9);
    --text-light: #f5f5f5;
    --text-muted: #888;
    --glow-gold: 0 0 20px rgba(212, 175, 55, 0.5);
    --glow-red: 0 0 30px rgba(196, 30, 58, 0.6);
}

/* ==================== Reset & Base ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ==================== Background Effects (Lightweight) ==================== */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #0a0a0f 100%);
}

.bg-gradient {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(196, 30, 58, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(212, 175, 55, 0.05) 0%, transparent 40%);
    animation: bgRotate 60s linear infinite;
    will-change: transform;
}

.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(circle at 50% 50%, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle at 50% 50%, black 40%, transparent 100%);
    animation: gridPulse 10s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Scanline Effect */
.bg-scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(212, 175, 55, 0.05) 50%, 
        transparent 100%);
    background-size: 100% 200%;
    animation: scanlineMove 8s linear infinite;
    pointer-events: none;
    z-index: 1;
    opacity: 0.3;
}

@keyframes scanlineMove {
    0% { background-position: 0% -100%; }
    100% { background-position: 0% 200%; }
}

/* Floating Particles */
.bg-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.bg-particles span {
    position: absolute;
    bottom: -20px;
    width: 4px;
    height: 4px;
    background: var(--primary-gold);
    box-shadow: 0 0 10px var(--primary-gold);
    opacity: 0;
    border-radius: 50%;
    animation: floatUp 15s linear infinite;
}

/* Randomize particles */
.bg-particles span:nth-child(1) { left: 10%; animation-duration: 12s; animation-delay: 0s; }
.bg-particles span:nth-child(2) { left: 20%; width: 6px; height: 6px; animation-duration: 18s; animation-delay: 2s; background: var(--primary-red); box-shadow: 0 0 10px var(--primary-red); }
.bg-particles span:nth-child(3) { left: 35%; animation-duration: 15s; animation-delay: 4s; }
.bg-particles span:nth-child(4) { left: 50%; width: 3px; height: 3px; animation-duration: 20s; animation-delay: 6s; }
.bg-particles span:nth-child(5) { left: 65%; animation-duration: 14s; animation-delay: 1s; background: var(--primary-red); box-shadow: 0 0 10px var(--primary-red); }
.bg-particles span:nth-child(6) { left: 80%; width: 5px; height: 5px; animation-duration: 16s; animation-delay: 3s; }
.bg-particles span:nth-child(7) { left: 90%; animation-duration: 19s; animation-delay: 5s; }
.bg-particles span:nth-child(8) { left: 25%; width: 2px; height: 2px; animation-duration: 22s; animation-delay: 7s; background: var(--primary-red); box-shadow: 0 0 10px var(--primary-red); }
.bg-particles span:nth-child(9) { left: 45%; animation-duration: 13s; animation-delay: 8s; }
.bg-particles span:nth-child(10) { left: 75%; width: 4px; height: 4px; animation-duration: 17s; animation-delay: 2s; }
.bg-particles span:nth-child(11) { left: 5%; animation-duration: 25s; animation-delay: 0s; }
.bg-particles span:nth-child(12) { left: 15%; width: 5px; height: 5px; animation-duration: 21s; animation-delay: 4s; background: var(--primary-red); box-shadow: 0 0 10px var(--primary-red); }
.bg-particles span:nth-child(13) { left: 55%; animation-duration: 16s; animation-delay: 9s; }
.bg-particles span:nth-child(14) { left: 85%; width: 3px; height: 3px; animation-duration: 14s; animation-delay: 3s; }
.bg-particles span:nth-child(15) { left: 95%; animation-duration: 18s; animation-delay: 6s; background: var(--primary-red); box-shadow: 0 0 10px var(--primary-red); }

@keyframes floatUp {
    0% { transform: translateY(0) translateX(0); opacity: 0; }
    20% { opacity: 0.6; }
    50% { transform: translateY(-50vh) translateX(20px); opacity: 0.6; }
    80% { opacity: 0.3; }
    100% { transform: translateY(-100vh) translateX(-20px); opacity: 0; }
}

@keyframes bgRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== Container ==================== */
.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* ==================== Header ==================== */
header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    width: 100%;
}

.title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.title {
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-gold-light), var(--primary-gold), var(--primary-red));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(212, 175, 55, 0.4));
    letter-spacing: 0.1em;
    animation: titleGlow 3s ease-in-out infinite;
    margin: 0;
}

@keyframes titleGlow {
    0%, 100% { filter: drop-shadow(0 0 30px rgba(212, 175, 55, 0.4)); }
    50% { filter: drop-shadow(0 0 50px rgba(212, 175, 55, 0.7)); }
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-top: 10px;
    letter-spacing: 0.3em;
}

/* Title Editing */
.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
    padding: 5px;
}

.icon-btn:hover {
    color: var(--primary-gold);
}

.title-edit-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

#title-input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--primary-gold);
    color: var(--primary-gold-light);
    font-size: 1.5rem;
    padding: 5px 10px;
    border-radius: 5px;
    text-align: center;
    width: 300px;
}

.settings-toggle-btn {
    position: absolute;
    right: 0;
    top: 0;
    background: transparent;
    border: 1px solid var(--primary-gold);
    color: var(--primary-gold);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.settings-toggle-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    box-shadow: var(--glow-gold);
}

/* ==================== Spinners Container ==================== */
.spinners-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 50px;
}

.spinner-wrapper {
    width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-card);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s, box-shadow 0.3s;
}

.spinner-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    border-color: #444;
}

.spinner-wrapper.disabled {
    opacity: 0.5;
    filter: grayscale(1);
    pointer-events: none;
}

.spinner-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.spinner-label {
    font-weight: 700;
    color: var(--primary-gold);
    font-size: 1.1rem;
}

.spinner-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.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;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-gold);
}

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

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.mini-spin-btn {
    background: transparent;
    border: 1px solid #444;
    color: var(--text-light);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mini-spin-btn:hover {
    background: var(--primary-gold);
    border-color: var(--primary-gold);
    color: #000;
    transform: rotate(180deg);
}

/* Spinner Box */
.spinner {
    width: 100%;
    height: 200px; /* VISIBLE_ITEMS * ITEM_HEIGHT */
    overflow: hidden;
    position: relative;
    background: #0f0f15;
    border-radius: 5px;
    border: 1px solid #222;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    margin-bottom: 15px;
}

/* Gradient Masks for 3D effect */
.spinner::before, .spinner::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 2;
    pointer-events: none;
}

.spinner::before {
    top: 0;
    background: linear-gradient(to bottom, #0f0f15, transparent);
}

.spinner::after {
    bottom: 0;
    background: linear-gradient(to top, #0f0f15, transparent);
}

.spinner-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 50px; /* ITEM_HEIGHT */
    margin-top: -25px;
    background: rgba(212, 175, 55, 0.1);
    border-top: 1px solid rgba(212, 175, 55, 0.5);
    border-bottom: 1px solid rgba(212, 175, 55, 0.5);
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.1);
}

.spinner-inner {
    /* transition managed by JS */
    width: 100%;
    text-align: center;
}

.spinner-item {
    height: 50px; /* ITEM_HEIGHT */
    line-height: 50px;
    font-size: 1.1rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
}

.spinner.spinning .spinner-item {
    filter: blur(1px);
}

/* Result Display */
.result-display {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-gold-light);
    min-height: 1.5em;
    opacity: 0.5;
    transition: all 0.3s;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.result-display.active {
    opacity: 1;
    transform: scale(1.1);
    color: #fff;
    text-shadow: 0 0 20px var(--primary-gold);
}

/* ==================== Main Button ==================== */
.spin-button {
    position: relative;
    background: linear-gradient(to bottom, #c41e3a, #8b0000);
    border: none;
    padding: 20px 60px;
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
    cursor: pointer;
    clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%);
    transition: all 0.1s;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 50px;
    outline: none;
}

.spin-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
    box-shadow: 0 10px 30px rgba(196, 30, 58, 0.4);
}

.spin-button:active {
    transform: translateY(2px);
    filter: brightness(0.9);
}

.spin-button:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
    transform: none;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
}

.spin-button:hover .btn-glow {
    transform: translateX(100%);
    transition: transform 0.5s;
}

/* ==================== Final Result Area ==================== */
.final-result {
    width: 100%;
    max-width: 800px;
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid var(--primary-gold);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s;
    pointer-events: none;
    position: relative;
    overflow: hidden;
}

.final-result.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    box-shadow: 0 0 50px rgba(212, 175, 55, 0.1);
}

.final-result h2 {
    color: var(--primary-gold);
    margin-bottom: 20px;
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    position: relative;
    display: inline-block;
}

.final-result h2::after {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-gold), transparent);
    margin-top: 5px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 20px;
}

.result-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.result-item-label {
    display: block;
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 5px;
}

.result-item-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

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

.modal.show {
    display: flex;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #151520;
    border: 1px solid #444;
    width: 90%;
    max-width: 800px;
    border-radius: 10px;
    padding: 30px;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.glass-modal {
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid var(--primary-gold);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.2);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #fff;
}

.settings-tabs {
    display: flex;
    border-bottom: 1px solid #333;
    margin-bottom: 20px;
}

.tab-btn {
    background: none;
    border: none;
    color: #888;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    position: relative;
}

.tab-btn:hover {
    color: #ccc;
}

.tab-btn.active {
    color: var(--primary-gold);
    font-weight: bold;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-gold);
}

.tab-content-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    min-height: 300px;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.item-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.item-checkbox-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.item-checkbox-label input {
    accent-color: var(--primary-gold);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.primary-btn, .secondary-btn {
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.primary-btn {
    background: var(--primary-gold);
    border: none;
    color: #000;
}

.primary-btn:hover {
    background: var(--primary-gold-light);
    transform: translateY(-2px);
}

.secondary-btn {
    background: transparent;
    border: 1px solid #444;
    color: #ccc;
}

.secondary-btn:hover {
    border-color: #666;
    color: #fff;
}

/* Weight Settings Specifics */
.weight-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 5px;
}

.weight-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

/* ==================== Animations ==================== */
@keyframes bounceIn {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
