:root {
    --bg-color: #14142B;
    --surface-color: #22223B;
    --surface-light: #33334D;
    --primary-color: #6C63FF;
    --primary-light: #C8B6FF;
    --teal-color: #009688;
    --text-primary: #FFFFFF;
    --text-secondary: #AAAAAA;
    --divider-color: #44447A;
    --danger-color: #FF726D;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans KR', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 14px;
    padding-top: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Top Bar */
.top-bar {
    width: 100%;
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.btn-outline {
    flex: 1;
    height: 40px;
    background: transparent;
    border: 1px solid var(--divider-color);
    color: var(--primary-light);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-outline:active {
    background: var(--surface-color);
}

/* Title Row */
.title-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--primary-light);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
}
.icon-btn:disabled {
    color: gray;
}

/* Roulette Area */
.roulette-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 10px 0 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

#roulette-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid #2D2D4E;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

.pointer {
    position: absolute;
    top: -5px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 24px solid white;
    z-index: 10;
}

.spin-btn {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-color: white;
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 900;
    border: none;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 5;
    transition: transform 0.1s;
}
.spin-btn:active {
    transform: scale(0.95);
}
.spin-btn:disabled {
    background-color: #DDDDDD;
    cursor: not-allowed;
}

/* Filters */
.filter-row {
    width: 100%;
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.chip {
    flex: 1;
    background-color: var(--surface-color);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 8px 0;
    text-align: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.chip.active {
    background-color: var(--primary-color);
    color: white;
}

.type-chip.active {
    background-color: var(--teal-color);
}
.flex-1-6 {
    flex: 1.6;
}

/* Inputs */
.input-row {
    width: 100%;
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    margin-top: 8px;
}

.input-row input {
    flex: 1;
    background-color: var(--surface-color);
    border: none;
    border-radius: 12px;
    padding: 0 16px;
    color: white;
    font-size: 13px;
    height: 56px;
    outline: none;
}
.input-row input::placeholder {
    color: gray;
}

.input-row:nth-child(6) input { /* AI input */
    background-color: var(--surface-light);
    border-radius: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    height: 56px;
}

.btn-teal {
    background-color: var(--teal-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    height: 56px;
}

/* AI Recommendations */
#ai-results-container {
    width: 100%;
    margin-top: 16px;
}
.ai-title {
    font-size: 15px;
    margin-bottom: 10px;
}
.ai-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
}
.ai-card-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}
.ai-card-badge {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 12px;
}
.ai-card-tag {
    color: var(--teal-color);
    font-size: 10px;
}
.ai-card-desc {
    color: #DDDDDD;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
}
.ai-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ai-card-name {
    color: #64B5F6;
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.ai-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-card-dist {
    color: gray;
    font-size: 12px;
}
.btn-add-ai {
    background-color: var(--surface-light);
    color: var(--primary-light);
    border: none;
    border-radius: 15px;
    padding: 6px 12px;
    font-size: 11px;
    cursor: pointer;
}

/* Spinner */
.spinner {
    border: 3px solid rgba(108, 99, 255, 0.3);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal {
    background-color: var(--surface-color);
    width: 85%;
    max-width: 400px;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.modal h3 {
    margin-bottom: 16px;
    font-size: 18px;
}
.modal input[type="text"] {
    background: transparent;
    border: 1px solid gray;
    color: white;
    padding: 10px;
    border-radius: 8px;
    width: 100%;
    margin-bottom: 16px;
    outline: none;
}
.modal input[type="text"]:focus {
    border-color: var(--primary-color);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 16px;
}
.btn-text {
    background: transparent;
    border: none;
    color: gray;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
}
.btn-text.primary {
    color: var(--primary-color);
}

.list-container {
    overflow-y: auto;
    flex: 1;
}
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--surface-light);
}
.list-item-text {
    flex: 1;
    font-size: 15px;
    cursor: pointer;
}
.list-item-text.active {
    color: var(--primary-light);
    font-weight: bold;
}
.list-item-current {
    color: var(--primary-color);
    font-size: 11px;
    margin-right: 8px;
}
.btn-icon {
    background: transparent;
    border: none;
    color: var(--danger-color);
    font-size: 18px;
    cursor: pointer;
}
.mt-10 { margin-top: 10px; }

/* Sound Manager */
.sound-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.sound-select {
    width: 100%;
    background: var(--surface-light);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    margin: 8px 0 20px 0;
    outline: none;
}
.modal h4 { font-size: 14px; color: var(--text-secondary); margin-top: 10px; }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 40px; height: 20px; }
.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: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(20px); }
.slider.round { border-radius: 20px; }
.slider.round:before { border-radius: 50%; }

/* Win Modal */
.win-modal {
    align-items: center;
    padding: 32px;
}
.win-emoji { font-size: 48px; margin-bottom: 12px; }
.win-title { font-size: 28px; font-weight: 900; color: var(--primary-color); margin-bottom: 8px; }
.win-menu { font-size: 26px; font-weight: bold; text-align: center; margin-bottom: 24px; word-break: keep-all; }
.full-width { width: 100%; height: 48px; font-size: 16px; }

.bottom-padding { height: 60px; }
