/* assets/style.css */

/* --- CSS Variables & Base --- */
:root {
    /* ライトモード（デフォルト） */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-input: #ffffff;
    --border-color: #e2e8f0;
    --border-input: #cbd5e1;
    
    --text-heading: #1e293b;
    --text-main: #334155;
    --text-sub: #64748b;
    --text-muted: #94a3b8;
    
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --accent-bg: #eff6ff; /* 薄い青背景 */
    --accent-border: #bfdbfe;
    
    --danger-bg: #fee2e2;
    --danger-text: #ef4444;
    --danger-border: #fecaca;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    
    --kagi-url: url('../images/kagi-icon.svg'); /* パスは環境に合わせて調整 */
}

/* ダークモード定義 */
body.dark-mode {
    --bg-body: #0f172a;       /* 暗いネイビー */
    --bg-card: #1e293b;       /* カード背景 */
    --bg-sidebar: #1e293b;
    --bg-input: #334155;
    --border-color: #334155;
    --border-input: #475569;
    
    --text-heading: #f1f5f9;  /* 白に近いグレー */
    --text-main: #cbd5e1;
    --text-sub: #94a3b8;
    --text-muted: #64748b;
    
    --primary-color: #3b82f6; /* 明るめの青 */
    --primary-hover: #60a5fa;
    --accent-bg: #1e293b;     /* ダークモードではカード色と同じか少し変える */
    --accent-border: #334155;
    
    --danger-bg: #450a0a;
    --danger-text: #fca5a5;
    --danger-border: #7f1d1d;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
body { 
    margin: 0; padding: 0; 
    background-color: var(--bg-body); 
    color: var(--text-main);
    font-family: 'Inter', 'Noto Sans JP', sans-serif; 
    -webkit-font-smoothing: antialiased; 
    transition: background-color 0.3s, color 0.3s;
}

/* === Login Page Styles === */
.login-page-body { background-color: var(--bg-card); display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.login-page-wrapper { width: 100%; max-width: 600px; margin: 0 auto; padding: 20px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.login-main-content { display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; margin-bottom: auto; padding-top: 100px; }
.main-logo-img { height: 80px; width: auto; margin-bottom: 32px; }
/* ダークモードでロゴを白く反転 */
body.dark-mode .main-logo-img, 
body.dark-mode .header-logo { filter: brightness(0) invert(1); }

.welcome-text { font-size: 32px; font-weight: 500; color: var(--text-heading); margin-bottom: 12px; letter-spacing: -0.5px; }
.sub-text { font-size: 16px; color: var(--text-sub); margin-bottom: 48px; }
.auth-buttons-area { width: 100%; max-width: 400px; }
.btn-google { display: flex; align-items: center; justify-content: center; width: 100%; background: #fff; color: #374151; border: 1px solid #d1d5db; border-radius: 6px; padding: 12px; font-size: 15px; font-weight: 500; text-decoration: none; transition: all 0.2s; box-shadow: var(--shadow-sm); }
.btn-google:hover { background-color: #f9fafb; border-color: #9ca3af; box-shadow: var(--shadow-md); }
.btn-google svg { margin-right: 12px; width: 20px; height: 20px; }
.login-footer { margin-top: auto; padding: 20px 0; text-align: center; width: 100%; display: flex; justify-content: center; }
.terms-text { font-size: 11px; color: var(--text-muted); line-height: 1.5; max-width: 480px; margin: 0; }
.terms-text a { color: var(--text-sub); text-decoration: none; margin: 0 4px; }
.terms-text a:hover { text-decoration: underline; color: var(--text-main); }
.dynamic-msg { width: 100%; max-width: 400px; padding: 12px; border-radius: 6px; font-size: 13px; text-align: left; margin-bottom: 20px; }
.dynamic-msg.error { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }

/* === Dashboard Styles === */
.dashboard-wrapper { display: flex; flex-direction: column; height: 100dvh; width: 100vw; overflow: hidden; }
.app-header { height: 64px; background: var(--bg-card); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; padding: 0; z-index: 20; }
.header-left { width: 240px; text-align: center; display: flex; align-items: center; justify-content: center; } 
.header-logo { height: 36px; width: auto; }
.header-right { padding-right: 24px; display: flex; align-items: center; gap: 20px; }
.header-logo-link { display: inline-block; transition: opacity 0.2s; }
.header-logo-link:hover { opacity: 0.7; }

/* Bonus Badge */
.bonus-badge { background-color: var(--bg-card); color: var(--primary-color); padding: 6px 12px; border-radius: 16px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border-color); cursor: pointer; margin-right: 12px; transition: all 0.2s; white-space: nowrap; }
.bonus-badge:hover { background-color: var(--accent-bg); border-color: var(--text-sub); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.bonus-badge.disabled { background-color: var(--bg-body); color: var(--text-muted); border-color: var(--border-color); cursor: default; transform: none; box-shadow: none; }

/* Credit Display */
.header-credit-wrapper { display: flex; align-items: center; gap: 10px; }
.credit-label { font-size: 12px; font-weight: 600; color: var(--text-sub); }
.header-credit-container { background: var(--bg-body); padding: 6px 12px; border-radius: 8px; display: flex; flex-direction: column; gap: 4px; width: 140px; border: 1px solid var(--border-color); }
.header-credit-info { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text-main); line-height: 1; }
.header-credit-total { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.header-credit-bar-bg { width: 100%; height: 4px; background: var(--border-color); border-radius: 2px; overflow: hidden; }
.header-credit-bar-fill { height: 100%; background: linear-gradient(135deg, #00E0FF 0%, #0078FF 100%); transition: width 0.3s ease; border-radius: 3px; }

/* Sidebar */
.app-body { display: flex; flex: 1; overflow: hidden; }
.app-sidebar { width: 240px; background: var(--bg-sidebar); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; }
.sidebar-content { padding: 20px 0; flex: 1; display: flex; flex-direction: column; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn-wrapper { padding: 0 20px 10px 20px; }
.nav-cta { width: 100%; padding: 12px; background: #3b82f6; color: #fff !important; border: none; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; text-align: center; transition: background 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: var(--shadow-sm); text-decoration: none; }
.nav-cta:hover { background: #2563eb; color: #fff; }
.nav-cta:active { transform: translateY(0); box-shadow: none; }
.nav-cta img { filter: brightness(0) invert(1); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 24px; text-decoration: none; color: var(--text-sub); font-size: 14px; font-weight: 500; transition: all 0.2s; border-left: 3px solid transparent; }
/* ダークモード用のアイコン調整 */
body.dark-mode .nav-item img { filter: brightness(0) invert(0.7); }
body.dark-mode .nav-item.active img { filter: invert(48%) sepia(79%) saturate(2476%) hue-rotate(190deg) brightness(118%) contrast(119%); }

.nav-item:hover { color: var(--text-heading); background-color: var(--accent-bg); }
.nav-item.active { background: transparent; color: var(--primary-color); font-weight: 700; }
.sidebar-bottom { margin-top: auto; padding: 20px 0; border-top: none; }
.legal-links { margin-top: 10px; padding: 0 24px; font-size: 11px; display: flex; flex-direction: column; gap: 6px; }
.legal-links a { color: var(--text-muted); text-decoration: none; }
.legal-links a:hover { color: var(--text-sub); text-decoration: underline; }

/* === Main Content === */
.app-content { flex: 1; overflow-y: auto; background-color: var(--bg-body); padding: 32px; }
.content-inner { max-width: 1100px; margin: 0 auto; }
.create-layout { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.create-main-col { min-width: 0; }
.create-side-col { display: flex; flex-direction: column; gap: 24px; }

/* Tips Box */
.tips-box { background: var(--accent-bg); border: 1px solid var(--accent-border); border-radius: 8px; padding: 20px; }
.sidebar-title { font-size: 14px; font-weight: 700; color: var(--primary-color); margin: 0 0 15px 0; display: flex; align-items: center; gap: 6px; }
.tips-content { color: var(--text-main); font-size: 13px; line-height: 1.6; }
.tips-content h1, .tips-content h2, .tips-content h3, .tips-content h4 { font-size: 14px; font-weight: 700; color: var(--primary-color); margin: 12px 0 6px 0; }
.tips-content p { margin: 0 0 10px 0; }
.tips-content ul { margin: 0 0 10px 20px; padding: 0; }

/* Templates */
.user-template-tag { background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-color); border-radius: 4px; padding: 4px 8px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.user-template-tag:hover { border-color: var(--primary-color); color: var(--primary-color); background: var(--accent-bg); }
.template-delete-btn { font-size: 14px; color: var(--text-muted); line-height: 1; display: flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; }
.template-delete-btn:hover { color: var(--danger-text); background: var(--danger-bg); }
.btn-add-template-trigger { background: none; border: none; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--primary-color); margin-left: 8px; }
.btn-add-template-trigger:hover { text-decoration: underline; }
.template-input-row { display: none; align-items: center; gap: 8px; width: 100%; margin-bottom: 12px; animation: slideDown 0.2s ease-out; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.input-stylish { flex: 1; border: 1px solid var(--border-input); border-radius: 20px; padding: 6px 12px; font-size: 12px; outline: none; transition: all 0.2s; background: var(--bg-input); color: var(--text-heading); box-shadow: var(--shadow-sm); }
.input-stylish:focus { border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1); }
.btn-circle-save { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-color); color: #fff; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3); }
.btn-circle-save:hover { background: var(--primary-hover); transform: scale(1.05); }

/* ▼▼▼ ロックアイコン（オーバーレイ） ▼▼▼ */
.rhs-locked-container { position: relative; min-height: 80px; }
.rhs-lock-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(2px);
    z-index: 10; display: flex; align-items: center; justify-content: center;
    border-radius: inherit; cursor: help;
}
/* ダークモード時のオーバーレイ調整 */
body.dark-mode .rhs-lock-overlay { background: rgba(15, 23, 42, 0.6); }

.rhs-lock-icon {
    width: 40px; height: 40px;
    background-image: var(--kagi-url); background-repeat: no-repeat;
    background-position: center; background-size: contain;
    opacity: 0.8; transition: transform 0.2s;
}
.rhs-lock-overlay:hover .rhs-lock-icon { transform: scale(1.1); opacity: 1; }

/* ツールチップ (共通) */
[data-tooltip]:hover::after {
    content: attr(data-tooltip); position: absolute;
    bottom: 100%; left: 50%; transform: translate(-50%, -8px);
    background-color: var(--text-heading); color: var(--bg-card); padding: 6px 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
    white-space: nowrap; z-index: 100; pointer-events: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15); opacity: 0; animation: tooltipFade 0.2s forwards;
}
.rhs-lock-overlay[data-tooltip]:hover::after {
    bottom: auto; top: 50%; transform: translate(-50%, 25px); /* ロックアイコンは下に出す */
}
@keyframes tooltipFade { to { opacity: 1; } }

#rhs-timeline-container { display: flex; flex-direction: column; gap: 20px; margin-top: 32px; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-content { padding: 10px 0; }
.plan-info-row { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.plan-name { font-size: 20px; font-weight: 700; color: var(--text-heading); margin: 0; }
.credit-status { margin-bottom: 16px; }
.credit-labels { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-sub); margin-bottom: 8px; }
.credit-val { font-weight: 700; color: var(--primary-color); }
.progress-bg { width: 100%; height: 10px; background: var(--bg-body); border-radius: 5px; overflow: hidden; border: 1px solid var(--border-color); }
.progress-fill { height: 100%; background: linear-gradient(135deg, #00E0FF 0%, #0078FF 100%); border-radius: 5px; }
.setting-row { margin-bottom: 16px; }
.setting-row label { display: block; font-size: 13px; font-weight: 600; color: var(--text-main); margin-bottom: 6px; }

/* Input Forms */
.panel-section { margin-bottom: 32px; }
.input-card { background: var(--bg-card); border-radius: 12px; padding: 24px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); } 
.card-header { margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
.card-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--text-heading); }
.suggestions-area { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.suggestion-tag { background: var(--accent-bg); color: var(--primary-color); border: 1px solid var(--accent-border); border-radius: 0; padding: 4px 12px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.suggestion-tag:hover { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.input-row-stack { margin-bottom: 16px; }
.topic-input { width: 100%; padding: 14px 16px; border: 1px solid var(--border-input); border-radius: 0; font-size: 16px; background: var(--bg-input); color: var(--text-heading); transition: .2s; }
.topic-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.topic-input.is-invalid, .length-input.is-invalid { border-color: var(--danger-text); background-color: var(--danger-bg); }
.input-error-msg { color: var(--danger-text); font-size: 12px; font-weight: 600; margin-top: 6px; display: none; }
.conditions-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.condition-item { width: 100%; }
.number-input-wrap { position: relative; display: inline-block; width: 100%; }
.length-input { width: 100%; padding: 14px 50px 14px 16px; border: 1px solid var(--border-input); border-radius: 0; font-size: 16px; background: var(--bg-input); color: var(--text-heading); transition: .2s; text-align: left; }
.length-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.unit { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--text-sub); pointer-events: none; background: transparent; }
.custom-select { width: 100%; padding: 14px 16px; border: 1px solid var(--border-input); border-radius: 0; font-size: 16px; background: var(--bg-input); color: var(--text-heading); transition: .2s; cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%208l5%205%205-5%22%20stroke%3D%22%236b7280%22%20stroke-width%3D%222%22%20fill%3D%22none%22%2F%3E%3C%2Fsvg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.custom-select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.btn-row-wrapper { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 24px; position: relative; }
.spacer { display: none; }
.generate-wrapper { grid-column: 2; text-align: center; }
.credit-cost-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
#rhs-generate-btn { padding: 12px 60px; width: 100%; background: #3b82f6; color: #fff; border: none; border-radius: 10px; font-size: 16px; font-weight: 700; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: center; }
#rhs-generate-btn:hover { transform: translateY(-1px); background: #2563eb; box-shadow: var(--shadow-md); color: #fff !important; }
#rhs-generate-btn:active { transform: translateY(0); box-shadow: none; }
#rhs-generate-btn:disabled { background: var(--text-muted); cursor: wait; transform: none; box-shadow: none; }
.reset-wrapper { justify-self: end; }
.reset-btn { background: none; border: none; cursor: pointer; padding: 8px; opacity: 0.5; transition: opacity 0.2s; display: flex; position: relative; }
.reset-btn:hover { opacity: 1; }
/* ダークモードでリセットボタンを白く */
body.dark-mode .reset-btn img { filter: brightness(0) invert(1); }
.reset-btn img { width: 20px; height: 20px; }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); padding: 10px 20px; border-radius: 6px; font-size: 14px; font-weight: 700; cursor: pointer; transition: .2s; }
.btn-danger:hover { background: var(--danger-text); color: #fff; border-color: var(--danger-text); }

/* Output & Result */
#rhs-output-placeholder { background: var(--bg-card); border-radius: 0; border: 2px dashed var(--border-color); height: 300px; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--text-muted); }
.placeholder-content { display: flex; flex-direction: column; align-items: center; }
#rhs-output-placeholder p { font-size: 14px; line-height: 1.6; }
.output-card { background: var(--bg-card); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: visible; border: 1px solid var(--border-color); } 
.output-header { background: var(--accent-bg); padding: 12px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.result-badge { font-size: 11px; font-weight: 700; color: var(--primary-color); text-transform: uppercase; letter-spacing: 0.05em; background: rgba(59, 130, 246, 0.1); padding: 4px 8px; border-radius: 0; }
.action-buttons { display: flex; gap: 8px; }
.action-icon-btn { background: transparent; border: none; cursor: pointer; display: flex; align-items: center; padding: 8px; position: relative; opacity: 0.6; transition: opacity 0.2s; }
.action-icon-btn:hover { opacity: 1; }
body.dark-mode .action-icon-btn img { filter: brightness(0) invert(0.8); }
.action-icon-btn img { width: 18px; height: 18px; margin: 0; }
.editor-container { padding: 40px; min-height: 400px; }
#rhs-output-title, #rhs-detail-title { margin: 0 0 24px 0; font-size: 24px; font-weight: 700; color: var(--text-heading); border-bottom: 2px solid var(--border-color); padding-bottom: 16px; line-height: 1.4; }
.editor-view { font-size: 16px; line-height: 1.8; color: var(--text-main); white-space: pre-wrap; }

/* === Modal Styles === */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(4px);
}
.modal-content {
    background: var(--bg-card); width: 90%; max-width: 500px; border-radius: 12px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden; display: flex; flex-direction: column; animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); position: relative;
    border: 1px solid var(--border-color);
}
@keyframes modalPop { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.modal-ad-area { padding: 20px; min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg-body); }
.ad-label-top { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 15px; text-transform: uppercase; }
#rhs-ad-slot { width: 100%; display: flex; justify-content: center; }
#rhs-ad-slot img { max-width: 100%; height: auto; border-radius: 4px; box-shadow: var(--shadow-sm); }
.modal-progress-area { padding: 15px 20px; background: var(--bg-card); border-top: 1px solid var(--border-color); }
.progress-bar-box { width: 100%; height: 6px; background: var(--border-color); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.bar-fill { height: 100%; width: 0%; background: #2563eb; transition: width 0.3s linear; }
.progress-info { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-sub); font-weight: 600; }
.progress-time { color: var(--text-muted); font-weight: 500; }
.close-btn-floating { position: absolute; top: 10px; right: 10px; background: rgba(255,255,255,0.8); border: none; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #64748b; transition: .2s; z-index: 5; }
.close-btn-floating:hover { background: #fff; color: #ef4444; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

/* === Saved Report List === */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; }
.report-item-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 0; box-shadow: var(--shadow-sm); transition: all 0.2s ease; cursor: pointer; display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.report-item-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary-color); }
.report-card-body { padding: 20px; flex: 1; }
.report-item-date { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }
.report-item-title { font-size: 16px; font-weight: 700; color: var(--text-heading); margin: 0 0 10px 0; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.report-item-excerpt { font-size: 13px; color: var(--text-sub); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.report-item-actions { background: var(--accent-bg); border-top: 1px solid var(--border-color); padding: 10px 20px; text-align: right; display: flex; justify-content: flex-end; gap: 10px; }
.btn-icon-trash, .btn-icon-restore { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 6px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; color: var(--text-sub); }
.btn-icon-trash:hover { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.btn-icon-restore:hover { background: var(--accent-bg); border-color: var(--accent-border); color: var(--primary-color); }
.btn-back { background: transparent; border: none; color: var(--text-sub); font-weight: 600; cursor: pointer; font-size: 14px; margin-bottom: 10px; }
.btn-back:hover { text-decoration: underline; color: var(--primary-color); }

/* =========================================
   Mobile Responsiveness
   ========================================= */
.mobile-menu-btn {
    display: none; 
    background: none; border: none; cursor: pointer; padding: 10px; margin-right: 8px; color: var(--text-main);
}

/* --- Mobile / Tablet (<768px) --- */
@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
    .app-sidebar { position: fixed; top: 64px; left: -250px; width: 250px; height: calc(100% - 64px); z-index: 100; transition: left 0.3s ease; box-shadow: 4px 0 10px rgba(0,0,0,0.1); }
    .app-sidebar.open { left: 0; }
    .app-sidebar-overlay { display: none; position: fixed; top: 64px; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 90; }
    .app-sidebar-overlay.active { display: block; }
    .header-left { width: auto; padding-left: 16px; display: flex; align-items: center; }
    .header-logo { height: 32px; }
    .header-right { padding-right: 16px; gap: 10px; }
    .credit-label { display: none; }
    .header-credit-container { width: auto; background: transparent; padding: 0; border: none; }
    .header-credit-info { font-size: 14px; }
    .header-credit-bar-bg { display: none; }
    .app-content { padding: 20px 16px 120px 16px; } 
    .create-layout { display: flex; flex-direction: column; gap: 24px; }
    .create-main-col { width: 100%; min-width: 0; }
    .create-side-col { width: 100%; display: flex; flex-direction: column; gap: 20px; }
    .input-row-stack, .conditions-grid { display: flex; flex-direction: column; gap: 12px; }
    .conditions-grid { grid-template-columns: 1fr; }
    .btn-row-wrapper { display: flex; flex-direction: column; gap: 15px; }
    .generate-wrapper { width: 100%; }
    #rhs-generate-btn { width: 100%; }
    .reset-wrapper { align-self: flex-end; }
    .settings-grid { grid-template-columns: 1fr; }
    .setting-row { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
    .setting-row label { margin-bottom: 0; }
    .setting-row:has(.rhs-toggle), .setting-row[style*="justify-content:space-between"] { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
    .rhs-toggle { align-self: auto; margin-left: 0; }
}

/* --- Mobile (<480px) --- */
@media (max-width: 480px) {
    .login-main-content { padding-top: 40px; }
    .main-logo-img { height: 60px; margin-bottom: 20px; }
    .login-page-wrapper { padding: 20px; }
    .welcome-text { font-size: 24px; }
    .auth-buttons-area { width: 100%; }
    .terms-text { font-size: 10px; max-width: 100%; padding: 0 10px; }
    .pricing-container { flex-direction: column; align-items: center; }
    .pricing-card { width: 100%; max-width: 340px; min-height: auto; }
    .pricing-card.recommended { transform: none; border-width: 2px; margin: 10px 0; min-height: auto; }
}

/* ▼▼▼ 課金UIのスタイル (v3.9.0 修正版) ▼▼▼ */
.btn-sidebar-upgrade { 
    width: 100%; 
    background: linear-gradient(135deg, #3b82f6 0%, #ec4899 100%); 
    color: #fff; 
    border: none; 
    border-radius: 8px; 
    padding: 10px; 
    font-weight: 800; 
    font-size: 13px; 
    cursor: pointer; 
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3); 
    transition: all 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 6px; 
    margin-top: 10px; 
}
.btn-sidebar-upgrade:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.4); 
    opacity: 0.95;
}
.btn-sidebar-upgrade:active { transform: translateY(0); }
.btn-manage-sub { background: var(--bg-body); color: var(--text-main); border: 1px solid var(--border-color); padding: 8px 16px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; margin-top: 10px; }
.btn-manage-sub:hover { background: var(--border-color); }

/* ▼▼▼ 新・料金プランページのスタイル ▼▼▼ */
.pricing-header { text-align: center; max-width: 600px; margin: 0 auto 50px auto; }
.pricing-header h2 { font-size: 32px; font-weight: 800; color: var(--text-heading); margin-bottom: 12px; letter-spacing: -0.02em; }
.pricing-header p { color: var(--text-sub); line-height: 1.6; font-size: 15px; }
.pricing-container { display: flex; justify-content: center; align-items: center; gap: 24px; flex-wrap: wrap; max-width: 1100px; margin: 0 auto 80px auto; }
.pricing-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 32px 24px; width: 300px; min-height: 520px; text-align: center; position: relative; transition: all 0.3s ease; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); }
.pricing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.pricing-card.recommended { border: 2px solid transparent; background-image: linear-gradient(var(--bg-card), var(--bg-card)), linear-gradient(135deg, #3b82f6 0%, #ec4899 100%); background-origin: border-box; background-clip: padding-box, border-box; padding: 48px 24px; min-height: 560px; transform: scale(1.05); z-index: 10; box-shadow: 0 20px 40px -10px rgba(59, 130, 246, 0.15); }
.pricing-card.recommended:hover { transform: scale(1.05) translateY(-4px); box-shadow: 0 25px 50px -10px rgba(59, 130, 246, 0.25); }
.badge-best { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, #3b82f6 0%, #ec4899 100%); color: #fff; padding: 6px 16px; border-radius: 20px; font-size: 12px; font-weight: 700; letter-spacing: 0.5px; box-shadow: 0 4px 10px rgba(236, 72, 153, 0.3); }
.pricing-title { font-size: 22px; font-weight: 800; color: var(--text-heading); margin-bottom: 8px; }
.pricing-desc { font-size: 13px; color: var(--text-sub); margin-bottom: 24px; font-weight: 500; }
.pricing-price { font-size: 44px; font-weight: 800; color: var(--text-heading); margin-bottom: 10px; line-height: 1; letter-spacing: -1px; position: relative; display: inline-block; }
.pricing-price .currency { font-size: 24px; vertical-align: top; margin-right: 2px; font-weight: 600; }
.pricing-price .period { font-size: 14px; font-weight: 500; color: var(--text-sub); margin-left: 4px; vertical-align: baseline; }
.discount-tag { display: block; font-size: 12px; color: #ec4899; font-weight: 700; margin-bottom: 20px; height: 18px; }
.features-label { text-align: left; font-size: 13px; font-weight: 700; color: var(--text-heading); margin-bottom: 12px; display: block; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.pricing-features { list-style: none; padding: 0; margin: 0 0 32px 0; text-align: left; flex: 1; }
.pricing-features li { font-size: 14px; color: var(--text-main); margin-bottom: 14px; display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; }
.pricing-features li::before { content: ""; display: inline-block; width: 18px; height: 18px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%233b82f6' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M4.5 12.75l6 6 9-13.5' /%3E%3C/svg%3E"); background-size: contain; background-repeat: no-repeat; background-position: center; flex-shrink: 0; margin-top: 2px; }
.btn-pricing { width: 100%; padding: 14px; border-radius: 6px; font-weight: 700; font-size: 15px; cursor: pointer; transition: all 0.2s; text-align: center; }
.btn-pricing.btn-outline { background: var(--bg-card); color: var(--primary-color); border: 1px solid var(--primary-color); }
.btn-pricing.btn-outline:hover { background: var(--accent-bg); }
.btn-pricing.btn-primary { background: linear-gradient(135deg, #3b82f6 0%, #ec4899 100%); color: #fff; border: none; box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3); }
.btn-pricing.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 15px rgba(59, 130, 246, 0.4); }
.btn-pricing.disabled { background: var(--bg-body); color: var(--text-muted); border: 1px solid var(--border-color); cursor: not-allowed; box-shadow: none; transform: none !important; }

/* トグルスイッチ */
.rhs-toggle { position: relative; display: inline-block; width: 52px; height: 28px; flex: 0 0 52px; margin: 0; padding: 0; cursor: pointer; vertical-align: middle; }
.rhs-toggle input { opacity: 0; width: 0; height: 0; position: absolute; margin: 0; pointer-events: none; }
.rhs-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .3s; border-radius: 34px; }
.rhs-slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.rhs-toggle input:checked + .rhs-slider { background-color: var(--primary-color); }
.rhs-toggle input:checked + .rhs-slider:before { transform: translateX(24px); }
.rhs-toggle input:focus + .rhs-slider { box-shadow: 0 0 0 2px rgba(37,99,235,0.2); }

.plan-toggle-wrapper { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 30px; }
.toggle-label { font-weight: 700; font-size: 14px; color: var(--text-muted); transition: .2s; }
.toggle-label.active { color: var(--text-heading); }
.period-save { color: var(--danger-text); font-size:11px; font-weight:700; margin-left:4px; }