/* ============================================================
   Standalone ranking pages - shared stylesheet
   Palette matched to forum theme dsvue_cgmvred2013 (primary #852a2a)
   ASCII only on purpose: the pages are served as GBK.
   ============================================================ */

* { box-sizing: border-box; }

body.rank-page {
    margin: 0;
    padding: 22px 12px 46px;
    background: #f3f1f1;
    color: #333;
    font: 14px/1.65 "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

.rank-wrap { max-width: 1080px; margin: 0 auto; }

/* ---------- card ---------- */
.rank-card {
    background: #fff;
    border: 1px solid #e2dbdb;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(133, 42, 42, .08);
    overflow: hidden;
}

/* ---------- header ---------- */
.rank-head {
    padding: 18px 22px;
    background: #852a2a;
    background: linear-gradient(135deg, #852a2a 0%, #a13a3a 100%);
    color: #fff;
}
.rank-head h1 {
    margin: 0;
    font-size: 21px;
    font-weight: 600;
    letter-spacing: .5px;
}
.rank-head .rank-sub {
    margin-top: 5px;
    font-size: 12px;
    color: #f0d6d6;
}

/* ---------- meta bar ---------- */
.rank-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    align-items: center;
    justify-content: space-between;
    padding: 11px 22px;
    background: #faf8f8;
    border-bottom: 1px solid #e2dbdb;
    font-size: 12px;
    color: #848484;
}
.rank-meta strong { color: #852a2a; font-weight: 600; }

/* ---------- table ---------- */
.rank-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.rank-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;          /* 固定布局，列宽严格按下面的规则分配 */
}

/* 表头：默认左对齐 */
table.rank-table thead th {
    padding: 12px 14px;
    background: #852a2a;
    color: #fff;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid #6d2121;
    overflow: hidden;
    text-overflow: ellipsis;
}

table.rank-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0eaea;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

table.rank-table tbody tr:nth-child(odd)  { background: #fff; }
table.rank-table tbody tr:nth-child(even) { background: #faf8f8; }
table.rank-table tbody tr:hover { background: #f7eded; }

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

/* ------------------------------------------------------------------
   对齐规则
   注意优先级：必须是「类 + thead + th」这种组合才压得过
   上面那条 `table.rank-table thead th`（优先级 0,1,3）。
   单纯 `th.rank-num` 只有 (0,1,1)，会被覆盖 —— 这正是之前错位的原因。
   ------------------------------------------------------------------ */

/* 数字列：表头和数据都右对齐 */
table.rank-table thead th.rank-num,
table.rank-table tbody td.rank-num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* 名次列：居中 */
table.rank-table thead th.rank-idx,
table.rank-table tbody td.rank-idx {
    text-align: center;
    white-space: nowrap;
}

/* 玩家名/商品名：左对齐 + 主色 */
table.rank-table tbody td.rank-name {
    color: #6d2121;
    font-weight: 600;
}

/* ---------- 列宽分配（配合 table-layout: fixed）---------- */

/* 自由市场：商品名 | 数量 | 魔币 | 精华 | 出售者 */
table.rank-table.cols-market th:nth-child(1), table.rank-table.cols-market td:nth-child(1) { width: 26%; }
table.rank-table.cols-market th:nth-child(2), table.rank-table.cols-market td:nth-child(2) { width: 12%; }
table.rank-table.cols-market th:nth-child(3), table.rank-table.cols-market td:nth-child(3) { width: 19%; }
table.rank-table.cols-market th:nth-child(4), table.rank-table.cols-market td:nth-child(4) { width: 14%; }
table.rank-table.cols-market th:nth-child(5), table.rank-table.cols-market td:nth-child(5) { width: 29%; }

/* 排行榜：名次 | 玩家名 | 数值 */
table.rank-table.cols-rank th:nth-child(1), table.rank-table.cols-rank td:nth-child(1) { width: 88px; }
table.rank-table.cols-rank th:nth-child(2), table.rank-table.cols-rank td:nth-child(2) { width: auto; }
table.rank-table.cols-rank th:nth-child(3), table.rank-table.cols-rank td:nth-child(3) { width: 32%; }

/* ---------- rank medals ---------- */
.medal {
    display: inline-block;
    min-width: 26px;
    height: 26px;
    line-height: 26px;
    padding: 0 7px;
    border-radius: 13px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: #b9b0b0;
}
.medal.m1 { background: #c9a227; background: linear-gradient(135deg, #e8c158, #c9a227); }
.medal.m2 { background: #9e9e9e; background: linear-gradient(135deg, #c9c9c9, #9e9e9e); }
.medal.m3 { background: #b87333; background: linear-gradient(135deg, #d99a5b, #b87333); }
.medal.plain { background: #efe9e9; color: #848484; font-weight: 600; }

/* ---------- empty / error ---------- */
.rank-msg { padding: 46px 22px; text-align: center; color: #848484; }
.rank-msg .rank-msg-icon {
    display: block;
    font-size: 32px;
    line-height: 1;
    margin-bottom: 10px;
    opacity: .45;
}
.rank-msg.is-error { color: #852a2a; }

/* ---------- footer ---------- */
.rank-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    justify-content: space-between;
    padding: 13px 22px;
    background: #faf8f8;
    border-top: 1px solid #e2dbdb;
    font-size: 12px;
    color: #9a9a9a;
}
.rank-foot a { color: #852a2a; text-decoration: none; }
.rank-foot a:hover { text-decoration: underline; }

/* ---------- small screens ---------- */
@media screen and (max-width: 900px) {
    /* 窄屏改为自动布局，避免固定百分比把内容挤没 */
    table.rank-table { table-layout: auto; }
    table.rank-table.cols-market th:nth-child(n),
    table.rank-table.cols-market td:nth-child(n) { width: auto; min-width: 68px; }
    table.rank-table.cols-market th:nth-child(1),
    table.rank-table.cols-market td:nth-child(1) { min-width: 110px; }
    table.rank-table.cols-rank th:nth-child(1),
    table.rank-table.cols-rank td:nth-child(1) { width: 64px; min-width: 64px; }
}

@media screen and (max-width: 736px) {
    body.rank-page { padding: 12px 8px 30px; }
    .rank-head { padding: 14px 15px; }
    .rank-head h1 { font-size: 17px; }
    .rank-meta { padding: 9px 15px; gap: 6px 12px; }
    table.rank-table { font-size: 13px; }
    table.rank-table thead th { padding: 10px; }
    table.rank-table tbody td { padding: 9px 10px; }
    .rank-foot { padding: 11px 15px; }
}
@media screen and (max-width: 480px) {
    table.rank-table { font-size: 12px; }
    table.rank-table thead th { padding: 9px 8px; }
    table.rank-table tbody td { padding: 8px 8px; }
    .medal { min-width: 22px; height: 22px; line-height: 22px; font-size: 12px; padding: 0 5px; border-radius: 11px; }
    .rank-head h1 { font-size: 16px; }
}

/* ============================================================
   扩展：庄园卡片网格 + 计算器 + 通用组件
   与论坛主题 dsvue_cgmvred2013 配色一致（主色 #852a2a）
   ============================================================ */

/* ---------- 通用页头（借给没有 .rank-head 的页面用） ---------- */
.page-head {
    padding: 18px 22px;
    background: #852a2a;
    background: linear-gradient(135deg, #852a2a 0%, #a13a3a 100%);
    color: #fff;
    border-radius: 10px 10px 0 0;
}
.page-head h1, .page-head h2 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: .5px; }
.page-head .page-sub { margin-top: 5px; font-size: 12px; color: #f0d6d6; }

/* ---------- 卡片网格（庄园大盘） ---------- */
.vgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    padding: 16px;
}

.v-card {
    background: #fff;
    border: 1px solid #e2dbdb;
    border-radius: 10px;
    border-top: 4px solid #852a2a;
    box-shadow: 0 2px 8px rgba(133, 42, 42, .07);
    padding: 15px 16px 13px;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s, transform .15s;
}
.v-card:hover { box-shadow: 0 5px 16px rgba(133, 42, 42, .16); transform: translateY(-1px); }
.v-card.empty-stock { border-top-color: #b9b0b0; opacity: .82; }
.v-card.empty-stock:hover { transform: none; }

.v-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.v-name { font-size: 16px; font-weight: 600; color: #6d2121; }
.v-rank { font-size: 15px; white-space: nowrap; letter-spacing: 1px; }
.v-owner { font-size: 12px; color: #848484; margin: 5px 0 12px; }

.v-stats {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 7px 11px;
    background: #faf8f8;
    border: 1px solid #f0eaea;
    border-radius: 6px;
    margin-bottom: 12px;
}
.stat-mult { font-weight: 600; color: #8e44ad; }
.stat-stock { font-weight: 600; color: #1e8e4e; }
.stat-stock.out { color: #c0392b; }

.item-list { border-top: 1px dashed #ece4e4; padding-top: 10px; flex-grow: 1; }
.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: 13px;
}
.item-row + .item-row { border-top: 1px solid #f7f2f2; }
.item-name { color: #444; }
.price-box { text-align: right; white-space: nowrap; }
.base-price { text-decoration: line-through; color: #b9b0b0; font-size: 12px; margin-right: 6px; }
.actual-price { font-weight: 600; color: #c0671e; }

/* ---------- 计算器 ---------- */
.calc-wrap { max-width: 460px; margin: 0 auto; }
.calc-body { padding: 20px 22px 22px; }

.calc-field { margin-bottom: 20px; }
.calc-field label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    color: #444;
    margin-bottom: 9px;
}
.calc-val { color: #c0671e; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; background: transparent; margin: 0; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track {
    width: 100%; height: 7px; cursor: pointer;
    background: #ece4e4; border-radius: 4px;
}
input[type=range]::-webkit-slider-thumb {
    height: 22px; width: 22px; border-radius: 50%;
    background: #852a2a; cursor: pointer;
    -webkit-appearance: none; margin-top: -7.5px;
    box-shadow: 0 2px 5px rgba(133,42,42,.35);
    border: 2px solid #fff;
}
input[type=range]::-moz-range-track { width: 100%; height: 7px; background: #ece4e4; border-radius: 4px; }
input[type=range]::-moz-range-thumb {
    height: 20px; width: 20px; border-radius: 50%; background: #852a2a;
    cursor: pointer; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(133,42,42,.35);
}
input[type=range]:focus::-webkit-slider-runnable-track { background: #e0d5d5; }

.calc-result {
    background: #faf8f8;
    border: 1px solid #ece4e4;
    border-radius: 8px;
    padding: 16px 18px;
    margin-top: 22px;
}
.calc-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 14px;
    color: #555;
    padding: 5px 0;
}
.calc-line b { color: #852a2a; font-variant-numeric: tabular-nums; }
.calc-line.ok b { color: #1e8e4e; }
.calc-total {
    border-top: 1px dashed #ddd0d0;
    margin-top: 9px;
    padding-top: 11px;
    font-size: 17px;
    font-weight: 700;
    color: #444;
}
.calc-total b { color: #c0392b; }

.calc-alert {
    margin-top: 16px;
    padding: 11px 14px;
    border-radius: 7px;
    font-size: 13px;
    text-align: center;
    background: #fdf3e3;
    color: #a35a10;
    border: 1px solid #f0d9b5;
    display: none;
}
.calc-alert.danger { background: #fdeaea; color: #a8231b; border-color: #f3c9c5; }

/* ---------- 面包屑 ---------- */
.page-crumb {
    padding: 11px 22px;
    background: #faf8f8;
    border-bottom: 1px solid #e2dbdb;
    font-size: 12px;
    color: #848484;
}
.page-crumb a { color: #852a2a; text-decoration: none; }
.page-crumb a:hover { text-decoration: underline; }

@media screen and (max-width: 736px) {
    .vgrid { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
    .v-card { padding: 13px 14px 11px; }
    .v-name { font-size: 15px; }
    .calc-body { padding: 16px 15px 18px; }
    .page-head { padding: 14px 15px; }
    .page-head h1, .page-head h2 { font-size: 17px; }
    .page-crumb { padding: 9px 15px; }
}

/* ---------- 传送信息行（传送单价 / 许可次数） ---------- */
.v-stats-tp {
    margin-top: -6px;          /* 紧贴上面那行，视觉成组 */
    background: #fdf8f2;
    border-color: #f2e3d0;
}
.stat-tp { color: #8a6a3d; }
.stat-tp b { color: #c0671e; font-weight: 700; font-variant-numeric: tabular-nums; }
