/* ============================================================
   楚风魔方 - 魔方公式库样式
   ============================================================ */

.fx-page {
    background: var(--color-bg-gray, #f6f6f6);
    --max-width: 1880px;
}

.fx-page .container {
    max-width: 1880px;
}

.fx-main {
    padding-top: var(--header-height, 72px);
    min-height: 70vh;
}

/* ---------- 顶部横幅 ---------- */
.fx-hero {
    background: linear-gradient(135deg, #172950 0%, #2a4a8f 60%, #447fbf 100%);
    color: #fff;
    padding: 40px 0 34px;
}

.fx-hero-title {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.fx-hero-sub {
    font-size: 14px;
    opacity: 0.9;
    max-width: 720px;
    line-height: 1.8;
}

/* ---------- 主体 ---------- */
.fx-body {
    padding-top: 22px;
    padding-bottom: 40px;
}

/* 分类标签 */
.fx-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.fx-tab {
    border: 1px solid #ddd;
    background: #fff;
    color: var(--color-text, #333);
    padding: 8px 20px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.fx-tab:hover {
    border-color: var(--color-primary, #c40000);
    color: var(--color-primary, #c40000);
}

.fx-tab.active {
    background: var(--color-primary, #c40000);
    border-color: var(--color-primary, #c40000);
    color: #fff;
    box-shadow: 0 4px 12px rgba(196, 0, 0, 0.25);
}

.fx-tab .fx-tab-count {
    font-size: 12px;
    opacity: 0.8;
    margin-left: 4px;
}

.fx-desc {
    color: var(--color-text-gray, #666);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 16px;
    background: #fff;
    border-left: 3px solid var(--color-primary, #c40000);
    padding: 10px 16px;
    border-radius: 6px;
}

/* 工具条 */
.fx-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.fx-search {
    flex: 0 1 260px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    outline: none;
    transition: border-color 0.2s ease;
}

.fx-search:focus {
    border-color: var(--color-primary, #c40000);
}

.fx-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fx-chip {
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #555;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.fx-chip:hover {
    border-color: #bbb;
}

.fx-chip.active {
    background: #172950;
    border-color: #172950;
    color: #fff;
}

/* 卡片网格：每行 4 个情形 */
.fx-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.fx-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm, 0 2px 10px rgba(0, 0, 0, 0.06));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    content-visibility: auto;
    contain-intrinsic-size: auto 300px;
}

.fx-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.fx-card-cube {
    background: linear-gradient(160deg, #f3f6fb, #e7edf7);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 132px;
}

.fx-card-cube .cube-svg {
    width: 100%;
    height: auto;
    max-height: 150px;
}

.cube-svg {
    display: block;
    width: 100%;
    height: auto;
}

.fx-card-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.fx-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.fx-name {
    font-size: 15px;
    font-weight: 700;
    color: #222;
}

.fx-tag {
    display: inline-block;
    font-size: 11px;
    color: #2a4a8f;
    background: #eef2fb;
    border-radius: 999px;
    padding: 2px 9px;
    white-space: nowrap;
}

.fx-alg {
    font-family: "Consolas", "Menlo", monospace;
    font-size: 13px;
    color: #1a1a1a;
    background: #f6f6f6;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 8px 10px;
    text-align: left;
    line-height: 1.6;
    word-break: break-word;
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease;
    flex: 1;
    min-height: 40px;
}

.fx-alg:hover {
    background: #eef7ee;
    border-color: #b7e0b7;
}

.fx-alg::after {
    content: "复制";
    position: absolute;
    right: 6px;
    bottom: 4px;
    font-size: 10px;
    color: #aaa;
    font-family: inherit;
}

.fx-scramble {
    font-family: "Consolas", "Menlo", monospace;
    font-size: 14px;
    font-weight: 700;
    color: #444;
    background: #fbfbfb;
    border: 1px dashed #e5e5e5;
    border-radius: 8px;
    padding: 7px 10px;
    line-height: 1.55;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.fx-scramble::before {
    content: "打乱 ";
    color: #c40000;
    font-weight: 700;
    font-family: inherit;
}

.fx-scramble:hover { background: #fff7f0; border-color: #f0c9a0; }

.fx-alt-hint {
    font-size: 12px;
    color: #2a4a8f;
    text-align: right;
}

/* 卡片内列出全部复原公式 */
.fx-alg-label {
    font-size: 11px;
    color: #999;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.fx-algs {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fx-alg-item {
    flex: none;
    min-height: 0;
    font-size: 15px;
    font-weight: 700;
    padding: 8px 11px;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}

.fx-alg-item::after { content: none; }

.fx-alg-idx {
    display: inline-block;
    min-width: 16px;
    margin-right: 3px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    color: #2a4a8f;
}

.fx-alt-box { margin-bottom: 8px; font-size: 13px; }
.fx-alt-box:last-child { margin-bottom: 0; }

.fx-status {
    text-align: center;
    color: var(--color-text-light, #999);
    padding: 30px 0;
    font-size: 14px;
}

.fx-status[hidden] { display: none; }

.fx-card.hidden { display: none; }

/* ---------- 详情弹窗 ---------- */
.fx-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.fx-modal.active { display: flex; }

.fx-modal-card {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 720px;
    max-height: 92vh;
    overflow: auto;
    position: relative;
    padding: 26px;
}

.fx-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    border: none;
    background: transparent;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.fx-modal-close:hover { color: #333; }

.fx-modal-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    align-items: start;
}

.fx-modal-cube {
    background: linear-gradient(160deg, #f3f6fb, #e7edf7);
    border-radius: 12px;
    padding: 18px;
}

.fx-modal-info h3 {
    font-size: 22px;
    margin-bottom: 8px;
}

.fx-field {
    margin-top: 16px;
}

.fx-field > label {
    display: block;
    font-size: 12px;
    color: var(--color-text-light, #999);
    margin-bottom: 6px;
    font-weight: 600;
}

.fx-copy-box {
    display: block;
    width: 100%;
    text-align: left;
    font-family: "Consolas", "Menlo", monospace;
    font-size: 14px;
    line-height: 1.7;
    color: #1a1a1a;
    background: #f6f6f6;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    word-break: break-word;
    transition: background 0.15s ease;
}

.fx-copy-box:hover { background: #eef7ee; border-color: #b7e0b7; }

.fx-note {
    font-size: 14px;
    color: #444;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* ---------- 页脚 ---------- */
.fx-page .site-footer {
    margin-top: 0;
}

.footer-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.fx-footer-brand img { height: 40px; }
.fx-footer-brand p { font-size: 13px; opacity: 0.85; margin-top: 6px; }
.fx-footer-links a { color: #fff; opacity: 0.85; font-size: 14px; }
.fx-footer-links a:hover { opacity: 1; text-decoration: underline; }

/* 复制提示 */
.fx-toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(23, 41, 80, 0.94);
    color: #fff;
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 3000;
}

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

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
    .fx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .fx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .fx-hero-title { font-size: 24px; }
    .fx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .fx-card-cube { min-height: 110px; padding: 10px; }
    .fx-modal-grid { grid-template-columns: 1fr; }
    .fx-modal-cube { max-width: 260px; margin: 0 auto; }
    .fx-search { flex: 1 1 100%; }
}

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