/* 鲸尾书斋 · 四季自习室
   像素方块视觉：硬边描边、无圆角、无模糊阴影；配色沿用站点浅色底 + 深色舞台 */

.study-section { border-top: none; padding-top: clamp(8px, 2vw, 18px); }

.study-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(300px, .72fr);
  gap: clamp(20px, 3vw, 38px);
  align-items: start;
}

/* ---------------- 季节切换 ---------------- */
.season-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}
.season-tab {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 12px 9px;
  border: 3px solid #b9cbe0;
  border-bottom-width: 5px;
  background: #fbfdff;
  color: #4a5f7d;
  text-align: left;
  transition: transform .12s steps(2), background .15s, border-color .15s, color .15s;
}
.season-tab__cn { font-size: 15px; font-weight: 700; letter-spacing: .18em; }
.season-tab__en { font-size: 9px; letter-spacing: .22em; opacity: .62; }
.season-tab:hover { border-color: #8fa9c6; color: #1b2d4b; }
.season-tab.is-on {
  background: #1e2a41;
  border-color: #101a2b;
  color: #f2f7ff;
  transform: translateY(2px);
}
.season-tab.is-on::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -5px; height: 3px;
  background: var(--season-accent, #e88fa8);
}
.season-tab[data-season="spring"] { --season-accent: #e08aa4; }
.season-tab[data-season="summer"] { --season-accent: #f0b429; }
.season-tab[data-season="autumn"] { --season-accent: #dd7f34; }
.season-tab[data-season="winter"] { --season-accent: #7aa7d9; }

/* ---------------- 场景舞台 ---------------- */
.scene-wrap { --frame-1: #26324a; --frame-2: #131b2b; }

.scene-frame {
  position: relative;
  padding: 8px;
  background: var(--frame-1);
  border: 3px solid var(--frame-2);
  box-shadow: 0 0 0 3px #33405c, 0 14px 0 -6px rgba(27, 45, 75, .18);
}
#studyScene {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0f1522;
}

.scene-hud {
  position: absolute; left: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 7px 11px 6px;
  background: rgba(12, 18, 30, .74);
  border-left: 3px solid var(--hud-accent, #e08aa4);
  color: #eef4ff;
  pointer-events: none;
}
.scene-hud b { font-size: 13px; letter-spacing: .16em; font-weight: 700; }
.scene-hud span { font-size: 10px; letter-spacing: .12em; opacity: .74; }

.scene-caption {
  margin-top: 14px;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink-2);
}

.scene-parts {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 12px;
  list-style: none; padding: 0;
}
.scene-parts li {
  padding: 4px 9px;
  font-size: 11px; letter-spacing: .06em;
  color: #55688a;
  background: #eef4fa;
  border: 2px solid #d7e4f0;
}

/* ---------------- 计时器 ---------------- */
.study-aside { position: sticky; top: 92px; display: grid; gap: 14px; }

.timer-card {
  padding: 18px 18px 16px;
  background: #fbfdff;
  border: 3px solid #c2d4e6;
  border-bottom-width: 6px;
  box-shadow: 0 0 0 3px #e6effa;
}

.timer-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.timer-head b { font-size: 13.5px; letter-spacing: .14em; color: #16233c; }
.timer-status {
  padding: 3px 8px; font-size: 10.5px; letter-spacing: .1em;
  color: #4d6383; background: #eaf1f9; border: 2px solid #d3e2f0;
}
.timer-status[data-state="running"] { color: #1f6b4a; background: #e4f4ea; border-color: #bfe3cd; }
.timer-status[data-state="paused"] { color: #8a5a12; background: #fdf1dc; border-color: #f0d9b0; }
.timer-status[data-state="done"] { color: #a5312c; background: #fbe6e4; border-color: #f0c3bf; }

/* 点阵数字：5×7 像素字，由 JS 写入 box-shadow；元素本身只有 1 格大，其余点靠阴影铺开 */
.timer-face {
  --u: clamp(5px, 1.15vw, 7px);
  display: flex; align-items: flex-start; justify-content: center;
  gap: calc(var(--u) * 1.5);
  min-height: calc(var(--u) * 7 + 22px);
  padding: 10px 0 12px;
  color: #17253f;
}
.timer-face.is-done { color: #b3352f; }
.timer-face.is-done .pix-char { animation: pix-blink 1s steps(1) infinite; }
@keyframes pix-blink { 50% { opacity: .28; } }

.pix-char {
  display: block; flex: none;
  width: var(--u); height: var(--u);
  margin-right: calc(var(--u) * 4);
  box-shadow: var(--dots, none);
}
.pix-colon {
  display: block; flex: none;
  width: var(--u); height: var(--u);
  box-shadow: var(--dots, none);
}
.timer-face > :last-child { margin-right: 0; }

/* 进度：24 段方格 */
.timer-progress {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  height: 8px;
  margin-bottom: 16px;
}
.timer-progress i {
  display: block;
  background: #e2ecf6;
  transition: background .2s steps(2);
}
.timer-progress i.on { background: var(--bar-accent, #6f8fbe); }
.timer-progress i.head { background: #17253f; }

.timer-actions { display: grid; grid-template-columns: 1.35fr 1fr; gap: 8px; margin-bottom: 12px; }

.px-btn {
  padding: 11px 12px;
  font-size: 13px; letter-spacing: .12em; font-weight: 600;
  color: #1b2d4b;
  background: #e9f1fa;
  border: 3px solid #b9cde0;
  border-bottom-width: 5px;
  transition: transform .1s steps(2), background .15s, border-color .15s;
}
.px-btn:hover { background: #dde9f6; border-color: #93adc8; }
.px-btn:active { transform: translateY(3px); border-bottom-width: 3px; }
.px-btn--primary { color: #f4f9ff; background: #2f5a92; border-color: #1d3f6b; }
.px-btn--primary:hover { background: #37679f; border-color: #20456f; }
.px-btn--sm { padding: 8px 12px; font-size: 12px; letter-spacing: .08em; }

.timer-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.px-chip {
  padding: 8px 4px;
  font-size: 12px; font-weight: 600; color: #3c5070;
  background: #f2f7fc;
  border: 2px solid #d8e4f0;
  transition: .15s;
}
.px-chip em { font-style: normal; font-size: 9px; opacity: .7; margin-left: 1px; }
.px-chip:hover { border-color: #9db6d0; }
.px-chip.is-on { background: #1e2a41; border-color: #101a2b; color: #f2f7ff; }

.timer-custom {
  display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; align-items: end;
  padding-top: 12px; border-top: 2px dashed #dbe6f2;
}
.timer-custom label {
  display: grid; gap: 4px;
  font-size: 10px; letter-spacing: .12em; color: #6a7d97;
}
.timer-custom input {
  width: 100%; padding: 8px 9px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px; color: #17253f;
  background: #fff;
  border: 2px solid #cfdff0;
  border-radius: 0;
}
.timer-custom input:focus { outline: none; border-color: #2f5a92; }

.timer-hint { margin-top: 11px; font-size: 11px; line-height: 1.7; color: #7a8ca4; }

.study-note {
  padding: 15px 16px;
  background: #eef4fb;
  border-left: 3px solid #9fb8d4;
}
.study-note b { font-size: 12px; letter-spacing: .14em; color: #2c4568; }
.study-note p { margin-top: 6px; font-size: 12.5px; line-height: 1.85; color: #536a88; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 980px) {
  .study-grid { grid-template-columns: minmax(0, 1fr); }
  .study-aside { position: static; }
  .timer-card { max-width: 520px; }
}
@media (max-width: 560px) {
  .season-tab { padding: 8px 8px 7px; border-width: 2px; border-bottom-width: 4px; }
  .season-tab__cn { font-size: 14px; letter-spacing: .1em; }
  .season-tab__en { font-size: 8px; letter-spacing: .14em; }
  .timer-card { padding: 15px 14px 14px; }
  .timer-face { --u: clamp(5px, 3vw, 6px); gap: calc(var(--u) * 1.2); }
  .timer-custom { grid-template-columns: 1fr 1fr 1fr; }
  .timer-custom .px-btn { grid-column: 1 / -1; }
  .scene-hud { left: 14px; bottom: 14px; padding: 5px 8px 4px; }
  .scene-hud b { font-size: 11px; letter-spacing: .1em; }
  .scene-hud span { font-size: 9px; }
  .scene-caption { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .season-tab, .px-btn { transition: none; }
  .timer-face.is-done .pix-char { animation: none; }
}

/* 场景下方提示 */
.scene-tip {
  margin-top: 7px;
  font-size: 11.5px; letter-spacing: .04em; color: #8497ad;
}
.scene-tip::before { content: "▸ "; color: #b3c4d6; }

/* 桌面闹钟：点击画面里的闹钟弹出的设置层 */
.alarm-dialog {
  position: absolute; inset: 0; z-index: 6;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(10, 16, 28, .62);
}
.alarm-dialog[hidden] { display: none; }

.alarm-box {
  width: min(346px, 100%);
  padding: 15px 16px 14px;
  background: #fbfdff;
  border: 3px solid #16233c;
  box-shadow: 0 0 0 4px #d7e5f4;
}
.alarm-box__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.alarm-box__head b { font-size: 13px; letter-spacing: .12em; color: #16233c; }
.alarm-x {
  width: 26px; height: 26px; line-height: 1;
  font-size: 17px; color: #4a5f7d;
  background: #eef4fb; border: 2px solid #cfdff0;
  transition: .15s;
}
.alarm-x:hover { background: #dde9f6; border-color: #93adc8; }

.alarm-box__sub {
  margin-top: 8px; font-size: 11.5px; line-height: 1.7; color: #6a7d97;
}
.alarm-box__sub b { color: #2f5a92; }

.alarm-box__inputs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  margin-top: 12px;
}
.alarm-box__inputs label {
  display: grid; gap: 4px;
  font-size: 10px; letter-spacing: .12em; color: #6a7d97;
}
.alarm-box__inputs input {
  width: 100%; padding: 8px 9px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px; color: #17253f;
  background: #fff; border: 2px solid #cfdff0; border-radius: 0;
}
.alarm-box__inputs input:focus { outline: none; border-color: #2f5a92; }

.alarm-box__acts {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px;
  margin-top: 13px;
}

@media (max-width: 560px) {
  .alarm-box { padding: 13px 13px 12px; }
  .alarm-box__head b { font-size: 12px; letter-spacing: .08em; }
  .alarm-box__acts { grid-template-columns: 1fr 1fr; }
}

/* 数字输入框去掉原生上下箭头，避免破坏像素风；直接键入即可 */
.timer-custom input::-webkit-outer-spin-button,
.timer-custom input::-webkit-inner-spin-button,
.alarm-box__inputs input::-webkit-outer-spin-button,
.alarm-box__inputs input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.timer-custom input,
.alarm-box__inputs input { -moz-appearance: textfield; appearance: textfield; }

/* ---------------- 全屏专注 ---------------- */
.fs-btn {
  position: absolute; right: 10px; top: 10px; z-index: 4;
  width: 36px; height: 36px;
  background: rgba(12, 18, 30, .72);
  border: 2px solid rgba(150, 170, 195, .55);
  transition: background .15s, border-color .15s, transform .1s steps(2);
}
.fs-btn:hover { background: rgba(24, 36, 56, .92); border-color: #cfe0f2; }
.fs-btn:active { transform: translateY(2px); }
.fs-btn i { position: absolute; width: 9px; height: 9px; border: 2px solid #e8f0fa; }
.fs-btn i:nth-child(1) { top: 5px; left: 5px; border-right: 0; border-bottom: 0; }
.fs-btn i:nth-child(2) { top: 5px; right: 5px; border-left: 0; border-bottom: 0; }
.fs-btn i:nth-child(3) { bottom: 5px; left: 5px; border-right: 0; border-top: 0; }
.fs-btn i:nth-child(4) { bottom: 5px; right: 5px; border-left: 0; border-top: 0; }

/* 舞台上全是自习室，其它页面元素不参与渲染 */
.study-stage:fullscreen,
.study-stage:-webkit-full-screen,
.study-stage.is-pseudo-fs {
  position: fixed; inset: 0; z-index: 9000;
  display: grid; place-items: center;
  padding: clamp(8px, 2.4vh, 30px);
  background: #0d1422;
  overflow: hidden;
  overscroll-behavior: contain;
}
.study-stage:fullscreen .study-grid,
.study-stage:-webkit-full-screen .study-grid,
.study-stage.is-pseudo-fs .study-grid {
  width: min(100%, 1720px);
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
}
/* 场景按可用高度收口，避免全屏时竖着超出屏幕 */
.study-stage:fullscreen .scene-frame,
.study-stage:-webkit-full-screen .scene-frame,
.study-stage.is-pseudo-fs .scene-frame {
  max-width: min(100%, calc((100vh - 190px) * 16 / 9));
  margin-inline: auto;
}
/* 全屏只留场景与计时器 */
.study-stage:fullscreen .scene-caption,
.study-stage:fullscreen .scene-tip,
.study-stage:fullscreen .scene-parts,
.study-stage:-webkit-full-screen .scene-caption,
.study-stage:-webkit-full-screen .scene-tip,
.study-stage:-webkit-full-screen .scene-parts,
.study-stage.is-pseudo-fs .scene-caption,
.study-stage.is-pseudo-fs .scene-tip,
.study-stage.is-pseudo-fs .scene-parts { display: none; }
.study-stage:fullscreen .fs-btn,
.study-stage:-webkit-full-screen .fs-btn,
.study-stage.is-pseudo-fs .fs-btn { display: none; }

body.is-fs-lock { overflow: hidden; }

/* 退出按钮：只在全屏、且鼠标贴到屏幕边缘时出现 */
.fs-exit-wrap {
  position: fixed; top: 0; left: 50%; z-index: 20;
  padding: 10px 0 0;
  opacity: 0; pointer-events: none;
  transform: translateX(-50%) translateY(-10px);
  transition: opacity .22s ease, transform .22s ease;
}
.fs-exit-wrap.is-shown {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.fs-exit {
  padding: 9px 16px;
  font-size: 12px; letter-spacing: .12em; color: #eaf2fb;
  background: rgba(16, 26, 42, .94);
  border: 2px solid #6f8aa8;
  box-shadow: 0 0 0 3px rgba(8, 14, 24, .45);
}
.fs-exit:hover { background: #1d2c44; border-color: #cfe0f2; }
.fs-exit kbd {
  font: inherit; font-size: 10px; letter-spacing: .04em;
  padding: 1px 4px; margin-left: 7px;
  border: 1px solid #5d7590; color: #a9c3dd;
}

@media (max-width: 980px) {
  .study-stage:fullscreen .study-grid,
  .study-stage.is-pseudo-fs .study-grid { grid-template-columns: minmax(0, 1fr); }
  .study-stage:fullscreen .scene-frame,
  .study-stage.is-pseudo-fs .scene-frame { max-width: 100%; }
}
@media (max-width: 560px) {
  .fs-btn { width: 40px; height: 40px; }
  .fs-btn i { width: 10px; height: 10px; }
}

/* 全屏时连说明卡也收起，只留场景与计时器 */
.study-stage:fullscreen .study-note,
.study-stage:-webkit-full-screen .study-note,
.study-stage.is-pseudo-fs .study-note { display: none; }

/* 极矮窗口才允许滚动，避免内容被裁 */
@media (max-height: 620px) {
  .study-stage:fullscreen,
  .study-stage.is-pseudo-fs { overflow: auto; }
}
