/* Study Planner — Хичээл: the week timetable, lesson cards, homework, exams, and the sheets that edit them. */

.sub-h { font-size: 1rem; margin: 6px 0 0; font-family: var(--font-head); }
.strip-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(0deg, rgba(0, 0, 0, .62), rgba(0, 0, 0, 0) 62%),
    color-mix(in srgb, var(--c1) 22%, transparent);
}
.seg--3 { grid-template-columns: repeat(3, 1fr); }
.seg--mini { grid-template-columns: auto auto; padding: 3px; gap: 2px; border-radius: 11px; }
.seg--mini button { min-height: 30px; padding: 0 12px; border-radius: 8px; font-size: .85rem; }

/* ---------- week ---------- */
.sched-hint { margin: 0 0 10px; }
.week {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(80vw, 300px); gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px;
  margin: 0 -16px; padding: 2px 16px 14px;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.day { scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.day-head {
  display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
}
.day-head b { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 1.05rem; }
.day-head span { margin-left: auto; color: var(--muted); font-size: .85rem; }
.day.is-today .day-head { background: var(--c1); color: var(--c4); border-color: transparent; }
.day.is-today .day-head span { color: color-mix(in srgb, var(--c4) 70%, transparent); }
.day-list { display: grid; gap: 10px; }
.day-add {
  min-height: 44px; border: 1.5px dashed var(--line-strong); border-radius: 14px; background: transparent;
  color: var(--muted); font-size: 1.3rem; cursor: pointer;
}
.day-add:hover { color: var(--text); border-color: var(--c1); }

@media (min-width: 900px) {
  .week { grid-auto-columns: minmax(200px, 1fr); margin: 0; padding: 2px 0 14px; scroll-snap-type: none; }
}

/* ---------- lesson card ---------- */
.lesson { border-radius: 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.lesson-head {
  position: relative; display: flex; align-items: flex-end; width: 100%; aspect-ratio: 16 / 9; padding: 10px 12px;
  border: 0; background: var(--subj); color: #fff; text-align: left; cursor: pointer; overflow: hidden;
}
.lesson-cover { position: absolute; inset: 0; display: grid; place-items: center; }
.lesson-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-emoji { font-size: 2.6rem; opacity: .9; transform: translate(28%, -8%) rotate(-8deg); justify-self: end; margin-right: 18px; }
.lesson-meta { position: relative; display: grid; gap: 1px; min-width: 0; }
.lesson-time { font-size: .78rem; font-weight: 600; opacity: .9; }
.lesson-name { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 1.12rem; line-height: 1.15; text-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.lesson-badge {
  position: absolute; top: 8px; right: 8px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px;
  display: grid; place-items: center; background: #fff; color: #111; font-size: .78rem; font-weight: 700;
}
.lesson-head:hover .lesson-cover img { transform: scale(1.03); }
.lesson-cover img { transition: transform .3s ease; }
/* clubs: a slimmer card with the emoji */
.lesson--club .lesson-head { aspect-ratio: auto; min-height: 66px; }
.lesson--club .cover-emoji { font-size: 2rem; }

/* opened lesson: info rows, homework, exams */
.info { display: grid; gap: 6px; margin: 0 0 10px; }
.info > div { display: grid; grid-template-columns: 118px 1fr; gap: 8px; font-size: .9rem; }
.info dt { color: var(--muted); }
.info dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.lesson-goal { padding: 8px 10px; border-radius: 12px; background: var(--surface-2); font-size: .9rem; }
.lesson-sec { padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--line); }
.lesson-sec .row .sub-h { margin: 0; }
.todo { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.todo li { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.todo input[type="checkbox"] { width: 22px; height: 22px; flex: none; accent-color: var(--c1); }
.todo-text { flex: 1; min-width: 0; padding: 4px 0; border: 0; background: none; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.todo li.is-done .todo-text { text-decoration: line-through; color: var(--muted); }
.due { flex: none; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); font-size: .75rem; font-weight: 600; }
.due.is-late { background: #C2413B; color: #fff; }
.todo-add { position: relative; margin-top: 6px; }
.todo-add .input { min-height: 42px; padding-right: 92px; }
.todo-due { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.todo-done { margin-top: 6px; }
.todo-done summary { cursor: pointer; padding: 4px 0; }
.exam-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.exam-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); text-align: left; cursor: pointer;
}
.exam-name { flex: 1; display: grid; min-width: 0; }
.exam-score { display: grid; justify-items: end; line-height: 1.15; }
.lesson-foot { margin-top: 12px; gap: 6px; }

/* lesson popup */
.pop-cover {
  position: relative; display: flex; align-items: flex-end; aspect-ratio: 16 / 9; margin-bottom: 14px; padding: 14px 16px;
  border-radius: 16px; background: var(--subj); color: #fff; overflow: hidden;
}
.pop-cover--club { aspect-ratio: auto; min-height: 96px; }
.pop-cover > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pop-cover > .cover-emoji { position: absolute; right: 30px; top: 18px; transform: none; margin: 0; }
.pop-close { position: absolute; top: 8px; right: 8px; color: #fff; background: rgba(0, 0, 0, .3); }
.lesson.is-open { box-shadow: 0 0 0 3px var(--subj), var(--shadow); }
/* desktop: the lesson floats on the right over the timetable, which keeps its full width */
body > .lesson-float.card {
  position: fixed; z-index: 45; right: 28px; top: 96px; margin: 0; width: 380px; max-height: calc(100dvh - 210px); overflow: auto;
  padding: 0 16px 16px; box-shadow: 0 24px 60px -16px color-mix(in srgb, var(--c1) 55%, transparent);
  animation: pop-in .18s cubic-bezier(.2, .9, .3, 1.2); transform-origin: top right;
}
.lesson-float .pop-cover { margin: 0 -16px 14px; border-radius: 0; aspect-ratio: 16 / 7; }
.pop-cover b { position: relative; font-family: var(--font-head); font-weight: var(--head-weight); font-size: 1.5rem; }

/* ---------- sheets ---------- */
.chip--new { border-style: dashed; }
.period-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.period-chip { display: grid; justify-items: center; gap: 0; padding: 6px 4px; border-radius: 12px; }
.period-chip b { font-size: 1rem; }
.period-chip span { font-size: .72rem; opacity: .8; }
.time-row, .row.two { flex-wrap: nowrap; align-items: start; }
.time-row > .field, .row.two > .field { flex: 1; min-width: 0; }
.subject-preview {
  position: relative; display: flex; align-items: flex-end; min-height: 96px; padding: 12px 14px; border-radius: 16px;
  background: var(--subj); color: #fff; overflow: hidden;
}
.subject-preview > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.subject-preview > .cover-emoji { position: absolute; right: 24px; top: 14px; }
.subject-preview b { position: relative; font-family: var(--font-head); font-weight: var(--head-weight); font-size: 1.25rem; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); background: var(--sw); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--c1); }
.emoji-chip { font-size: 1.1rem; padding: 4px 8px; }
