/* ============================================
   STUDENT TAMBAYAN — Module Styles
   Inherits all portal design tokens (colors,
   typography, radii, spacing) from student.css.
============================================ */

/* ---- Page wrapper overrides ---- */
#tambayan.page,
#tambayan-chess.page,
#tambayan-game-detail.page {
    display: none;
    height: 100%;
    overflow: hidden;
}
#tambayan.page.active,
#tambayan-chess.page.active,
#tambayan-game-detail.page.active {
    display: flex;
    flex-direction: column;
}

/* ---- Tab Bar ---- */
.tb-tab-bar {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tb-tab-bar::-webkit-scrollbar { display: none; }

.tb-tab {
    flex: 1;
    min-width: max-content;
    padding: 0.75rem 0.875rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
}
.tb-tab.active {
    color: #f83600;
    border-bottom-color: #f83600;
}

/* ---- Scrollable body ---- */
.tb-scroll-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.25rem;
}

/* ---- Welcome / Stats card ---- */
.tb-welcome-card {
    background: linear-gradient(135deg, #f83600 0%, #fe8c00 100%);
    border-radius: 1rem;
    padding: 1.25rem;
    color: #fff;
    margin-bottom: 1rem;
}
.tb-welcome-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.tb-welcome-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    border: 2px solid rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}
.tb-welcome-label {
    font-size: 0.68rem;
    font-weight: 400;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.tb-welcome-name {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.2;
}
.tb-stats-row {
    display: flex;
    gap: 0.5rem;
}
.tb-stat-item {
    flex: 1;
    text-align: center;
    background: rgba(255,255,255,0.16);
    border-radius: 0.625rem;
    padding: 0.625rem 0.25rem;
}
.tb-stat-num {
    font-size: 1.3rem;
    font-weight: 900;
    line-height: 1;
}
.tb-stat-lbl {
    font-size: 0.62rem;
    opacity: 0.8;
    margin-top: 0.2rem;
}

/* ---- Section header ---- */
.tb-section-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.tb-section-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1f2937;
}

/* ---- Announcement card ---- */
.tb-announce {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background 0.15s;
}
.tb-announce:active { background: #ffedd5; }
.tb-announce-tag {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #ea580c;
    margin-bottom: 0.2rem;
}
.tb-announce-title {
    font-size: 0.83rem;
    font-weight: 600;
    color: #1f2937;
}
.tb-announce-date {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.15rem;
}

/* ---- Activity feed ---- */
.tb-activity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f3f4f6;
}
.tb-activity:last-child { border-bottom: none; }
.tb-act-icon {
    width: 34px;
    height: 34px;
    border-radius: 0.5rem;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.tb-act-info { flex: 1; min-width: 0; }
.tb-act-text {
    font-size: 0.78rem;
    color: #1f2937;
    line-height: 1.35;
}
.tb-act-time {
    font-size: 0.68rem;
    color: #9ca3af;
    margin-top: 0.1rem;
}
.tb-act-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.18rem 0.5rem;
    border-radius: 9999px;
    flex-shrink: 0;
}
.tb-badge-win  { background: #f0fdf4; color: #16a34a; }
.tb-badge-loss { background: #fef2f2; color: #b91c1c; }
.tb-badge-draw { background: #f3f4f6; color: #6b7280; }

/* ---- Quick-play grid ---- */
.tb-qp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.625rem;
}
.tb-qp-btn {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.875rem 0.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
}
.tb-qp-btn:active { transform: scale(0.94); }
.tb-qp-icon { font-size: 1.5rem; line-height: 1; }
.tb-qp-name { font-size: 0.65rem; font-weight: 600; color: #374151; text-align: center; }

/* ---- Search bar ---- */
.tb-search {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.625rem;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.tb-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.875rem;
    color: #1f2937;
    background: transparent;
    font-family: inherit;
}
.tb-search svg { color: #9ca3af; flex-shrink: 0; width: 18px; height: 18px; }

/* ---- Game card ---- */
.tb-game-card {
    background: #fff;
    border: 1px solid #f3f4f6;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    cursor: pointer;
    transition: background 0.15s;
}
.tb-game-card:active { background: #f9fafb; }
.tb-game-ico-box {
    width: 50px;
    height: 50px;
    border-radius: 0.75rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.tb-game-info { flex: 1; min-width: 0; }
.tb-game-name { font-size: 0.875rem; font-weight: 700; color: #1f2937; }
.tb-game-desc {
    font-size: 0.72rem;
    color: #6b7280;
    margin-top: 0.15rem;
    line-height: 1.35;
}
.tb-game-meta {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-top: 0.3rem;
}
.tb-meta-item {
    font-size: 0.67rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}
.tb-meta-item b { color: #374151; font-weight: 600; }
.tb-live-dot {
    width: 5px; height: 5px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
}
.tb-chevron { color: #d1d5db; flex-shrink: 0; }

/* ---- Play button ---- */
.tb-play-btn {
    background: #f83600;
    color: #fff;
    border: none;
    border-radius: 0.625rem;
    padding: 0.5rem 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
    font-family: inherit;
    flex-shrink: 0;
}
.tb-play-btn:active { opacity: 0.82; }
.tb-play-btn-full {
    width: 100%;
    padding: 0.875rem;
    font-size: 0.9rem;
    border-radius: 0.75rem;
}

/* ---- Leaderboard ---- */
.tb-lb-filter {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
}
.tb-lb-filter::-webkit-scrollbar { display: none; }
.tb-lb-chip {
    padding: 0.32rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    font-family: inherit;
}
.tb-lb-chip.active {
    background: #f83600;
    color: #fff;
    border-color: #f83600;
}

.tb-lb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
.tb-lb-av-other { background: #f3f4f6; color: #374151; }

/* Leaderboard entries */
.tb-lb-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid #f3f4f6;
}
.tb-lb-row:last-child { border-bottom: none; }
.tb-lb-pos {
    font-size: 0.85rem;
    font-weight: 700;
    color: #6b7280;
    min-width: 1.75rem;
    text-align: center;
}
.tb-lb-pos-medal { font-size: 1rem; }
.tb-lb-row-info { flex: 1; min-width: 0; }
.tb-lb-row-name { font-size: 0.83rem; font-weight: 600; color: #1f2937; }
.tb-lb-row-course { font-size: 0.68rem; color: #9ca3af; }
.tb-lb-row-pts { text-align: right; flex-shrink: 0; }
.tb-lb-pts-val { font-size: 0.875rem; font-weight: 700; color: #1f2937; }
.tb-lb-wins-val { font-size: 0.63rem; color: #9ca3af; }

/* ---- Recent Games ---- */
.tb-gr-row {
    padding: 0.6rem 0;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.12s;
    cursor: default;
}
.tb-gr-row:last-child { border-bottom: none; }
.tb-gr-row:nth-child(even) { background: #f9fafb; margin: 0 -0.75rem; padding-left: 0.75rem; padding-right: 0.75rem; }
.tb-gr-row:hover { background: #f3f4f6; }
.tb-gr-row:nth-child(even):hover { background: #f3f4f6; margin: 0 -0.75rem; padding-left: 0.75rem; padding-right: 0.75rem; }

.tb-gr-combatants {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.28rem;
    min-width: 0;
}
.tb-gr-av {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 700;
    flex-shrink: 0;
}
.tb-gr-pname {
    font-size: 0.78rem;
    font-weight: 600;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 90px;
}
.tb-gr-vs {
    font-size: 0.65rem;
    font-weight: 400;
    color: #9ca3af;
    flex-shrink: 0;
    padding: 0 0.1rem;
}
.tb-gr-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tb-gr-date {
    font-size: 0.67rem;
    color: #9ca3af;
}
.tb-gr-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
    flex-shrink: 0;
}
.tb-gr-win  { background: #f0fdf4; color: #16a34a; }
.tb-gr-loss { background: #fef2f2; color: #b91c1c; }
.tb-gr-draw { background: #f3f4f6; color: #6b7280; }
.tb-gr-loading, .tb-gr-empty {
    font-size: 0.8rem;
    color: #9ca3af;
    text-align: center;
    padding: 0.75rem 0;
}
.tb-gr-err { color: #ef4444; }

/* ---- Multiplayer ---- */
.tb-mp-subtabs {
    display: flex;
    background: #f3f4f6;
    border-radius: 0.5rem;
    padding: 0.18rem;
    margin-bottom: 1rem;
}
.tb-mp-stab {
    flex: 1;
    padding: 0.48rem 0.25rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    font-family: inherit;
}
.tb-mp-stab.active {
    background: #fff;
    color: #f83600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.tb-mp-content { display: none; }
.tb-mp-content.active { display: block; }

/* Player card */
.tb-player-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid #f3f4f6;
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
}
.tb-player-av {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
}
.tb-player-info { flex: 1; min-width: 0; }
.tb-player-name { font-size: 0.875rem; font-weight: 600; color: #1f2937; }
.tb-player-meta { font-size: 0.7rem; color: #6b7280; margin-top: 0.1rem; }
.tb-online { color: #22c55e; }
.tb-challenge-btn {
    padding: 0.38rem 0.875rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 9999px;
    border: 1.5px solid #f83600;
    color: #f83600;
    background: none;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    font-family: inherit;
}
.tb-challenge-btn:active { background: #f83600; color: #fff; }

/* Challenge cards */
.tb-chall-card {
    background: #fff;
    border: 1px solid #f3f4f6;
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
}
.tb-chall-hdr { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.tb-chall-tag {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
}
.tb-tag-in   { background: #dbeafe; color: #1d4ed8; }
.tb-tag-sent { background: #f3f4f6; color: #6b7280; }
.tb-chall-name { font-size: 0.875rem; font-weight: 600; color: #1f2937; }
.tb-chall-game { font-size: 0.7rem; color: #6b7280; }
.tb-chall-timer { font-size: 0.68rem; font-weight: 700; color: #ea580c; margin-top: 0.2rem; }
.tb-chall-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.tb-accept-btn {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 0.5rem;
    border: none;
    background: #f83600;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
}
.tb-decline-btn {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    font-family: inherit;
}

/* Create Room form */
.tb-form-lbl {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.35rem;
    display: block;
}
.tb-form-grp { margin-bottom: 1rem; }
.tb-game-sel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
}
.tb-game-sel {
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.55rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    font-family: inherit;
}
.tb-game-sel.active { border-color: #f83600; color: #f83600; background: #fff7ed; }
.tb-time-row { display: flex; gap: 0.45rem; }
.tb-time-btn {
    flex: 1;
    padding: 0.5rem 0.25rem;
    font-size: 0.73rem;
    font-weight: 600;
    border: 1.5px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    font-family: inherit;
}
.tb-time-btn.active { border-color: #f83600; color: #f83600; background: #fff7ed; }
.tb-privacy {
    display: flex;
    background: #f3f4f6;
    border-radius: 0.5rem;
    padding: 0.18rem;
}
.tb-priv-btn {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.73rem;
    font-weight: 600;
    border: none;
    border-radius: 0.375rem;
    background: none;
    color: #6b7280;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    font-family: inherit;
}
.tb-priv-btn.active { background: #fff; color: #f83600; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.tb-create-btn {
    width: 100%;
    background: #f83600;
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    padding: 0.875rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.25rem;
    font-family: inherit;
    transition: opacity 0.15s;
}
.tb-create-btn:active { opacity: 0.85; }
.tb-room-code-box {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 0.875rem;
    padding: 1.5rem 1.25rem;
    text-align: center;
    margin-top: 1rem;
}
.tb-room-code {
    font-size: 2.2rem;
    font-weight: 900;
    color: #f83600;
    letter-spacing: 0.3rem;
    margin: 0.5rem 0;
}
.tb-copy-btn {
    background: #f83600;
    color: #fff;
    border: none;
    border-radius: 9999px;
    padding: 0.5rem 1.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 0.5rem;
    font-family: inherit;
}

/* ---- Game Detail Page ---- */
.tb-det-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}
.tb-det-icon { font-size: 2rem; }
.tb-det-name { font-size: 1rem; font-weight: 800; color: #1f2937; }
.tb-det-desc { font-size: 0.73rem; color: #6b7280; }

/* ============================================
   CHESS GAME STYLES
============================================ */
.chess-page {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.chess-hdr {
    padding: 0.75rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chess-status {
    padding: 0.28rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
}
.chess-st-play  { background: #dcfce7; color: #16a34a; }
.chess-st-check { background: #fee2e2; color: #b91c1c; }
.chess-st-ai    { background: #eff6ff; color: #2563eb; }
.chess-st-done  { background: #f3f4f6; color: #6b7280; }
.chess-resign-btn {
    font-size: 0.72rem;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

/* Body */
.chess-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    -webkit-overflow-scrolling: touch;
}

/* Player bars */
.chess-player-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.75rem;
    background: #fff;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.35rem;
}
.chess-av {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}
.chess-av-ai { background: #1f2937; color: #fff; }
.chess-av-me { background: #f83600; color: #fff; }
.chess-pb-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
}
.chess-pb-captured {
    font-size: 2rem;
    color: #6b7280;
    letter-spacing: -0.05em;
    flex: 1;
}
.chess-pb-turn {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #22c55e;
    display: none;
}
.chess-pb-turn.visible { display: block; }

/* Board */
.chess-board-wrap {
    position: relative;
    margin: 5px calc(-0.75rem + 5px);
    width: calc(100% + 1.5rem - 10px);
}
/* Flying piece — animated overlay during a move */
.chess-fly-piece {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.1rem, 4vw, 1.75rem);
    line-height: 1;
    pointer-events: none;
    z-index: 20;
    transition: transform 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}
/* Last-move highlight */
.chess-sq-last-light { background: #cdd26a; }
.chess-sq-last-dark  { background: #aaa23a; }

/* SVG sprite piece */
.chess-piece-img {
    display: block;
    pointer-events: none;
    flex-shrink: 0;
}
.chess-piece-unicode {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80%;
    line-height: 1;
}
.chess-sq .chess-piece-img {
    width: 88%;
    aspect-ratio: 1;
}
.chess-fly-piece .chess-piece-img {
    width: 88%;
    aspect-ratio: 1;
}
.chess-pb-captured .chess-piece-img {
    display: inline-block;
    width: 0.72em;
    height: 0.72em;
    vertical-align: middle;
}
.chess-promo-piece .chess-piece-img {
    width: 70%;
    aspect-ratio: 1;
}
.chess-board {
    width: 100%;
    aspect-ratio: 1;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border-radius: 0.375rem;
    overflow: hidden;
    border: 2px solid #374151;
}
.chess-sq {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    font-size: clamp(1.1rem, 4vw, 1.75rem);
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
    transition: filter 0.08s;
}
.chess-sq:active { filter: brightness(0.88); }
.chess-sq-light { background: #f0d9b5; }
.chess-sq-dark  { background: #b58863; }
.chess-sq-sel   { background: #f6f669 !important; }
.chess-sq-move  { background: #cdd16f !important; }
.chess-sq-hint  { outline: 3px solid #22c55e; outline-offset: -3px; }
.chess-sq-check { background: #ff6b6b !important; }

/* Legal move dots */
.chess-sq-dot::after {
    content: '';
    position: absolute;
    width: 28%;
    height: 28%;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    pointer-events: none;
}
/* Capture rings */
.chess-sq-cap-ring::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 3px solid rgba(0,0,0,0.22);
    pointer-events: none;
}
/* Coordinates */
.chess-sq-coord-f {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 0.5rem;
    font-weight: 700;
    opacity: 0.55;
    pointer-events: none;
    line-height: 1;
}
.chess-sq-coord-r {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 0.5rem;
    font-weight: 700;
    opacity: 0.55;
    pointer-events: none;
    line-height: 1;
}

/* Controls */
.chess-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.625rem;
    justify-content: center;
}
.chess-ctrl {
    flex: 1;
    max-width: 90px;
    padding: 0.55rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 0.5rem;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    color: #374151;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    transition: background 0.15s;
    font-family: inherit;
}
.chess-ctrl:active { background: #f3f4f6; }
.chess-ctrl svg { width: 16px; height: 16px; }

/* Thinking */
.chess-thinking {
    text-align: center;
    padding: 0.4rem;
    font-size: 0.75rem;
    color: #6b7280;
    font-style: italic;
    animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Move log */
.chess-movelog {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.75rem;
    margin-top: 0.625rem;
    max-height: 120px;
    overflow-y: auto;
}
.chess-movelog-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}
.chess-movelog-entries {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}
.chess-move-pair { font-size: 0.7rem; color: #374151; }
.chess-move-num  { color: #9ca3af; }

/* Promotion overlay */
.chess-promo-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.chess-promo-box {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    width: 280px;
}
.chess-promo-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
}
.chess-promo-pieces { display: flex; gap: 0.75rem; justify-content: center; }
.chess-promo-piece {
    width: 54px;
    height: 54px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
}
.chess-promo-piece:hover { border-color: #f83600; }
.chess-promo-piece:active { transform: scale(0.92); }

/* Game over overlay */
.chess-over-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.chess-over-box {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    text-align: center;
    width: 280px;
}
.chess-over-emoji { font-size: 3rem; margin-bottom: 0.5rem; }
.chess-over-title { font-size: 1.25rem; font-weight: 800; color: #1f2937; margin-bottom: 0.25rem; }
.chess-over-sub   { font-size: 0.85rem; color: #6b7280; margin-bottom: 1.5rem; }.chess-over-exit {
    width: 100%;
    background: none;
    border: 1.5px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.875rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    font-family: inherit;
}

/* Toast */
.tb-toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1f2937;
    color: #fff;
    padding: 0.625rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    white-space: nowrap;
}
.tb-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Join button in Help & Support */
.tb-join-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    background: linear-gradient(135deg, #f83600 0%, #fe8c00 100%);
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}
.tb-join-btn:active { opacity: 0.85; }
