/* 作业大屏覆盖样式：后台数据、日历标记、手机提示、登录门禁 */

/* 原始 200% 宽 + 3D 透视会让手机布局视口被撑到 900+ px，导致整页缩小 */
html { overflow: hidden; }
.bg-grid-3d { width: 100% !important; left: 0 !important; }

body.screen-display .math-box-actions,
body.screen-display #mathAddPage,
body.screen-display #mathSettings {
  display: none !important;
}

/* 大屏数学编辑条：上传题目 / 设置 */
.math-editor-bar {
  position: absolute; right: 4px; bottom: 42px; z-index: 25;
  display: flex; gap: 7px;
}
.math-editor-bar[hidden] { display: none !important; }
.math-editor-bar button {
  height: 30px; padding: 0 12px; border-radius: 99px; cursor: pointer;
  border: 1px solid rgba(0, 242, 254, .38); background: rgba(4, 18, 32, .78);
  color: #dffcff; font-family: inherit; font-size: 12px; letter-spacing: .04em;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: .2s;
}
.math-editor-bar button:hover { background: rgba(0, 242, 254, .22); border-color: rgba(0, 242, 254, .7); }
body.home-empty .math-editor-bar { bottom: 8px; }
.math-settings { bottom: 84px; width: 280px; }
.math-settings input[type="range"] { padding: 0; accent-color: #00f2fe; }

/* 大屏展示时，题目标题放在图片上方，避免遮住题目内容 */
body.screen-display .math-box.has-photo .math-box-head {
  position: static;
  background: none;
  padding: 10px 16px 0;
  pointer-events: none;
}
body.screen-display .math-box.has-photo .math-box-body {
  padding: 8px 18px 14px;
}

/* ---------- 数学文字题 ---------- */
.math-text-body {
  display: flex; align-items: center; justify-content: center;
  padding: 6px 22px 18px; overflow: auto;
}
.math-text-content {
  width: 100%; max-height: 100%; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
  font-size: clamp(20px, 1.8vw, 36px); line-height: 1.75;
  color: #f2feff; text-shadow: 0 3px 16px rgba(0, 0, 0, .45);
  letter-spacing: .02em;
}
.math-text-box { background: linear-gradient(145deg, rgba(0, 242, 254, .07), rgba(255, 255, 255, .03)); }

/* ---------- 照片自由缩放的手柄（可不等比拉伸） ---------- */
.photo-handles { position: absolute; inset: 0; z-index: 9; pointer-events: none; }
.photo-handle {
  position: absolute; width: 14px; height: 14px; border-radius: 4px;
  background: rgba(0, 242, 254, .9); border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 0 10px rgba(0, 242, 254, .75);
  pointer-events: auto; opacity: .38; transition: opacity .2s, transform .15s;
  touch-action: none;
}
.photo-frame:hover .photo-handle,
.photo-frame.resizing .photo-handle { opacity: 1; }
.photo-handle:hover { transform: scale(1.2); }
.photo-handle.nw { top: 6px; left: 6px; cursor: nwse-resize; }
.photo-handle.n  { top: 6px; left: 50%; margin-left: -7px; cursor: ns-resize; }
.photo-handle.ne { top: 6px; right: 6px; cursor: nesw-resize; }
.photo-handle.e  { top: 50%; right: 6px; margin-top: -7px; cursor: ew-resize; }
.photo-handle.se { bottom: 6px; right: 6px; cursor: nwse-resize; }
.photo-handle.s  { bottom: 6px; left: 50%; margin-left: -7px; cursor: ns-resize; }
.photo-handle.sw { bottom: 6px; left: 6px; cursor: nesw-resize; }
.photo-handle.w  { top: 50%; left: 6px; margin-top: -7px; cursor: ew-resize; }
.photo-frame.resizing { cursor: default; }

@supports (height: 100dvh) {
  body { height: 100dvh; }
}

/* ---------- 登录门禁 ---------- */
.screen-gate {
  position: fixed; inset: 0; z-index: 10020;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 42%, rgba(0, 90, 140, .3), transparent 70%),
    #02050f;
  transition: opacity .45s ease, visibility .45s;
}
.screen-gate.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.screen-gate-card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 520px; }
.screen-gate-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid rgba(0, 242, 254, .18); border-top-color: #00f2fe;
  animation: sg-spin .8s linear infinite; margin-bottom: 6px;
}
@keyframes sg-spin { to { transform: rotate(360deg); } }
.screen-gate-title { font-family: 'STXingkai', 'KaiTi', serif; font-size: 1.7rem; letter-spacing: .14em; color: #eafcff; }
.screen-gate-sub { font-size: 12px; letter-spacing: .12em; color: rgba(160, 220, 250, .65); line-height: 1.7; }
.screen-gate.error .screen-gate-title { color: #ffb3c5; }
.screen-gate-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; justify-content: center; }
.screen-gate-btn {
  padding: 9px 18px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .06); color: #dffcff; font-family: inherit; font-size: 13px;
  text-decoration: none; cursor: pointer;
}
.screen-gate-btn.primary { border-color: rgba(0, 242, 254, .55); background: rgba(0, 242, 254, .18); }

/* ---------- 语文句子卡片 ---------- */
#leftPanel { overflow-y: auto; overflow-x: hidden; padding-right: 3px; scrollbar-width: thin; }
#leftPanel::-webkit-scrollbar { width: 5px; }
#leftPanel::-webkit-scrollbar-thumb { background: rgba(0, 242, 254, .22); border-radius: 99px; }
#leftPanel .sentence-card { min-height: 68px; }
#leftPanel .sentence-card.expanded { min-height: 220px; }
.screen-loading-card,
.screen-empty-card {
  flex: 1; justify-content: center; align-items: center; text-align: center;
  border-style: dashed;
}
.screen-loading-card .card-text,
.screen-empty-card .card-text { font-size: clamp(1.1rem, 1.8vw, 1.6rem); color: rgba(220, 245, 255, .7); }
.screen-empty-card .card-details { max-height: none; opacity: 1; transform: none; margin-top: 10px; }
.screen-empty-card .detail-item { font-size: 15px; }
.screen-loading-card .card-text { animation: screen-breathe 2.2s ease-in-out infinite; }
@keyframes screen-breathe { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* 空白日期也要能看见「没有作业」的说明，而不是一张空壳卡片 */
body.home-empty .left-panel .screen-empty-card { opacity: 1; pointer-events: none; }
body.home-empty .left-panel .screen-empty-card .card-main-row { display: flex; }
body.home-empty .left-panel .screen-empty-card .card-details {
  display: block; max-height: none; opacity: 1; transform: none;
}

/* ---------- 日历：有作业的日期 ---------- */
.cal-day.has-hw:not(.is-today) {
  border-color: rgba(255, 51, 153, .45);
  background: linear-gradient(150deg, rgba(255, 51, 153, .12), rgba(255, 255, 255, .03) 55%, rgba(0, 242, 254, .06));
}
.cal-day.has-hw:not(.is-today) .cal-daynum { color: #fff; }
.cal-badge-hw { color: #1c0610; background: linear-gradient(135deg, #ffb3d5, #ff3399); }
.cal-day.has-hw .day-thumb { border-color: rgba(255, 51, 153, .22); }

/* ---------- 手机端提示 ---------- */
.screen-mobile-notice { display: none; }

@media (max-width: 900px) {
  body.stage-home #mainContainer,
  body.stage-home .back-btn,
  body.stage-home .date-chip,
  body.stage-home #drawingToolbar,
  body.stage-home #drawingCanvas,
  body.stage-home #previewCanvas,
  body.stage-home #brushCursor {
    display: none !important;
  }
  body.stage-home #screenMobileNotice {
    display: flex;
    position: fixed; inset: 0; z-index: 10015;
    flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    padding: 28px 22px calc(28px + env(safe-area-inset-bottom, 0px));
    text-align: center;
    background:
      radial-gradient(ellipse 80% 60% at 50% 30%, rgba(0, 80, 130, .4), transparent 72%),
      radial-gradient(ellipse 60% 45% at 80% 90%, rgba(255, 51, 153, .14), transparent 70%),
      rgba(2, 6, 14, .97);
  }
  .smn-icon {
    width: 72px; height: 72px; border-radius: 20px; display: flex; align-items: center; justify-content: center;
    font-size: 30px; color: #00f2fe; border: 1px solid rgba(0, 242, 254, .4);
    background: rgba(0, 242, 254, .08); box-shadow: 0 0 38px rgba(0, 242, 254, .22);
    margin-bottom: 6px;
  }
  .smn-title { font-family: 'STXingkai', 'KaiTi', serif; font-size: 1.65rem; letter-spacing: .08em; color: #f2feff; }
  .smn-text { max-width: 32em; font-size: 13px; line-height: 1.85; color: rgba(180, 220, 242, .78); }
  .smn-actions { display: flex; flex-direction: column; gap: 10px; width: min(320px, 100%); margin-top: 14px; }
  .smn-btn {
    display: flex; align-items: center; justify-content: center;
    padding: 12px 18px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .05); color: #dffcff; font-family: inherit; font-size: 14px; text-decoration: none;
  }
  .smn-btn.primary { border-color: rgba(0, 242, 254, .55); background: rgba(0, 242, 254, .16); font-weight: 700; }
  .smn-foot { margin-top: 18px; font: 10px/1.6 Consolas, monospace; letter-spacing: .22em; color: rgba(130, 190, 225, .45); }
}

@media (max-width: 700px) {
  .countdown-panel { max-height: 94vh; overflow: auto; }
  .schedule-panel { max-height: 94vh; }
  .calendar-panel { max-height: 94vh; }

  /* 手机日历只保留日期和作业圆点，避免 7 列缩略图被压成细条 */
  .cal-day { min-height: 56px; padding: 6px; gap: 2px; }
  .day-thumb { display: none; }
  .cal-day.has-hw::before {
    content: ''; position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
    width: 5px; height: 5px; border-radius: 50%; background: #ff3399;
    box-shadow: 0 0 8px rgba(255, 51, 153, .8);
  }
  .schedule-grid { min-width: 620px; grid-template-columns: 58px repeat(7, minmax(76px, 1fr)); }
  .sch-cell { min-height: 46px; font-size: 12px; }
}
