:root {
      --paper: #fff8e1;
      --paper-deep: #ffe7b3;
      --ink: #3e2723;
      --muted: #7b665d;
      --orange: #ff9500;
      --orange-deep: #e65100;
      --green: #3d9a74;
      --red: #d32f2f;
      --line: #efdfc7;
      --shadow: 0 14px 34px rgba(62, 39, 35, 0.16);
    }

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

    html,
    body {
      margin: 0;
      width: 100%;
      min-height: 100%;
      color: var(--ink);
      font-family: "PingFang SC", "Microsoft YaHei", KaiTi, sans-serif;
      background: #f4efe6;
      overflow-x: hidden;
    }

    button,
    input {
      font: inherit;
    }

    button {
      border: 0;
      cursor: pointer;
      color: inherit;
      -webkit-appearance: none;
      appearance: none;
    }

    .phone-shell {
      width: 100%;
      max-width: 430px;
      min-height: 100vh;
      margin: 0 auto;
      position: relative;
      overflow: hidden;
      background: var(--paper);
      box-shadow: 0 0 0 1px rgba(62, 39, 35, 0.08), 0 18px 46px rgba(62, 39, 35, 0.18);
    }

    .screen {
      display: none;
      width: 100%;
      min-height: 100vh;
      flex-direction: column;
      background: var(--paper);
      overflow-x: hidden;
    }

    .screen.active {
      display: flex;
    }

    .nav {
      min-height: 54px;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 14px;
      background: rgba(255, 255, 255, 0.86);
      border-bottom: 1px solid var(--line);
      position: relative;
      z-index: 12;
    }

    .back {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: rgba(62, 39, 35, 0.08);
      color: var(--ink);
      font-size: 20px;
      line-height: 32px;
      text-align: center;
      flex: 0 0 auto;
    }

    .nav-title {
      flex: 1;
      text-align: center;
      font-size: 17px;
      font-weight: 800;
      padding-right: 34px;
      line-height: 1.35;
    }

    .btn-main {
      width: min(84%, 340px);
      min-height: 44px;
      border-radius: 999px;
      background: linear-gradient(135deg, #ffb74d, #ff8a00);
      color: #fff;
      font-size: 16px;
      font-weight: 900;
      box-shadow: 0 6px 13px rgba(230, 81, 0, 0.22);
    }

    .btn-main.green {
      background: linear-gradient(135deg, #59bd90, #27895f);
      box-shadow: 0 6px 14px rgba(39, 137, 95, 0.24);
    }

    .btn-main.gray {
      background: linear-gradient(135deg, #9e9e9e, #6d6d6d);
      box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
    }

    .btn-light {
      min-height: 40px;
      padding: 0 15px;
      border-radius: 999px;
      background: #fff;
      border: 1px solid var(--line);
      color: var(--ink);
      font-weight: 800;
      box-shadow: 0 5px 12px rgba(62, 39, 35, 0.08);
    }

    .home {
      min-height: 100vh;
      width: 100%;
      padding: 58px 18px 32px;
      display: flex;
      flex-direction: column;
      overflow-y: auto;
      overflow-x: hidden;
      background: linear-gradient(180deg, #fff8e1 0%, #fff3d5 100%);
    }

    .hero {
      margin-bottom: 24px;
      padding-top: 4px;
      text-align: center;
      font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    }

    .eyebrow {
      margin: 0 0 17px;
      color: var(--orange-deep);
      display: inline-block;
      padding-bottom: 3px;
      border-bottom: 2px solid rgba(255, 183, 77, 0.78);
      font-size: 17px;
      font-weight: 700;
    }

    h1 {
      margin: 0 auto;
      max-width: 100%;
      font-size: 22px;
      line-height: 1.38;
      letter-spacing: 0.2px;
      white-space: normal;
      font-weight: 700;
    }

    .course-card {
      position: relative;
      overflow: hidden;
      border-radius: 18px;
      background: rgba(255, 255, 255, 0.9);
      border: 1px solid var(--line);
      padding: 15px 18px 15px 20px;
      margin-top: auto;
      margin-bottom: 0;
      box-shadow: 0 14px 30px rgba(62, 39, 35, 0.11);
      font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    }

    .course-card::before {
      content: "";
      position: absolute;
      left: 0;
      top: 16px;
      bottom: 16px;
      width: 5px;
      border-radius: 0 999px 999px 0;
      background: linear-gradient(180deg, #ffb74d, #ff8a00);
    }

    .course-title {
      font-size: 16px;
      font-weight: 700;
      margin-bottom: 0;
      line-height: 1.5;
      text-align: center;
    }

    .course-desc {
      color: var(--muted);
      font-size: 14px;
      line-height: 1.6;
    }

    .practice-area {
      margin-top: 34px;
      --home-char-size: clamp(58px, calc((100vw - 92px) / 4), 84px);
      --home-char-gap: 10px;
      display: flex;
      flex-direction: column;
      min-height: 430px;
      min-height: min(515px, calc(100svh - 205px));
    }

    .group-title {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 0 0 13px;
      color: var(--orange-deep);
      font-size: 16px;
      font-weight: 900;
    }

    .group-title::after {
      content: "";
      height: 1px;
      flex: 1;
      background: linear-gradient(90deg, rgba(255, 149, 0, 0.38), rgba(255, 149, 0, 0));
    }

    .char-grid + .group-title {
      margin-top: 38px;
    }

    .char-grid {
      display: grid;
      width: 100%;
      max-width: 100%;
      grid-template-columns: repeat(4, var(--home-char-size));
      gap: var(--home-char-gap);
      justify-content: start;
    }

    .char-card {
      width: var(--home-char-size);
      min-width: 0;
      height: var(--home-char-size);
      min-height: 0;
      border-radius: 17px;
      background: linear-gradient(180deg, #fffefb, #fffaf1);
      border: 2px solid rgba(255, 255, 255, 0.95);
      color: var(--ink);
      position: relative;
      box-shadow: 0 12px 24px rgba(62, 39, 35, 0.12);
      overflow: hidden;
      transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
    }

    .char-card.active {
      border-color: var(--orange);
      box-shadow: 0 14px 26px rgba(255, 149, 0, 0.2);
    }

    .char-card:active {
      transform: scale(0.97);
    }

    .mi-grid {
      position: absolute;
      inset: 10px;
      border: 2px solid rgba(211, 47, 47, 0.65);
      background:
        linear-gradient(90deg, transparent calc(50% - 1px), rgba(211, 47, 47, 0.35) calc(50% - 1px), rgba(211, 47, 47, 0.35) calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(transparent calc(50% - 1px), rgba(211, 47, 47, 0.35) calc(50% - 1px), rgba(211, 47, 47, 0.35) calc(50% + 1px), transparent calc(50% + 1px));
    }

    .char-text {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      font-family: KaiTi, STKaiti, "Microsoft YaHei", serif;
      font-size: clamp(38px, 12.5vw, 50px);
      font-weight: 900;
      color: var(--ink);
      -webkit-text-fill-color: var(--ink);
    }

    .camera-screen {
      background: #000;
      color: #fff;
      position: relative;
      min-height: 100vh;
      overflow: hidden;
    }

    .camera-screen .nav {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      background: transparent;
      border: 0;
      color: #fff;
    }

    .camera-screen .back {
      background: rgba(0, 0, 0, 0.4);
      color: #fff;
    }

    .camera {
      position: absolute;
      inset: 0;
      background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.12), transparent 42%),
        #111;
    }

    .camera video {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .mirror {
      transform: scaleX(-1);
    }

    .camera-placeholder {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      padding: 34px 24px;
      text-align: center;
      color: rgba(255, 255, 255, 0.72);
      line-height: 1.8;
      background: #111;
    }

    .posture-top {
      position: absolute;
      top: 12%;
      left: 0;
      right: 0;
      text-align: center;
      color: #ffd700;
      font-size: 18px;
      font-weight: 900;
      text-shadow: 0 2px 5px #000;
      z-index: 5;
    }

    .posture-guide {
      position: absolute;
      top: 22%;
      left: 50%;
      width: min(68vw, 250px);
      height: min(84vw, 330px);
      transform: translateX(-50%);
      border: 4px dashed var(--orange);
      border-radius: 150px 150px 24px 24px;
      box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.58);
      z-index: 4;
      pointer-events: none;
    }

    .posture-tips {
      position: absolute;
      left: 50%;
      bottom: 80px;
      width: min(86%, 356px);
      transform: translateX(-50%);
      border-radius: 16px;
      border: 2px solid #ffcc80;
      background: rgba(255, 255, 255, 0.95);
      color: #5d4037;
      font-size: 14px;
      font-weight: 900;
      line-height: 1.58;
      text-align: center;
      padding: 14px 14px 12px;
      z-index: 5;
      box-shadow: var(--shadow);
    }

    .posture-tips img {
      position: absolute;
      top: -44px;
      left: -8px;
      width: 70px;
      transform: rotate(-10deg);
    }

    .fixed-bottom {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 16px;
      display: flex;
      justify-content: center;
      z-index: 8;
    }

    .study {
      overflow-y: auto;
      padding-bottom: 120px;
      background: #fff8e1;
    }

    .video-card {
      width: 90%;
      height: 180px;
      margin: 40px auto 14px;
      border-radius: 10px;
      background: #000;
      border: 3px solid #ffcc80;
      box-shadow: none;
      overflow: hidden;
      position: relative;
      flex-shrink: 0;
    }

    .video-box {
      width: 100%;
      height: 100%;
      background: #000;
    }

    .video-box video {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: contain;
    }

    .teaching-panda {
      position: absolute;
      right: -18px;
      bottom: -18px;
      width: 60px;
      transform: rotate(10deg);
      pointer-events: none;
      animation: paw-move 1.5s infinite ease-in-out;
      display: none;
    }

    @keyframes paw-move {
      0%, 100% { transform: translateY(0) rotate(10deg); }
      50% { transform: translateY(-10px) rotate(5deg); }
    }

    .tian-card {
      width: 90%;
      margin: 0 auto;
      border-radius: 0;
      background: transparent;
      border: 0;
      padding: 0;
      box-shadow: none;
      display: flex;
      flex-direction: column;
      gap: 10px;
      align-items: center;
    }

    .tian {
      width: 160px;
      height: 160px;
      border: 3px solid var(--red);
      display: grid;
      place-items: center;
      font-family: KaiTi, STKaiti, "Microsoft YaHei", serif;
      font-size: 118px;
      font-weight: 900;
      background:
        linear-gradient(90deg, transparent calc(50% - 1px), rgba(211, 47, 47, 0.46) calc(50% - 1px), rgba(211, 47, 47, 0.46) calc(50% + 1px), transparent calc(50% + 1px)),
        linear-gradient(transparent calc(50% - 1px), rgba(211, 47, 47, 0.46) calc(50% - 1px), rgba(211, 47, 47, 0.46) calc(50% + 1px), transparent calc(50% + 1px)),
        #fff;
    }

    .lesson-hint {
      width: 100%;
      border-radius: 12px;
      background: #fff3e0;
      border: 1px dashed #ffb74d;
      padding: 12px 20px;
      color: #5d4037;
      font-size: 15px;
      line-height: 1.6;
      text-align: center;
    }

    .prep {
      width: 90%;
      margin: 25px auto 0;
      position: relative;
      border-radius: 10px;
      border: 1px solid #efebe9;
      background: rgba(255, 255, 255, 0.6);
      padding: 12px;
      color: #5d4037;
      font-size: 13px;
      line-height: 1.6;
    }

    .prep img {
      position: absolute;
      right: 10px;
      top: -45px;
      width: 70px;
      transform: rotate(10deg);
    }

    .study .fixed-bottom {
      position: fixed;
      max-width: 430px;
      margin: 0 auto;
      background: linear-gradient(transparent, var(--paper) 35%);
      padding-top: 18px;
      bottom: 0;
      height: 88px;
    }

    .scan-frame {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 168px;
      height: 168px;
      transform: translate(-50%, -50%);
      border: 3px solid #ffd700;
      box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.68);
      display: grid;
      place-items: center;
      z-index: 4;
    }

    .ghost-char {
      color: rgba(211, 47, 47, 0.62);
      font-family: KaiTi, STKaiti, "Microsoft YaHei", serif;
      font-size: 94px;
      font-weight: 900;
    }

    .scan-hint {
      position: absolute;
      left: 50%;
      bottom: 96px;
      transform: translateX(-50%);
      width: min(84%, 360px);
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.62);
      color: #fff;
      font-weight: 900;
      text-align: center;
      padding: 11px 44px 11px 18px;
      z-index: 5;
    }

    .scan-hint img {
      position: absolute;
      right: -2px;
      top: -38px;
      width: 68px;
      transform: rotate(12deg);
    }

    .file-fallback {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 76px;
      display: flex;
      justify-content: center;
      z-index: 7;
    }

    .file-fallback input {
      position: absolute;
      width: 1px;
      height: 1px;
      opacity: 0;
      pointer-events: none;
    }

    .file-fallback label {
      color: #fff;
      border-bottom: 1px solid rgba(255, 255, 255, 0.8);
      font-size: 13px;
      font-weight: 800;
    }

    .adjust-screen {
      background: #222;
      color: #fff;
      min-height: 100vh;
      padding: 64px 18px 20px;
      align-items: center;
      justify-content: center;
      gap: 14px;
    }

    .adjust-screen .nav {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      background: transparent;
      border: 0;
      color: #fff;
    }

    .adjust-screen .back {
      background: rgba(255, 255, 255, 0.12);
      color: #fff;
    }

    .adjust-title {
      margin: 0;
      color: #ffd700;
      text-align: center;
      font-size: 17px;
      font-weight: 900;
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    }

    .adjust-box {
      width: min(82vw, 310px);
      height: min(82vw, 310px);
      max-width: 310px;
      max-height: 310px;
      border: 3px solid #ffd700;
      background: #fff;
      position: relative;
      overflow: hidden;
      touch-action: none;
      user-select: none;
      cursor: grab;
    }

    .adjust-box:active {
      cursor: grabbing;
    }

    #adjustImg {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 100%;
      height: 100%;
      object-fit: contain;
      transform: translate(-50%, -50%) scale(1);
      transform-origin: center;
      background: #fff;
      will-change: transform;
    }

    .adjust-guide {
      position: absolute;
      z-index: 2;
      inset: 9%;
      border: 2px solid rgba(255, 183, 37, 0.94);
      box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.08);
      pointer-events: none;
    }

    .adjust-guide-v,
    .adjust-guide-h {
      position: absolute;
      opacity: 0.72;
    }

    .adjust-guide-v {
      top: 0;
      bottom: 0;
      left: 50%;
      border-left: 1px dashed rgba(255, 159, 24, 0.92);
    }

    .adjust-guide-h {
      left: 0;
      right: 0;
      top: 50%;
      border-top: 1px dashed rgba(255, 159, 24, 0.92);
    }

    .adjust-overlay {
      position: absolute;
      z-index: 3;
      inset: 9%;
      display: grid;
      place-items: center;
      pointer-events: none;
    }

    #adjustChar {
      color: rgba(211, 47, 47, 0.62);
      font-family: KaiTi, STKaiti, "Microsoft YaHei", serif;
      font-size: min(42vw, 160px);
      font-weight: 900;
      transform: scale(1);
      transform-origin: center;
      line-height: 1;
      will-change: transform;
    }

    .controls {
      width: min(100%, 380px);
      display: grid;
      gap: 8px;
    }

    .control-hint {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      color: #ffd700;
      font-weight: 900;
      text-align: center;
    }

    .control-hint img {
      width: 42px;
      transform: rotate(-10deg);
    }

    .range-wrap {
      display: grid;
      grid-template-columns: 42px 34px minmax(0, 1fr) 34px 48px;
      gap: 7px;
      align-items: center;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.1);
      padding: 7px 9px;
      color: #fff;
      font-weight: 900;
    }

    .range-wrap output {
      font-variant-numeric: tabular-nums;
      text-align: right;
      font-size: 13px;
    }

    .adjust-target-switch {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 3px;
      padding: 3px;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.12);
    }

    .adjust-target-switch button {
      min-height: 34px;
      border: 0;
      border-radius: 6px;
      background: transparent;
      color: rgba(255, 255, 255, 0.72);
      font-weight: 900;
    }

    .adjust-target-switch button.active {
      background: #fff;
      color: #7b3e12;
    }

    .adjust-scale-button,
    .nudge-pad button,
    .adjust-reset {
      width: 34px;
      height: 34px;
      border: 1px solid rgba(255, 255, 255, 0.24);
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.15);
      color: #fff;
      font-size: 21px;
      font-weight: 900;
      line-height: 1;
    }

    .adjust-fine-row {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 16px;
    }

    .nudge-pad {
      display: grid;
      grid-template-columns: repeat(4, 34px);
      gap: 8px;
    }

    .adjust-reset {
      color: #ffd979;
    }

    input[type="range"] {
      width: 100%;
      accent-color: var(--orange);
    }

    .report {
      overflow-y: auto;
      padding-bottom: 26px;
      background: #fff8e1;
    }

    .report-card {
      width: 100%;
      margin: 0;
      border: 0;
      padding: 24px 0 18px;
      background: transparent;
      box-shadow: none;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .final-frame-wrapper {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 26px;
      width: min(86%, 368px);
      min-height: 250px;
      padding: 24px 28px;
      position: relative;
      border: 8px solid #ffb74d;
      border-radius: 8px;
      background: #fff;
      box-shadow: 0 10px 20px rgba(62, 39, 35, 0.1);
    }

    .final-frame {
      position: relative;
      width: 190px;
      height: 190px;
      flex: 0 0 190px;
      margin: 0;
      border: 0;
      border-radius: 0;
      background: transparent;
      overflow: hidden;
    }

    .final-frame img.work {
      width: 100%;
      height: 100%;
      object-fit: contain;
      display: block;
    }

    .stamp-img {
      width: 76px;
      height: 76px;
      flex: 0 0 76px;
      object-fit: contain;
      transform: none;
      filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    }

    .comment-bubble {
      width: min(90%, 390px);
      margin-top: 48px;
      position: relative;
      border-radius: 15px;
      background: #fff;
      border: 2px solid #ffcc80;
      padding: 36px 22px 22px;
      color: #555;
      line-height: 1.75;
      font-size: 16px;
      box-shadow: 0 4px 12px rgba(230, 81, 0, 0.06);
    }

    .comment-bubble::before {
      content: "";
      position: absolute;
      top: -14px;
      left: 50%;
      transform: translateX(-50%);
      border-width: 0 14px 14px 14px;
      border-style: solid;
      border-color: transparent transparent #ffcc80 transparent;
    }

    .comment-bubble img {
      position: absolute;
      right: -6px;
      top: -72px;
      width: 94px;
      transform: rotate(10deg);
      z-index: 2;
    }

    .stars {
      color: #ffd700;
      font-size: 26px;
      text-align: center;
      margin-bottom: 10px;
      letter-spacing: 2px;
    }

    .report-actions {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      margin-top: 28px;
      margin-bottom: 20px;
    }

    .report-actions .btn-light {
      display: none;
    }

    .btn-report {
      width: min(58%, 250px);
      min-height: 50px;
      border-radius: 999px;
      background: linear-gradient(to right, #9e9e9e, #757575);
      color: #fff;
      font-size: 18px;
      font-weight: 900;
      box-shadow: 0 10px 20px rgba(255, 94, 58, 0.18);
    }

    .report-footer {
      margin-top: auto;
      padding: 30px 12px 10px;
      color: #9b918b;
      font-size: 12px;
      text-align: center;
      line-height: 1.7;
    }

    .loading,
    .confirm {
      display: none;
      position: fixed;
      inset: 0;
      width: min(100vw, 430px);
      margin: 0 auto;
      z-index: 50;
      align-items: center;
      justify-content: center;
    }

    .loading {
      background: rgba(255, 248, 225, 0.96);
      color: #5d4037;
      text-align: center;
      font-weight: 900;
      line-height: 1.8;
    }

    .loading img {
      width: 112px;
      display: block;
      margin: 0 auto 12px;
      animation: breathe 1.5s infinite ease-in-out;
    }

    .confirm {
      background: rgba(0, 0, 0, 0.78);
      padding: 20px;
    }

    .modal {
      width: min(100%, 330px);
      border-radius: 18px;
      background: #fff;
      color: var(--ink);
      padding: 18px;
      text-align: center;
      box-shadow: var(--shadow);
    }

    .modal h3 {
      margin: 0 0 8px;
      font-size: 20px;
    }

    .modal p {
      margin: 0 0 16px;
      color: var(--muted);
      line-height: 1.7;
    }

    .modal-actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .status-note {
      position: absolute;
      left: 24px;
      right: 24px;
      top: 70px;
      z-index: 8;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.46);
      color: rgba(255, 255, 255, 0.86);
      padding: 8px 12px;
      text-align: center;
      font-size: 13px;
      line-height: 1.5;
    }

    @keyframes breathe {
      0% { transform: scale(0.95); opacity: 0.9; }
      50% { transform: scale(1.04); opacity: 1; }
      100% { transform: scale(0.95); opacity: 0.9; }
    }

    .lesson-tabs {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 8px;
      margin: -2px 0 8px;
      font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    }

    .lesson-tab {
      min-height: 32px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.8);
      border: 1px solid rgba(255, 183, 77, 0.42);
      color: #8d5b22;
      font-size: 13px;
      font-weight: 800;
      box-shadow: 0 6px 14px rgba(62, 39, 35, 0.06);
    }

    .lesson-tab.active {
      background: linear-gradient(135deg, #ffb74d, #ff8a00);
      color: #fff;
      border-color: transparent;
      box-shadow: 0 9px 18px rgba(255, 149, 0, 0.22);
    }

    .video-box iframe {
      display: none;
      width: 100%;
      height: 100%;
      border: 0;
      background: #fff;
    }

    .video-box.use-frame {
      background: #fff;
    }

    .video-box.use-frame video {
      display: none;
    }

    .video-box.use-frame iframe {
      display: block;
    }

    .video-card.frame-mode {
      height: min(90vw, 380px);
      background: #fff;
    }

    .video-card.frame-mode .teaching-panda {
      right: -14px;
      bottom: -14px;
    }

    @media (min-width: 700px) {
      body {
        padding: 20px 0;
      }

      .phone-shell {
        min-height: calc(100vh - 40px);
        border-radius: 28px;
      }

      .screen,
      .camera-screen,
      .adjust-screen {
        min-height: calc(100vh - 40px);
      }
    }

    @media (max-width: 360px) {
      .home {
        padding: 48px 18px 30px;
      }

      .practice-area {
        margin-top: 32px;
        --home-char-size: clamp(54px, calc((100vw - 88px) / 4), 68px);
        --home-char-gap: 8px;
        min-height: 380px;
        min-height: min(420px, calc(100svh - 220px));
      }

      .char-grid {
        grid-template-columns: repeat(4, var(--home-char-size));
        gap: var(--home-char-gap);
      }

      .mi-grid {
        inset: 8px;
      }

      .char-text {
        font-size: clamp(36px, 12.2vw, 46px);
      }

      .btn-main {
        width: min(82%, 320px);
        min-height: 42px;
        font-size: 15px;
      }

      .eyebrow {
        font-size: 16px;
        margin-bottom: 15px;
      }

      h1 {
        font-size: 20px;
      }

      .course-card {
        border-radius: 16px;
        padding: 14px 16px 14px 18px;
      }

      .course-title {
        font-size: 15px;
      }

      .group-title {
        font-size: 15px;
      }

      .tian-card {
        grid-template-columns: 1fr;
      }

      .tian {
        margin: 0 auto;
      }
    }

    .ocr-debug {
      margin-top: 14px;
      padding: 9px 11px;
      border-radius: 12px;
      border: 1px dashed rgba(255, 167, 38, 0.66);
      background: rgba(255, 248, 225, 0.74);
      color: #71564b;
      font-size: 13px;
      font-weight: 700;
      line-height: 1.6;
      text-align: left;
    }

    .ocr-debug.good {
      border-color: rgba(67, 160, 71, 0.48);
      background: rgba(232, 245, 233, 0.88);
      color: #3f6f46;
    }

    .ocr-debug.warn {
      border-color: rgba(255, 167, 38, 0.68);
    }

    .ocr-debug.error {
      border-color: rgba(239, 83, 80, 0.52);
      background: rgba(255, 235, 238, 0.82);
      color: #8a4b45;
    }


    .site-beian {
      display: none;
      position: fixed;
      left: 50%;
      bottom: calc(7px + env(safe-area-inset-bottom));
      transform: translateX(-50%);
      width: min(100vw, 430px);
      padding: 0 10px;
      color: #9b918b;
      font-size: 11px;
      line-height: 1.45;
      text-align: center;
      z-index: 7;
      pointer-events: none;
    }

    body.beian-home .site-beian {
      display: block;
    }

    body.beian-home .home {
      padding-bottom: 78px;
    }

    .site-beian div {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: center;
      column-gap: 12px;
      row-gap: 3px;
    }

    .site-beian a {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      color: #9b918b;
      text-decoration: none;
      pointer-events: auto;
      white-space: nowrap;
    }

    .site-beian img {
      width: 16px;
      height: 16px;
      flex: 0 0 auto;
      object-fit: contain;
    }

    #goScan {
      width: min(68%, 280px);
      min-height: 48px;
      font-size: 17px;
    }


    html,
    body {
      width: 100%;
      min-width: 0;
      padding: 0;
      background: var(--paper);
    }

    .phone-shell {
      width: 100%;
      max-width: none;
      min-height: 100vh;
      min-height: 100svh;
      min-height: 100dvh;
      margin: 0;
      border-radius: 0;
      box-shadow: none;
    }

    .screen {
      min-height: 100vh;
      min-height: 100svh;
      min-height: 100dvh;
    }

    .study .fixed-bottom {
      left: 0;
      right: 0;
      width: 100%;
      max-width: none;
      margin: 0;
      transform: none;
    }

    .loading,
    .confirm {
      left: 0;
      right: 0;
      width: 100%;
      max-width: none;
      margin: 0;
      transform: none;
    }

    .site-beian {
      left: 0;
      right: 0;
      width: 100%;
      max-width: none;
      transform: none;
    }

    @media (min-width: 700px) and (hover: hover) and (pointer: fine) {
      body {
        padding: 20px 0;
        background: #f4efe6;
      }

      .phone-shell {
        max-width: 430px;
        min-height: calc(100vh - 40px);
        margin: 0 auto;
        border-radius: 28px;
        box-shadow: 0 0 0 1px rgba(62, 39, 35, 0.08), 0 18px 46px rgba(62, 39, 35, 0.18);
      }

      .screen,
      .camera-screen,
      .adjust-screen {
        min-height: calc(100vh - 40px);
      }

      .study .fixed-bottom,
      .loading,
      .confirm,
      .site-beian {
        left: 50%;
        right: auto;
        width: min(100vw, 430px);
        transform: translateX(-50%);
      }
    }


    .video-box {
      position: relative;
    }

    .video-play-overlay {
      display: none;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: 54px;
      height: 54px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.92);
      color: #3e2723;
      font-size: 24px;
      font-weight: 900;
      line-height: 54px;
      text-align: center;
      box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
      z-index: 4;
    }

    .video-play-overlay.show {
      display: grid;
      place-items: center;
    }

    .video-box.is-playing .video-play-overlay {
      display: none;
    }

    .fixed-bottom .btn-main,
    .adjust-screen > .btn-main {
      width: min(72%, 280px);
      min-height: 44px;
    }

    .modal-actions .btn-main {
      width: 100%;
    }



    body.app-booting {
      background: linear-gradient(135deg, #fff8e1 0%, #ffe0b2 100%);
    }

    body.app-booting .phone-shell,
    body.app-booting .site-beian {
      visibility: hidden;
    }

    body.app-booting::before {
      content: "";
      position: fixed;
      inset: 0;
      z-index: 9998;
      background: linear-gradient(135deg, #fff8e1 0%, #ffe0b2 100%);
    }

    body.app-booting::after {
      content: "潘哒哒书法课";
      position: fixed;
      left: 0;
      right: 0;
      top: 46%;
      z-index: 9999;
      color: #e65100;
      font-size: 26px;
      font-weight: 900;
      text-align: center;
      letter-spacing: 1px;
      animation: bootPulse 1.1s ease-in-out infinite alternate;
    }

    @keyframes bootPulse {
      from { opacity: 0.62; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }
