/* 选手获奖档案（/award/index、/award/school）
   ----------------------------------------------------------------------------
   两页共用一套网格：同一个 .aw-row 由父级 .aw-board-* 换列定义，
   这样表头与数据行永远对齐（列定义只写一处，不靠每个单元格自己撑）。

   ★ 隐藏列时必须同步改 grid-template-columns。
     只写 display:none 会让后面所有列整体左移，表头和内容错位 ——
     排行榜那边踩过，这里一律成对写。

   配色取 theme.css 的全局变量（--brand / --line / --ink …），
   因为 theme.css 在 main.php 里全局加载，不需要本页再引入。
   奖项六个色是本文件独有的局部值，不往全局放：只有这里用得上。
   ---------------------------------------------------------------------------- */

.aw-page {
    padding: 4px 0 32px;
}

/* ------------------------------------------------------------------ 页头 */
.aw-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 32px;
    padding: 22px 0 18px;
    border-bottom: 1px solid var(--line);
}

.aw-head-text {
    min-width: 0;
}

.aw-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: .3px;
    color: var(--ink);
}

.aw-lead {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.75;
    color: var(--ink-3);
    max-width: 720px;
}

.aw-lead b {
    color: var(--ink-2);
    font-weight: 600;
}

.aw-rules {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 4px;
}

.aw-rules li {
    display: flex;
    gap: 10px;
    font-size: 12.5px;
    line-height: 1.7;
}

.aw-rule-k {
    flex: 0 0 34px;
    color: var(--muted);
    letter-spacing: 1px;
}

.aw-rule-v {
    color: var(--ink-3);
    min-width: 0;
}

.aw-rule-v b {
    color: var(--ink-2);
    font-weight: 600;
}

/* 页头右上角三格统计 */
.aw-stat {
    display: flex;
    gap: 26px;
    flex: 0 0 auto;
    padding-top: 4px;
}

.aw-stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.aw-stat-num {
    font-size: 22px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
}

.aw-stat-lab {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

/* ------------------------------------------------------------ 年份筛选 */
.aw-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line-soft);
}

.aw-chips-lab {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 1px;
    margin-right: 2px;
}

.aw-chip {
    padding: 3px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--ink-3);
    background: #fff;
    line-height: 1.6;
    transition: color .12s, border-color .12s, background-color .12s;
}

.aw-chip:hover {
    color: var(--brand);
    border-color: var(--brand);
    text-decoration: none;
}

.aw-chip.is-on {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
    text-decoration: none;
}

/* -------------------------------------------------------------- 搜索框 */
/* 榜单页放在年份筛选那一行末尾（margin-left:auto 顶到右边），
   搜索页是独立的大号版本（.aw-search-lg）。
   两处共用同一套输入框与按钮，靠 flex 撑开，不写死宽度 —— 窄屏换行后
   输入框自己会占满一行（见下面 max-width:700 的规则）。 */
.aw-search {
    display: flex;
    align-items: stretch;
    margin-left: auto;
    border: 1px solid var(--line);
    border-radius: 3px;
    overflow: hidden;
    background: #fff;
}

.aw-search-in {
    width: 190px;
    min-width: 0;
    padding: 4px 10px;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: var(--ink);
    line-height: 1.6;
}

.aw-search-in::placeholder {
    color: var(--muted);
}

.aw-search:focus-within {
    border-color: var(--brand);
}

.aw-search-btn {
    flex: 0 0 auto;
    padding: 4px 14px;
    border: 0;
    background: var(--brand);
    color: #fff;
    font-size: 13px;
    line-height: 1.6;
    cursor: pointer;
    transition: background-color .12s;
}

.aw-search-btn:hover {
    background: var(--brand-dark);
}

/* 搜索页的大号版本：整行铺开 */
.aw-search-lg {
    margin: 18px 0 0;
    border-radius: 3px;
}

.aw-search-lg .aw-search-in {
    flex: 1 1 auto;
    width: auto;
    padding: 8px 14px;
    font-size: 14px;
}

.aw-search-lg .aw-search-btn {
    padding: 8px 26px;
    font-size: 14px;
}

/* ------------------------------------------------------------------ 榜单 */
.aw-board {
    margin-top: 4px;
    border-top: 1px solid var(--line);
}

.aw-row {
    display: grid;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13.5px;
    color: var(--ink-2);
}

/* 主榜：名次 学校 最高奖项 合计 A B C
   ★ 用显式类 .aw-board-main，不用 :not(.aw-board-year):not(.aw-board-list) 那种排除写法。
     排除写法每加一张新表就得再加一个 :not，加完特异性还高到没法用普通类覆盖 ——
     搜索页的学生表、认领页的勾选表都踩过这个坑。 */
.aw-board-main .aw-row {
    grid-template-columns: 60px minmax(0, 1fr) 220px 60px 44px 44px 44px;
}

.aw-row-head {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 1px;
    padding-top: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
    background: transparent;
}

.aw-row.is-top {
    background: #FBFCFB;
}

.aw-row.is-top .c-no {
    color: var(--brand);
    font-weight: 700;
}

.aw-row:not(.aw-row-head):hover {
    background: var(--brand-soft);
}

.c-no,
.c-n,
.c-g {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.c-g {
    color: var(--ink-3);
    font-size: 12.5px;
}

.c-school {
    /* 校名可能是「景东彝族自治县海亮高级中学」这种长串。
       min-width:0 是 grid 子项能收缩的前提，少了它 ellipsis 不生效。 */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.c-school a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.c-school a:hover {
    color: var(--brand);
    border-bottom-color: var(--brand);
    text-decoration: none;
}

.c-best {
    color: var(--ink-3);
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aw-empty {
    padding: 40px 12px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* ------------------------------------------------------------------ 分页 */
.aw-pager-wrap {
    margin: 20px 0 4px;
    text-align: center;
}

.aw-foot-note {
    margin: 16px 0 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.7;
}

/* -------------------------------------------------------------- 学校详情 */
.aw-sch-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 0 18px;
    border-bottom: 1px solid var(--line);
}

.aw-sch-main {
    min-width: 0;
}

.aw-sch-sub {
    margin: 0;
    font-size: 13px;
    color: var(--ink-3);
}

.aw-sch-sub b {
    color: var(--ink-2);
    font-weight: 600;
}

.aw-sch-rank {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    padding: 2px 0 2px 18px;
    border-left: 1px solid var(--line);
}

.aw-sch-rank-k {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 1px;
}

.aw-sch-rank-n {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

.aw-sch-rank.is-top .aw-sch-rank-n {
    color: var(--brand);
}

.aw-sch-rank-t {
    font-size: 11.5px;
    color: var(--muted);
}

/* 四张分档卡 */
.aw-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0 26px;
}

.aw-tile {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 3px;
}

.aw-tile-k {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 1px;
}

.aw-tile-n {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.aw-tile-d {
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--muted);
}

.aw-tile-a .aw-tile-n {
    color: #8A5A2B;
}

.aw-tile-b .aw-tile-n {
    color: var(--brand);
}

.aw-tile-c .aw-tile-n {
    color: var(--ink-3);
}

.aw-tile-best-v {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--ink-2);
}

.aw-h2 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-2);
    letter-spacing: .5px;
}

.aw-board-year {
    margin-bottom: 26px;
}

.aw-board-year .aw-row {
    grid-template-columns: 60px minmax(0, 1fr) 60px 44px 44px 44px;
}

/* 名单：年份 赛事 奖项 姓名 指导教师 年级
   教师列 150px —— 最长值「朱桂荣、郑作贵、杨津京」11 个汉字，12.5px 字号约 138px，
   再紧就会截断；实测只有 36 条是多教师，其余多为 2–3 字，留白可接受。 */
.aw-board-list .aw-row {
    grid-template-columns: 60px minmax(0, 1fr) 96px 130px 150px 76px;
}

.c-level {
    justify-self: start;
}

.c-name {
    color: var(--ink);
}

.c-grade {
    color: var(--ink-3);
    font-size: 12.5px;
}

/* 分数：等宽数字，扫一列时位数能对上；
   空值显示「—」—— 精英赛那 556 条原始名单没有分数，不是 0 分 */
.c-score {
    color: var(--ink-2);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

/* 指导教师：多数行没有（CSP-J/S 官方不公布），所以只有 5% 有值。
   空值统一显示淡「—」，跟年级同一口径；有值的加 title 兜住省略号。
   ★ 不写 :empty{display:none} —— grid 里某个子项 display:none 会让后面所有列
     整体左移，表头和数据行就错位了（主榜隐藏 A/B/C 时踩过）。 */
.c-teacher {
    color: var(--ink-3);
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 年级 = 获奖当时的年级（grade_at），不是现在读几年级。
   取值有「高一」「六年级」「小学/无」，最长的「小学/无」约 58px，
   所以列宽给死，别用 auto —— 否则同一列在不同行会各自不同宽。 */
.c-grade {
    color: var(--ink-3);
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aw-stage {
    font-style: normal;
    margin-left: 6px;
    padding: 0 6px;
    font-size: 11px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 2px;
}

/* 奖项胶囊：六档颜色只在局部定义 */
.aw-lv {
    display: inline-block;
    padding: 1px 9px;
    font-size: 12px;
    line-height: 1.7;
    border-radius: 999px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.aw-lv-gold {
    color: #8A5A00;
    background: #FBF3E0;
    border-color: #EBD9B4;
}

.aw-lv-silver {
    color: #55606B;
    background: #F2F4F6;
    border-color: #DCE1E6;
}

.aw-lv-bronze {
    color: #8A5A2B;
    background: #FAF1E9;
    border-color: #EBD8C6;
}

.aw-lv-first {
    color: var(--brand);
    background: var(--brand-soft);
    border-color: #CFE0DD;
}

.aw-lv-second {
    color: var(--ink-2);
    background: #F1F3F2;
    border-color: #E1E5E3;
}

.aw-lv-third {
    color: var(--ink-3);
    background: #F7F8F7;
    border-color: var(--line);
}

/* 未登录时的名单占位 */
.aw-locked {
    padding: 26px 20px;
    border: 1px dashed var(--line);
    border-radius: 3px;
    background: #FCFCFB;
    text-align: center;
}

.aw-locked-t {
    margin: 0 0 6px;
    font-size: 14px;
    color: var(--ink-2);
}

.aw-locked-d {
    margin: 0 0 14px;
    font-size: 12.5px;
    color: var(--muted);
}

.aw-locked-act {
    margin: 0;
}

.aw-btn {
    display: inline-block;
    padding: 6px 20px;
    font-size: 13px;
    color: #fff;
    background: var(--brand);
    border-radius: 3px;
}

.aw-btn:hover {
    color: #fff;
    background: var(--brand-dark);
    text-decoration: none;
}

/* ------------------------------------------------- 搜索结果 / 认领页 */

/* h2 的上边距要单独给：.aw-h2 原本只用于学校详情页（上面是 .aw-tiles，
   自带 26px 下边距），所以 margin-top 是 0。搜索页、认领页的 h2 上面
   是搜索框或表格，不补上边距就粘在一起。 */
.aw-h2-gap {
    margin-top: 22px;
}

/* h2 右边的说明小字（结果条数） */
.aw-h2-note {
    margin-left: 8px;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
    letter-spacing: 0;
}

/* 结果提示条：认领成功 / 失败原因。站内 flash 前后台都不渲染，
   这类结果只能自己造一个看得见的东西。 */
.aw-note {
    margin: 14px 0 0;
    padding: 9px 14px;
    font-size: 13px;
    line-height: 1.7;
    border-radius: 3px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
}

.aw-note-ok {
    border-color: #CFE0DD;
    background: var(--brand-soft);
    color: var(--brand);
}

.aw-note-ok a {
    color: var(--brand);
    text-decoration: underline;
}

.aw-note-err {
    border-color: #EBD8C6;
    background: #FAF1E9;
    color: var(--warn);
}

/* 学生搜索结果：年份 赛事 奖项 姓名 学校 */
/* 学生结果表：年份 赛事 分数 奖项 姓名 指导教师 学校
   ★ 分数列只有 60px，最长的分数是 400（NOIP 满分），三位数放得下 */
.aw-board-people .aw-row {
    grid-template-columns: 56px minmax(0, 170px) 60px 96px 96px 56px 130px minmax(0, 1fr);
}

/* 认领表：勾选 年份 赛事 奖项 学校 年级 */
.aw-board-claim .aw-row {
    grid-template-columns: 40px 56px minmax(0, 1fr) 100px minmax(0, 1fr) 70px;
}

.c-pick {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* 整行可点：<label class="aw-row"> 包住 checkbox。
   label 默认是 inline，必须让 .aw-row 的 display:grid 继续生效。 */
label.aw-row {
    display: grid;
}

.aw-row-pick {
    cursor: pointer;
}

.aw-row-pick:hover {
    background: var(--brand-soft);
}

.aw-row-pick input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.aw-claim-act {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin: 18px 0 22px;
}

/* .aw-btn 原本只给 <a> 用，这里 <button> 要自己抹掉浏览器默认边框与字体 */
.aw-claim-act .aw-btn {
    border: 0;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.6;
}

.aw-claim-tip {
    font-size: 12px;
    color: var(--muted);
}

/* ------------------------------------------------------------- 响应式 */
@media (max-width: 991px) {
    .aw-head {
        flex-direction: column;
        gap: 14px;
    }

    .aw-stat {
        gap: 22px;
        padding-top: 0;
    }

    .aw-stat-item {
        align-items: flex-start;
    }

    /* 主榜：收掉 A/B/C 三列 */
    .aw-board-main .aw-row {
        grid-template-columns: 52px minmax(0, 1fr) 160px 52px;
    }

    .aw-board-main .c-g {
        display: none;
    }

    .aw-tiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* 名单：收掉年级，保留教师（教师是本轮新增的功能点，年级在年份矩阵里也能看出分布）
       教师列 140px = 最长值 138px 刚好容下；再窄就会出现省略号（有 title 兜底，但不好看） */
    .aw-board-list .aw-row {
        grid-template-columns: 52px minmax(0, 1fr) 78px 100px 116px 56px;
    }

    /* 学生搜索结果：收掉学校（同校多条时重复显示也没信息量），分数/年级/教师保留 */
    .aw-board-people .aw-row {
        grid-template-columns: 52px minmax(0, 1fr) 56px 84px 84px 50px 108px;
    }

    .aw-board-people .c-school {
        display: none;
    }

    /* 认领表：收掉年级 */
    .aw-board-claim .aw-row {
        grid-template-columns: 36px 52px minmax(0, 1fr) 92px minmax(0, 120px);
    }

    .aw-board-claim .c-grade {
        display: none;
    }
}

@media (max-width: 700px) {
    .aw-title {
        font-size: 19px;
    }

    .aw-rules li {
        font-size: 12px;
    }

    /* 主榜：再收掉最高奖项 */
    .aw-board-main .aw-row {
        grid-template-columns: 44px minmax(0, 1fr) 52px;
        gap: 8px;
    }

    .aw-board-main .c-best {
        display: none;
    }

    .aw-row {
        padding: 9px 4px;
    }

    .aw-tiles {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    /* 年份矩阵：收掉 A/B/C */
    .aw-board-year .aw-row {
        grid-template-columns: 44px minmax(0, 1fr) 52px;
        gap: 8px;
    }

    .aw-board-year .c-g {
        display: none;
    }

    /* 名单：收掉赛事与教师，只留 年份 / 奖项 / 姓名 / 年级 */
    .aw-board-list .aw-row {
        grid-template-columns: 44px 86px minmax(0, 1fr) 52px;
        gap: 8px;
    }

    .aw-board-list .c-series {
        display: none;
    }

    .aw-board-list .c-teacher {
        display: none;
    }

    .aw-sch-head {
        flex-direction: column;
        gap: 10px;
    }

    .aw-sch-rank {
        flex-direction: row;
        align-items: baseline;
        gap: 8px;
        padding: 0;
        border-left: 0;
    }

    .aw-sch-rank-n {
        font-size: 20px;
    }

    /* 学生搜索结果：再收掉赛事，只留 年份 / 奖项 / 姓名 / 年级 */
    .aw-board-people .aw-row {
        grid-template-columns: 44px 70px minmax(0, 1fr) 56px;
        gap: 8px;
    }

    .aw-board-people .c-series {
        display: none;
    }

    /* 分数和教师一起收掉：700px 下这张表只剩「哪年、什么奖、谁」 */
    .aw-board-people .c-score,
    .aw-board-people .c-teacher {
        display: none;
    }

    /* 认领表：只留 勾选 / 年份 / 赛事 / 奖项。
       学校列收掉不影响判断 —— 候选本来就是按「姓名 + 学校」筛出来的，条条同校。 */
    .aw-board-claim .aw-row {
        grid-template-columns: 30px 40px minmax(0, 1fr) 78px;
        gap: 8px;
    }

    .aw-board-claim .c-school {
        display: none;
    }

    /* 搜索框：换行后占满一行，别缩在右上角 */
    .aw-search {
        width: 100%;
        margin-left: 0;
    }

    .aw-search-in {
        flex: 1 1 auto;
        width: auto;
    }
}
