/* ============================================
   Tour.ME — Mac OS Bright Style CSS
   ============================================ */

/* --- Reset & Variables --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Mac OS Colors — Bright, Clean, Professional */
    --bg-primary: #f5f5f7;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --bg-glass: rgba(255, 255, 255, 0.72);
    --bg-glass-strong: rgba(255, 255, 255, 0.88);
    --bg-overlay: rgba(0, 0, 0, 0.35);
    --bg-header: rgba(255, 255, 255, 0.82);
    
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --text-on-accent: #ffffff;
    
    --accent: #007aff;
    --accent-hover: #0066d6;
    --accent-light: #e8f2ff;
    --accent-gradient: linear-gradient(135deg, #007aff 0%, #5856d6 100%);
    --accent-gradient-hover: linear-gradient(135deg, #0066d6 0%, #4a48c4 100%);
    
    --success: #34c759;
    --warning: #ff9f0a;
    --danger: #ff3b30;
    --danger-bg: #fff2f1;
    
    --border: #d2d2d7;
    --border-light: #e8e8ed;
    --border-focus: #007aff;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.06);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 999px;
    
    --font-sans: 'Inter', 'Noto Sans TC', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* --- Scrollbar (Mac-style thin) --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ============================================
   HEADER
   ============================================ */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border-light);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-left, .header-right {
    flex: 1;
    display: flex;
    align-items: center;
}
.header-left { justify-content: flex-start; }
.header-right { justify-content: flex-end; }

.header-center { text-align: center; flex-shrink: 0; }

.app-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-top: 2px;
    font-weight: 400;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
    white-space: nowrap;
}
.header-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}
.header-btn svg { flex-shrink: 0; }

/* Language Switcher */
.lang-switcher { position: relative; }
.lang-btn { padding: 8px; border-radius: var(--radius-full); }

.lang-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 6px;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    width: 140px;
    z-index: 110;
    animation: fadeSlideDown 0.2s ease;
}
.lang-switcher:hover .lang-dropdown,
.lang-dropdown.show { display: block; }

.lang-option {
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
    font-family: var(--font-sans);
}
.lang-option:hover { background: var(--accent-light); }
.lang-option.active { background: var(--accent); color: var(--text-on-accent); }

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   HERO / SEO SECTION
   ============================================ */
.hero-section {
    background: linear-gradient(180deg, #e8f2ff 0%, var(--bg-primary) 100%);
    padding: 48px 24px 40px;
    text-align: center;
}
.hero-inner {
    max-width: 720px;
    margin: 0 auto;
}
.hero-badge {
    display: inline-block;
    padding: 6px 18px;
    background: var(--accent-gradient);
    color: var(--text-on-accent);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 18px;
    animation: pulse-badge 3s infinite ease-in-out;
}
@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 0 0 0px rgba(0,122,255,0.3); }
    50% { box-shadow: 0 0 0 8px rgba(0,122,255,0); }
}

.hero-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}
.hero-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 24px;
    line-height: 1.7;
}
.hero-features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}
.hero-feature-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.hero-feature-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.hero-feature-icon { font-size: 1.1rem; }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 32px;
}

/* --- Card (Step Container) --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    padding: 28px;
    margin-bottom: 24px;
    transition: box-shadow var(--transition-normal);
}
.card:hover { box-shadow: var(--shadow-lg); }

.step-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 18px;
}

.section-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 12px;
}

/* ============================================
   STEP 1 — UPLOAD
   ============================================ */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

/* Characters Grid */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

/* Character Slot */
.char-slot {
    position: relative;
}
.char-upload-box {
    aspect-ratio: 1;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
    position: relative;
}
.char-upload-box:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.char-upload-box.has-image {
    border-style: solid;
    border-color: var(--border-light);
}
.char-upload-box .upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-tertiary);
    font-size: 0.72rem;
    text-align: center;
    padding: 8px;
}
.char-upload-box .upload-placeholder svg {
    opacity: 0.5;
}
.char-upload-box .upload-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.char-remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--danger);
    color: white;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: transform var(--transition-fast);
}
.char-slot:hover .char-remove-btn { display: flex; }
.char-remove-btn:hover { transform: scale(1.15); }

.char-name-input {
    width: 100%;
    margin-top: 6px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    text-align: center;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast);
}
.char-name-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.12);
}

.btn-add-char {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.82rem;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
    font-weight: 500;
}
.btn-add-char:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* Background Upload */
.bg-upload-row {
    display: flex;
    gap: 16px;
    align-items: stretch;
}
.bg-upload-box {
    width: 140px;
    min-height: 140px;
    flex-shrink: 0;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
    position: relative;
}
.bg-upload-box:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.bg-upload-box.has-image {
    border-style: solid;
    border-color: var(--border-light);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-tertiary);
    font-size: 0.78rem;
}
.upload-placeholder svg { opacity: 0.4; }
.upload-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.bg-textarea {
    flex: 1;
    min-height: 140px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    resize: vertical;
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast);
    line-height: 1.6;
}
.bg-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.12);
}
.bg-textarea::placeholder { color: var(--text-tertiary); }

/* ============================================
   STEP 2 — THEME SELECTION
   ============================================ */
.step2-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.step2-header .step-title { margin-bottom: 0; }

.btn-generate-themes {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    background: var(--accent-gradient);
    color: var(--text-on-accent);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
    box-shadow: var(--shadow-sm);
}
.btn-generate-themes:hover {
    background: var(--accent-gradient-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.btn-generate-themes:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.theme-card {
    padding: 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-card);
}
.theme-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.theme-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(0,122,255,0.15);
}
.theme-card h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.theme-card p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.themes-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

/* ============================================
   STEP 3 — GENERATE
   ============================================ */
.generate-section { text-align: center; }
.generate-section .step-title { text-align: center; }

.photo-count-slider {
    max-width: 400px;
    margin: 0 auto 24px;
}
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.slider-header .step-title { margin-bottom: 0; font-size: 1rem; }
.slider-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
}

.range-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    transition: background var(--transition-fast);
}
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
}
.range-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.range-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow-md);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.btn { 
    font-family: var(--font-sans);
    cursor: pointer; 
    border: none;
    transition: all var(--transition-fast);
}

.btn-generate {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--accent-gradient);
    color: var(--text-on-accent);
    border-radius: var(--radius-full);
    box-shadow: 0 4px 20px rgba(0,122,255,0.35);
    transition: all var(--transition-normal);
}
.btn-generate:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0,122,255,0.45);
}
.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-generate.generating {
    animation: pulse-generate 1.5s infinite ease-in-out;
}
@keyframes pulse-generate {
    0%, 100% { box-shadow: 0 4px 20px rgba(0,122,255,0.35); }
    50% { box-shadow: 0 4px 30px rgba(0,122,255,0.55); }
}

.btn-zip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 0.88rem;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    margin-top: 16px;
    box-shadow: var(--shadow-sm);
}
.btn-zip:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}
.btn-zip:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================
   RESULTS
   ============================================ */
.results-section {
    margin-top: 32px;
    padding: 0 24px 32px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}
.results-title {
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.result-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.5s ease both;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-image-container {
    aspect-ratio: 2/3;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.result-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.result-image-container .spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-tertiary);
}
.result-image-container .error-retry {
    text-align: center;
    padding: 20px;
}
.result-image-container .error-retry p {
    color: var(--danger);
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.result-body {
    padding: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.result-copy {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    line-height: 1.7;
    margin-bottom: 12px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
}
.result-btn-row {
    display: flex;
    gap: 8px;
}
.result-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}
.result-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}
.result-btn.copied {
    background: #e6f9ed;
    color: var(--success);
    border-color: var(--success);
}

.btn-regen-copy {
    background: none;
    border: none;
    font-size: 0.75rem;
    color: var(--accent);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    font-family: var(--font-sans);
    transition: opacity var(--transition-fast);
}
.btn-regen-copy:hover { opacity: 0.7; }

.results-actions {
    text-align: center;
    margin-top: 32px;
}
.btn-start-over {
    padding: 12px 40px;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}
.btn-start-over:hover {
    background: var(--bg-primary);
    border-color: var(--text-tertiary);
}

/* ============================================
   ERROR BANNER
   ============================================ */
.error-banner {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 90vw;
    animation: fadeSlideDown 0.3s ease;
}
.error-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--danger);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

/* ============================================
   HISTORY PANEL
   ============================================ */
.history-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 300;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.history-panel {
    position: absolute;
    inset: 0 auto 0 0;
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    animation: slideInLeft 0.3s ease;
}
@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.history-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.history-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}
.btn-close-history {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color var(--transition-fast);
}
.btn-close-history:hover { color: var(--text-primary); }

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
.history-empty {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px 20px;
    font-size: 0.9rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}
.history-item:hover { background: var(--bg-primary); }
.history-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.history-item-info {
    flex: 1;
    overflow: hidden;
}
.history-item-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-item-date {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}
.history-item-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.history-btn {
    padding: 4px 12px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
}
.history-btn-load {
    background: var(--accent);
    color: var(--text-on-accent);
}
.history-btn-load:hover { background: var(--accent-hover); }
.history-btn-delete {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}
.history-btn-delete:hover { background: var(--danger); color: white; }

/* ============================================
   SPINNER
   ============================================ */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    padding: 40px 24px;
    margin-top: 32px;
}
.footer-inner {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}
.footer-seo-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.footer-seo-desc {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 18px;
}
.footer-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}
.footer-tag {
    padding: 4px 12px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
}
.footer-copyright {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* ============================================
   MOBILE TOOLBAR
   ============================================ */
.mobile-toolbar {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 50;
    gap: 10px;
}
.mobile-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-glass-strong);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}
.mobile-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.mobile-lang-switcher { position: relative; }
.mobile-lang-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    width: 140px;
    animation: fadeSlideDown 0.2s ease;
}

/* ============================================
   RESPONSIVE (RWD)
   ============================================ */
@media (max-width: 1024px) {
    .header-left .btn-label { display: none; }
}

@media (max-width: 768px) {
    .header-inner { padding: 10px 16px; }
    .app-title { font-size: 1.4rem; }
    .app-subtitle { display: none; }
    .header-left { display: none; }
    .header-right .lang-switcher { display: none; }
    
    .hero-section { padding: 32px 16px 28px; }
    .hero-title { font-size: 1.5rem; }
    .hero-desc { font-size: 0.85rem; }
    .hero-features { gap: 8px; }
    .hero-feature-item { font-size: 0.76rem; padding: 6px 12px; }
    
    .main-content { padding: 16px 16px 100px; }
    .card { padding: 20px 16px; border-radius: var(--radius-lg); }
    
    .upload-grid { grid-template-columns: 1fr; gap: 24px; }
    .characters-grid { grid-template-columns: repeat(3, 1fr); }
    
    .bg-upload-row { flex-direction: column; }
    .bg-upload-box { width: 100%; min-height: 160px; }
    .bg-textarea { min-height: 100px; }
    
    .step2-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .themes-grid { grid-template-columns: repeat(2, 1fr); }
    
    .btn-generate { padding: 14px 32px; font-size: 1rem; width: 100%; justify-content: center; }
    
    .results-section { padding: 0 16px 80px; }
    .results-grid { grid-template-columns: 1fr; }
    .results-title { font-size: 1.3rem; }
    
    .mobile-toolbar { display: flex; }
    
    .footer-seo-desc { font-size: 0.78rem; }
}

@media (max-width: 480px) {
    .app-title { font-size: 1.2rem; }
    .hero-title { font-size: 1.3rem; }
    .hero-features { flex-direction: column; align-items: center; }
    .characters-grid { grid-template-columns: repeat(2, 1fr); }
    .themes-grid { grid-template-columns: 1fr 1fr; }
    .card { padding: 16px 14px; }
    .step-title { font-size: 1.05rem; }
}
