*{box-sizing:border-box}
:root{
  --bg:#0f172a;
  --panel:#111827;
  --card:#ffffff;
  --card-dark:#0b1220;
  --line:#d1d5db;
  --text:#111827;
  --muted:#6b7280;
  --green:#16a34a;
  --green-dark:#0f7a35;
  --blue-soft:#eff6ff;
  --blue:#1d4ed8;
  --danger:#dc2626;
}
body{margin:0;font-family:"Microsoft YaHei",system-ui,sans-serif;background:linear-gradient(180deg,#f3f6fb 0%,#eef2f7 100%);color:var(--text)}
.shell{max-width:1320px;margin:0 auto;padding:22px}
.hero{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;padding:22px 24px;border-radius:22px;background:linear-gradient(135deg,#0f172a 0%,#1f2937 100%);color:#fff;box-shadow:0 10px 30px rgba(15,23,42,.22);margin-bottom:18px}
.eyebrow{font-size:13px;letter-spacing:1px;text-transform:uppercase;color:#86efac;margin-bottom:10px}
.hero h1{margin:0 0 10px;font-size:32px;line-height:1.2}
.hero p{margin:0;max-width:840px;color:#cbd5e1;line-height:1.7}
.hero-actions{display:flex;flex-direction:column;gap:10px;align-items:flex-end;min-width:170px}
.docs-btn,.ghost-link{text-decoration:none;border-radius:12px;padding:11px 16px;font-size:15px}
.docs-btn{background:#22c55e;color:#052e16;font-weight:700}
.ghost-link{background:rgba(255,255,255,.1);color:#fff;border:1px solid rgba(255,255,255,.16)}
.tabs{display:flex;gap:10px;margin-bottom:18px;flex-wrap:wrap}
.tab-btn{border:none;background:#e5e7eb;padding:12px 18px;border-radius:14px;font-size:16px;cursor:pointer;color:#111827;transition:.15s}
.tab-btn.active{background:var(--green);color:#fff;box-shadow:0 8px 20px rgba(22,163,74,.26)}
.tab-panel{display:none}
.tab-panel.active{display:block}
.grid{display:grid;gap:16px}
.grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.compact-gap{margin-top:16px}
.trainer-grid{grid-template-columns:1.12fr .88fr}
.card{background:var(--card);border-radius:20px;padding:20px;box-shadow:0 10px 30px rgba(15,23,42,.06);border:1px solid rgba(15,23,42,.04)}
.card h2,.card h3{margin:0 0 14px}
.compact-card h2{font-size:20px}
textarea,.input,input[type="number"]{width:100%;border:1px solid var(--line);border-radius:12px;padding:12px;font-size:15px;background:#fff;color:var(--text)}
textarea{min-height:148px;resize:vertical}
.actions,.toolbar,.manual-buttons,.trainer-controls,.chip-row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.actions{margin-top:12px}
button{border:none;background:var(--green);color:#fff;border-radius:12px;padding:10px 16px;font-size:15px;cursor:pointer;transition:.14s}
button:hover{background:var(--green-dark)}
button.ghost{background:#e5e7eb;color:#111827}
button.ghost:hover{background:#d1d5db}
.output,.mini-output{margin:12px 0 0;background:var(--card-dark);color:#e5e7eb;border-radius:14px;padding:12px;white-space:pre-wrap;word-break:break-all;min-height:94px;font-family:ui-monospace,Consolas,Monaco,monospace}
.small-output{min-height:70px}
.mini-output{min-height:60px}
.tall-output{min-height:110px}
.hint-card p{margin:0;color:#374151;font-size:18px;line-height:1.8}
.section-title-row{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.chip{padding:7px 10px;border-radius:999px;font-size:13px;font-weight:600;background:#dcfce7;color:#166534}
.muted-chip{background:#f3f4f6;color:#6b7280}
.warn-chip{background:#fef3c7;color:#92400e}
.trainer-help{padding:12px 14px;border-radius:14px;background:var(--blue-soft);color:var(--blue);line-height:1.7;margin-top:12px}
.settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:14px}
.settings-grid label{display:flex;flex-direction:column;gap:8px;color:#374151;font-size:14px}
.trainer-top-actions{margin-top:14px}
.key-button{width:100%;padding:24px 16px;font-size:21px;background:#111827;margin-top:12px;font-weight:700}
.key-button.active{background:var(--danger)}
.manual-buttons{margin-top:14px}
.manual-buttons button{min-width:88px}
.foot-hint{margin-top:14px;color:var(--muted);font-size:13px;line-height:1.7}
.status-row{margin-top:12px}
.status-row span{display:block;color:var(--muted);margin-bottom:6px;font-size:14px}
.status-row strong{font-size:20px;min-height:24px;display:block}
.stats-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:16px}
.stat-box{background:#f8fafc;border:1px solid #e5e7eb;border-radius:16px;padding:14px}
.stat-label{font-size:13px;color:#6b7280;margin-bottom:8px}
.stat-value{font-size:28px;font-weight:800;color:#111827}
.small-stat{font-size:18px}
code{padding:2px 6px;border-radius:6px;background:#eef2f7;color:#0f172a}
@media (max-width: 980px){
  .grid.two,.trainer-grid,.settings-grid{grid-template-columns:1fr}
  .hero{flex-direction:column}
  .hero-actions{align-items:flex-start}
  .section-title-row{flex-direction:column}
}

/* 报底生成 */
.message-grid{grid-template-columns:.72fr 1.28fr;align-items:start}
.message-settings-card{min-height:100%}
.message-intro{margin:-4px 0 18px;color:var(--muted);line-height:1.7}
.message-type-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.type-option{position:relative;display:flex;flex-direction:column;gap:5px;padding:14px;border:1px solid #e5e7eb;border-radius:14px;background:#f8fafc;cursor:pointer;transition:.15s}
.type-option input{position:absolute;opacity:0;pointer-events:none}
.type-option span{font-size:17px;font-weight:800;color:#111827}
.type-option small{font-size:12px;color:#6b7280}
.type-option.active,.type-option:has(input:checked){border-color:#16a34a;background:#f0fdf4;box-shadow:0 0 0 2px rgba(22,163,74,.08)}
.message-form-grid{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:16px}
.message-actions{margin-top:18px}
.print-btn{background:#111827}
.print-btn:hover{background:#020617}
.message-meta{display:flex;gap:18px;flex-wrap:wrap;margin-top:16px;padding-top:14px;border-top:1px solid #e5e7eb;color:#6b7280;font-size:14px}
.message-meta strong{color:#111827}
.paper-tip{margin:-8px 0 0;color:#6b7280;font-size:13px}
.paper-status{padding:7px 10px;border-radius:999px;background:#f3f4f6;color:#6b7280;font-size:11px;letter-spacing:1px;font-weight:700}
.telegram-card-wrap{overflow:hidden}
.telegram-paper{margin-top:16px;background:#fffdf5;border:1px solid #d6d0c0;box-shadow:0 8px 24px rgba(92,77,45,.10);min-height:590px;padding:30px 34px;position:relative;font-family:"Courier New",Consolas,monospace;color:#171717}
.paper-header{display:flex;justify-content:space-between;gap:20px;font-size:20px;font-weight:800;letter-spacing:2px}
.paper-header div:last-child{font-size:12px;font-weight:400;letter-spacing:0;color:#666}
.paper-rule{height:2px;background:#222;margin:15px 0 13px}
.paper-info{display:flex;gap:22px;flex-wrap:wrap;font-size:12px;color:#555;border-bottom:1px dashed #aaa;padding-bottom:13px}
.paper-info strong{color:#111}
.paper-body{padding:24px 0 34px;min-height:390px;font-size:calc(22px * var(--paper-scale, 1));line-height:2.25;letter-spacing:1px;overflow:hidden}
.message-table{width:100%;table-layout:fixed;border-collapse:collapse;border-spacing:0}
.message-table tr{height:1.95em}
.message-group{width:20%;white-space:nowrap;overflow:hidden;text-overflow:clip;font-weight:700;text-align:center;padding:5px 8px 8px;border-bottom:1px dashed rgba(120,113,94,.32);box-sizing:border-box}
.paper-placeholder{width:100%;font-family:"Microsoft YaHei",system-ui,sans-serif;color:#aaa;text-align:center;font-size:15px;line-height:2;padding-top:120px;letter-spacing:0}
.paper-footer{position:absolute;left:34px;right:34px;bottom:18px;padding-top:10px;border-top:1px solid #c9c3b5;display:flex;justify-content:space-between;color:#777;font-size:11px;letter-spacing:.5px}

@media (max-width:980px){
  .message-grid{grid-template-columns:1fr}
  .message-type-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (max-width:600px){
  .message-type-grid{grid-template-columns:1fr}
}

@media print{
  @page{size:A4 portrait;margin:12mm}
  body{background:#fff}
  body *{visibility:hidden !important}
  #messageTab,#messageTab *{visibility:visible !important}
  #messageTab{display:block !important;position:absolute;left:0;top:0;width:100%;padding:0}
  #messageTab>.message-grid{display:block}
  .message-settings-card,.paper-tip,.paper-status{display:none !important}
  .telegram-card-wrap{box-shadow:none;border:none;padding:0;background:#fff}
  .telegram-paper{margin:0;min-height:0;box-shadow:none;border:1px solid #999;background:#fffdf5;padding:12mm 12mm 18mm;page-break-inside:auto}
  .paper-body{min-height:0;font-size:calc(20px * var(--paper-scale, 1));line-height:2.05;width:100%;overflow:visible}
  .message-table{width:100%;table-layout:fixed;page-break-inside:auto}
  .message-table tr{page-break-inside:avoid;page-break-after:auto}
  .message-group{white-space:nowrap;overflow:hidden;text-overflow:clip;min-width:0;padding-left:2mm;padding-right:2mm}
  .paper-footer{left:12mm;right:12mm;bottom:6mm}
}
