* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow: hidden; background: #05070a;
    font-family: "PingFang SC","Microsoft YaHei",-apple-system,sans-serif; }

#gameCanvas { display: block; position: fixed; inset: 0; }

/* ★ 操作按钮栏：右对齐 */
.tf-topbar { position: fixed; top: 12px; right: 12px; z-index: 100;
    display: flex; gap: 6px; flex-wrap: wrap; }
.tf-btn {
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(20,24,30,.72);
    color: #eef2f6;
    border-radius: 8px;
    font-size: 13px;
    padding: 6px 12px;
    cursor: pointer;
    font-weight: 600;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all .15s ease;
    line-height: 1.3;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tf-btn:hover { background: rgba(40,48,58,.85); border-color: rgba(255,255,255,.35);
    transform: translateY(-1px); color: #eef2f6; text-decoration: none; }
.tf-btn:active { transform: translateY(0); }
.tf-btn:focus { outline: none; }
.tf-btn .glyphicon { margin-right: 5px; font-size: 12px; }
.tf-btn-primary {
    background: linear-gradient(180deg, #4d9e68, #267a48);
    border-color: transparent;
    text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.tf-btn-primary:hover { filter: brightness(1.12); background: linear-gradient(180deg, #4d9e68, #267a48); }

/* ======================================================================
   弹窗：水平 + 垂直居中
   ====================================================================== */
.tf-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.72);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 20px;
    overflow-y: auto;
}
.tf-modal.show { display: flex; }

.tf-modal-box {
    background: rgba(24,28,34,.97);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 16px;
    color: #eef2f6;
    padding: 22px 26px 20px;
    max-width: 680px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 24px 72px rgba(0,0,0,.8);
    position: relative;
    margin: auto;
}
.tf-modal-title {
    font-size: 17px; font-weight: 800; margin: 0 0 16px;
    display: flex; align-items: center; gap: 8px;
    padding-right: 32px;
}
.tf-modal-title .glyphicon { color: #7fc8e0; font-size: 18px; }
.tf-modal-close {
    position: absolute; top: 12px; right: 14px;
    background: transparent; border: none; color: #b8c0cc;
    font-size: 26px; cursor: pointer; line-height: 1;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    transition: all .15s;
}
.tf-modal-close:hover { color: #fff; background: rgba(255,255,255,.08); }
.tf-modal-body { font-size: 13.5px; line-height: 1.8; color: #b8c0cc; }
.tf-modal-body b { color: #eef2f6; }
.tf-modal-body table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12.5px; }
.tf-modal-body th, .tf-modal-body td {
    border: 1px solid rgba(255,255,255,.12); padding: 6px 10px; text-align: left;
}
.tf-modal-body th { background: rgba(255,255,255,.05); color: #eef2f6; }

/* 设置项 */
.tf-set-group { margin-bottom: 16px; }
.tf-set-group:last-of-type { margin-bottom: 0; }
.tf-set-label {
    font-size: 11px; font-weight: 800; color: #7d8895;
    letter-spacing: .6px; text-transform: uppercase; margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
}
.tf-set-label .glyphicon { color: #7fc8e0; font-size: 12px; }
.tf-set-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px,1fr)); gap: 7px; }
.tf-opt {
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(255,255,255,.04);
    color: #b8c0cc;
    border-radius: 9px; padding: 9px 8px;
    font-size: 12.5px; cursor: pointer; text-align: center;
    font-weight: 600; transition: all .15s;
}
.tf-opt:hover { border-color: rgba(127,200,224,.55); color: #eef2f6; }
.tf-opt.active {
    background: linear-gradient(180deg,#5a7a90,#3a5060);
    border-color: transparent; color: #fff;
    box-shadow: 0 3px 12px rgba(0,0,0,.4);
}
.tf-opt small { display: block; font-size: 10px; opacity: .7; margin-top: 2px; font-weight: 400; }

/* 弹窗底部按钮栏 */
.tf-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.1);
    flex-wrap: wrap;
}
.tf-modal-footer .tf-btn { min-width: 100px; justify-content: center; }

/* ======================================================================
   对局报告
   ====================================================================== */
.tf-report-banner {
    text-align: center;
    font-size: 30px;
    font-weight: 900;
    padding: 8px 0 16px;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.tf-report-banner .glyphicon { font-size: 34px; }
.tf-report-banner.win { color: #2fd66a; text-shadow: 0 0 30px rgba(47,214,106,.7); }
.tf-report-banner.lose { color: #e2726b; text-shadow: 0 0 30px rgba(226,114,107,.7); }

.tf-report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.tf-stat {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 9px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all .15s;
}
.tf-stat:hover { background: rgba(255,255,255,.06); border-color: rgba(127,200,224,.3); }
.tf-stat .ico {
    width: 34px; height: 34px; flex: 0 0 34px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(127,200,224,.1); border-radius: 8px;
    color: #7fc8e0; font-size: 15px;
}
.tf-stat .k { font-size: 10px; color: #7d8895; letter-spacing: .3px; }
.tf-stat .v { font-size: 15px; font-weight: 800; color: #eef2f6; margin-top: 2px; }
.tf-stat .v small { font-size: 10px; font-weight: 500; color: #7d8895; margin-left: 2px; }
.tf-advice {
    margin-top: 14px; padding: 11px 14px;
    background: rgba(127,200,224,.08);
    border-left: 3px solid #7fc8e0;
    border-radius: 6px; font-size: 13px; line-height: 1.7; color: #b8c0cc;
}
.tf-advice .glyphicon { color: #7fc8e0; margin-right: 6px; }

@media (max-width: 640px) {
    .tf-topbar { top: 8px; right: 8px; gap: 4px; }
    .tf-btn { font-size: 11px; padding: 5px 8px; }
    .tf-btn .glyphicon { margin-right: 3px; font-size: 11px; }
    .tf-modal-box { padding: 18px; }
    .tf-report-grid { grid-template-columns: 1fr; }
    .tf-report-banner { font-size: 24px; }
    .tf-modal-footer { justify-content: center; }
}