:root {
    --bg-dark: #090d16;
    --bg-darker: #05070c;
    --bg-card: rgba(15, 23, 42, 0.45);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.4);
    --primary-hover: #a78bfa;
    --secondary: #ec4899;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-blur: blur(16px);
}

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

body {
    font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* 背景グロー装飾 */
.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, rgba(236, 72, 153, 0.04) 50%, transparent 100%);
    top: -100px;
    left: -100px;
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

/* 全体コンテナ */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* ヘッダー */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 32px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.back-link:hover {
    color: var(--text-main);
}

.divider {
    color: var(--border-color);
}

.logo-icon {
    font-size: 2rem;
}

.title-group h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.title-group p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ボタン共通 */
.btn {
    font-family: inherit;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    backdrop-filter: var(--glass-blur);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-block {
    width: 100%;
}

/* メインレイアウト */
.app-main {
    display: grid;
    grid-template-columns: 1fr 280px 1fr;
    gap: 24px;
    flex: 1;
}

/* エディタペイン */
.editor-pane {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: var(--glass-blur);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(100vh - 240px);
    min-height: 480px;
}

.panel-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
}

.panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.panel-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

.editor-container {
    flex: 1;
    position: relative;
}

.editor-container textarea {
    width: 100%;
    height: 100%;
    background: #070a13;
    border: none;
    color: #e2e8f0;
    font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 16px;
    resize: none;
    outline: none;
}

/* エラーバナー */
.error-banner {
    background: rgba(239, 68, 68, 0.1);
    border-top: 1px solid rgba(239, 68, 68, 0.25);
    padding: 12px 16px;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.error-title {
    color: #ef4444;
    font-weight: 600;
}

.error-desc {
    color: #fca5a5;
}

/* オプションカード */
.options-pane {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.options-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: var(--glass-blur);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.options-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
}

.select-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.select-field label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.select-field select {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    width: 100%;
    cursor: pointer;
}

/* Mockオプション */
.mock-options {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.slider-field {
    margin-top: 6px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
    accent-color: var(--primary);
}

.badge-pro {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

/* フッター */
.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-fund-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-fund-info a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.footer-fund-info a:hover {
    text-decoration: underline;
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 7, 12, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 520px;
    max-width: 90%;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal.active .modal-content {
    transform: scale(1);
}

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

.modal-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

.modal-fund-box {
    background: rgba(251, 191, 36, 0.05);
    border: 1px solid rgba(251, 191, 36, 0.15);
    border-radius: 10px;
    padding: 16px;
    margin: 16px 0 24px 0;
}

.modal-fund-box h4 {
    color: #fbbf24;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

.modal-fund-box p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.modal-action-links {
    display: flex;
    justify-content: center;
}

.unlock-form label {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 10px;
}

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

.input-group input {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
}

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

.error-msg {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 8px;
    font-weight: 500;
}

/* トースト */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--primary);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.2);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 2000;
    font-size: 0.85rem;
    font-weight: 500;
    transition: opacity 0.3s, transform 0.3s;
}

.hidden {
    display: none !important;
}

/* レスポンシブ */
@media (max-width: 1000px) {
    .app-main {
        grid-template-columns: 1fr;
    }
    .options-pane {
        order: -1;
    }
    .editor-pane {
        height: 380px;
        min-height: auto;
    }
}
