@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Thin.woff2') format('woff2');
    font-weight: 100;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-ExtraLight.woff2') format('woff2');
    font-weight: 200;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Light.woff2') format('woff2');
    font-weight: 300;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-ExtraBold.woff2') format('woff2');
    font-weight: 800;
    font-display: swap;
}
@font-face {
    font-family: 'Pretendard';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Black.woff2') format('woff2');
    font-weight: 900;
    font-display: swap;
}

:root {
    --primary-color-light: #4CAF50;
    --background-color-light: #f5f5f5;
    --font-color-light: #333;
    --border-color-light: #ccc;
    --result-bg-light: #ffffff;
    --arrow-color-light: #333333;

    --primary-color-dark: #00E676;
    --background-color-dark: #121212;
    --font-color-dark: #FFFFFF;
    --result-bg-dark: #1E1E1E;
    --arrow-color-dark: #00E676;
}

body {
    background-color: var(--background-color-light);
    color: var(--font-color-light);
    font-family: 'Pretendard', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    transition: background-color 0.4s ease, color 0.4s ease;
}

body.dark-mode {
    background-color: var(--background-color-dark);
    color: var(--font-color-dark);
}

.header {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

#streamer-info {
    display: flex;
    align-items: center;
    gap: 15px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#streamer-info.visible {
    visibility: visible;
    opacity: 1;
}

#streamer-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color-light);
}

body.dark-mode #streamer-image {
    border-color: var(--primary-color-dark);
}

#streamer-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color-light);
}

body.dark-mode #streamer-name {
    color: var(--primary-color-dark);
}

#page-content {
    transition: filter 0.3s ease-in-out;
}

body.popup-active #page-content {
    filter: blur(8px);
}

.main-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 40px;
    padding-top: 80px; /* To avoid overlap with header */
}

.roulette-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wheel-container {
    position: relative;
    width: 400px;
    height: 400px;
}

.roulette-arrow {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid var(--arrow-color-light);
    z-index: 10;
    transition: border-top-color 0.4s ease;
}

body.dark-mode .roulette-arrow {
    border-top-color: var(--arrow-color-dark);
}

#roulette-canvas {
    border: 5px solid var(--border-color-light);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

body.dark-mode #roulette-canvas {
    border-color: var(--primary-color-dark);
    box-shadow: 0 0 25px var(--primary-color-dark);
}

#spin-button {
    background-color: var(--primary-color-light);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 3rem;
    transition: all 0.3s ease;
    font-weight: bold;
    font-family: 'Pretendard', sans-serif;
}

#spin-button:hover {
    background-color: #45a049;
}

body.dark-mode #spin-button {
    background-color: var(--primary-color-dark);
    color: var(--background-color-dark);
    box-shadow: 0 0 15px var(--primary-color-dark);
}

body.dark-mode #spin-button:hover {
    background-color: #00D68F;
    box-shadow: 0 0 25px #00D68F;
}

#streamer-id-popup-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#streamer-id-popup-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

#streamer-id-popup {
    background-color: var(--result-bg-light);
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: center;
    width: 300px;
}

body.dark-mode #streamer-id-popup {
    background-color: var(--result-bg-dark);
}

#streamer-id-popup h2 {
    margin: 0;
    font-size: 1.4rem;
}

#streamer-id-input {
    padding: 12px;
    border: 1px solid var(--border-color-light);
    border-radius: 5px;
    font-family: 'Pretendard', sans-serif;
    font-size: 1rem;
}

body.dark-mode #streamer-id-input {
    background-color: #333;
    color: var(--font-color-dark);
    border-color: var(--primary-color-dark);
}

#submit-streamer-id {
    background-color: var(--primary-color-light);
    color: white;
    border: none;
    padding: 12px;
    font-size: 1.1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

body.dark-mode #submit-streamer-id {
    background-color: var(--primary-color-dark);
    color: var(--background-color-dark);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 999;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

#result-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color-light);
    background-color: var(--result-bg-light);
    padding: 40px 60px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 1000;
    text-align: center;
    max-width: 80%;
}

#result-display.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

body.dark-mode #result-display {
    color: var(--primary-color-dark);
    background-color: var(--result-bg-dark);
    text-shadow: 0 0 10px var(--primary-color-dark);
}

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

#theme-switcher-button, #settings-button {
    background-color: var(--result-bg-light);
    border: 2px solid var(--border-color-light);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    color: var(--font-color-light);
    text-decoration: none;
    box-sizing: border-box;
}

#theme-switcher-button .material-symbols-outlined,
#settings-button .material-symbols-outlined {
    font-size: 24px;
}

body.dark-mode #theme-switcher-button, body.dark-mode #settings-button {
    background-color: var(--result-bg-dark);
    border-color: var(--primary-color-dark);
    color: var(--font-color-dark);
}

.editor-container {
    width: 350px;
    display: flex;
    flex-direction: column;
}

#item-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.item-entry {
    display: flex;
    align-items: center;
    gap: 5px;
}

.item-entry input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid var(--border-color-light);
    border-radius: 4px;
    font-family: 'Pretendard', sans-serif;
}

body.dark-mode .item-entry input {
    background-color: var(--result-bg-dark);
    color: var(--font-color-dark);
    border-color: var(--primary-color-dark);
}

.item-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.item-controls button {
    width: 24px;
    height: 24px;
    cursor: pointer;
    border: 1px solid var(--border-color-light);
    border-radius: 50%;
    background-color: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
}

.item-controls button .material-symbols-outlined {
    font-size: 16px;
}

.item-probability {
    width: 80px;
    text-align: right;
    font-size: 0.9rem;
}

body.dark-mode .item-controls button {
    background-color: #444;
    color: white;
    border-color: var(--primary-color-dark);
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

.controls button {
    width: 36px;
    height: 36px;
    cursor: pointer;
    border: 1px solid var(--border-color-light);
    border-radius: 50%;
    background-color: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
}

.controls button .material-symbols-outlined {
    font-size: 20px;
}

body.dark-mode .controls button {
    background-color: #444;
    color: white;
    border-color: var(--primary-color-dark);
}