:root {
    --primary: #0071e3;
    --primary-hover: #0077ed;
    --bg-dark: #000000;
    --bg-card: rgba(28, 28, 30, 0.8);
    --text-main: #f5f5f7;
    --text-dim: #86868b;
    --border: rgba(255, 255, 255, 0.1);
    --glass: rgba(255, 255, 255, 0.05);
    --error: #ff3b30;
    --success: #34c759;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Progress Bar */
.progress-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    z-index: 1000;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #5ac8fa);
    transition: width 0.4s ease-out;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 0.5rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px var(--primary));
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #a1a1a6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Sections */
.section {
    display: none;
    animation: slideIn 0.5s var(--transition);
}

.section.active {
    display: block;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.glass {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-desc {
    color: var(--text-dim);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Components */
.input-group {
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-main);
    font-weight: 500;
}

input[type="password"],
textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.config-group {
    margin: 2rem 0;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.toggle-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.toggle-info p {
    font-size: 0.9rem;
    color: var(--text-dim);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #3a3a3c;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px; width: 22px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* Buttons */
.primary-button {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1rem;
}

.primary-button:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

.primary-button:active { transform: scale(0.98); }

.text-button {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

.icon-button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.icon-button:hover { background: rgba(255, 255, 255, 0.1); }

/* Warning Box */
.warning-box {
    background: rgba(255, 159, 10, 0.1);
    border: 1px solid rgba(255, 159, 10, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.api-help {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.api-help a { color: var(--primary); text-decoration: none; }

/* Questions List */
.questions-list {
    margin: 2rem 0;
}

.question-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary);
}

.question-card p {
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Results */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.result-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.result-card h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

.result-text { font-size: 1.1rem; }

.result-list {
    padding-left: 1.5rem;
}

.result-list li {
    margin-bottom: 0.5rem;
    color: #d1d1d6;
}

.code-wrapper {
    position: relative;
    background: #000;
    border-radius: 12px;
    margin-top: 0.5rem;
}

#result-final-prompt {
    padding: 1.5rem;
    font-family: 'SFMono-Regular', Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
    color: #e4e4e6;
}

.copy-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition);
}

.code-wrapper:hover .copy-button { opacity: 1; }

.tips-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(52, 199, 89, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(52, 199, 89, 0.1);
}

.tips-box h4 {
    color: var(--success);
    margin-bottom: 0.5rem;
}

.tips-box p { font-size: 0.95rem; color: #d1d1d6; }

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    gap: 1.5rem;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--text-dim);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer */
.app-footer {
    margin-top: auto;
    padding: 2rem 0;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 600px) {
    .app-container { padding: 1rem; }
    .glass { padding: 1.5rem; }
    h2 { font-size: 1.5rem; }
}
