/* ไอคอนกิจกรรม + หน้า "ลุ้นสด" */

/* ---------- ตราโรงเรียน ---------- */
.auth-logo.has-img { width: 112px; height: 112px; background: #fff; padding: 6px; border-radius: 26px; box-shadow: 0 8px 22px rgba(6, 78, 59, .22); }
.auth-logo.has-img img { border-radius: 20px; }
.admin-sidebar .brand .logo.has-img { background: #fff; padding: 3px; overflow: hidden; }
.admin-sidebar .brand .logo.has-img img { width: 100%; height: 100%; object-fit: contain; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; background: #fff; padding: 2px; object-fit: contain; flex: none; }

/* utility: ให้ข้อความยาวตัดด้วย … ภายใน flex/grid ได้ (Bootstrap 5.3 ไม่มีคลาสนี้) */
.min-w-0 { min-width: 0; }
.race-main .race-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- ไอคอนกิจกรรม ---------- */
.icon-bubble { flex: none; width: 46px; height: 46px; border-radius: 14px; display: inline-grid; place-items: center; font-size: 1.55rem; line-height: 1;
    background: linear-gradient(135deg, #fff, var(--em-50)); border: 1px solid var(--em-100); box-shadow: var(--shadow-sm); }
.icon-bubble.lg { width: 64px; height: 64px; font-size: 2.2rem; border-radius: 18px; }
.icon-bubble.sm { width: 34px; height: 34px; font-size: 1.15rem; border-radius: 10px; }
.activity-card .icon-bubble { transition: transform .2s ease; }
.activity-card:hover .icon-bubble { transform: rotate(-8deg) scale(1.08); }
.detail-hero .icon-bubble { background: rgba(255, 255, 255, .95); border: 0; }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; max-height: 168px; overflow-y: auto; padding: 6px; border: 1px solid var(--gray-200); border-radius: 10px; }
.icon-picker button { border: 1px solid transparent; background: #fff; border-radius: 8px; font-size: 1.35rem; line-height: 1; padding: 6px 0; }
.icon-picker button:hover { background: var(--em-50); }
.icon-picker button.active { border-color: var(--em-600); background: var(--em-50); }

/* ---------- หน้า "ลุ้นสด" ---------- */
.board-hero { border-radius: 22px; padding: 1.4rem; color: #fff; display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; justify-content: space-between;
    background: radial-gradient(600px 300px at 0% 0%, rgba(201, 162, 39, .35), transparent 60%), linear-gradient(135deg, var(--em-900), var(--em-600)); box-shadow: var(--shadow); }
.board-hero-main { flex: 1 1 340px; min-width: 0; }
.board-title { color: #fff; font-size: clamp(1.35rem, 3.5vw, 2.2rem); font-weight: 800; margin: .25rem 0 .35rem; }
.board-sub { color: rgba(255, 255, 255, .88); }
.live-dot-light { color: rgba(255, 255, 255, .85) !important; }
.countdown { display: flex; gap: .5rem; }
.countdown > div { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); border-radius: 14px; min-width: 66px; padding: .45rem .5rem; text-align: center; }
.countdown b { display: block; font-size: clamp(1.4rem, 4vw, 2.1rem); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.countdown span { font-size: .75rem; opacity: .85; }
.countdown.urgent > div { background: rgba(201, 162, 39, .35); border-color: var(--gold-500); }
.board-ring-wrap { text-align: center; flex: none; margin: 0 auto; }
.board-ring { --p: 0; width: 168px; height: 168px; border-radius: 50%; display: grid; place-items: center;
    background: conic-gradient(var(--gold-500) calc(var(--p) * 1%), rgba(255, 255, 255, .18) 0); }
.board-ring-inner { width: 128px; height: 128px; border-radius: 50%; background: var(--em-800); display: grid; place-content: center; }
.board-ring-inner b { font-size: 2rem; font-weight: 800; line-height: 1; }
.board-ring-inner span { font-size: .8rem; opacity: .85; }
.board-ring-caption { margin-top: .5rem; font-size: .9rem; opacity: .9; }
.board-stat { background: #fff; border: 1px solid var(--gray-200); border-radius: 16px; padding: .8rem .9rem; display: flex; gap: .7rem; align-items: center; box-shadow: var(--shadow-sm); height: 100%; }
.board-stat .emoji { font-size: 1.9rem; line-height: 1; }
.board-stat b { display: block; font-size: 1.55rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.board-stat small { color: var(--gray-500); }
.board-card .card-header { font-size: 1.02rem; }

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.rank-list li { display: flex; gap: .65rem; align-items: center; }
.rank { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--gray-100); color: var(--gray-700); }
.rank-1 { background: var(--gold-500); color: #fff; }
.rank-2 { background: #8f9c96; color: #fff; }
.rank-3 { background: #b9774a; color: #fff; }
.hot { font-weight: 800; color: #c2410c; background: #fff1e7; border-radius: 99px; padding: .15rem .55rem; font-size: .85rem; white-space: nowrap; }

.almost-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; }
.almost { display: flex; gap: .6rem; align-items: center; border: 1px solid var(--gray-200); border-radius: 14px; padding: .55rem .65rem; background: #fffdf6; }
.left-badge { flex: none; font-weight: 800; font-size: .8rem; color: #9a3412; background: #ffe4d5; border-radius: 99px; padding: .2rem .55rem; white-space: nowrap; }
.left-badge.pulse { animation: pop 1.2s ease-in-out infinite; }
@keyframes pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }

.grade-row { display: grid; grid-template-columns: 44px 1fr 120px; gap: .6rem; align-items: center; margin-bottom: .8rem; }
.grade-label { font-weight: 800; color: var(--em-800); }
.grade-track { position: relative; height: 14px; border-radius: 99px; background: var(--gray-100); }
.grade-bar { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--em-500), var(--em-700)); transition: width .8s ease; }
.grade-runner { position: absolute; top: 50%; transform: translate(-50%, -58%); font-size: 1.3rem; transition: left .8s ease; }
.grade-num { font-weight: 700; text-align: right; }
.grade-num small { color: var(--gray-500); font-weight: 500; }

.ticker { list-style: none; margin: 0; padding: .25rem 0; max-height: 330px; overflow-y: auto; }
.ticker li { display: flex; gap: .6rem; align-items: center; padding: .5rem 1rem; border-bottom: 1px dashed var(--gray-100); }
.ticker li small { color: var(--gray-500); }
.ticker li.freed { background: #fffbeb; }
.ticker .t-icon { font-size: 1.35rem; flex: none; }

.race { display: grid; gap: .45rem; }
.race-row { display: grid; grid-template-columns: 30px 46px 1fr auto; gap: .65rem; align-items: center; padding: .45rem .55rem; border-radius: 14px; border: 1px solid transparent; }
.race-row:hover { background: var(--gray-50); }
.race-row.is-mine { border-color: var(--gold-500); background: var(--gold-100); }
.race-row.is-full .race-name { color: var(--gray-500); }
.race-pos { font-weight: 800; color: var(--gray-500); text-align: center; }
.race-name { font-weight: 600; }
.race-track { height: 12px; border-radius: 99px; background: var(--gray-100); overflow: hidden; margin-top: .3rem; }
.race-bar { height: 100%; border-radius: 99px; background: var(--em-600); transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.race-bar.warn { background: var(--gold-500); }
.race-bar.full { background: #c2410c; }
.race-num { text-align: right; min-width: 92px; font-size: .9rem; color: var(--gray-500); }
.race-num b { font-size: 1.1rem; color: var(--ink); }
.race-num small { display: block; font-size: .75rem; }
.mine-chip { font-size: .72rem; font-weight: 700; color: #7a5b06; background: #fde9a6; border-radius: 99px; padding: .05rem .45rem; white-space: nowrap; }
.flash-up { animation: flashUp 1.4s ease; }
.flash-down { animation: flashDown 1.4s ease; }
@keyframes flashUp { 0% { background: var(--em-100); } 100% { background: transparent; } }
@keyframes flashDown { 0% { background: #fef3c7; } 100% { background: transparent; } }
.board-screen { background: var(--gray-50); }

@media (max-width: 575.98px) {
    .board-hero { padding: 1rem; border-radius: 18px; }
    .countdown > div { min-width: 0; flex: 1; }
    .board-ring { width: 136px; height: 136px; }
    .board-ring-inner { width: 102px; height: 102px; }
    .race-row { grid-template-columns: 22px 38px 1fr auto; gap: .45rem; }
    .race-row .icon-bubble { width: 38px; height: 38px; font-size: 1.25rem; }
    .race-num { min-width: 70px; }
    .grade-row { grid-template-columns: 38px 1fr 92px; }
}
@media (prefers-reduced-motion: reduce) {
    .race-bar, .grade-bar, .grade-runner, .progress-bar { transition: none; }
    .left-badge.pulse, .live-dot::before { animation: none; }
}
