:root {
    --bg-color: #fcfbf9;
    --text-color: #2c2c2c;
    --primary-color: #7b61ff;
    --primary-hover: #6347e8;
    --tag-bg: #f0edf7;
    --tag-selected: #7b61ff;
    --border-color: #e5e5e5;
    --card-bg: #ffffff;
}

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

body {
    font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    position: relative;
}

/* Screens */
.screen {
    display: none;
    animation: fadeIn 0.4s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 20px;
}

header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

header p {
    color: #666;
    font-size: 15px;
}

/* Categories & Tags */
.category-group {
    margin-bottom: 25px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.category-group h3 {
    font-size: 16px;
    color: #444;
}

.refresh-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.3s ease;
}

.refresh-btn:hover {
    transform: rotate(180deg);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-btn {
    background: var(--tag-bg);
    color: #555;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.tag-btn:hover {
    background: #e3deef;
}

.tag-btn.selected {
    background: var(--tag-selected);
    color: white;
    box-shadow: 0 2px 8px rgba(123, 97, 255, 0.3);
}

/* Custom Input */
#custom-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

#custom-input:focus {
    border-color: var(--primary-color);
}

/* Buttons */
.primary-btn, .secondary-btn, .text-btn {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    margin-top: 10px;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(123, 97, 255, 0.2);
}

.primary-btn:hover {
    background: var(--primary-hover);
}

.primary-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.secondary-btn {
    background: linear-gradient(135deg, #111, #333);
    color: white;
}

.text-btn {
    background: transparent;
    color: #666;
    margin-top: 5px;
}

/* Loading Indicator */
.hidden {
    display: none !important;
}

#loading-indicator {
    text-align: center;
    padding: 40px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ad Screen & Loading Screens */
#loading-prompt-screen, #loading-premium-screen, #prompt-result-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

#prompt-result-screen {
    display: none;
}
#prompt-result-screen.active {
    display: flex;
}
#loading-prompt-screen {
    display: none;
}
#loading-prompt-screen.active {
    display: flex;
}
#loading-premium-screen {
    display: none;
}
#loading-premium-screen.active {
    display: flex;
}

.ad-content, #result-box {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
}

#result-box {
    border: 2px solid var(--primary-color);
}

#generated-prompt {
    font-size: 22px;
    font-weight: 600;
    margin: 30px 0;
    color: var(--primary-color);
    word-break: keep-all;
    line-height: 1.5;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.adsense-banner {
    margin: 25px 0;
    background: #f9f9f9;
    border: 1px dashed #ccc;
    padding: 20px;
    border-radius: 8px;
    font-size: 12px;
    color: #888;
}

.ad-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #eee;
    border-radius: 4px;
    margin: 20px 0;
    overflow: hidden;
}

#ad-progress {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.1s linear;
}

.small-text {
    font-size: 12px;
    color: #999;
}

/* Premium PDF Screen */
#pdf-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.pdf-page {
    margin-bottom: 50px;
    page-break-after: always;
}

.pdf-page:last-child {
    margin-bottom: 0;
    page-break-after: auto;
}

.pdf-page h1 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 20px;
    color: #111;
}

.pdf-prompt {
    font-size: 16px;
    text-align: center;
    margin-bottom: 30px;
    font-style: italic;
    color: #444;
}

.image-wrapper {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

.guide-section {
    margin-bottom: 30px;
}

.guide-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    padding-bottom: 5px;
}

.guide-section p {
    font-size: 15px;
    color: #444;
}

.palette-grid {
    display: flex;
    gap: 15px;
}

.palette-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.color-name {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.color-hex {
    font-size: 11px;
    color: #666;
    font-family: monospace;
}

/* PDF Mode Classes (Lessons Learned) */
.pdf-mode {
    padding: 0 !important;
    background: white !important;
    max-width: 800px !important;
}

.pdf-mode #pdf-container {
    box-shadow: none !important;
    padding: 20px !important;
    border-radius: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

.pdf-mode .image-wrapper {
    border-radius: 0 !important;
    box-shadow: none !important;
}

.pdf-mode * {
    overflow: visible !important;
}

.action-buttons {
    margin-top: 30px;
}
