/* snap_week: the import flow (start, reading, review, saved), its sheets and the Week badge. Solid content only (no
   glass), theme tokens only; the warm "please check" tint is the shell's .badge.warn colour. Works at 320 px. */

.sw { --sw-warn: #b25000; --sw-warn-bg: rgb(255 149 0 / 0.16); --sw-warn-mark: rgb(255 204 0 / 0.38); }
:root[data-scheme="dark"] .sw,
:root[data-scheme="dark"] .sw-sheet { --sw-warn: #ffb340; --sw-warn-bg: rgb(255 159 10 / 0.2); --sw-warn-mark: rgb(255 214 10 / 0.3); }
.sw-sheet { --sw-warn: #b25000; --sw-warn-bg: rgb(255 149 0 / 0.16); --sw-warn-mark: rgb(255 204 0 / 0.38); }

.sw .sw-host { padding-bottom: 8px; }

/* ---------- start ---------- */

.sw .sw-hero { text-align: center; padding: 12px 8px 4px; }
.sw .sw-hero-ico {
  width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 50%;
  display: grid; place-items: center; color: var(--accent); background: rgb(var(--accent-rgb) / 0.12);
}
.sw .sw-hero-ico .ico { width: 32px; height: 32px; }
.sw .sw-lead { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.sw .sw-body { margin: 8px 0 0; font-size: 15px; line-height: 1.4; color: var(--subtitle); overflow-wrap: anywhere; }
.sw .sw-buttons { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 0; }
.sw .sw-buttons .btn { width: 100%; }
.sw .sw-tips, .sw .sw-note, .sw .sw-privacy, .sw .sw-here, .sw .sw-hint, .sw .sw-plan {
  margin: 10px 4px 0; font-size: 13px; line-height: 1.4; color: var(--hint); overflow-wrap: anywhere;
}
.sw .sw-note:empty { display: none; }
.sw .sw-note.sw-warn { color: var(--sw-warn); }
.sw .sw-plan { color: var(--subtitle); margin-top: 8px; }

/* ---------- reading: the sheet lights up line by line ---------- */

.sw .sw-reading { text-align: center; padding: 16px 8px 0; }
.sw .sw-scan {
  position: relative; width: 150px; height: 190px; margin: 4px auto 18px; padding: 18px 16px; box-sizing: border-box;
  border-radius: 12px; background: var(--bg2); overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
}
.sw .sw-scan i {
  display: block; height: 7px; width: var(--w, 60%); border-radius: 4px; background: rgb(var(--text-rgb) / 0.1);
  transition: background-color .4s ease;
}
.sw .sw-scan i.lit { background: rgb(var(--accent-rgb) / 0.55); }
.sw .sw-scan.moving::after {
  content: ''; position: absolute; left: 0; right: 0; top: -40%; height: 40%;
  background: linear-gradient(to bottom, rgb(var(--accent-rgb) / 0), rgb(var(--accent-rgb) / 0.16), rgb(var(--accent-rgb) / 0));
  animation: sw-wave 2.4s ease-in-out infinite;
}
@keyframes sw-wave { from { transform: translateY(0); } to { transform: translateY(350%); } }
.sw .sw-phase { margin: 0; font-size: 17px; font-weight: 600; }
.sw .sw-sub { margin: 4px 0 12px; min-height: 18px; font-size: 13px; color: var(--hint); font-variant-numeric: tabular-nums; }
.sw .sw-reading .progress { max-width: 260px; margin: 0 auto 12px; }
.sw .sw-reading .btn { margin-top: 8px; }

/* ---------- forms in the error states ---------- */

.sw .sw-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* ---------- review: the head ---------- */

.sw .sw-head { padding: 4px 4px 0; }
.sw .sw-title { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.sw .sw-meta { margin: 2px 0 0; font-size: 15px; color: var(--subtitle); }
.sw .sw-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.sw .sw-status .badge { font-size: 13px; padding: 3px 10px; }
.sw .sw-status .btn { min-height: 34px; padding: 0 14px; font-size: 15px; }
.sw .sw-groups { margin: 14px 0 0; }
.sw .sw-groups .chip.sw-off span { text-decoration: line-through; opacity: .6; }
.sw .group.sw-doubt-group .row-value { color: var(--sw-warn); }
.sw .row-item.sw-doubt { box-shadow: inset 3px 0 0 var(--sw-warn); }
.sw .row-item.sw-doubt-title .row-title { color: var(--sw-warn); }

/* ---------- review: the week preview ---------- */

.sw .sw-grid {
  display: grid; grid-template-columns: 28px repeat(var(--cols, 6), minmax(0, 1fr)); gap: 4px; margin: 16px 0 4px;
}
.sw .sw-gh { font-size: 12px; font-weight: 600; color: var(--hint); text-align: center; padding: 2px 0 4px; text-transform: capitalize; }
.sw .sw-gp { font-size: 12px; font-weight: 600; color: var(--hint); display: grid; place-items: center; }
.sw .sw-gc {
  min-height: 44px; border: 0; border-radius: 10px; padding: 4px 2px; background: var(--bg2); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font: inherit;
  cursor: pointer; min-width: 0;
}
.sw .sw-gc.empty { background: rgb(var(--text-rgb) / 0.03); cursor: default; }
.sw .sw-gc.doubt { background: var(--sw-warn-bg); box-shadow: inset 0 0 0 1.5px var(--sw-warn); }
.sw .sw-gc:active:not(.empty) { scale: .96; }
.sw .sw-ab { font-size: 13px; font-weight: 700; line-height: 1.15; letter-spacing: .02em; }
.sw .sw-ab.k-lecture { color: var(--accent); }
.sw .sw-more { font-size: 11px; color: var(--hint); }
.sw .sw-gc.in { animation: sw-in var(--spring-glass-dur, 500ms) var(--spring-glass, ease) both; animation-delay: calc(var(--i, 0) * 28ms); }
@keyframes sw-in { from { opacity: 0; transform: translateY(14px) scale(.92); } to { opacity: 1; transform: none; } }

/* ---------- review: the classes ---------- */

.sw .sw-days .row-sub { overflow-wrap: anywhere; white-space: normal; }
.sw mark.sw-q {
  background: var(--sw-warn-mark); color: inherit; border-radius: 4px; padding: 0 3px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.sw .sw-gone .row-title { text-decoration: line-through; color: var(--hint); }
.sw .sw-gone .row-value { color: var(--accent); }
.sw .sw-flash { animation: sw-flash 1.2s ease; }
@keyframes sw-flash { 0%, 40% { background: rgb(var(--accent-rgb) / 0.16); } 100% { background: transparent; } }

/* ---------- saved ---------- */

.sw .sw-done { text-align: center; padding: 18px 8px 4px; }
.sw .sw-done-ico {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
  color: var(--accent-text); background: var(--accent);
}
.sw .sw-done-ico .ico { width: 34px; height: 34px; }
.sw .sw-done.in .sw-done-ico { animation: sw-pop var(--spring-micro-dur, 250ms) var(--spring-micro, ease) both; }
@keyframes sw-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- the sheets: one class, one doubtful cell, the code, the bells ---------- */

.sw-sheet .sw-edit, .sw-sheet .sw-check-body { display: flex; flex-direction: column; gap: 14px; padding-bottom: 4px; }
.sw-sheet .sw-field { display: flex; flex-direction: column; gap: 6px; }
.sw-sheet .sw-label { font-size: 13px; color: var(--hint); }
.sw-sheet .sw-input, .sw .sw-input {
  width: 100%; box-sizing: border-box; min-height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--sep); background: var(--bg); color: var(--text); font: inherit; font-size: 17px;
}
.sw-sheet .sw-input:focus-visible, .sw .sw-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sw-sheet .sw-field.doubt .sw-input { border-color: var(--sw-warn); background: var(--sw-warn-bg); }
.sw-sheet .sw-field.doubt > .sw-label { color: var(--sw-warn); }
.sw-sheet .sw-error { margin: 0; font-size: 13px; color: var(--destructive); }
.sw-sheet .sw-error:empty { display: none; }
.sw-sheet .sw-help, .sw-sheet .sw-fixnote { margin: -8px 0 0; font-size: 12px; color: var(--hint); overflow-wrap: anywhere; }
.sw-sheet .sw-alts { display: flex; flex-direction: column; gap: 6px; margin-top: -6px; }
.sw-sheet .sw-chips { gap: 6px; }
.sw-sheet .sw-delete { align-self: flex-start; margin-top: 4px; }
.sw-sheet .sw-seen { margin: 0; }
.sw-sheet .sw-crop {
  display: block; max-width: 100%; height: auto; border-radius: 10px; background: #fff;
  box-shadow: 0 0 0 1px var(--sep);
}
.sw-sheet .sw-seen figcaption { margin-top: 4px; font-size: 12px; color: var(--hint); }
.sw-sheet .sw-left { margin: 0; font-size: 13px; color: var(--hint); font-variant-numeric: tabular-nums; }
.sw-sheet .sw-where { margin: -8px 0 0; font-size: 15px; color: var(--subtitle); overflow-wrap: anywhere; }
.sw-sheet .sw-check-label { margin: 0; font-size: 13px; color: var(--sw-warn); }
.sw-sheet .sw-check-value { margin: -8px 0 0; font-size: 22px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.sw-sheet .sw-same { margin: -8px 0 0; font-size: 13px; color: var(--subtitle); }
.sw-sheet .sw-check-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sw-sheet .sw-check-actions .btn { flex: 1 1 120px; }
.sw-sheet .sw-fixbox { display: flex; flex-direction: column; gap: 10px; }
.sw-sheet .sw-bell .sw-input { font-variant-numeric: tabular-nums; }

/* ---------- Week → the badge ---------- */

.sw-badge .row-item:first-child .row-ico { color: var(--sw-warn, #b25000); }

@media (prefers-reduced-motion: reduce) {
  .sw .sw-scan.moving::after { animation: none; display: none; }
  .sw .sw-gc.in, .sw .sw-done.in .sw-done-ico, .sw .sw-flash { animation: none; }
  .sw .sw-scan i { transition: none; }
}

@media (prefers-contrast: more) {
  .sw .sw-tips, .sw .sw-note, .sw .sw-privacy, .sw .sw-here, .sw .sw-hint, .sw .sw-gh, .sw .sw-gp,
  .sw-sheet .sw-label, .sw-sheet .sw-help, .sw-sheet .sw-left { color: var(--text); }
  .sw .sw-gc { box-shadow: inset 0 0 0 1px var(--sep); }
  .sw .sw-gc.doubt { box-shadow: inset 0 0 0 2px var(--sw-warn); }
  .sw mark.sw-q { text-decoration: underline; text-decoration-thickness: 2px; }
}
