* { box-sizing: border-box; }
body { margin: 0; padding: 0; background-color: #f3f4f6; font-family: 'Inter', 'Noto Sans JP', sans-serif; color: #374151; }

/* === Login Page Styles (Centered Logo + Bottom Footer) === */
.login-page-body {
    background-color: #fff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.login-page-wrapper {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* コンテンツを縦方向中央に */
}

/* Main Content */
.login-main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    margin-bottom: auto; /* フッターを下に追いやるため、上部は詰めない */
    padding-top: 100px; /* 少し下に下げる */
}

/* Logo Style */
.main-logo-img {
    height: 80px; /* 大きめに設定 */
    width: auto;
    margin-bottom: 32px; /* タイトルとの間隔 */
}

.welcome-text {
    font-size: 32px;
    font-weight: 500;
    color: #111;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.sub-text {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 48px;
}

/* Auth Buttons */
.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: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-google:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.btn-google svg {
    margin-right: 12px;
    width: 20px;
    height: 20px;
}

/* Footer / Terms (Bottom & Subtle) */
.login-footer {
    margin-top: auto; /* 画面最下部に固定 */
    padding: 40px 0 20px 0;
    text-align: center;
    width: 100%;
    display: flex;
    justify-content: center;
}

.terms-text {
    font-size: 11px; /* 小さく */
    color: #cbd5e1; /* かなり薄いグレー */
    line-height: 1.5;
    max-width: 480px;
    margin: 0;
}

.terms-text a {
    color: #9ca3af; /* リンクも少し薄く */
    text-decoration: none;
    margin: 0 4px;
}

.terms-text a:hover {
    text-decoration: underline;
    color: #6b7280;
}

/* Error Messages */
.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: #fee2e2; color: #ef4444; }


/* === Dashboard Styles (Existing) === */
.dashboard-wrapper { display: flex; flex-direction: column; height: 100vh; width: 100vw; overflow: hidden; }

/* Header */
.app-header { height: 64px; background: #fff; border-bottom: none; display: flex; justify-content: space-between; align-items: center; padding: 0; z-index: 20; }
.header-left { width: 240px; text-align: center; }
.header-logo { height: 40px; width: auto; }
.header-right { padding-right: 24px; display: flex; align-items: center; gap: 20px; }

/* Credit Display */
.header-credit-wrapper { display: flex; align-items: center; gap: 10px; }
.credit-label { font-size: 12px; font-weight: 600; color: #6b7280; }
.header-credit-container { background: #f3f4f6; padding: 6px 12px; border-radius: 8px; display: flex; flex-direction: column; gap: 4px; width: 140px; }
.header-credit-info { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #374151; line-height: 1; }
.header-credit-total { font-size: 11px; color: #9ca3af; font-weight: 500; }
.header-credit-bar-bg { width: 100%; height: 4px; background: #e5e7eb; 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; }

.app-body { display: flex; flex: 1; overflow: hidden; }

/* Sidebar */
.app-sidebar { width: 240px; background: #fff; border-right: none; 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: 0 1px 2px rgba(0,0,0,0.05);
    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: #6b7280; 
    font-size: 14px; font-weight: 500; 
    transition: all 0.2s; 
    border-left: 3px solid transparent; 
}
.nav-item img { transition: filter 0.2s; }
.nav-item:hover { color: #111; background-color: #f9fafb; }
.nav-item.active { background: transparent; color: #2563eb; font-weight: 700; }
.nav-item.active img { filter: invert(29%) sepia(92%) saturate(1961%) hue-rotate(210deg) brightness(96%) contrast(96%); }

.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: #9ca3af; text-decoration: none; }
.legal-links a:hover { color: #6b7280; text-decoration: underline; }

.app-content { flex: 1; overflow-y: auto; background-color: #f3f4f6; 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 { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 20px; }
.sidebar-title { font-size: 14px; font-weight: 700; color: #1e3a8a; margin: 0 0 15px 0; display: flex; align-items: center; gap: 6px; }
.tips-content { color: #4b5563; 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: #2563eb; margin: 12px 0 6px 0; }
.tips-content p { margin: 0 0 10px 0; }
.tips-content ul { margin: 0 0 10px 20px; padding: 0; }

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

@media (max-width: 900px) {
    .create-layout { grid-template-columns: 1fr; }
    .create-side-col { margin-top: 20px; flex-direction: column-reverse; } 
}

.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 */
.plan-info-row { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.plan-name { font-size: 20px; font-weight: 700; color: #111; margin: 0; }
.plan-price { font-size: 13px; font-weight: 700; color: #6b7280; background: #f3f4f6; padding: 4px 12px; border-radius: 20px; }

.credit-status { margin-bottom: 16px; }
.credit-labels { display: flex; justify-content: space-between; font-size: 14px; color: #6b7280; margin-bottom: 8px; }
.credit-val { font-weight: 700; color: #2563eb; }
.progress-bg { width: 100%; height: 10px; background: #f3f4f6; border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(135deg, #00E0FF 0%, #0078FF 100%); border-radius: 5px; }
.next-reset { font-size: 12px; color: #9ca3af; text-align: right; }

.setting-row { margin-bottom: 16px; }
.setting-row label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.setting-actions { margin-top: 24px; text-align: right; }

/* Panel */
.panel-section { margin-bottom: 32px; }
.input-card { background: #fff; border-radius: 0; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid #e5e7eb; }
.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: #111; }
.suggestions-area { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.suggestion-tag { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; border-radius: 0; padding: 4px 12px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.suggestion-tag:hover { background: #2563eb; color: #fff; border-color: #2563eb; }
.input-row-stack { margin-bottom: 16px; }
.topic-input { width: 100%; padding: 14px 16px; border: 1px solid #e5e7eb; border-radius: 0; font-size: 16px; background: #fff; transition: .2s; }
.topic-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.topic-input.is-invalid, .length-input.is-invalid { border-color: #ef4444; background-color: #fef2f2; }
.input-error-msg { color: #ef4444; 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 #e5e7eb; border-radius: 0; font-size: 16px; background: #fff; transition: .2s; text-align: left; }
.length-input:focus { outline: none; border-color: #2563eb; 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: #6b7280; pointer-events: none; background: transparent; }

.custom-select { width: 100%; padding: 14px 16px; border: 1px solid #e5e7eb; border-radius: 0; font-size: 16px; background: #fff; 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: #2563eb; 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: #9ca3af; 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: 0 1px 2px rgba(0,0,0,0.05);
    display: flex; align-items: center; justify-content: center;
}
#rhs-generate-btn:hover { 
    transform: translateY(-1px); 
    background: #2563eb; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    color: #fff !important;
}
#rhs-generate-btn:active { transform: translateY(0); box-shadow: none; }
#rhs-generate-btn:disabled { background: #9ca3af; cursor: wait; transform: none; box-shadow: none; }

.cost-badge { display: flex; align-items: center; gap: 2px; font-size: 13px; opacity: 0.9; background: rgba(0,0,0,0.1); padding: 2px 6px; border-radius: 4px; }

.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; }
.reset-btn img { width: 20px; height: 20px; }

.btn-danger { background: #fee2e2; color: #ef4444; border: 1px solid #fecaca; padding: 10px 20px; border-radius: 6px; font-size: 14px; font-weight: 700; cursor: pointer; transition: .2s; }
.btn-danger:hover { background: #ef4444; color: #fff; border-color: #ef4444; }

[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -8px); background-color: #333; color: #fff; padding: 6px 10px; border-radius: 4px; font-size: 11px; white-space: nowrap; z-index: 100; pointer-events: none; box-shadow: 0 4px 10px rgba(0,0,0,0.15); opacity: 0; animation: tooltipFade 0.2s forwards; }
@keyframes tooltipFade { from { opacity: 0; transform: translate(-50%, -4px); } to { opacity: 1; transform: translate(-50%, -8px); } }

#rhs-output-placeholder { background: #fff; border-radius: 0; border: 2px dashed #e5e7eb; height: 300px; display: flex; align-items: center; justify-content: center; text-align: center; color: #9ca3af; }
.placeholder-content { display: flex; flex-direction: column; align-items: center; }
#rhs-output-placeholder p { font-size: 14px; line-height: 1.6; }
.output-card { background: #fff; border-radius: 0; box-shadow: 0 4px 6px rgba(0,0,0,0.05); overflow: visible; border: 1px solid #e5e7eb; }
.output-header { background: #f8fafc; padding: 12px 24px; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; }
.result-badge { font-size: 11px; font-weight: 700; color: #2563eb; text-transform: uppercase; letter-spacing: 0.05em; background: #eff6ff; 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; }
.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: #111; border-bottom: 2px solid #f3f4f6; padding-bottom: 16px; line-height: 1.4; }
.editor-view { font-size: 16px; line-height: 1.8; color: #374151; white-space: pre-wrap; }

/* === モーダル調整 (v3.1.3+) === */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: #fff;
    width: 90%; max-width: 420px; /* 広告サイズに合わせて調整 */
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden; 
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalPop { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.modal-header-left { display: flex; align-items: center; gap: 12px; }
.modal-title { font-size: 16px; color: #111; }

.spinner {
    width: 18px; height: 18px; margin-left: 10px;
    border: 3px solid #e5e7eb; border-top-color: #2563eb;
    border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.close-btn {
    background: none; border: none; cursor: pointer; color: #9ca3af;
    padding: 4px; border-radius: 50%; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.close-btn:hover { background-color: #e5e7eb; color: #4b5563; }

.modal-body {
    padding: 20px;
    display: flex; justify-content: center; align-items: center;
    background: #fff;
    min-height: 250px;
}

.ad-label { display: none; } /* ラベル非表示 */

#rhs-ad-slot {
    display: flex; justify-content: center; align-items: center;
    width: 100%;
}
#rhs-ad-slot > div, #rhs-ad-slot > iframe, #rhs-ad-slot img {
    max-width: 100%; height: auto; display: block;
}

/* レポート一覧などのスタイル */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; }
.report-item-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.03); transition: transform 0.2s; cursor: pointer; }
.report-item-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.report-item-title { font-size: 16px; font-weight: 700; color: #111; margin: 0 0 10px 0; line-height: 1.4; }
.report-item-meta { font-size: 12px; color: #9ca3af; margin-bottom: 10px; }
.report-item-excerpt { font-size: 13px; color: #6b7280; line-height: 1.6; margin-bottom: 15px; min-height: 40px; }
.report-item-actions { border-top: 1px solid #f3f4f6; padding-top: 15px; text-align: right; }
.btn-trash { background: #fee2e2; color: #ef4444; border: none; padding: 6px 12px; border-radius: 4px; font-size: 12px; font-weight: 600; cursor: pointer; margin-left: 5px; }
.btn-trash:hover { background: #fca5a5; color: #fff; }
.btn-restore { background: #dbeafe; color: #2563eb; border: none; padding: 6px 12px; border-radius: 4px; font-size: 12px; font-weight: 600; cursor: pointer; margin-left: 5px; }
.btn-restore:hover { background: #bfdbfe; }
.btn-back { background: transparent; border: none; color: #6b7280; font-weight: 600; cursor: pointer; font-size: 14px; margin-bottom: 10px; }
.btn-back:hover { text-decoration: underline; color: #2563eb; }