
:root{
  --bg:#f2f2f0;
  --paper:#fff;
  --text:#101012;
  --muted:#76767c;
  --line:#dddddf;
  --axis:38px;
  --day-head:42px;
}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:var(--bg);color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;-webkit-text-size-adjust:100%}
button,input{font:inherit}
button{-webkit-tap-highlight-color:transparent;cursor:pointer}
[hidden]{display:none!important}

.screen{
  width:min(100%,760px);
  height:100dvh;
  margin:0 auto;
  padding:8px 8px calc(8px + env(safe-area-inset-bottom));
  display:flex;
  flex-direction:column;
  gap:8px;
}
.week-bar{
  flex:0 0 auto;
  background:#fff;
  border:1px solid #e1e1e3;
  border-radius:18px;
  padding:8px 10px 7px;
  box-shadow:0 8px 22px rgba(0,0,0,.055);
}
.week-main-row{display:grid;grid-template-columns:36px 1fr 36px;align-items:center;gap:8px}
.arrow-btn{width:36px;height:36px;border:0;border-radius:12px;background:#111;color:#fff;font-size:24px;display:grid;place-items:center;line-height:1}
.arrow-btn:disabled{opacity:.2;cursor:default}
.current-week{text-align:center;min-width:0}
.current-week strong{display:block;font-size:19px;letter-spacing:-.03em;line-height:1.1}
.current-week span{display:block;margin-top:3px;color:var(--muted);font-size:10px}
.week-strip{display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;margin-top:7px;padding-bottom:1px}
.week-strip::-webkit-scrollbar{display:none}
.week-pill{flex:0 0 auto;border:1px solid #d8d8dc;background:#f7f7f6;color:#414147;border-radius:999px;padding:6px 9px;font-size:10px;font-weight:800;line-height:1}
.week-pill.active{background:#111;color:#fff;border-color:#111}

.timetable-card{
  flex:1 1 auto;
  min-height:0;
  background:#fff;
  border:1px solid #e1e1e3;
  border-radius:18px;
  padding:8px;
  box-shadow:0 8px 24px rgba(0,0,0,.055);
  display:flex;
  flex-direction:column;
}
.table-toolbar{flex:0 0 auto;height:38px;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 2px 7px}
.table-toolbar h1{margin:0;font-size:16px;letter-spacing:-.03em;line-height:1}
.table-toolbar p{margin:4px 0 0;color:var(--muted);font-size:9px;line-height:1}
.current-btn{border:1px solid #d7d7db;background:#fff;color:#111;border-radius:11px;padding:7px 9px;font-size:10px;font-weight:800;line-height:1}
.load-error{flex:0 0 auto;background:#111;color:#fff;border-radius:12px;padding:10px;font-size:11px;margin-bottom:6px}

.schedule-wrap{
  flex:1 1 auto;
  min-height:0;
  display:grid;
  grid-template-columns:var(--axis) minmax(0,1fr);
  border:1px solid #d9d9dc;
  border-radius:14px;
  overflow:hidden;
  background:#fafaf9;
}
.time-axis{position:relative;background:#eeeeec;border-right:1px solid #d9d9dc;min-height:0}
.axis-head{height:var(--day-head);border-bottom:1px solid #dedee1}
.axis-body{position:relative;height:calc(100% - var(--day-head))}
.axis-label{position:absolute;left:0;right:0;transform:translateY(-50%);text-align:center;font-size:8px;color:#696970;font-weight:800;line-height:1}
.week-grid-area{min-width:0;min-height:0;display:flex;flex-direction:column}
.days-head{flex:0 0 var(--day-head);display:grid;grid-template-columns:repeat(5,1fr);background:#f0f0ee;border-bottom:1px solid #dedee1}
.day-head{display:flex;flex-direction:column;align-items:center;justify-content:center;border-left:1px solid #e2e2e5;min-width:0}
.day-head:first-child{border-left:0}
.day-head strong{font-size:10px;line-height:1}
.day-head span{font-size:8px;color:#78787e;margin-top:3px;line-height:1}
.grid-body{position:relative;flex:1 1 auto;min-height:0;display:grid;grid-template-columns:repeat(5,1fr);background:#fbfbfa}
.day-column{position:relative;min-width:0;border-left:1px solid #e7e7e9}
.day-column:first-child{border-left:0}
.hour-line{position:absolute;left:0;right:0;border-top:1px solid #eeeeef;z-index:0;pointer-events:none}
.course{position:absolute;left:2px;right:2px;border-radius:8px;padding:4px 3px 3px;border:1px solid #111;overflow:hidden;text-align:left;z-index:1;box-shadow:0 3px 8px rgba(0,0,0,.08);transition:.14s transform}
.course:active{transform:scale(.975)}
.course.pending{background:#111;color:#fff}
.course.done{background:#fff;color:#111;border-color:#b8b8bd}
.course-title{display:block;font-size:8.5px;font-weight:850;line-height:1.14;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
.course-room{display:block;font-size:7px;opacity:.72;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.course-time{display:block;font-size:6.5px;opacity:.65;margin-top:2px;white-space:nowrap}
.done-badge{position:absolute;right:3px;top:3px;width:12px;height:12px;border-radius:50%;background:#111;color:#fff;display:grid;place-items:center;font-size:7px;font-weight:900}

.modal-mask{position:fixed;inset:0;background:rgba(0,0,0,.42);backdrop-filter:blur(7px);display:flex;align-items:flex-end;justify-content:center;padding:10px;opacity:0;visibility:hidden;transition:.18s;z-index:50}
.modal-mask.show{opacity:1;visibility:visible}
.modal-card{width:min(100%,480px);background:#fff;border-radius:22px;padding:18px 16px 16px;position:relative;box-shadow:0 24px 70px rgba(0,0,0,.22);transform:translateY(14px);transition:.2s}
.modal-mask.show .modal-card{transform:translateY(0)}
.modal-close{position:absolute;right:12px;top:12px;width:32px;height:32px;border:0;border-radius:10px;background:#f0f0f2;color:#666;font-size:20px}
.modal-head{padding-right:38px}
.modal-head p{margin:0;color:#777;font-size:10px;font-weight:800}
.modal-head h2{margin:6px 0 0;font-size:18px;line-height:1.25;letter-spacing:-.03em}
.modal-head span{display:block;margin-top:6px;color:#777;font-size:10px}
.field{display:block;margin-top:14px}
.field>span{display:block;margin-bottom:7px;font-size:11px;font-weight:800}
.field input{width:100%;border:1px solid #d9d9dd;background:#fafaf9;border-radius:13px;padding:12px 12px;outline:none}
.field input:focus{border-color:#111;background:#fff;box-shadow:0 0 0 3px rgba(17,17,17,.05)}
.upload-box{display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px dashed #ceced3;background:#fafaf9;border-radius:14px;padding:12px}
.upload-box strong{display:block;font-size:11px}
.upload-box small{display:block;margin-top:3px;color:#7d7d83;font-size:9px}
.upload-box em{font-style:normal;font-size:20px;color:#888}
.photo-preview{display:none;width:100%;max-height:220px;object-fit:cover;border-radius:14px;border:1px solid #ddd;margin-top:8px}
.submit-btn{width:100%;border:0;border-radius:14px;background:#111;color:#fff;padding:12px;font-size:13px;font-weight:850;margin-top:16px}
.submit-btn:disabled{opacity:.55}
.toast{position:fixed;left:50%;bottom:20px;transform:translate(-50%,12px);opacity:0;background:#111;color:#fff;border-radius:999px;padding:9px 13px;font-size:10px;z-index:90;transition:.18s;pointer-events:none}
.toast.show{opacity:1;transform:translate(-50%,0)}

@media (max-width:390px){
  :root{--axis:34px;--day-head:38px}
  .screen{padding:6px 6px calc(6px + env(safe-area-inset-bottom));gap:6px}
  .week-bar{padding:6px 8px 6px;border-radius:16px}
  .week-main-row{grid-template-columns:32px 1fr 32px;gap:6px}
  .arrow-btn{width:32px;height:32px;border-radius:10px;font-size:21px}
  .current-week strong{font-size:17px}
  .current-week span{font-size:9px}
  .week-strip{margin-top:5px;gap:5px}
  .week-pill{font-size:9px;padding:5px 8px}
  .timetable-card{padding:6px;border-radius:16px}
  .table-toolbar{height:34px;padding-bottom:5px}
  .table-toolbar h1{font-size:14px}
  .table-toolbar p{font-size:8px;margin-top:3px}
  .current-btn{font-size:9px;padding:6px 8px;border-radius:9px}
  .schedule-wrap{border-radius:11px}
  .course-title{font-size:7.8px;-webkit-line-clamp:4}
  .course-room{font-size:6.5px}
  .course-time{font-size:6px}
  .axis-label{font-size:7px}
  .day-head strong{font-size:9px}
  .day-head span{font-size:7px}
}
@media (min-width:700px){
  .screen{padding:12px 12px 14px;gap:10px}
  .week-bar{padding:10px 12px}
  .timetable-card{padding:10px}
  .course-title{font-size:10px}
  .course-room{font-size:8px}
  .course-time{font-size:7.5px}
  .modal-mask{align-items:center}
}

.view-mode{margin-top:15px}
.info-row{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:12px 0;border-bottom:1px solid #e6e6e8}
.info-row span,.section-label{font-size:11px;color:#77777d;font-weight:700}
.info-row strong{font-size:13px;text-align:right;max-width:72%;line-height:1.5}
.photo-section{margin-top:13px}
.photo-loading{margin-top:8px;padding:14px;text-align:center;background:#f5f5f4;border-radius:13px;color:#8a8a90;font-size:11px}
.view-photo{display:block;width:100%;max-height:270px;object-fit:cover;border-radius:14px;margin-top:8px;border:1px solid #dedee1;background:#f4f4f3}
.edit-btn{width:100%;margin-top:14px;border:0;border-radius:14px;background:#111;color:#fff;padding:12px 14px;font-weight:800;font-size:13px}
.form-actions{display:grid;grid-template-columns:1fr;gap:8px;margin-top:14px}
.form-actions.has-cancel{grid-template-columns:1fr 1.4fr}
.form-actions .submit-btn{margin-top:0}
.secondary-btn{border:1px solid #d8d8dc;background:#f5f5f4;color:#333;border-radius:14px;padding:12px;font-weight:750}
