/* ============================================================
   网络安全教学演示终端 · 主样式
   风格：深色极简 + 青色点缀
   本页面为纯本地教学模拟，无任何真实发包能力
   ============================================================ */

:root {
    --cyan:  #22d3ee;
    --green: #4ade80;
    --red:   #f87171;
    --amber: #fbbf24;
    --bg:    #0c0f12;
    --panel: #14181d;
    --line:  #232a31;
    --txt:   #dfe6ec;
    --dim:   #7d8b96;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }

html, body {
    min-height: 100%;
    background-color: var(--bg);
    color: var(--txt);
    font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
}

body { padding-bottom: 72px; }

::selection { background: rgba(34, 211, 238, 0.3); color: #fff; }

/* ---------------- 布局 ---------------- */

.wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 14px;
}

.card-label {
    font-size: 13px;
    color: var(--dim);
    letter-spacing: 1px;
    margin-bottom: 12px;
}

/* ---------------- 顶部 ---------------- */

.hero {
    text-align: center;
    padding: 40px 16px 26px;
}
.hero h1 {
    font-size: 24px;
    color: #fff;
    letter-spacing: 6px;
    font-weight: 700;
}
.hero .sub {
    margin-top: 8px;
    font-size: 12px;
    color: var(--dim);
    letter-spacing: 2px;
}

/* ---------------- 未安装提示 ---------------- */

.not-installed-bar {
    position: sticky;
    top: 0;
    z-index: 950;
    padding: 10px 16px;
    background: #2a1512;
    border-bottom: 1px solid rgba(248, 113, 113, 0.45);
    color: var(--red);
    font-size: 13px;
    text-align: center;
    line-height: 1.7;
}
.not-installed-bar a {
    color: #fff;
    background: var(--red);
    padding: 2px 10px;
    border-radius: 4px;
    text-decoration: none;
    margin-left: 6px;
}

/* ---------------- 手机号 ---------------- */

.phone-input {
    width: 100%;
    height: 44px;
    background: #0c0f12;
    border: 1px solid var(--line);
    color: var(--txt);
    padding: 0 14px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
    border-radius: 6px;
    outline: none;
    font-family: "SF Mono", Consolas, monospace;
    transition: border-color .2s, box-shadow .2s;
}
.phone-input::placeholder { color: #55606a; letter-spacing: 0; font-family: inherit; }
.phone-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}
.phone-input.err { border-color: var(--red); }

.phone-info {
    min-height: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.phone-info .p-hint { font-size: 12px; color: var(--dim); }
.phone-info .chip {
    font-size: 12px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    background: #0c0f12;
    color: var(--txt);
    border-radius: 4px;
}
.phone-info .chip b { color: var(--cyan); font-weight: 500; }
.phone-info .chip.warn { border-color: rgba(251, 191, 36, .45); color: var(--amber); }
.phone-info .chip.warn b { color: var(--amber); }
.phone-info .chip.err { border-color: rgba(248, 113, 113, .45); color: var(--red); }

/* ---------------- 模式切换 ---------------- */

.mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.mode-btn {
    position: relative;
    height: 52px;
    background: #0c0f12;
    border: 1px solid var(--line);
    color: var(--dim);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: all .18s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.mode-btn .m-sub { font-size: 11px; opacity: .75; }
.mode-btn:hover { border-color: #33404b; color: var(--txt); }
.mode-btn.active {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(34, 211, 238, 0.08);
}

.mode-desc {
    margin-top: 12px;
    padding: 10px 12px;
    border-left: 2px solid var(--cyan);
    background: rgba(34, 211, 238, 0.05);
    border-radius: 0 4px 4px 0;
    font-size: 12px;
    color: #9fb3bd;
    line-height: 1.9;
}
.mode-desc::before {
    content: "原理说明";
    display: block;
    color: var(--cyan);
    font-size: 11px;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

/* ---------------- 轰炸时间 ---------------- */

.duration-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.dur-btn {
    height: 46px;
    background: #0c0f12;
    border: 1px solid var(--line);
    color: var(--dim);
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: all .18s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.dur-btn .d-title { font-size: 14px; }
.dur-btn .d-sub { font-size: 11px; opacity: .75; }
.dur-btn:hover { border-color: #33404b; color: var(--txt); }
.dur-btn.active {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(34, 211, 238, 0.08);
}

/* ---------------- 二级分类多选 ---------------- */

.cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.cat-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #0c0f12;
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: all .16s ease;
}
.cat-item:hover { border-color: #33404b; }
.cat-item .c-name { font-size: 13px; color: #cfd8de; }
.cat-item .c-desc { font-size: 11px; color: var(--dim); margin-top: 2px; }
.cat-item .c-check {
    position: absolute;
    top: 8px; right: 8px;
    width: 15px; height: 15px;
    border: 1px solid #3a4650;
    border-radius: 3px;
    transition: all .16s;
}
.cat-item.selected { border-color: var(--cyan); background: rgba(34, 211, 238, 0.07); }
.cat-item.selected .c-name { color: var(--cyan); }
.cat-item.selected .c-check { border-color: var(--cyan); background: var(--cyan); }
.cat-item.selected .c-check::after {
    content: "";
    display: block;
    width: 7px; height: 3px;
    margin: 3px auto 0;
    border-left: 1.5px solid #06222a;
    border-bottom: 1.5px solid #06222a;
    transform: rotate(-45deg);
}

.cat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--dim);
}
.cat-footer .sel-count { color: var(--cyan); }
.cat-footer .spacer { flex: 1; }
.mini-btn {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--dim);
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: all .16s;
}
.mini-btn:hover { border-color: var(--cyan); color: var(--cyan); }

/* ---------------- 执行按钮 ---------------- */

.run-btn {
    width: 100%;
    height: 46px;
    background: var(--cyan);
    color: #06222a;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 3px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: .18s;
    margin-bottom: 14px;
}
.run-btn:hover { background: #67e8f9; }
.run-btn:active { transform: scale(.99); }
.run-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------- 底部提示 ---------------- */

.footer-fixed {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 900;
    background: rgba(12, 15, 18, 0.96);
    border-top: 1px solid var(--line);
    padding: 10px 16px;
    text-align: center;
}
.footer-fixed .fb {
    font-size: 12px;
    color: var(--dim);
    line-height: 1.7;
    max-width: 720px;
    margin: 0 auto;
}

/* ---------------- Toast ---------------- */

.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 12000;
    width: calc(100% - 32px);
    max-width: 420px;
    pointer-events: none;
}
.toast-item {
    background: #1b2128;
    border: 1px solid var(--line);
    border-left: 3px solid var(--cyan);
    padding: 10px 14px;
    margin-bottom: 8px;
    font-size: 13px;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    color: var(--txt);
}
.toast-item .tp { font-weight: 600; margin-right: 6px; }

/* ---------------- 遮罩层 ---------------- */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.overlay.show { display: flex; }

/* ---------------- 卡密弹窗 ---------------- */

.modal {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 28px 24px 22px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
.modal-close {
    position: absolute;
    top: 10px; right: 10px;
    width: 26px; height: 26px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--dim);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    transition: all .16s;
}
.modal-close:hover { color: var(--red); border-color: var(--red); }

.modal .m-head { text-align: center; margin-bottom: 18px; }
.modal .m-head h3 { color: #fff; font-size: 16px; font-weight: 600; }
.modal .m-head .m-sub { font-size: 12px; color: var(--dim); margin-top: 6px; }

.card-input {
    width: 100%;
    height: 42px;
    background: #0c0f12;
    border: 1px solid var(--line);
    color: var(--txt);
    padding: 0 12px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 1.5px;
    border-radius: 6px;
    outline: none;
    font-family: "SF Mono", Consolas, monospace;
    transition: border-color .2s, box-shadow .2s;
}
.card-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12); }
.card-input.err { border-color: var(--red); }

.m-error {
    display: none;
    margin-top: 10px;
    font-size: 12px;
    color: var(--red);
    line-height: 1.7;
    padding: 8px 10px;
    border: 1px solid rgba(248, 113, 113, .4);
    border-radius: 4px;
    background: rgba(248, 113, 113, .06);
}
.m-error.show { display: block; }

.m-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
}
.m-btn {
    height: 42px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: .18s;
}
.m-btn.buy { background: rgba(34, 211, 238, 0.10); border: 1px solid rgba(34, 211, 238, 0.5); color: var(--cyan); }
.m-btn.buy:hover { background: rgba(34, 211, 238, 0.20); border-color: var(--cyan); }
.m-btn.ok { background: var(--cyan); border: 1px solid var(--cyan); color: #06222a; }
.m-btn.ok:hover { background: #67e8f9; }
.m-btn.ok:active { transform: scale(.99); }
.m-btn.ok:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- 执行面板 ---------------- */

.exec-panel {
    width: 100%;
    max-width: 680px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}
.exec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}
.exec-head .t {
    font-size: 13px;
    color: var(--txt);
    display: flex;
    align-items: center;
    gap: 8px;
}
.exec-head .t .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--green);
}
.exec-head .stop-btn {
    background: transparent;
    border: 1px solid rgba(248, 113, 113, .45);
    color: var(--red);
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: .16s;
}
.exec-head .stop-btn:hover { background: rgba(248, 113, 113, .12); }

.exec-taskinfo {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: #101418;
}
.ti-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ti-label { font-size: 11px; color: var(--dim); }
.ti-val { font-size: 13px; color: var(--txt); word-break: break-all; }
.task-status {
    display: inline-block;
    font-size: 12px;
    padding: 1px 8px;
    border-radius: 4px;
    align-self: flex-start;
}
.task-status.run { color: var(--amber); border: 1px solid rgba(251, 191, 36, .4); }
.task-status.done { color: var(--green); border: 1px solid rgba(74, 222, 128, .4); }

.exec-ok {
    display: none;
    margin: 0 16px;
    padding: 10px 14px;
    border: 1px solid rgba(74, 222, 128, .35);
    background: rgba(74, 222, 128, .07);
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--green);
    line-height: 1.8;
}
.exec-ok.show { display: block; }

.exec-body {
    padding: 14px 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 260px;
    scrollbar-width: thin;
    scrollbar-color: #2f3a43 transparent;
}
.exec-body::-webkit-scrollbar { width: 6px; }
.exec-body::-webkit-scrollbar-thumb { background: #2f3a43; border-radius: 3px; }

.progress-wrap { margin-bottom: 12px; }
.progress-bar {
    height: 6px;
    background: #0c0f12;
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--cyan);
    border-radius: 3px;
    transition: width .3s ease;
}
.progress-txt {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--dim);
    margin-top: 6px;
}

.exec-log { font-size: 12px; line-height: 1.95; white-space: pre-wrap; word-break: break-all; font-family: "SF Mono", Consolas, monospace; }

.exec-sum {
    display: none;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(74, 222, 128, .3);
    background: rgba(74, 222, 128, .05);
    border-radius: 6px;
    font-size: 12px;
    color: var(--green);
    line-height: 1.9;
}
.exec-sum.show { display: block; }
.exec-sum .big { font-size: 14px; font-weight: 600; color: var(--green); }

/* 日志行颜色 */
.log-line { color: var(--dim); }
.log-line.c-cyan  { color: var(--cyan); }
.log-line.c-green { color: var(--green); }
.log-line.c-red   { color: var(--red); }
.log-line.c-amber { color: var(--amber); }
.log-line.c-dim   { color: var(--dim); }

/* ---------------- 抖动 ---------------- */

.shake { animation: shake .35s both; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 640px) {
    .hero { padding: 28px 16px 20px; }
    .hero h1 { font-size: 20px; letter-spacing: 4px; }
    .card { padding: 14px; }
    .mode-tabs, .duration-tabs { gap: 6px; }
    .mode-btn { height: 56px; font-size: 13px; padding: 6px 2px; }
    .mode-btn .m-sub { display: block; font-size: 10.5px; opacity: .75; margin-top: 1px; } /* 移动端也显示副文字 */
    .dur-btn { height: 52px; padding: 6px 2px; }
    .dur-btn .d-sub { display: block; font-size: 10.5px; opacity: .75; margin-top: 1px; }
    .cat-grid { grid-template-columns: repeat(2, 1fr); }
    .cat-item { padding: 9px 10px; }
    .cat-item .c-desc { display: block; font-size: 10.5px; } /* 移动端也显示分类说明 */
    .cat-item .c-name { font-size: 12px; }
    .exec-taskinfo { grid-template-columns: repeat(2, 1fr); }
    .m-actions { grid-template-columns: 1fr; }
}

/* ---------------- 执行面板：常驻悬浮关闭 ---------------- */

.head-actions { display: flex; align-items: center; gap: 8px; }
.close-float {
    border: 1px solid var(--cyan);
    background: var(--cyan);
    color: #06222a;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: .18s;
    font-family: inherit;
}
.close-float:hover { background: #67e8f9; border-color: #67e8f9; }
.close-float:active { transform: scale(.97); }

/* ---------------- 右下角悬浮：进度查询 ---------------- */

.fab-progress {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff;
    cursor: pointer;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: 0;
    white-space: nowrap;
    font-family: inherit;
    box-shadow: 0 8px 22px rgba(8, 145, 178, .45);
    transition: transform .2s, box-shadow .2s;
}
.fab-progress:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(8, 145, 178, .55); }
.fab-progress:active { transform: scale(.95); }

.progress-modal { max-width: 440px; }
.progress-result { display: none; margin-top: 16px; }
.progress-result.show { display: block; }
.prog-empty { font-size: 13px; color: var(--dim); padding: 14px 0; text-align: center; }
.prog-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #101418;
}
.prog-item .pi-top { display: flex; justify-content: flex-start; align-items: center; gap: 8px; flex-wrap: nowrap; margin-bottom: 8px; }
.pi-status-col { display: flex; flex-direction: row; align-items: center; gap: 6px; }
.prog-item .pi-mode { font-size: 13px; font-weight: 600; color: var(--txt); }
.prog-item .pi-meta { font-size: 12px; color: var(--dim); line-height: 1.9; }
.prog-item .pi-meta b { color: var(--cyan); font-weight: 600; }
.prog-status { font-size: 12px; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.prog-status.running { color: var(--green); border: 1px solid rgba(74, 222, 128, .4); background: rgba(74, 222, 128, .08); }
.prog-status.expired { color: var(--amber); border: 1px solid rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .08); }
.prog-status.archived { color: var(--dim); border: 1px solid rgba(120, 140, 160, .4); background: rgba(120, 140, 160, .08); }
.prog-bar { height: 8px; border-radius: 999px; background: #1c232b; overflow: hidden; margin-top: 8px; }
.prog-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #06b6d4, #0891b2); }
.prog-pct { font-size: 12px; color: var(--cyan); margin-top: 4px; }
.prog-status.terminated { color: var(--red); border: 1px solid rgba(248, 113, 113, .4); background: rgba(248, 113, 113, .08); }
.prog-terminate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    background: var(--cyan);
    border: 1px solid var(--cyan);
    color: #062b33;
    font-family: inherit;
    box-shadow: 0 1px 4px rgba(6, 182, 212, .35);
    transition: .18s;
}
.prog-terminate:hover { background: #22d3ee; border-color: #22d3ee; box-shadow: 0 2px 8px rgba(6, 182, 212, .45); }
.prog-terminate:active { transform: scale(.96); }
.m-btn.danger { background: var(--red); border: 1px solid var(--red); color: #fff; }
.m-btn.danger:hover { background: #f87171; }
.m-btn.danger:disabled { opacity: .5; cursor: not-allowed; }
.m-btn.cancel { background: transparent; border: 1px solid var(--line); color: var(--dim); }
.m-btn.cancel:hover { color: var(--txt); border-color: var(--dim); }
.m-tip { font-size: 12.5px; color: var(--dim); line-height: 1.8; margin: 0 0 14px; text-align: center; }
.m-tip strong { color: var(--red); }

/* ---------------- 禁止缩放（移动端 / iOS Safari） ---------------- */
html { -webkit-text-size-adjust: 100%; }
body, input, button, textarea, select { touch-action: manipulation; }

/* ---------------- 进度弹窗：内容超高时可滚动，关闭按钮始终可达 ---------------- */
#progressModal { overflow-y: auto; -webkit-overflow-scrolling: touch; }
#progressModal .modal { margin: auto; max-height: none; }
