/* =========================
   共有スタイル
========================= */

:root {
    --color-text-main: #fff;
    --color-text-sub: #ddd;
    --color-text-muted: #bbb;

    --main-color: #a78bfa;
    --color-text-answer: #1f2340;

    --color-bg-page-start: #0f0f0f;
    --color-bg-page-end: #1c1c1c;

    --color-bg-container: #1f1f1f;
    --color-bg-summary: #242424;
    --color-bg-card: #2a2a2a;

    --color-bg-button: #444;
    --color-bg-answer: #2c2c2c;
    --color-bg-answer-hover: #3a3a3a;

    --color-bg-score: #333;
    --color-bg-score-fill: #777;

    --radius-container: 20px;
    --radius-card: 18px;
    --radius-summary: 16px;
    --radius-button: 999px;
    --radius-button-soft: 14px;

    --shadow-container: 0 10px 40px rgba(0,0,0,.6);
    --shadow-card: 0 4px 20px rgba(0,0,0,.3);

    --transition-base: opacity .2s ease, background .2s ease;
}

body{
    margin:0;
    font-family:"Helvetica Neue",Arial,sans-serif;
    background:linear-gradient(135deg,var(--color-bg-page-start),var(--color-bg-page-end));
    color:var(--color-text-main);
    min-height:100vh;
    position:relative;
    overflow-x:hidden;
}

body.diagnosis-page{
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    min-height:100vh;
}

body.diagnosis-page::before,
body.result-page::before,
body.scenario-page::before,
body.scenario-list-page::before{

    content:"";

    position:fixed;

    inset:0;

    background:
        linear-gradient(rgba(10,10,15,.45),rgba(10,10,15,.62)),
        url("images/back_p.png") center/cover no-repeat;

    z-index:-2;

}

.container{
    width:min(92%,760px);
    margin:24px auto;
    padding:26px 24px;
    background:var(--color-bg-container);
    color:var(--color-text-main);
    border-radius:var(--radius-container);
    box-shadow:var(--shadow-container);
    box-sizing:border-box;
}

body.diagnosis-page .container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width:min(92%,620px);
    margin: auto;
    background:rgba(255,255,255,.12);
    border:1px solid rgba(255,255,255,.20);
    border-radius:24px;
    backdrop-filter:blur(22px);
    -webkit-backdrop-filter:blur(22px);
    box-shadow:
        0 20px 60px rgba(0,0,0,.35),
        inset 0 1px 0 rgba(255,255,255,.20);
}

body.result-page {
    display:flex;
    flex-direction:column;
    min-height:100vh;
}

body.result-page .page-content {
    flex: 1 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

body.result-page .container,
body.scenario-page .container{
    width:min(92%,760px);
    margin:24px auto;
    padding:26px 24px;
}

/* =========================
   シナリオ詳細ページ
========================= */

body.scenario-page{
    display:flex;
    flex-direction:column;
    min-height:100vh;
    text-align:center;
}

body.scenario-page .page-content {
    flex: 1 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

body.scenario-page .container{
    text-align:center;
}

body.scenario-page #title{
    margin-bottom:12px;
    text-align:center;
}

body.scenario-page .catch-copy{
    margin-bottom:24px;
    color:var(--color-text-sub);
    font-size:18px;
    text-align:center;
}

body.scenario-page #players,
body.scenario-page #time,
body.scenario-page #beginner,
body.scenario-page #focus,
body.scenario-page #lost,
body.scenario-page #gmDifficulty{
    margin:8px 0;
    text-align:center;
}

body.scenario-page #summary,
body.scenario-page .score-list{
    text-align:center;
    line-height:1.8;
}

body.scenario-page h2{
    margin-top:28px;
}

#question{
    font-size:22px;
    margin-bottom:14px;
    font-weight:bold;
}

.progress{
    margin:0 0 10px;
    color:var(--color-text-muted);
    font-size:14px;
}

body.diagnosis-page #answers{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:8px 10px;
}

.answer-btn{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:13px 18px;
    background:rgba(255,255,255,.92);
    color:var(--color-text-answer);
    border:1px solid #ece7ff;
    border-radius:14px;
    font-size:16px;
    font-weight:600;
    cursor:pointer;
    box-shadow:0 4px 12px rgba(0,0,0,.06);
    transition:.2s;
}

.answer-btn:hover{
    transform:translateY(-2px);
    border-color:var(--main-color);
}

.diagnosis-back-area {
    margin-top: 18px;
    text-align: center;
}

.diagnosis-back-btn {
    grid-column: 1 / -1;
    justify-self: center;
    margin-top: 12px;
    padding: 10px 18px;
    background: transparent;
    color: var(--color-text-sub);
    border: 1px solid rgba(255,255,255,.24);
    border-radius: var(--radius-button);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.diagnosis-back-btn:hover {
    color: var(--color-text-main);
    border-color: var(--main-color);
}

.answer-btn::after{
    content:"\203A";
    color:var(--main-color);
    font-size:26px;
}

body.diagnosis-page #answers .answer-btn:last-child:nth-child(odd){
    grid-column:1 / 3;
    width:50%;
    justify-self:center;
}

/* =========================
   詳細ページ・結果ページ共通ボタン
========================= */

body.scenario-page h2{
    margin:40px 0 18px;
}

.action-buttons{
    display:flex;
    justify-content:center;
    align-items:center;
    flex-wrap:wrap;
    gap:12px;

    margin-top:24px;
}

.secondary-buttons {
    margin-top: 25px;
}

/* =========================
   エラー表示
========================= */

.not-found {
    text-align: center;
}

.not-found h1 {
    margin-bottom: 16px;
}

.not-found p {
    margin-bottom: 28px;
    color: var(--color-text-sub);
    line-height: 1.8;
}

/* =========================
   共通ボタン
========================= */

.detail-btn,
.result-share-btn,
.result-restart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: var(--color-bg-button);
    color: var(--color-text-main);

    border: none;
    text-decoration: none;

    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;

    cursor: pointer;
    box-sizing: border-box;

    transition: var(--transition-base);

    appearance: none;
    -webkit-appearance: none;
}

.detail-btn {
    padding: 12px 24px;
    border-radius: var(--radius-button);
    text-align: center;
}

.detail-btn:hover,
.result-share-btn:hover,
.result-restart-btn:hover {
    opacity: 0.8;
}

/* =========================
   結果ページ見出し
========================= */

.result-header{
    text-align:center;
    margin-bottom:36px;
}

.result-subtitle{
    margin:0 0 10px;

    color:rgba(255,255,255,.65);

    font-size:12px;
    font-weight:700;
    letter-spacing:.25em;
}

body.result-page h1{
    margin:0;
    font-size:34px;
    font-weight:700;
}

body.result-page #question{

    margin-top:18px;

    font-size:24px;
    font-weight:700;
    line-height:1.5;
}

body.result-page .progress{
    display:none;
}

/* =========================
   診断結果カード
========================= */

.result-card {
    width: 100%;
    max-width: 440px;
    margin: 18px auto;
    padding: 20px;

    background: var(--color-bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);

    text-align: left;
    box-sizing: border-box;

    animation: fadeIn 0.3s ease;
}

.result-card h3 {
    font-size: 22px;
    margin: 0 0 8px;
}

.result-card p {
    margin: 8px 0;
    line-height: 1.6;
}

.result-card .catch-copy {
    color: var(--color-text-sub);
    font-size: 14px;
}

.result-card .tag-list {
    margin: 12px 0;
}

/* =========================
   診断条件表示
========================= */

.answer-summary {
    width: 100%;
    max-width: 440px;
    margin: 0 auto 20px;
    padding: 16px;

    background: var(--color-bg-summary);
    border-radius: var(--radius-summary);

    text-align: left;
    box-sizing: border-box;
}

.answer-summary h3 {
    margin-top: 0;
}

.answer-summary p {
    margin: 6px 0;
}

/* =========================
   結果下部ボタン
========================= */

.result-actions {
    width: 100%;
    max-width: 360px;
    margin: 28px auto 0;

    display: flex;
    flex-direction: column;
    gap: 12px;
}

.share-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.result-share-btn {
    width: 100%;
    min-height: 52px;
    padding: 0 12px;
    border-radius: var(--radius-button);
}

.result-restart-btn {
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    border-radius: var(--radius-button-soft);
    font-size: 16px;
}

.result-restart-btn + .result-restart-btn {
    margin-top: 12px;
}

/* =========================
   タグ
========================= */

.tag-list {
    margin: 12px 0;
}

.tag {
    display: inline-block;
    margin: 4px;
    padding: 5px 8px;

    background: var(--color-bg-button);
    color: var(--color-text-main);

    border-radius: var(--radius-button);
    font-size: 12px;
    text-decoration: none;
}

.tag-search-btn {
    border: none;
    font-family: inherit;
    cursor: pointer;
}

.tag-search-btn:hover {
    opacity: 0.8;
}

/* =========================
   スコアバー
========================= */

.match-score {
    margin: 16px 0;
}

.score-label {
    margin-bottom: 6px;
    font-weight: bold;
}

.score-bar {
    width: 100%;
    height: 10px;

    background: var(--color-bg-score);
    border-radius: var(--radius-button);

    overflow: hidden;
}

.score-fill {
    height: 100%;

    background: var(--color-bg-score-fill);
    border-radius: var(--radius-button);
}

.score-value {
    margin-top: 4px;
    color: var(--color-text-sub);
    font-size: 13px;
    text-align: right;
}

/* =========================
   アニメーション
========================= */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeQuestionIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeQuestionOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

@media(max-width:600px){

    body.diagnosis-page #answers{
        grid-template-columns:1fr;
    }

    body.diagnosis-page #answers .answer-btn:last-child:nth-child(odd){
        grid-column:auto;
        width:100%;
    }

    .container{
        margin:16px auto;
        padding:22px 16px;
    }

    body.diagnosis-page .container{
        width:min(94%,620px);
    }

    .answer-btn{
        padding:14px 16px;
    }
}

/* =========================
   シナリオ一覧ページ
========================= */

body.scenario-list-page,
body.random-page {
    text-align: center;
}

.random-start {
    margin: 28px 0;
    color: var(--color-text-sub);
    line-height: 1.8;
}

.random-loading {
    margin: 32px 0;
    color: var(--color-text-sub);
    font-size: 18px;
    font-weight: 700;
}

.random-result-title {
    margin: 28px 0 16px;
    font-size: 18px;
    font-weight: 700;
}

.scenario-list-container {
    width: min(94%, 980px);
}

.scenario-list-header {
    margin-bottom: 28px;
}

.scenario-list-header h1 {
    margin: 0 0 12px;
    font-size: 34px;
}

.page-description {
    color: var(--color-text-sub);
    line-height: 1.8;
}

.scenario-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.scenario-row-card {
    padding: 22px;

    background: var(--color-bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);

    text-align: left;
    box-sizing: border-box;
}

.scenario-row-main {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
}

.scenario-row-title-area h2 {
    margin: 0 0 8px;
    font-size: 24px;
}

.scenario-row-title-area .catch-copy {
    margin: 0;
    color: var(--color-text-sub);
    line-height: 1.7;
}

.scenario-row-link {
    flex-shrink: 0;
    color: var(--color-text-main);
    text-decoration: none;
    font-weight: 700;
    opacity: 0.85;
}

.scenario-meta-boxes {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;

    margin-top: 18px;
}

.scenario-meta-box {
    padding: 12px 10px;

    background: var(--color-bg-summary);
    border-radius: 14px;

    text-align: center;
}

.scenario-meta-box span {
    display: block;
    margin-bottom: 6px;

    color: var(--color-text-muted);
    font-size: 12px;
}

.scenario-meta-box strong {
    font-size: 14px;
    line-height: 1.5;
}

.scenario-row-tags {
    margin-top: 14px;
}

.scenario-tag-slider {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    overflow: hidden;
}

.scenario-tag-slider .scenario-row-tags {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.scenario-tag-slider .scenario-row-tags::-webkit-scrollbar {
    display: none;
}

.tag-scroll-btn {
    flex-shrink: 0;

    width: 34px;
    height: 34px;

    border: none;
    border-radius: 50%;

    background: var(--color-bg-button);
    color: var(--color-text-main);

    font-size: 18px;
    cursor: pointer;
}

.tag-scroll-btn:hover {
    opacity: 0.8;
}

@media(max-width: 760px) {
    .scenario-row-main {
        flex-direction: column;
    }

    .scenario-meta-boxes {
        grid-template-columns: repeat(2, 1fr);
    }

    .scenario-row-link {
        align-self: flex-end;
    }
}

/* =========================
   シナリオ一覧検索・絞り込み
========================= */

.scenario-filter-panel {
    margin: 24px auto 28px;
    padding: 18px;

    background: var(--color-bg-summary);
    border-radius: var(--radius-summary);

    box-sizing: border-box;
}

.scenario-search-box {
    margin-bottom: 16px;
}

.scenario-search-box label,
.scenario-filter-item label {
    display: block;
    margin-bottom: 8px;

    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 700;
}

.scenario-search-box input,
.scenario-filter-item select {
    width: 100%;
    padding: 13px 14px;

    background: var(--color-bg-container);
    color: var(--color-text-main);

    border: 1px solid rgba(255,255,255,.16);
    border-radius: 14px;

    font-size: 15px;
    box-sizing: border-box;
}

.scenario-search-box input::placeholder {
    color: var(--color-text-muted);
}

.scenario-filter-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.no-result {
    padding: 24px;
    color: var(--color-text-sub);
}

.search-status {
    margin: 12px 0 20px;

    color: var(--color-text-sub);

    font-size: 14px;
    text-align: center;
}

.filter-actions {
    margin-top: 28px;
    text-align: center;
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    margin: 14px 0 18px;
}

.selected-tag {
    padding: 6px 10px;

    background: var(--color-bg-button);
    color: var(--color-text-main);

    border: 1px solid rgba(255,255,255,.16);
    border-radius: var(--radius-button);

    font-size: 12px;
    font-weight: 700;

    cursor: pointer;
}

@media(max-width: 900px) {
    .scenario-filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media(max-width: 520px) {
    .scenario-filter-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================
   ランキングページ
========================= */

.ranking-page {
    max-width: 960px;
    margin: 0 auto;
}

.ranking-section {
    margin-top: 40px;
}

.ranking-section h2 {
    margin-bottom: 16px;
    font-size: 1.4rem;
}

.ranking-list {
    display: grid;
    gap: 16px;
}

.ranking-card {
    display: flex;
    gap: 16px;
    padding: 18px;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 16px;
}

.ranking-number {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #ffb833;
    color: #fff;
    font-weight: bold;
    font-size: 1.2rem;
}

.ranking-content h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.ranking-content h3 a {
    color: #333;
    text-decoration: none;
}

.ranking-content h3 a:hover {
    text-decoration: underline;
}

.ranking-catch {
    margin: 0 0 10px;
    color: #555;
    line-height: 1.7;
}

.ranking-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ranking-meta span {
    display: inline-block;
    padding: 4px 10px;
    background: #f5f6f7;
    border-radius: 999px;
    font-size: 0.85rem;
    color: #555;
}

.ranking-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 40px;
}

.ranking-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    padding: 12px 18px;
    border-radius: 999px;
    background: #ffb833;
    color: #fff;
    font-weight: bold;
    text-decoration: none;
}

.ranking-button:hover {
    opacity: 0.85;
}

.ranking-button-secondary {
    background: #333;
}

@media (max-width: 600px) {
    .ranking-card {
        gap: 12px;
        padding: 14px;
    }

    .ranking-number {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* =========================
   フッター
========================= */

#footer {
    width: 100%;
    flex-shrink: 0;
}

.site-footer {
    width: 100%;
    margin-top: 0;
    padding: 10px 5px;
    border-top: 1px solid var(--border-color);
    background: #333132;
    text-align: center;
    box-sizing: border-box;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 20px;
}

.footer-links a {
    color: var(--color-text-main);
    font-size: 15px;
    text-decoration: none;
    font-weight: 400;
}

.footer-links a:hover {
    color: var(--main-color);
}

.copyright {
    margin: 0;
    font-size: 13px;
    color: #888;
}

/* =========================
   固定ページ
========================= */

body.static-page {
    justify-content: flex-start;
    align-items: center;
}

body.static-page .container {
    width: min(92%, 860px);
    margin: 40px auto;
    padding: 36px;
    background: var(--color-bg-container);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--radius-container);
    box-shadow: var(--shadow-container);
    color: var(--color-text-main);
}

body.static-page h1 {
    margin-bottom: 36px;
    text-align: center;
    color: var(--color-text-main);
}

body.static-page section {

    margin-bottom: 50px;

}

body.static-page h2 {
    margin-bottom: 18px;
    padding-left: 14px;
    border-left: 5px solid var(--main-color);
    color: var(--color-text-main);
}

body.static-page h3 {

    margin-top: 28px;

    margin-bottom: 12px;

    color: var(--main-color);

}

body.static-page p,
body.static-page li {
    margin-bottom: 16px;
    line-height: 2;
    color: var(--color-text-sub);
}

body.static-page ul {

    margin: 0;

    padding-left: 24px;

}

body.static-page li {

    margin-bottom: 8px;

}

body.static-page .container a {
    color: var(--main-color);
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition-base);
}

body.static-page a:hover {

    text-decoration: underline;

}

body.static-page section:last-child {

    margin-bottom: 0;

}