/* Mega Idea Forge */

:root {
    --bg: #f3f5ff;
    --bg-soft: rgba(232, 234, 246, 0.88);
    --panel: rgba(255, 255, 255, 0.94);
    --panel-strong: #ffffff;
    --line: rgba(48, 63, 159, 0.12);
    --line-strong: rgba(48, 63, 159, 0.2);
    --ink: #263067;
    --ink-soft: #4f5c98;
    --ink-muted: #7986cb;
    --accent: #303f9f;
    --accent-strong: #24338c;
    --accent-soft: #e8eaf6;
    --accent-warm: #7986cb;
    --accent-warm-soft: #e8eaf6;
    --danger: #a43d2b;
    --danger-soft: #f7d9d2;
    --success: #2c7a60;
    --success-soft: #dcefe7;
    --shadow-sm: 0 10px 24px rgba(48, 63, 159, 0.1);
    --shadow-md: 0 20px 48px rgba(48, 63, 159, 0.14);
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --color-100t: #24338c;
    --color-10t: #303f9f;
    --color-1t: #7986cb;
    --color-graveyard: #5e6ba8;
}

* {
    box-sizing: border-box;
}

html {
    background:
        radial-gradient(circle at top left, rgba(48, 63, 159, 0.16), transparent 28rem),
        radial-gradient(circle at top right, rgba(121, 134, 203, 0.18), transparent 26rem),
        linear-gradient(180deg, #f9faff 0%, #f3f5ff 48%, #eef1ff 100%);
    min-height: 100%;
}

body {
    position: relative;
    margin: 0;
    color: var(--ink);
    background: transparent;
    font-family: "Noto Sans JP", sans-serif;
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: auto;
    width: 28rem;
    height: 28rem;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(14px);
    opacity: 0.45;
    z-index: -1;
}

body::before {
    top: -10rem;
    left: -8rem;
    background: radial-gradient(circle, rgba(48, 63, 159, 0.28), transparent 68%);
}

body::after {
    right: -10rem;
    bottom: -10rem;
    background: radial-gradient(circle, rgba(121, 134, 203, 0.26), transparent 68%);
}

h1, h2, h3, h4, h5, h6,
.site-logo,
.page-title,
.summary-card header {
    font-family: "Sora", "Noto Sans JP", sans-serif;
}

a {
    color: var(--accent-strong);
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

.container,
main.container {
    width: min(1200px, calc(100% - 2rem));
    max-width: none;
    margin-inline: auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 0.95rem 0 0.9rem;
    backdrop-filter: blur(18px);
    background: linear-gradient(
        180deg,
        rgba(243, 245, 255, 0.94) 0%,
        rgba(243, 245, 255, 0.76) 100%
    );
    border-bottom: 1px solid rgba(48, 63, 159, 0.08);
}

.topbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.9rem;
}

.site-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.18rem;
    margin: 0;
}

.site-nav-shell {
    overflow-x: auto;
    scrollbar-width: none;
}

.site-nav-shell::-webkit-scrollbar {
    display: none;
}

.topbar nav {
    display: block;
    width: max-content;
    min-width: 100%;
    margin: 0;
    padding: 0.45rem;
    border: 1px solid rgba(48, 63, 159, 0.08);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.64));
    box-shadow: 0 12px 32px rgba(48, 63, 159, 0.08);
}

.site-kicker {
    color: var(--accent-warm);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    color: var(--ink);
    font-size: clamp(1.2rem, 2.2vw, 1.7rem);
    font-weight: 800;
    line-height: 1.05;
}

.site-logo:hover {
    color: var(--accent-strong);
}

.site-subtitle {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.site-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav li {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.6rem 0.9rem;
    border-radius: 14px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-soft);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-shadow: none;
    transition:
        color 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.site-nav a:hover {
    color: var(--accent-strong);
    background: transparent;
    border-color: transparent;
    transform: none;
}

.site-nav a.active {
    color: var(--accent-strong);
    background: rgba(232, 234, 246, 0.96);
    border-color: rgba(48, 63, 159, 0.12);
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(48, 63, 159, 0.1);
}

.app-main {
    padding-top: 2rem;
    padding-bottom: 4rem;
    animation: rise-in 0.55s ease both;
}

.site-footer {
    padding: 1.5rem 0 2.25rem;
    border-top: 1px solid rgba(48, 63, 159, 0.08);
}

.site-footer .container {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--ink-muted);
}

.site-footer small {
    color: var(--ink-muted);
}

.page-title {
    position: relative;
    margin: 0 0 1.4rem;
    padding-bottom: 1rem;
    color: var(--ink);
    font-size: clamp(1.8rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.page-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: min(10rem, 32vw);
    height: 0.3rem;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-warm));
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.summary-card {
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 1rem 1rem 1.2rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(232, 234, 246, 0.78));
    border: 1px solid rgba(48, 63, 159, 0.1);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.summary-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 0.35rem;
    background: linear-gradient(90deg, var(--accent), var(--accent-warm));
    opacity: 0.8;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.summary-card header {
    margin-bottom: 0.8rem;
    color: var(--ink-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.card-value {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.05em;
}

.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(48, 63, 159, 0.08);
    border-radius: var(--radius-md);
    background: var(--bg-soft);
    box-shadow: var(--shadow-sm);
}

.dashboard-meta {
    color: var(--ink-muted);
    font-size: 0.86rem;
}

.dashboard-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
    gap: 1.2rem;
}

.dashboard-columns > section,
.writer-layout > section,
.source-form,
.filter-bar,
.detail-section,
.list-page table,
.dashboard-columns table {
    background: var(--panel);
    border: 1px solid rgba(48, 63, 159, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(14px);
}

.dashboard-columns > section {
    min-width: 0;
    padding: 1.25rem;
}

.dashboard-columns > section > h3,
.writer-layout > section > h3,
.source-form h3,
.detail-section h3 {
    margin: 0 0 1rem;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.dashboard-columns table,
.list-page table,
.detail-section table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

table thead th {
    padding: 0.9rem 0.9rem 0.85rem;
    color: var(--ink-muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: rgba(232, 234, 246, 0.9);
    border-bottom: 1px solid rgba(48, 63, 159, 0.12);
}

table tbody td {
    padding: 0.9rem;
    color: var(--ink);
    border-bottom: 1px solid rgba(48, 63, 159, 0.06);
    vertical-align: middle;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody tr:hover {
    background: rgba(232, 234, 246, 0.55);
}

.list-page table tbody td a,
.dashboard-columns table tbody td a {
    font-weight: 700;
}

.dashboard-ideas-table .idea-title-cell {
    width: 42%;
}

.idea-summary {
    margin-top: 0.34rem;
    color: var(--ink-soft);
    font-size: 0.79rem;
    line-height: 1.5;
    font-weight: 500;
}

.dashboard-ideas-table .signal-stack-cell {
    min-width: 12rem;
}

.dashboard-news-table .signal-stack-cell {
    min-width: 8rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.24rem 0.62rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-100t {
    background: rgba(48, 63, 159, 0.14);
    color: var(--color-100t);
    border-color: rgba(48, 63, 159, 0.18);
}

.badge-10t {
    background: rgba(48, 63, 159, 0.1);
    color: var(--color-10t);
    border-color: rgba(48, 63, 159, 0.16);
}

.badge-1t {
    background: rgba(121, 134, 203, 0.18);
    color: var(--color-1t);
    border-color: rgba(121, 134, 203, 0.22);
}

.badge-graveyard {
    background: rgba(121, 134, 203, 0.12);
    color: var(--color-graveyard);
    border-color: rgba(121, 134, 203, 0.18);
}

.badge-domain {
    background: rgba(121, 134, 203, 0.14);
    color: var(--accent-warm);
    border-color: rgba(121, 134, 203, 0.18);
}

.badge-active {
    background: rgba(44, 122, 96, 0.12);
    color: var(--success);
    border-color: rgba(44, 122, 96, 0.16);
}

.badge-inactive {
    background: rgba(111, 126, 132, 0.12);
    color: var(--ink-soft);
    border-color: rgba(111, 126, 132, 0.14);
}

.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding: 1rem;
}

.filter-bar select,
.form-row input,
.form-row select {
    margin: 0;
    min-width: 9.5rem;
    border: 1px solid rgba(48, 63, 159, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
}

.filter-bar button,
.btn-primary,
button[type="submit"] {
    border-radius: 999px;
    border: 1px solid rgba(48, 63, 159, 0.18);
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #f7fffd;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(48, 63, 159, 0.22);
}

.filter-bar button:hover,
.btn-primary:hover,
button[type="submit"]:hover {
    background: linear-gradient(135deg, var(--accent-strong), #1c2a75);
    color: #fff;
}

.btn-primary:disabled,
button[type="submit"]:disabled {
    cursor: progress;
    opacity: 0.82;
    transform: none;
    box-shadow: 0 8px 18px rgba(48, 63, 159, 0.18);
}

.btn-sm {
    padding: 0.45rem 0.85rem;
    font-size: 0.78rem;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #8f3324);
    border-color: rgba(164, 61, 43, 0.18);
    box-shadow: 0 10px 24px rgba(164, 61, 43, 0.18);
}

.source-form {
    margin-bottom: 1.35rem;
    padding: 1.2rem;
}

.form-row {
    display: flex;
    align-items: flex-end;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

.form-row label {
    display: block;
    margin-bottom: 0.42rem;
    color: var(--ink-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.count-info {
    margin: 0 0 0.9rem;
    color: var(--ink-muted);
    font-size: 0.86rem;
}

.writer-submit-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.writer-submit-button {
    position: relative;
    min-width: 11.5rem;
}

.writer-submit-button.is-loading {
    padding-left: 2.7rem;
}

.writer-submit-button.is-loading::before {
    content: "";
    position: absolute;
    left: 1.05rem;
    top: 50%;
    width: 1rem;
    height: 1rem;
    margin-top: -0.5rem;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.36);
    border-top-color: rgba(255, 255, 255, 0.96);
    animation: writer-spin 0.8s linear infinite;
}

.writer-submit-status {
    color: var(--ink-soft);
    font-size: 0.9rem;
    line-height: 1.5;
}

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 1.4rem 0 0;
}

.pagination a,
.pagination strong,
.pagination span {
    min-width: 2.35rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    text-align: center;
    font-size: 0.82rem;
}

.pagination a {
    border: 1px solid rgba(48, 63, 159, 0.12);
    background: rgba(255, 255, 255, 0.8);
    color: var(--ink-soft);
}

.pagination a:hover {
    color: var(--accent-strong);
    border-color: rgba(48, 63, 159, 0.18);
    background: rgba(232, 234, 246, 0.88);
}

.pagination strong.current {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    box-shadow: 0 10px 20px rgba(48, 63, 159, 0.18);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.8rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    color: var(--ink-soft);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(48, 63, 159, 0.08);
}

.detail-page h2 {
    margin: 0 0 0.55rem;
    color: var(--ink);
    font-size: clamp(1.6rem, 3.2vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.detail-date {
    margin-bottom: 1rem;
    color: var(--ink-muted);
    font-size: 0.86rem;
}

.detail-section {
    margin-bottom: 1.2rem;
    padding: 1.3rem 1.4rem;
}

.detail-section p,
.detail-section td,
.detail-section td a,
.detail-section div {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.detail-section p,
.detail-table td {
    white-space: pre-wrap;
}

.detail-section .badge,
.detail-section .signal-role {
    white-space: nowrap;
}

.detail-table th {
    width: 170px;
    color: var(--ink-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.01em;
    background: transparent;
}

.detail-table td {
    font-size: 0.92rem;
}

.tam-display {
    display: grid;
    gap: 0.45rem;
}

.tam-display-headline {
    color: var(--ink);
    font-size: 1.02rem;
    font-weight: 800;
}

.tam-display-label {
    color: var(--ink-muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tam-display-breakdown {
    display: grid;
    gap: 0.42rem;
}

.tam-display-line {
    display: block;
    padding: 0.34rem 0.62rem;
    border-radius: 12px;
    background: rgba(232, 234, 246, 0.78);
    color: var(--ink);
    font-size: 0.84rem;
    line-height: 1.5;
}

.tam-display-line-result {
    font-weight: 700;
    background: rgba(48, 63, 159, 0.1);
    color: var(--accent-strong);
}

.writer-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
    gap: 1.2rem;
}

.writer-layout > section {
    min-width: 0;
    padding: 1.25rem;
}

.writer-form {
    display: grid;
    gap: 0.9rem;
}

.writer-form input,
.writer-form textarea {
    width: 100%;
}

.writer-form .form-group {
    width: 100%;
}

.writer-placeholder {
    margin: 0;
    color: var(--ink-muted);
    font-size: 0.92rem;
}

.writer-sources {
    margin-bottom: 1rem;
}

.generated-article {
    margin-bottom: 0;
}

.generated-article-body {
    color: var(--ink);
    font-size: 0.95rem;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.generated-article-body > :first-child {
    margin-top: 0;
}

.generated-article-body > :last-child {
    margin-bottom: 0;
}

.generated-article-body h2,
.generated-article-body h3,
.generated-article-body h4 {
    margin: 1.35rem 0 0.65rem;
    color: var(--accent-strong);
    line-height: 1.35;
}

.generated-article-body p {
    margin: 0 0 0.9rem;
}

.generated-article-body ul,
.generated-article-body ol {
    margin: 0 0 1rem 1.2rem;
    padding: 0;
}

.generated-article-body li {
    margin-bottom: 0.38rem;
}

.generated-article-body code {
    padding: 0.08rem 0.35rem;
    border-radius: 8px;
    background: rgba(48, 63, 159, 0.08);
    color: var(--accent-strong);
    font-size: 0.88em;
}

.ai-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.ai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 10rem;
    padding: 0.72rem 1rem;
    border-radius: 18px;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 800;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.ai-btn:hover {
    color: #fff;
    transform: translateY(-2px);
    opacity: 0.96;
}

.ai-btn-chatgpt {
    background: linear-gradient(135deg, #0f9d76, #0a7a5d);
}

.ai-btn-claude {
    background: linear-gradient(135deg, #d97757, #bb5c39);
}

.ai-btn-gemini {
    background: linear-gradient(135deg, #7986cb, #303f9f);
}

.ai-btn-copy {
    background: linear-gradient(135deg, #5f6ea8, #303f9f);
}

.flash-success,
.flash-error {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.flash-success {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid rgba(44, 122, 96, 0.16);
}

.flash-error {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(164, 61, 43, 0.14);
}

.copy-toast {
    position: fixed;
    left: 50%;
    bottom: 2rem;
    transform: translateX(-50%) translateY(1rem);
    opacity: 0;
    padding: 0.78rem 1.2rem;
    border-radius: 999px;
    background: rgba(48, 63, 159, 0.92);
    color: #fff;
    box-shadow: var(--shadow-md);
    transition: opacity 0.24s ease, transform 0.24s ease;
    z-index: 80;
}

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

.signal-stack-cell {
    min-width: 15rem;
}

.signal-stack {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.signal-line,
.signal-subline {
    line-height: 1.4;
}

.signal-subline {
    color: var(--ink-soft);
    font-size: 0.8rem;
}

.signal-role {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.45rem;
    padding: 0.12rem 0.48rem;
    border-radius: 999px;
    background: rgba(48, 63, 159, 0.12);
    color: var(--accent-strong);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.signal-role-support {
    background: rgba(121, 134, 203, 0.14);
    color: var(--accent-warm);
}

@keyframes writer-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .topbar nav {
        border-radius: 20px;
    }

    .dashboard-columns {
        grid-template-columns: 1fr;
    }

    .writer-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 720px) {
    .container,
    main.container {
        width: min(100% - 1rem, 1200px);
    }

    .site-header {
        padding-top: 0.8rem;
    }

    .site-nav a {
        font-size: 0.82rem;
        min-height: 2.35rem;
        padding-inline: 0.78rem;
    }

    .site-nav {
        gap: 0.28rem;
    }

    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-section,
    .writer-layout > section,
    .source-form,
    .dashboard-columns > section,
    .filter-bar {
        padding: 1rem;
        border-radius: 22px;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar {
        align-items: stretch;
    }

    .filter-bar select,
    .filter-bar button {
        width: 100%;
    }

    .signal-stack-cell {
        min-width: 11rem;
    }

    .ai-buttons {
        flex-direction: column;
    }

    .ai-btn {
        width: 100%;
    }
}
