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

@keyframes halloweenGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(-45deg, #1a0033, #330066, #660033, #993300, #cc6600, #ff6600);
    background-size: 400% 400%;
    animation: halloweenGradient 15s ease infinite;
    min-height: 100vh;
    padding: 20px;
}

.page-header {
    max-width: 960px;
    margin: 0 auto 30px;
    text-align: center;
    color: #f8fafc;
}

.page-header h1 {
    font-size: clamp(2.4rem, 5vw, 3.2rem);
    margin-bottom: 12px;
    text-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.tagline {
    font-size: clamp(1.1rem, 2.2vw, 1.35rem);
    line-height: 1.6;
    max-width: 680px;
    margin: 0 auto;
    color: rgba(248, 250, 252, 0.85);
}

main {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

body.fullscreen-active {
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

.container.fullscreen-active {
    max-width: none;
    width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: clamp(16px, 4vh, 48px);
    gap: clamp(16px, 4vh, 36px);
    background: linear-gradient(-45deg, #1a0033, #330066, #660033, #993300, #cc6600, #ff6600);
    background-size: 400% 400%;
    animation: halloweenGradient 15s ease infinite;
    box-shadow: none;
}

.container.fullscreen-active .wheel-container {
    margin: 0;
}

.container.fullscreen-active #wheelCanvas {
    width: 100%;
    height: 100%;
}

.container.fullscreen-active .controls,
.container.fullscreen-active .result {
    margin: 0;
    width: min(90vw, 640px);
    align-items: center;
    text-align: center;
}

.config-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    padding: 10px 24px;
    font-size: 1em;
    font-weight: 600;
    color: #1f2933;
    background: #f3f4f6;
    border: 2px solid #d1d5db;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.config-toggle:hover {
    background: #e5e7eb;
    border-color: #c7ccd3;
}

.config-toggle:focus-visible {
    outline: 3px solid #764ba2;
    outline-offset: 2px;
}

.config-toggle:active {
    transform: translateY(1px);
}

.config-section.is-hidden {
    display: none;
}

.container.fullscreen-active .config-section {
    display: none;
}

.container.fullscreen-active .config-toggle {
    display: none;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
}

.wheel-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 30px;
}

#wheelCanvas {
    display: block;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: #fff;
}

.pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 40px solid #ff4444;
    z-index: 10;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.3));
}

.spin-button {
    display: block;
    margin: 0;
    padding: 15px 50px;
    font-size: 1.3em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.spin-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3);
}

.spin-button:active {
    transform: translateY(0);
}

.spin-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 30px;
    width: 100%;
}

.fullscreen-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: #1f2933;
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

.fullscreen-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.35);
    background: #111827;
}

.fullscreen-button:focus-visible {
    outline: 3px solid #764ba2;
    outline-offset: 3px;
}

.fullscreen-button .fullscreen-exit {
    display: none;
}

.fullscreen-button.active .fullscreen-enter {
    display: none;
}

.fullscreen-button.active .fullscreen-exit {
    display: inline;
}

.result {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    min-height: 40px;
    margin-bottom: 30px;
    padding: 15px;
    border-radius: 10px;
    background: #f0f0f0;
}

.result.show {
    animation: resultPop 0.5s ease;
}

@keyframes resultPop {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.config-section {
    margin-top: 40px;
    border-top: 2px solid #eee;
    padding-top: 30px;
}

.config-section h2 {
    color: #333;
    margin-bottom: 20px;
}

.config-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    font-size: 1em;
    background: #f0f0f0;
    border: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.tab-btn:hover {
    background: #e0e0e0;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.config-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prize-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.prize-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 18px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.prize-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.prize-card-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #1f2937;
}

.prize-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.prize-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.95em;
    color: #374151;
}

.prize-field .field-label {
    font-weight: 600;
    color: #111827;
}

.prize-field input[type="text"] {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 1em;
}

.prize-field input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

.prize-field input[type="color"] {
    height: 44px;
    padding: 6px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
}

.prize-field input[type="color"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

.add-prize-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding: 12px 24px;
    border: none;
    border-radius: 999px;
    font-weight: 600;
    font-size: 1em;
    color: white;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 20px rgba(34, 197, 94, 0.25);
}

.add-prize-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(34, 197, 94, 0.35);
}

.add-prize-btn:active {
    transform: translateY(0);
}

.add-prize-btn:focus-visible {
    outline: 3px solid #16a34a;
    outline-offset: 2px;
}

.prize-remove {
    border: none;
    background: transparent;
    color: #ef4444;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease;
}

.prize-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

.prize-remove:focus-visible {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

.prize-remove:disabled,
.prize-remove[aria-disabled="true"] {
    cursor: not-allowed;
    color: #9ca3af;
    background: transparent;
}

.color-chip {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    vertical-align: middle;
}

.tab-content {
    display: none;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 0 10px 10px 10px;
}

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

.tab-content h3 {
    color: #333;
    margin-bottom: 10px;
}

.note {
    color: #666;
    font-style: italic;
    margin-bottom: 20px;
    padding: 10px;
    background: #fff3cd;
    border-radius: 5px;
    border-left: 4px solid #ffc107;
}

.prize-config {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

.prize-config label {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.prize-config input {
    width: 140px;
    max-width: 100%;
    padding: 8px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
}

.prize-config input:focus {
    outline: none;
    border-color: #667eea;
}

.prize-config .percent {
    margin-left: 5px;
    font-weight: bold;
    color: #666;
}

.config-total {
    margin: 20px 0;
    padding: 15px;
    background: white;
    border-radius: 8px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
}

#totalProb,
#totalVisual {
    color: #667eea;
}

.update-btn {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.update-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.update-btn:active {
    transform: translateY(0);
}

.seo-section {
    max-width: 1200px;
    margin: 0 auto 60px;
    background: rgba(15, 23, 42, 0.65);
    color: #f8fafc;
    border-radius: 20px;
    padding: clamp(20px, 4vw, 36px);
    box-shadow: 0 20px 50px rgba(10, 0, 25, 0.45);
}

.seo-content {
    max-width: 860px;
    margin: 0 auto;
}

.seo-content h2 {
    font-size: clamp(1.8rem, 3.2vw, 2.4rem);
    margin-bottom: 16px;
}

.seo-content h3 {
    font-size: clamp(1.4rem, 2.4vw, 1.8rem);
    margin: 26px 0 12px;
}

.seo-content p {
    line-height: 1.7;
    margin-bottom: 18px;
}

.seo-content ol {
    padding-left: 20px;
    margin-left: 0;
}

.seo-content li {
    margin-bottom: 10px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 560px) {

    .tab-btn {
        padding: 6px 8px;
    }   

    .container {
        padding: clamp(16px, 5vw, 22px);
    }
    
    #wheelCanvas {
        width: 100%;
        height: 100%;
    }
    .pointer {
        top: -16px;
        border-left-width: 16px;
        border-right-width: 16px;
        border-top-width: 32px;
    }
    .controls {
        gap: 10px;
    }
    .spin-button {
        width: 100%;
        padding: 14px 20px;
        font-size: 1.1em;
    }
}

.page-footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
    text-align: center;
    color: #f8fafc;
}

.license-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    font-weight: 600;
    color: #0f172a;
    background: rgba(248, 250, 252, 0.9);
    border: 2px solid rgba(15, 23, 42, 0.25);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.license-link:hover {
    background: #f8fafc;
    border-color: rgba(15, 23, 42, 0.4);
    transform: translateY(-1px);
}

.license-link:focus-visible {
    outline: 3px solid #64748b;
    outline-offset: 3px;
}

.license-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 6vw, 48px);
    z-index: 2000;
}

.license-modal[hidden] {
    display: none;
}

.license-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
}

.license-dialog {
    position: relative;
    max-width: 720px;
    width: min(100%, 700px);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.45);
    overflow: hidden;
}

.license-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.license-close {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.license-close:hover {
    transform: scale(1.1);
}

.license-close:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 8px;
}

.license-body {
    padding: 0 24px 24px;
    overflow-y: auto;
    background: #f1f5f9;
}

.license-text {
    white-space: pre-wrap;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #0f172a;
}
