﻿* { margin: 0; padding: 0; box-sizing: border-box; font-family: "Microsoft YaHei", sans-serif; }
    html, body { overflow-x: hidden; }
    body { width: 100%; max-width: 100vw; background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 20px; color: #222; }
    .generator-page { width: 100%; max-width: min(1000px, 100vw); margin: 0 auto; overflow-x: hidden; }
    header { width: 100%; max-width: 100vw; overflow: hidden; background: linear-gradient(to right, #1a6d1f, #2a8a2a); color: #fff; padding: 20px; border-radius: 10px 10px 0 0; text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,.1); margin-bottom: 20px; }
    header h1 { font-size: clamp(1.45rem, 7vw, 2.2rem); margin-bottom: 10px; letter-spacing: 0; line-height: 1.25; overflow-wrap: anywhere; }
    header p { width: 100%; max-width: 100%; margin: 0 auto; line-height: 1.8; font-size: clamp(13px, 4vw, 16px); white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
    .container { display: flex; flex-wrap: wrap; gap: 30px; width: 100%; margin-bottom: 30px; }
    .form-container, .preview-container { flex: 1; min-width: 0; background: #fff; border-radius: 10px; padding: 25px; box-shadow: 0 5px 25px rgba(0,0,0,.1); }
    .preview-container { padding: 20px; position: relative; overflow: hidden; }
    h2 { color: #1a6d1f; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid #e0e6ed; }
    h3 { margin: 18px 0 12px; color: #333; }
    .form-group { margin-bottom: 20px; }
    label { display: block; margin-bottom: 8px; font-weight: 700; color: #333; }
    input, select { width: 100%; max-width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 16px; transition: all .3s; background: #fff; }
    input:focus, select:focus { outline: none; border-color: #2a8a2a; box-shadow: 0 0 0 2px rgba(42,138,42,.2); }
    .score-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
    .btn { background: linear-gradient(to right, #1a6d1f, #2a8a2a); color: #fff; border: none; padding: 14px 25px; font-size: 18px; border-radius: 6px; cursor: pointer; width: 100%; font-weight: 700; transition: all .3s; box-shadow: 0 4px 10px rgba(26,109,31,.3); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
    .btn:hover { background: linear-gradient(to right, #2a8a2a, #1a6d1f); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(26,109,31,.4); }
    .preview-content { background: #f8f9fa; border: 1px dashed #2a8a2a; border-radius: 8px; padding: 20px; min-height: 400px; position: relative; overflow: hidden; }
    .preview-header { background: #2a8a2a; color: #fff; padding: 10px; text-align: center; border-radius: 5px; margin-bottom: 15px; }
    .student-info { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #eee; }
    .student-info p { margin: 5px 0; }
    .qr-container { width: 100px; height: 100px; margin: 10px auto; background: #fff; padding: 5px; flex: 0 0 auto; }
    .qr-fallback-link { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; color: #1a6d1f; background: #fff; border: 1px solid #1a6d1f; text-align: center; text-decoration: none; font-size: 12px; line-height: 1.35; word-break: break-word; }
    .grades-table { width: 100%; border-collapse: collapse; margin: 15px 0; table-layout: fixed; }
    .grades-table th, .grades-table td { border: 1px solid #ddd; padding: 10px; text-align: center; word-break: break-word; }
    .grades-table th { background-color: #f0f0f0; }
    .watermark { position: absolute; inset: 0; pointer-events: none; opacity: .1; z-index: 1; overflow: hidden; }
    .watermark-text { position: absolute; font-size: 24px; color: #1a6d1f; transform: rotate(-20deg); white-space: nowrap; top: 48%; left: 16%; }
    .preview-content > :not(.watermark) { position: relative; z-index: 2; }
    .rank-help { color: #1a6d1f; cursor: pointer; text-decoration: underline; font-size: .9rem; margin-top: 5px; display: inline-block; }
    .rank-help:hover { color: #2a8a2a; }
    .rank-help-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 1000; justify-content: center; align-items: center; padding: 20px; }
    .rank-help-content { background: #fff; padding: 20px; border-radius: 10px; max-width: 90%; max-height: 90%; overflow: auto; text-align: center; }
    .rank-help-content img { max-width: 100%; max-height: 80vh; border: 1px solid #ddd; margin: 12px 0; }
    .close-modal { position: fixed; top: 20px; right: 20px; color: #fff; font-size: 30px; cursor: pointer; }
    .security-code-container { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
    .security-code-option { display: flex; align-items: center; gap: 5px; }
    .security-code-option input { width: auto; }
    .security-code-option label { display: inline; margin: 0; }
    .features { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin-top: 20px; width: 100%; }
    .feature-card { background: #fff; border-radius: 10px; padding: 20px; flex: 1; min-width: 200px; text-align: center; box-shadow: 0 4px 10px rgba(0,0,0,.08); transition: all .3s; }
    .feature-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,.12); }
    .feature-icon { font-size: 36px; color: #2a8a2a; margin-bottom: 15px; }
    .feature-card h3 { color: #1a6d1f; margin-bottom: 10px; }
    .feature-card p { line-height: 1.6; }
    .feature-card .btn { margin-top: 12px; font-size: 15px; padding: 10px 14px; }
    footer { width: 100%; text-align: center; padding: 20px; color: #666; margin-top: 20px; border-top: 1px solid #e0e6ed; line-height: 1.8; }
    footer img { margin-top: 8px; }

    .result-page { display: none; width: 100%; max-width: 750px; background: #fff; min-height: 100vh; color: #000; }
    .result-top { background: #090; color: #fff; text-align: center; font-size: 22px; padding: 17px 10px; }
    .result-box { position: relative; padding: 30px 26px 20px; background: #fff; overflow: hidden; }
    .result-watermark { pointer-events: none; position: absolute; inset: 0; opacity: 1; z-index: 1; }
    .result-content { position: relative; z-index: 2; }
    .result-student { display: grid; grid-template-columns: minmax(0, 1fr) 132px; align-items: start; gap: 16px; margin-bottom: 20px; }
    .result-student p { font-size: 16px; line-height: 2; }
    .result-qr { width: 132px; height: 132px; padding: 6px; background: #fff; }
    .result-content h3 { color: #000; margin: 18px 0 10px; font-size: 18px; font-weight: 400; }
    .result-content h3 b { border-left: 5px solid #32b92b; padding-left: 8px; }
    .official-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; table-layout: fixed; background: #fff; }
    .official-table td { border: 1px solid #999; text-align: center; padding: 10px 6px; font-size: 15px; word-break: break-word; }
    .official-table .tHead td { background: #f0f0f0; }
    .explain { margin: 12px 0; font-size: 14px; line-height: 1.8; }
    .explain em { font-style: normal; font-weight: 700; }
    .explain dl, .explain dd, .explain dt { margin: 0; }
    .jym { color: red; font-size: 16px; margin: 16px 0; word-break: break-all; }
    .result-actions { padding: 20px 26px 10px; background: #fff; }
    .result-actions .btn { background: #090; box-shadow: none; }
    .copy { padding: 18px 10px 30px; text-align: center; color: #333; font-size: 14px; line-height: 2; }
    .copy a { color: #333; text-decoration: none; }
    body.show-result { padding: 0; background: #fff; }
    body.show-result .generator-page { display: none; }
    body.show-result .result-page { display: block; }

    @media (max-width: 768px) {
      body { display: block; padding: 0; width: 100%; }
      .generator-page { width: 100%; max-width: none; overflow-x: hidden; }
      .generator-page > * { max-width: 100%; }
      .container { display: block; width: 100%; padding: 0 10px; margin-bottom: 18px; }
      .score-inputs { grid-template-columns: 1fr; }
      .student-info { flex-direction: row; align-items: flex-start; }
      .result-student { grid-template-columns: minmax(0, 1fr) 92px; gap: 10px; align-items: start; }
      header h1 { font-size: clamp(1.35rem, 7vw, 1.7rem); }
      header { border-radius: 0; margin-bottom: 14px; }
      .form-container, .preview-container, footer { border-radius: 8px; }
      .form-container, .preview-container { padding: 16px; width: 100%; margin: 0 0 16px; box-shadow: 0 3px 14px rgba(0,0,0,.08); }
      .preview-content { padding: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
      .qr-container { width: 92px; height: 92px; }
      .result-page { max-width: none; }
      .official-table td, .grades-table th, .grades-table td { font-size: 12px; padding: 7px 3px; }
      .features { display: block; padding: 0 10px; margin-top: 0; }
      .feature-card { width: 100%; margin-bottom: 12px; }
      footer { margin-top: 8px; }
    }

    @media (max-width: 420px) {
      body { padding: 0; }
      header { padding: 16px 12px; }
      header h1 { font-size: clamp(1.25rem, 6.5vw, 1.5rem); }
      header p { max-width: 24em; font-size: 14px; }
      h2 { font-size: 1.25rem; }
      input, select { font-size: 16px; padding: 11px; }
      .btn { font-size: 16px; padding: 13px 16px; }
      .features { gap: 12px; }
      .feature-card { min-width: 0; padding: 16px; }
      .student-info { gap: 8px; }
      .student-info p { font-size: 13px; }
      .result-student { grid-template-columns: minmax(0, 1fr) 86px; gap: 8px; }
      .grades-table { min-width: 0; }
      footer { font-size: 13px; padding: 16px 10px; }
    }

    @media (max-width: 360px) {
      .container, .features { padding: 0 8px; }
      .form-container, .preview-container { padding: 14px 12px; }
      .grades-table th, .grades-table td { font-size: 11px; padding: 6px 2px; }
      .student-info { flex-direction: row; align-items: flex-start; }
      .result-student { grid-template-columns: minmax(0, 1fr) 80px; gap: 6px; }
    }
