﻿* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, #25354b, #090e17 75%);
    color: #e8e8e8;
    font-family: "Microsoft JhengHei", sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

main {
    width: 90%;
    max-width: 750px;
    padding: 45px;
    background: linear-gradient(145deg, #202b3b, #111722);
    border: 1px solid #a8894e;
    border-radius: 18px;
    box-shadow: 0 20px 60px #0008;
}

h1 {
    color: #e5bf73;
    text-align: center;
    letter-spacing: 3px;
    margin-bottom: 40px;
}

h2 {
    color: #f1d69b;
    font-size: 32px;
    border-bottom: 1px solid #8d7447;
    padding-bottom: 15px;
}

p {
    color: #c3cbd6;
    font-size: 17px;
    line-height: 1.9;
}

.class-menu {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 35px;
}

.class-menu button {
    background: #29384c;
    color: #f1d69b;
    border: 1px solid #8d7447;
    border-radius: 8px;
    padding: 14px 6px;
    font-size: 15px;
    cursor: pointer;
    transition: 0.25s;
}

.class-menu button:hover {
    background: #a8894e;
    color: #101722;
    transform: translateY(-3px);
}

@media (max-width: 500px) {
    main {
        padding: 24px;
    }

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

.class-menu button.active {
    background: linear-gradient(135deg, #c9a45e, #80602e);
    color: #101722;
    border-color: #f4d58d;
    font-weight: bold;
    box-shadow: 0 0 18px #d4a64a55;
}

.class-menu button.active:hover {
    background: linear-gradient(135deg, #e4c17a, #a87b3b);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    background: #253247;
    border: 1px solid #35465d;
    border-radius: 10px;
}

.stat-card span {
    color: #c3cbd6;
    font-size: 14px;
}

.stat-card strong {
    color: #f1d69b;
    font-size: 25px;
    font-weight: 700;
}


.skill-section {
    margin-top: 35px;
}

.skill-section h3 {
    color: #e5bf73;
    font-size: 23px;
    margin-bottom: 18px;
}

.skill-card {
    background: #253247;
    border: 1px solid #35465d;
    border-radius: 10px;
    padding: 22px;
    margin-bottom: 14px;
    transition: 0.25s;
}

.skill-card:hover {
    border-color: #c9a45e;
    box-shadow: 0 0 15px #d4a64a22;
}

.skill-card h4 {
    color: #f1d69b;
    font-size: 18px;
    margin: 0 0 12px;
}

.skill-card p {
    color: #c3cbd6;
    font-size: 15px;
    line-height: 1.8;
    margin: 0;
}

/* 職業專屬主題色 */
body {
    --class-color: #e5bf73;
    --class-glow: #e5bf7333;
}

/* 戰士 */
body[data-job="warrior"] {
    --class-color: #e47767;
    --class-glow: #e4776733;
}

/* 法師 */
body[data-job="mage"] {
    --class-color: #b9a0ff;
    --class-glow: #b9a0ff33;
}

/* 牧師 */
body[data-job="priest"] {
    --class-color: #87d8ad;
    --class-glow: #87d8ad33;
}

/* 盜賊 */
body[data-job="thief"] {
    --class-color: #75d6e4;
    --class-glow: #75d6e433;
}

/* 職業名稱 */
#class-info h2 {
    color: var(--class-color);
    border-bottom-color: var(--class-color);
}

/* 能力卡片數值 */
.stat-card strong {
    color: var(--class-color);
}

/* 技能卡片標題 */
.skill-card h4 {
    color: var(--class-color);
}

/* 技能卡片光影 */
.skill-card:hover {
    border-color: var(--class-color);
    box-shadow: 0 0 15px var(--class-glow);
}


/* 職業專屬主題色 */
body {
    --class-color: #e5bf73;
    --class-glow: #e5bf7333;
}

/* 戰士 */
body[data-job="warrior"] {
    --class-color: #e47767;
    --class-glow: #e4776733;
}

/* 法師 */
body[data-job="mage"] {
    --class-color: #b9a0ff;
    --class-glow: #b9a0ff33;
}

/* 牧師 */
body[data-job="priest"] {
    --class-color: #87d8ad;
    --class-glow: #87d8ad33;
}

/* 盜賊 */
body[data-job="thief"] {
    --class-color: #75d6e4;
    --class-glow: #75d6e433;
}

/* 職業名稱 */
#class-info h2 {
    color: var(--class-color);
    border-bottom-color: var(--class-color);
}

/* 能力卡片數值 */
.stat-card strong {
    color: var(--class-color);
}

/* 技能卡片標題 */
.skill-card h4 {
    color: var(--class-color);
}

/* 技能卡片光影 */
.skill-card:hover {
    border-color: var(--class-color);
    box-shadow: 0 0 15px var(--class-glow);
}


/* 職業名稱與定位 */
.class-heading {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--class-color);
    margin-bottom: 25px;
}

.class-heading h2 {
    border-bottom: none !important;
    margin-bottom: 0;
}

.class-role {
    color: var(--class-color);
    background: var(--class-glow);
    border: 1px solid var(--class-color);
    border-radius: 30px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}


/* 職業介紹切換動畫 */
@keyframes classFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#class-info {
    animation: classFadeIn 0.4s ease-out;
}

#class-info.animate {
    animation: none;
    animation: classFadeIn 0.4s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    #class-info,
    #class-info.animate {
        animation: none;
    }
}


/* 手機版專用排版 */
@media (max-width: 600px) {

    body {
        display: block;
        min-height: 100vh;
        padding: 12px;
    }

    main {
        width: 100%;
        max-width: none;
        padding: 22px 16px;
        margin: 0 auto;
        border-radius: 14px;
    }

    h1 {
        font-size: 23px;
        letter-spacing: 1px;
        margin-bottom: 28px;
    }

    .class-menu {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 30px;
    }

    .class-menu button {
        padding: 13px 5px;
        font-size: 14px;
    }

    .class-heading {
        gap: 10px;
        margin-bottom: 20px;
    }

    .class-heading h2 {
        font-size: 27px;
    }

    .class-role {
        font-size: 11px;
        padding: 5px 10px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-top: 22px;
    }

    .stat-card {
        min-width: 0;
        padding: 15px 12px;
    }

    .stat-card strong {
        font-size: 23px;
    }

    .skill-section {
        margin-top: 28px;
    }

    .skill-card {
        padding: 16px;
    }
}


/* 職業能力卡片動態光影 */
.stat-card {
    position: relative;
    overflow: hidden;
    transition:
        transform 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

/* 卡片左上角的淡色光暈 */
.stat-card::before {
    content: "";
    position: absolute;
    top: -45px;
    left: -45px;
    width: 130px;
    height: 130px;
    background: radial-gradient(
        circle,
        var(--class-glow),
        transparent 70%
    );
    pointer-events: none;
}

/* 滑鼠移入時的效果 */
.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--class-color);
    box-shadow: 0 8px 24px var(--class-glow);
}

/* 數值保留在光暈上方 */
.stat-card span,
.stat-card strong {
    position: relative;
    z-index: 1;
}

/* 尊重減少動畫偏好 */
@media (prefers-reduced-motion: reduce) {
    .stat-card {
        transition: none;
    }

    .stat-card:hover {
        transform: none;
    }
}


/* 能力卡片可互動提示 */
.stat-card {
    cursor: pointer;
}

.stat-card:focus-visible {
    outline: 2px solid var(--class-color);
    outline-offset: 3px;
}

/* 能力說明區 */
.stat-description {
    margin-top: 16px;
    padding: 18px;
    background: #202d40;
    border: 1px solid var(--class-color);
    border-radius: 10px;
}

.stat-description h4 {
    margin: 0 0 10px;
    color: var(--class-color);
    font-size: 17px;
}

.stat-description p {
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    color: #c3cbd6;
}


/* 能力卡片選取狀態 */
.stat-card.selected {
    border-color: var(--class-color);
    box-shadow: 0 0 16px var(--class-glow);
}

/* 說明卡片出現動畫 */
.stat-description {
    animation: classFadeIn 0.25s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .stat-description {
        animation: none;
    }
}


/* 能力說明關閉按鈕 */
.stat-description {
    position: relative;
    padding-right: 50px;
}

.stat-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #c3cbd6;
    font-size: 25px;
    cursor: pointer;
}

.stat-close:hover,
.stat-close:focus-visible {
    color: var(--class-color);
    border-color: var(--class-color);
    background: var(--class-glow);
}


/* 四職業比較按鈕 */
.compare-controls {
    display: flex;
    justify-content: center;
    margin: 28px 0;
}

#compare-btn {
    width: 100%;
    padding: 15px 24px;
    background: linear-gradient(135deg, #c9a45e, #80602e);
    color: #101722;
    border: 1px solid #f4d58d;
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    transition: 0.25s ease;
    box-shadow: 0 4px 18px #d4a64a33;
}

#compare-btn:hover {
    background: linear-gradient(135deg, #e4c17a, #a87b3b);
    box-shadow: 0 0 22px #d4a64a66;
    transform: translateY(-2px);
}

#compare-btn:active {
    transform: translateY(0);
}

#compare-btn:focus-visible {
    outline: 2px solid #f4d58d;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    #compare-btn {
        transition: none;
    }

    #compare-btn:hover {
        transform: none;
    }
}


/* 四職業比較表 */
.compare-panel {
    margin: 0 0 30px;
    overflow-x: auto;
    border: 1px solid #a8894e;
    border-radius: 12px;
    background: #202d40;
    animation: classFadeIn 0.3s ease-out;
}

.compare-table {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    text-align: center;
}

.compare-table th,
.compare-table td {
    padding: 15px 10px;
    border-bottom: 1px solid #35465d;
    color: #c3cbd6;
    font-size: 14px;
}

.compare-table tr:first-child th {
    color: #f1d69b;
    background: #29384c;
}

.compare-table tr:not(:first-child):hover {
    background: #304159;
}

.compare-table tr:last-child th,
.compare-table tr:last-child td {
    border-bottom: none;
}

@media (prefers-reduced-motion: reduce) {
    .compare-panel {
        animation: none;
    }
}


/* 修正職業比較區塊排列 */
.compare-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 15px;
}

/* 防止比較按鈕被表格撐高 */
#compare-btn {
    width: 100%;
    flex: none;
    min-height: 52px;
    height: auto;
}

/* 比較表獨立排列在按鈕下方 */
.compare-panel {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 0 15px;
    overflow-x: auto;
    box-sizing: border-box;
}


/* 比較表最高能力數值 */
.compare-table td.stat-best {
    color: #f4cb75;
    font-weight: bold;
    background: rgba(244, 203, 117, 0.08);
    text-shadow: 0 0 10px rgba(244, 203, 117, 0.3);
}


/* 戰術化技能比較 */
.tactical-compare {
    padding: 22px;
    border-top: 1px solid #a8894e;
}

.tactical-compare h3 {
    color: #e5bf73;
    margin: 0 0 20px;
    font-size: 20px;
}

.tactical-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.tactical-compare-card {
    background: #253247;
    border: 1px solid #35465d;
    border-radius: 10px;
    padding: 18px;
}

.tactical-compare-card h4 {
    color: #f1d69b;
    margin: 0 0 12px;
    font-size: 16px;
}

.tactical-compare-card p {
    color: #c3cbd6;
    font-size: 14px;
    line-height: 1.8;
    margin: 0;
}

@media (max-width: 600px) {
    .tactical-grid {
        grid-template-columns: 1fr;
    }

    .tactical-compare {
        padding: 15px;
    }
}


/* 戰術化技能比較 */
.tactical-compare {
    padding: 22px;
    border-top: 1px solid #a8894e;
}

.tactical-compare h3 {
    color: #e5bf73;
    margin: 0 0 20px;
    font-size: 20px;
}

.tactical-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.tactical-compare-card {
    background: #253247;
    border: 1px solid #35465d;
    border-radius: 10px;
    padding: 18px;
}

.tactical-compare-card h4 {
    color: #f1d69b;
    margin: 0 0 12px;
    font-size: 16px;
}

.tactical-compare-card p {
    color: #c3cbd6;
    font-size: 14px;
    line-height: 1.8;
    margin: 0;
}

@media (max-width: 600px) {
    .tactical-grid {
        grid-template-columns: 1fr;
    }

    .tactical-compare {
        padding: 15px;
    }
}


/* 四職業技能專屬配色 */
.tactical-warrior {
    --skill-color: #ff6b60;
}

.tactical-mage {
    --skill-color: #b79aff;
}

.tactical-priest {
    --skill-color: #79d6a5;
}

.tactical-thief {
    --skill-color: #69d4e4;
}

.tactical-compare-card {
    border-color: var(--skill-color, #35465d);
    transition: border-color 0.25s ease,
                box-shadow 0.25s ease;
}

.tactical-compare-card h4 {
    color: var(--skill-color, #f1d69b);
}

.tactical-compare-card:hover {
    box-shadow: 0 0 18px color-mix(
        in srgb,
        var(--skill-color) 25%,
        transparent
    );
}


/* 比較表職業名稱互動 */
.compare-job-link {
    background: transparent;
    border: none;
    color: #f1d69b;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 6px;
    transition: 0.2s ease;
}

.compare-job-link:hover {
    background: #a8894e33;
    color: #ffe3a1;
    text-decoration: underline;
}

.compare-job-link:focus-visible {
    outline: 2px solid #f4d58d;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .compare-job-link {
        transition: none;
    }
}


/* 技能卡片快速導覽 */
.tactical-compare-card {
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.tactical-compare-card:hover {
    transform: translateY(-3px);
}

.tactical-compare-card:focus-visible {
    outline: 2px solid var(--skill-color);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .tactical-compare-card {
        transition: none;
    }

    .tactical-compare-card:hover {
        transform: none;
    }
}


/* 手機版職業比較表優化 */
@media (max-width: 600px) {

    .compare-panel {
        width: 100%;
        overflow-x: auto;
    }

    .compare-table {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
    }

    .compare-table th,
    .compare-table td {
        padding: 12px 3px;
        font-size: 11px;
        white-space: nowrap;
    }

    .compare-table th:first-child {
        width: 27%;
    }

    .compare-table th:not(:first-child) {
        width: 18.25%;
    }

    .compare-job-link {
        font-size: 11px;
        padding: 8px 2px;
    }

    .tactical-compare {
        padding: 14px 10px;
    }

    .tactical-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .tactical-compare-card {
        padding: 14px;
    }
}


/* 修正返回頂部按鈕外觀 */
body button#back-to-top {
    position: fixed !important;
    right: 24px !important;
    bottom: 24px !important;

    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;

    padding: 0 !important;
    margin: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    border-radius: 50% !important;
    border: 1px solid #f4d58d !important;
    background: linear-gradient(135deg, #c9a45e, #80602e) !important;

    color: #101722 !important;
    font-size: 26px !important;
    font-weight: bold !important;

    cursor: pointer;
    z-index: 9999 !important;

    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);

    box-shadow: 0 4px 20px #0008;
    transition: opacity 0.25s, transform 0.25s;
}

body button#back-to-top.visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

@media (max-width: 600px) {
    body button#back-to-top {
        right: 16px !important;
        bottom: 20px !important;
    }
}



/* RPG 職業圖鑑快速導覽列 */
.quick-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0 30px;
}

.quick-nav button {
    background: #253247;
    color: #e5bf73;
    border: 1px solid #a8894e;
    border-radius: 10px;
    padding: 15px 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.quick-nav button:hover {
    background: #35465d;
    transform: translateY(-2px);
}

.quick-nav button:focus-visible {
    outline: 2px solid #f4d58d;
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .quick-nav {
        gap: 7px;
    }

    .quick-nav button {
        padding: 12px 4px;
        font-size: 12px;
    }
}


/* 職業特色卡片 */
.class-feature-card {
    margin-top: 24px;
    padding: 22px;
    background: linear-gradient(135deg, #253247, #172131);
    border: 1px solid var(--class-color, #e5bf73);
    border-left: 4px solid var(--class-color, #e5bf73);
    border-radius: 12px;
}

.class-feature-card h3 {
    margin: 0 0 12px;
    color: var(--class-color, #e5bf73);
    font-size: 19px;
}

.class-feature-card p {
    margin: 0;
    color: #c3cbd6;
    line-height: 1.9;
    font-size: 15px;
}

