:root {
    --bg-dark: #090a0f;
    --bg-panel: #131520;
    --bg-hover: #1e2235;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --accent-color: #ec4899;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --font-sans: 'Inter', sans-serif;
    --font-logo: 'Outfit', sans-serif;
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
}

/* アプリコンテナ */
.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
}

/* ヘッダー */
.app-header {
    height: 70px;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 24px;
    animation: float 3s ease-in-out infinite;
}

.logo-text h1 {
    font-family: var(--font-logo);
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #a5b4fc, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
}

/* メインボディ */
.app-body {
    display: flex;
    flex: 1;
    height: calc(100vh - 70px);
    overflow: hidden;
}

/* プレビューエリア */
.preview-section {
    flex: 1;
    background-color: #0b0c13;
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0),
        radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 0);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    overflow: auto;
    position: relative;
}

.preview-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

#mockup-canvas {
    max-width: 100%;
    max-height: 70vh;
    box-shadow: var(--shadow-premium);
    border-radius: var(--radius-md);
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* アップロードプロンプト */
.upload-placeholder {
    width: 480px;
    padding: 48px 24px;
    background: rgba(19, 21, 32, 0.6);
    border: 2px dashed rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-premium);
}

.upload-placeholder:hover {
    border-color: var(--primary-color);
    background: rgba(19, 21, 32, 0.8);
    transform: translateY(-2px);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.upload-placeholder:hover .upload-icon {
    color: var(--primary-color);
}

.upload-placeholder h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-placeholder p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.file-note {
    font-size: 11px;
    color: #e2e8f0;
    opacity: 0.5;
    display: block;
}

/* コントロールパネル */
.control-panel {
    width: 360px;
    background-color: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.panel-section h2 {
    font-family: var(--font-logo);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* トグルボタン */
.toggle-buttons {
    display: flex;
    background-color: var(--bg-dark);
    padding: 4px;
    border-radius: var(--radius-md);
    gap: 2px;
    border: 1px solid var(--border-color);
}

.toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.toggle-btn:hover {
    color: var(--text-primary);
}

.toggle-btn.active {
    background-color: var(--bg-panel);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 背景プリセット */
.bg-presets {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.bg-preset {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.bg-preset:hover {
    transform: scale(1.1);
}

.bg-preset.active {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

/* スライダー */
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.slider-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-color);
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    outline: none;
    border: 1px solid var(--border-color);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: transform 0.1s, background-color 0.1s;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--accent-color);
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #4f46e5);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.icon {
    width: 16px;
    height: 16px;
}

/* トースト */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(19, 21, 32, 0.95);
    border: 1px solid var(--primary-color);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(8px);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* アニメーション */
@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

/* スクロールバーカスタム */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 戻るボタン */
.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* 寄付サイドバーカード */
.donation-sidebar-card {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 12px;
}

.donation-sidebar-card h2 {
    color: var(--accent-color) !important;
    font-size: 13px !important;
    border-bottom: none !important;
    margin-bottom: 8px !important;
    padding-bottom: 0 !important;
}

.sidebar-support-content p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

/* AdSenseプレースホルダー広告枠 */
.adsense-placeholder-sidebar {
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    text-align: center;
}

.adsense-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.ads-box {
    height: 120px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ads-box p {
    font-size: 12px;
    color: var(--text-muted);
}

/* モーダルオーバーレイ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

/* モーダルカード */
.modal-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 480px;
    max-width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), var(--shadow-glow);
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.show .modal-card {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-family: var(--font-logo);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.btn-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-promo-text {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-features {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feat-item {
    font-size: 12.5px;
    color: var(--text-primary);
}

.modal-support-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-key-section {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-key-section label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.key-input-row {
    display: flex;
    gap: 8px;
}

.key-input-row input {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
}

.key-input-row input:focus {
    border-color: var(--primary-color);
}

.key-help {
    font-size: 11px;
    color: var(--text-muted);
}

