:root {
  --bg: #f7f5fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --surface-soft: #f1edf8;
  --text: #282331;
  --muted: #7d7688;
  --border: #e6e0ed;
  --primary: #7357d8;
  --primary-dark: #5e43c1;
  --primary-soft: #eee8ff;
  --success: #3e9b76;
  --success-soft: #e8f7f0;
  --danger: #c95563;
  --danger-soft: #fdecef;
  --shadow: 0 14px 45px rgba(70, 52, 98, 0.09);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

[data-theme="dark"] {
  --bg: #17141e;
  --surface: rgba(35, 30, 44, 0.94);
  --surface-strong: #25202e;
  --surface-soft: #30293b;
  --text: #f5f1fa;
  --muted: #aaa2b7;
  --border: #3b3446;
  --primary: #a58aff;
  --primary-dark: #8d6ff0;
  --primary-soft: #3c3159;
  --success: #71c69f;
  --success-soft: #243c33;
  --danger: #ef8792;
  --danger-soft: #47282f;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.26);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 5%, rgba(158, 128, 255, 0.11), transparent 28%),
    radial-gradient(circle at 90% 2%, rgba(112, 196, 158, 0.10), transparent 26%),
    var(--bg);
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 54px);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
}

.brand-wrap { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px; display: grid; place-items: center;
  border-radius: 15px;
  background: linear-gradient(145deg, var(--primary), #9f81f5);
  color: #fff; font-weight: 800; letter-spacing: -0.04em;
  box-shadow: 0 10px 24px rgba(115, 87, 216, 0.25);
}
.brand-wrap h1 { margin: 0; font-size: 19px; letter-spacing: -0.03em; }
.brand-wrap p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

.dday-card {
  display: grid; grid-template-columns: auto auto; column-gap: 9px; align-items: center;
  padding: 8px 13px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface);
}
.dday-card span { font-size: 11px; color: var(--muted); }
.dday-card strong { grid-row: 1 / 3; grid-column: 2; font-size: 20px; color: var(--primary); }
.dday-card small { font-size: 11px; color: var(--muted); }

.app-shell {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 24px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 26px clamp(16px, 3.4vw, 46px) 70px;
  transition: grid-template-columns .24s ease;
}
.app-shell[data-youtube-size="compact"] { grid-template-columns: minmax(280px, 320px) minmax(0, 1fr); }
.app-shell[data-youtube-size="medium"] { grid-template-columns: minmax(360px, 430px) minmax(0, 1fr); }
.app-shell[data-youtube-size="large"] { grid-template-columns: minmax(500px, 610px) minmax(0, 1fr); }
.left-column, .main-column { min-width: 0; }
.left-column { display: flex; flex-direction: column; gap: 18px; }
.main-column { display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 22px;
}

.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.section-heading.between { justify-content: space-between; }
.section-heading h2, .calendar-toolbar h2 { margin: 3px 0 0; font-size: 21px; letter-spacing: -0.045em; }
.eyebrow { color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: 0.15em; }
.muted { color: var(--muted); line-height: 1.65; }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.primary-button, .secondary-button, .success-button, .danger-button, .icon-button, .text-button {
  border: 0; border-radius: 12px; font-weight: 700; transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.primary-button:hover:not(:disabled), .secondary-button:hover:not(:disabled), .success-button:hover:not(:disabled), .danger-button:hover:not(:disabled), .icon-button:hover:not(:disabled) { transform: translateY(-1px); }
.primary-button { background: var(--primary); color: #fff; padding: 12px 16px; box-shadow: 0 8px 18px rgba(115, 87, 216, 0.20); }
.primary-button:hover:not(:disabled) { background: var(--primary-dark); }
.secondary-button { background: var(--surface-soft); color: var(--text); padding: 12px 16px; border: 1px solid var(--border); }
.success-button { background: var(--success); color: #fff; padding: 12px 16px; }
.danger-button { background: var(--danger-soft); color: var(--danger); padding: 12px 16px; }
.icon-button { width: 42px; height: 42px; background: var(--surface-soft); color: var(--text); border: 1px solid var(--border); font-size: 20px; }
.text-button { background: transparent; color: var(--danger); padding: 10px; }
.compact { padding: 10px 13px; font-size: 13px; }
.full { width: 100%; }
.grow { flex: 1; }

.field-label { display: block; margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.text-input, .select-input {
  width: 100%; min-height: 44px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-strong); color: var(--text); padding: 10px 12px; outline: none;
  transition: border .15s ease, box-shadow .15s ease;
}
.text-input:focus, .select-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.textarea { resize: vertical; }
.inline-row { display: flex; gap: 8px; align-items: center; }
.button-row { display: flex; gap: 10px; margin-top: 15px; }
.top-gap { margin-top: 18px; }
.hidden { display: none !important; }
.empty-state { color: var(--muted); text-align: center; padding: 28px 16px; border: 1px dashed var(--border); border-radius: 18px; }

.youtube-heading { margin-bottom: 10px; }
.youtube-size-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.youtube-size-toolbar > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.segmented-control { display: inline-flex; gap: 3px; padding: 4px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--border); }
.youtube-size-button { border: 0; border-radius: 8px; padding: 6px 9px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; }
.youtube-size-button.active { background: var(--surface-strong); color: var(--primary); box-shadow: 0 3px 10px rgba(0,0,0,.08); }
.youtube-frame { width: 100%; aspect-ratio: 16 / 9; min-height: 190px; border-radius: 18px; overflow: hidden; margin-bottom: 16px; background: #141218; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 10px 24px rgba(0,0,0,.12); }
.youtube-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.youtube-frame:fullscreen { width: 100vw; height: 100vh; border-radius: 0; background: #000; }
.youtube-frame:fullscreen iframe { width: 100%; height: 100%; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-tile { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 16px; padding: 14px; }
.stat-tile span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 7px; }
.stat-tile strong { font-size: 18px; letter-spacing: -0.04em; }
.mini-guide-card { background: linear-gradient(145deg, color-mix(in srgb, var(--primary-soft) 75%, var(--surface)), var(--surface)); }
.mini-guide-card h3 { margin: 8px 0 10px; line-height: 1.4; }
.mini-guide-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 18px; }
.tracker-inputs { display: grid; grid-template-columns: .65fr 1fr 1fr; gap: 10px; margin-top: 16px; }
.selected-book { display: flex; gap: 16px; align-items: center; margin-top: 15px; min-height: 120px; }
.selected-book:not(.empty-state) { padding: 15px; border-radius: 18px; background: var(--surface-soft); border: 1px solid var(--border); }
.selected-book img { width: 74px; height: 104px; border-radius: 10px; object-fit: cover; background: var(--border); box-shadow: 0 8px 18px rgba(0,0,0,.12); }
.book-info h3 { margin: 0 0 7px; font-size: 18px; }
.book-info p { margin: 4px 0; color: var(--muted); font-size: 12px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; background: var(--primary-soft); color: var(--primary); }
.active-session-banner { margin-top: 14px; padding: 12px 14px; border-radius: 14px; color: var(--success); background: var(--success-soft); font-size: 13px; line-height: 1.5; }

.pomodoro-card { position: relative; overflow: hidden; }
.pomodoro-card::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; right: -110px; bottom: -130px; background: color-mix(in srgb, var(--primary) 10%, transparent); pointer-events: none; }
.timer-device {
  --timer-accent: #9f81ff;
  width: min(335px, 100%);
  margin: 0 auto;
  padding: 18px 18px 20px;
  border-radius: 30px;
  background: linear-gradient(145deg, #f3f0ec, #cfcac3);
  border: 1px solid rgba(65, 55, 46, .18);
  box-shadow: 0 22px 35px rgba(31, 25, 22, .20), inset 2px 2px 2px rgba(255,255,255,.85), inset -3px -3px 6px rgba(80,70,60,.14);
  color: #211f20;
  position: relative;
  z-index: 1;
}
[data-theme="dark"] .timer-device { background: linear-gradient(145deg, #dad4cd, #aaa39b); }
.timer-device[data-mode="short"], .timer-device[data-mode="long"] { --timer-accent: #5dd29e; }
.timer-device-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.timer-branding { font-size: 9px; letter-spacing: .16em; font-weight: 900; color: #4b4745; display: flex; align-items: center; gap: 7px; }
.timer-led { width: 7px; height: 7px; border-radius: 50%; background: var(--timer-accent); box-shadow: 0 0 10px var(--timer-accent); }
.timer-knob { width: 34px; height: 34px; border-radius: 50%; padding: 5px; background: linear-gradient(145deg, #55504d, #1f1c1b); box-shadow: 0 4px 8px rgba(0,0,0,.25), inset 1px 1px 1px rgba(255,255,255,.18); }
.timer-knob span { display: block; width: 2px; height: 9px; border-radius: 2px; margin: 2px auto 0; background: var(--timer-accent); box-shadow: 0 0 5px var(--timer-accent); }
.timer-dial {
  --remaining-angle: 360deg;
  width: min(270px, 88%);
  aspect-ratio: 1;
  margin: 0 auto;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--timer-accent) 0deg var(--remaining-angle), #303033 var(--remaining-angle) 360deg);
  box-shadow: 0 10px 24px rgba(0,0,0,.32), inset 0 0 0 5px #1d1c1f, inset 0 0 0 8px rgba(255,255,255,.08);
  transition: background .45s linear;
}
.timer-dial::before {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: repeating-conic-gradient(from -90deg, rgba(255,255,255,.82) 0deg 1deg, transparent 1deg 6deg);
  -webkit-mask: radial-gradient(circle, transparent 0 83%, #000 84% 100%);
  mask: radial-gradient(circle, transparent 0 83%, #000 84% 100%);
  opacity: .68;
}
.timer-dial::after { content: ""; position: absolute; inset: 24px; border-radius: 50%; background: radial-gradient(circle at 38% 30%, #29292d, #09090b 70%); box-shadow: inset 0 0 18px rgba(0,0,0,.75); }
.timer-screen { position: relative; z-index: 3; width: 69%; min-height: 108px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(180deg, rgba(23,25,26,.95), rgba(5,6,7,.98)); border: 1px solid rgba(255,255,255,.08); box-shadow: inset 0 0 17px rgba(0,0,0,.8), 0 2px 0 rgba(255,255,255,.05); }
.timer-mode-badge { font-size: 9px; letter-spacing: .18em; font-weight: 900; color: var(--timer-accent); margin-bottom: 3px; }
.timer-screen strong { color: #f7f8f2; font-family: "Courier New", ui-monospace, monospace; font-size: clamp(34px, 5vw, 45px); line-height: 1; letter-spacing: -.07em; font-variant-numeric: tabular-nums; text-shadow: 0 0 13px color-mix(in srgb, var(--timer-accent) 48%, transparent); }
.timer-screen small { color: #858b89; font-family: ui-monospace, monospace; font-size: 9px; letter-spacing: .20em; margin-top: 7px; }
.dial-number { position: absolute; z-index: 4; color: rgba(255,255,255,.72); font: 700 8px ui-monospace, monospace; }
.dial-60 { top: 10px; left: 50%; transform: translateX(-50%); }
.dial-10 { right: 28px; top: 50px; }
.dial-20 { right: 28px; bottom: 50px; }
.dial-30 { bottom: 10px; left: 50%; transform: translateX(-50%); }
.dial-40 { left: 28px; bottom: 50px; }
.dial-50 { left: 28px; top: 50px; }
.timer-mode-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.timer-mode-button { border: 1px solid rgba(43,39,37,.18); border-radius: 10px; padding: 8px 5px; background: rgba(255,255,255,.38); color: #514d4a; font-size: 10px; font-weight: 800; }
.timer-mode-button.active { color: #fff; background: #2c2929; box-shadow: inset 0 0 0 1px rgba(255,255,255,.09), 0 3px 8px rgba(0,0,0,.16); }
.timer-button-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; margin-top: 10px; }
.timer-hardware-button { border: 0; border-radius: 12px; padding: 11px 8px; background: linear-gradient(180deg, #4b4746, #282526); color: #f4f1ed; font-size: 12px; font-weight: 900; box-shadow: 0 4px 0 #171516, 0 7px 12px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.17); transform: translateY(0); }
.timer-hardware-button:active { transform: translateY(3px); box-shadow: 0 1px 0 #171516, 0 3px 6px rgba(0,0,0,.22); }
.timer-start { background: linear-gradient(180deg, color-mix(in srgb, var(--timer-accent) 72%, #4b4746), color-mix(in srgb, var(--timer-accent) 35%, #242123)); }
.pomo-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; margin-top: 14px; position: relative; z-index: 1; }

.tabbar { display: flex; gap: 7px; flex-wrap: wrap; padding: 7px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.tab-button { border: 0; border-radius: 11px; background: transparent; color: var(--muted); padding: 11px 15px; font-weight: 700; }
.tab-button.active { background: var(--primary); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.calendar-toolbar { display: flex; justify-content: center; align-items: center; gap: 22px; margin-bottom: 18px; text-align: center; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays span { padding: 8px; text-align: center; color: var(--muted); font-size: 11px; font-weight: 700; }
.calendar-day { min-height: 122px; padding: 10px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); background: var(--surface-strong); cursor: pointer; transition: background .15s ease, transform .15s ease; overflow: hidden; }
.calendar-day:nth-child(7n) { border-right: 1px solid var(--border); }
.calendar-day:nth-last-child(-n + 7) { border-bottom: 1px solid var(--border); }
.calendar-day:nth-child(1) { border-top-left-radius: 16px; }
.calendar-day:nth-child(7) { border-top-right-radius: 16px; }
.calendar-day:hover { background: var(--surface-soft); transform: translateY(-1px); position: relative; z-index: 1; }
.calendar-day.other-month { opacity: .42; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.calendar-day-number { font-size: 12px; font-weight: 800; }
.calendar-content { display: grid; gap: 4px; margin-top: 9px; }
.calendar-chip { padding: 5px 6px; border-radius: 7px; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-chip.goal { color: var(--primary); background: var(--primary-soft); }
.calendar-chip.actual { color: var(--success); background: var(--success-soft); }
.calendar-chip.efficiency { color: var(--text); background: var(--surface-soft); }

.filter-row { display: flex; gap: 8px; align-items: center; }
.compact-select { min-width: 120px; width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 12px; vertical-align: middle; }
th { color: var(--muted); font-size: 10px; letter-spacing: .04em; }
td strong { display: block; font-size: 12px; }
td small { color: var(--muted); }
.action-buttons { display: flex; gap: 6px; }
.mini-action { border: 1px solid var(--border); background: var(--surface-soft); color: var(--text); border-radius: 8px; padding: 6px 8px; font-size: 10px; }
.mini-action.delete { color: var(--danger); }

.planner-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: 18px; }
.form-grid { display: grid; gap: 12px; }
.form-grid.two-col { grid-template-columns: 1fr 1fr; }
.span-2 { grid-column: span 2; }
.checkbox-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin-top: 12px; }
.checkbox-row input { accent-color: var(--primary); }
.plan-result-card { min-height: 100%; }
.plan-result { text-align: left; }
.plan-result:not(.empty-state) { padding: 0; border: 0; }
.result-hero { padding: 18px; border-radius: 18px; background: linear-gradient(140deg, var(--primary), #9b7aec); color: #fff; }
.result-hero span { font-size: 12px; opacity: .82; }
.result-hero strong { display: block; margin-top: 7px; font-size: 32px; letter-spacing: -.05em; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.result-item { padding: 13px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-soft); }
.result-item span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.result-item strong { font-size: 15px; }
.result-note { margin: 14px 0 0; padding: 12px; border-radius: 12px; background: var(--success-soft); color: var(--success); font-size: 12px; line-height: 1.6; }

.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 13px; }
.library-book { display: grid; grid-template-columns: 66px 1fr; gap: 12px; padding: 13px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface-soft); }
.library-book img { width: 66px; height: 94px; border-radius: 9px; object-fit: cover; background: var(--border); }
.library-book h3 { margin: 0 0 6px; font-size: 14px; line-height: 1.35; }
.library-book p { margin: 3px 0; font-size: 10px; color: var(--muted); }
.library-actions { grid-column: 1 / -1; display: flex; gap: 7px; }
.library-actions button { flex: 1; }

.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.stacked-buttons { display: grid; gap: 9px; margin-top: 16px; }
.file-label { display: flex; align-items: center; justify-content: center; cursor: pointer; }
.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 13px; }
.feature-list li { padding: 12px; border-radius: 13px; background: var(--surface-soft); }
.feature-list strong { display: block; font-size: 12px; margin-bottom: 4px; }
.feature-list span { color: var(--muted); font-size: 11px; line-height: 1.5; }


.book-search-helper { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 7px; }
.book-search-helper .hint { margin: 0; }
.external-search-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.text-link-button { border: 0; background: transparent; color: var(--primary); font-size: 11px; font-weight: 800; padding: 2px 4px; }
.text-link-button:hover { text-decoration: underline; }
.cover-editor { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 14px; align-items: stretch; padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-soft); }
.cover-preview-wrap { width: 105px; min-height: 145px; border-radius: 11px; overflow: hidden; background: var(--border); box-shadow: 0 7px 16px rgba(0,0,0,.12); }
.cover-preview-wrap img { display: block; width: 100%; height: 100%; min-height: 145px; object-fit: cover; }
.cover-fields { min-width: 0; }
.upload-cover-button { display: inline-flex; margin-top: 8px; padding: 9px 11px; border-radius: 10px; background: var(--surface-strong); color: var(--primary); border: 1px solid var(--border); font-size: 11px; font-weight: 800; cursor: pointer; }
.search-source-badge { display: inline-flex; margin-left: 5px; padding: 2px 5px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 8px; vertical-align: 1px; }
.modal { width: min(760px, calc(100% - 24px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 24px; background: transparent; }
.modal::backdrop { background: rgba(24, 18, 35, .52); backdrop-filter: blur(6px); }
.modal-card { max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface-strong); color: var(--text); padding: 24px; border-radius: 24px; border: 1px solid var(--border); box-shadow: 0 25px 80px rgba(0,0,0,.25); }
.modal-card.small { width: min(540px, 100%); margin: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.modal-header h2 { margin: 4px 0 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.book-search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 9px; margin-top: 12px; max-height: 260px; overflow-y: auto; }
.search-book-item { display: grid; grid-template-columns: 48px 1fr; gap: 8px; padding: 9px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); cursor: pointer; text-align: left; }
.search-book-item:hover { border-color: var(--primary); }
.search-book-item img { width: 48px; height: 68px; object-fit: cover; border-radius: 7px; background: var(--border); }
.search-book-item strong { font-size: 11px; line-height: 1.35; }
.search-book-item span { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }
.day-summary { margin-top: 14px; padding: 12px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 13px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.toast { position: fixed; left: 50%; top: 82px; z-index: 100; transform: translate(-50%, -20px); padding: 11px 16px; border-radius: 12px; background: var(--text); color: var(--surface-strong); font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 1fr; }
  .left-column { display: grid; grid-template-columns: 1.3fr .7fr; align-items: start; }
  .mini-guide-card { grid-column: span 2; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  .topbar { align-items: flex-start; }
  .topbar-actions { gap: 6px; }
  #cloudButton { display: none; }
  .hero-grid, .planner-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .calendar-day { min-height: 96px; padding: 7px; }
  .calendar-chip { font-size: 8px; }
}

@media (max-width: 620px) {
  .memo-editor-grid,.memo-list-toolbar { grid-template-columns:1fr; }
  .memo-card-foot { align-items:flex-start; flex-direction:column; }
  .topbar { position: static; padding: 15px; }
  .brand-wrap p { display: none; }
  .dday-card span, .dday-card small { display: none; }
  .dday-card { grid-template-columns: 1fr; }
  .dday-card strong { grid-column: 1; grid-row: 1; font-size: 16px; }
  .topbar-actions .secondary-button { display: none; }
  #loginButton { padding: 10px 11px; font-size: 11px; }
  .app-shell { padding: 14px 12px 50px; gap: 14px; }
  .left-column { display: flex; }
  .card { padding: 17px; border-radius: 20px; }
  .tracker-inputs { grid-template-columns: 1fr 1fr; }
  .tracker-inputs > div:first-child { grid-column: span 2; }
  .form-grid.two-col { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .tabbar { overflow-x: auto; flex-wrap: nowrap; }
  .tab-button { white-space: nowrap; }
  .calendar-day { min-height: 74px; }
  .calendar-chip.efficiency { display: none; }
  .calendar-content { margin-top: 5px; }
  .calendar-chip { padding: 3px; }
  .filter-row { align-items: stretch; flex-direction: column; }
  .compact-select { width: 100%; }
  .modal-card { padding: 18px; }
}

@media (max-width: 1180px) {
  .app-shell, .app-shell[data-youtube-size="compact"], .app-shell[data-youtube-size="medium"], .app-shell[data-youtube-size="large"] { grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); }
  .youtube-size-button[data-youtube-size="large"] { display: none; }
}
@media (max-width: 900px) {
  .app-shell, .app-shell[data-youtube-size="compact"], .app-shell[data-youtube-size="medium"], .app-shell[data-youtube-size="large"] { grid-template-columns: 1fr; }
  .left-column { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .youtube-card { grid-column: 1 / -1; }
  .youtube-size-button[data-youtube-size="large"] { display: inline-block; }
}
@media (max-width: 620px) {
  .left-column { display: flex; }
  .book-search-helper { display: block; }
  .external-search-buttons { justify-content: flex-start; margin-top: 8px; }
  .cover-editor { grid-template-columns: 78px minmax(0,1fr); }
  .cover-preview-wrap { width: 78px; min-height: 110px; }
  .cover-preview-wrap img { min-height: 110px; }
  .timer-device { width: 100%; padding: 15px; border-radius: 24px; }
  .timer-dial { width: min(255px, 88%); }
}
@media (max-width: 1120px) {
  .app-shell,
  .app-shell[data-youtube-size="compact"],
  .app-shell[data-youtube-size="medium"],
  .app-shell[data-youtube-size="large"] { grid-template-columns: 1fr; }
  .left-column { display: grid; grid-template-columns: 1.3fr .7fr; align-items: start; }
  .youtube-card { grid-column: 1 / -1; }
  .mini-guide-card { grid-column: span 2; }
}
@media (max-width: 620px) {
  .left-column { display: flex; }
  .mini-guide-card { grid-column: auto; }
}

/* ===== Study Flow v3 refinements ===== */
.today-progress-card {
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 72%, var(--surface-strong)), var(--surface-strong));
  border: 1px solid color-mix(in srgb, var(--primary) 15%, var(--border));
}
.today-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.today-progress-head strong { color: var(--primary); font-size: 14px; }
.soft-progress { height: 9px; margin-top: 10px; border-radius: 999px; overflow: hidden; background: color-mix(in srgb, var(--border) 75%, transparent); }
.soft-progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #ab8cff); transition: width .35s ease; }

.color-input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
}

.naver-link-importer {
  padding: 15px;
  border-radius: 16px;
  background: color-mix(in srgb, #03c75a 7%, var(--surface-soft));
  border: 1px solid color-mix(in srgb, #03c75a 22%, var(--border));
}
.book-search-divider { display: flex; align-items: center; gap: 10px; margin: 17px 0; color: var(--muted); font-size: 11px; font-weight: 700; }
.book-search-divider::before, .book-search-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.capacity-summary {
  margin: 15px 0 9px;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

/* Physical digital timer inspired layout */
.digital-timer-device {
  --timer-accent: #ff725f;
  --timer-screen: #0c1017;
  --timer-digits: #e6fbff;
  width: min(390px, 100%);
  margin: 0 auto;
  position: relative;
  z-index: 2;
}
.digital-timer-case {
  padding: 15px 16px 18px;
  border-radius: 42px;
  background: linear-gradient(145deg, #fffef9, #e8e4dc);
  border: 1px solid rgba(71, 62, 48, .13);
  box-shadow: 0 23px 38px rgba(34, 29, 24, .19), inset 2px 2px 4px rgba(255,255,255,.95), inset -3px -4px 8px rgba(91,80,65,.10);
}
.digital-timer-brand {
  height: 18px;
  text-align: center;
  color: #77716b;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
}
.digital-timer-screen {
  min-height: 334px;
  padding: 12px 15px 15px;
  border-radius: 28px;
  background: radial-gradient(circle at 48% 42%, color-mix(in srgb, var(--timer-screen) 84%, #273044), var(--timer-screen) 72%);
  box-shadow: inset 0 0 0 2px #252a34, inset 0 0 25px rgba(0,0,0,.78), 0 2px 0 rgba(255,255,255,.72);
  color: #e9fbff;
}
.timer-screen-top {
  min-height: 25px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  color: #d8f7ff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-shadow: 0 0 7px rgba(150,224,255,.4);
}
.timer-screen-top span:nth-child(2) { color: color-mix(in srgb, var(--timer-accent) 75%, white); }
.timer-screen-top span:last-child { text-align: right; }
.segment-ring-wrap {
  width: min(300px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  position: relative;
}
.segment-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.timer-segment {
  fill: #27303b;
  stroke: #11161d;
  stroke-width: .7;
  transition: fill .15s ease, filter .15s ease, opacity .15s ease;
}
.timer-segment.active {
  fill: var(--timer-accent);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--timer-accent) 55%, transparent));
}
.timer-segment.elapsed { fill: color-mix(in srgb, var(--timer-accent) 18%, #27303b); }
.ring-label {
  position: absolute;
  transform: translate(-50%, -50%);
  color: var(--timer-digits);
  font-size: 11px;
  font-weight: 800;
  text-shadow: 0 0 6px rgba(150,224,255,.55);
  pointer-events: none;
}
.ring-label-0 { left: 50%; top: 4%; }
.ring-label-5 { left: 73%; top: 10%; }
.ring-label-10 { left: 91%; top: 27%; }
.ring-label-15 { left: 97%; top: 50%; }
.ring-label-20 { left: 91%; top: 73%; }
.ring-label-25 { left: 73%; top: 90%; }
.ring-label-30 { left: 50%; top: 96%; }
.ring-label-35 { left: 27%; top: 90%; }
.ring-label-40 { left: 9%; top: 73%; }
.ring-label-45 { left: 3%; top: 50%; }
.ring-label-50 { left: 9%; top: 27%; }
.ring-label-55 { left: 27%; top: 10%; }
.timer-center-display {
  position: absolute;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 54%; aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 35%, #151e29, #070a0f 72%);
  box-shadow: inset 0 0 16px rgba(0,0,0,.85), 0 0 0 1px rgba(165,225,255,.07);
}
.timer-ms-label { color: #b8dce8; font-size: 8px; font-weight: 800; letter-spacing: .2em; }
.timer-center-display strong {
  margin: 4px 0 2px;
  color: var(--timer-digits);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(32px, 6vw, 44px);
  line-height: 1;
  letter-spacing: -.08em;
  text-shadow: 0 0 10px rgba(177,232,255,.48);
}
.timer-center-display small { color: color-mix(in srgb, var(--timer-accent) 76%, white); font-size: 9px; font-weight: 800; }
.digital-timer-device[data-mode="short"], .digital-timer-device[data-mode="long"] { --timer-accent: #54d6a4; }
.digital-timer-device .timer-mode-row { margin-top: 13px; }
.digital-timer-device .timer-button-row { margin-top: 10px; }
.digital-timer-device .timer-hardware-button {
  border-radius: 15px;
  background: linear-gradient(#fff, #e9e5df);
  color: #3d3935;
  border: 1px solid rgba(73,64,54,.16);
  box-shadow: 0 4px 0 #c7c1b8, 0 8px 15px rgba(35,29,24,.12);
}
.digital-timer-device .timer-hardware-button:active { transform: translateY(3px); box-shadow: 0 1px 0 #c7c1b8; }
.digital-timer-device .timer-hardware-button.timer-start { color: #fff; background: linear-gradient(145deg, var(--timer-accent), color-mix(in srgb, var(--timer-accent) 72%, #8c2d2a)); border-color: transparent; box-shadow: 0 4px 0 color-mix(in srgb, var(--timer-accent) 55%, #4a2020), 0 8px 15px color-mix(in srgb, var(--timer-accent) 22%, transparent); }

/* Softer calendar: no heavy black grid */
.calendar-weekdays { gap: 6px; padding: 0 3px 8px; }
.calendar-weekdays span { padding: 6px 0; color: var(--muted); font-size: 11px; font-weight: 800; text-align: center; }
.calendar-grid { gap: 7px; }
.calendar-day,
.calendar-day:nth-child(7n),
.calendar-day:nth-last-child(-n + 7) {
  min-height: 126px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 68%, transparent);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface-strong) 88%, var(--surface-soft));
  box-shadow: 0 5px 14px rgba(66,48,84,.035);
}
.calendar-day:hover { background: var(--surface-strong); box-shadow: 0 9px 20px rgba(66,48,84,.08); transform: translateY(-2px); }
.calendar-day.today { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 12%, transparent), 0 8px 18px rgba(66,48,84,.07); }
.calendar-day:nth-child(7n + 1) .calendar-day-number { color: #df6b76; }
.calendar-day:nth-child(7n) .calendar-day-number { color: #6287d9; }
.calendar-content { gap: 5px; }
.calendar-chip { border: 0; line-height: 1.35; padding: 5px 7px; border-radius: 8px; white-space: normal; }
.calendar-chip.goal { background: color-mix(in srgb, var(--primary) 10%, var(--surface-strong)); color: var(--primary); }
.calendar-chip.actual { background: color-mix(in srgb, var(--success) 10%, var(--surface-strong)); color: var(--success); }
.calendar-chip.efficiency { background: color-mix(in srgb, #f1a244 12%, var(--surface-strong)); color: #b66a17; }
.calendar-day.other-month { opacity: .34; box-shadow: none; }

.day-session-list { display: grid; gap: 8px; margin-top: 12px; }
.day-session-item { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; padding: 11px 12px; border-radius: 13px; background: var(--surface-soft); border: 1px solid var(--border); }
.day-session-item strong { font-size: 12px; }
.day-session-item span { color: var(--muted); font-size: 11px; }
.day-session-item em { grid-row: 1 / 3; grid-column: 2; align-self: center; color: var(--success); font-size: 12px; font-style: normal; font-weight: 800; }

@media (max-width: 1120px) {
  .digital-timer-screen { min-height: 315px; }
}
@media (max-width: 720px) {
  .inline-row { flex-wrap: wrap; }
  .inline-row > .text-input { flex: 1 1 100%; }
  .inline-row > button { flex: 1; }
  .calendar-grid { gap: 4px; }
  .calendar-day, .calendar-day:nth-child(7n), .calendar-day:nth-last-child(-n + 7) { min-height: 94px; border-radius: 11px; padding: 6px; }
  .calendar-chip { font-size: 8px; padding: 3px 4px; }
  .digital-timer-case { border-radius: 32px; padding: 12px; }
  .digital-timer-screen { min-height: 300px; border-radius: 23px; padding-inline: 9px; }
}

/* =========================
   Study Flow v4 additions
   ========================= */
.quote-strip {
  max-width: 1680px;
  margin: 18px auto 0;
  padding: 14px clamp(16px, 3.4vw, 46px);
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) 38px auto;
  align-items: center;
  gap: 12px;
}
.quote-copy {
  min-width: 0;
  padding: 15px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, var(--surface)), color-mix(in srgb, #f1a244 7%, var(--surface)));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.quote-copy strong { display:block; margin-top:4px; font-size:15px; letter-spacing:-.025em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.quote-copy small { display:block; margin-top:4px; color:var(--muted); font-size:11px; }
.quote-arrow { width:38px; height:38px; border:1px solid var(--border); border-radius:50%; background:var(--surface); color:var(--text); font-size:22px; }

.live-clock { font: 800 18px ui-monospace, SFMono-Regular, Menlo, monospace; color:var(--primary); }
.remaining-grid { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.remaining-grid > div { padding:12px; border-radius:14px; background:var(--surface-soft); border:1px solid var(--border); }
.remaining-grid span { display:block; color:var(--muted); font-size:10px; margin-bottom:5px; }
.remaining-grid strong { font-size:14px; letter-spacing:-.03em; }
.day-segment-text { margin-top:11px; padding:10px 12px; border-radius:12px; background:color-mix(in srgb,var(--primary) 7%,var(--surface-strong)); color:var(--muted); font-size:11px; line-height:1.55; }

.quick-links-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.quick-link-item { position:relative; display:flex; align-items:center; gap:9px; min-height:56px; padding:10px 34px 10px 11px; border:1px solid var(--border); border-radius:14px; background:var(--surface-soft); color:var(--text); text-decoration:none; overflow:hidden; }
.quick-link-item:hover { transform:translateY(-1px); background:var(--surface-strong); }
.quick-link-item b { font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.quick-link-icon { display:grid; place-items:center; width:32px; height:32px; flex:0 0 32px; border-radius:10px; background:var(--surface-strong); font-size:17px; }
.quick-link-edit { position:absolute; top:7px; right:7px; width:23px; height:23px; border:0; border-radius:8px; background:transparent; color:var(--muted); }
.quick-links-empty { grid-column:1/-1; padding:16px; border:1px dashed var(--border); border-radius:14px; color:var(--muted); text-align:center; font-size:11px; }

.today-reading-advisor { margin-top:14px; padding:14px; border-radius:16px; border:1px solid color-mix(in srgb,var(--primary) 20%,var(--border)); background:linear-gradient(135deg,color-mix(in srgb,var(--primary) 7%,var(--surface-strong)),var(--surface-strong)); }
.advisor-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; margin-bottom:11px; }
.advisor-head strong { font-size:13px; }
.advisor-head span { color:var(--muted); font-size:10px; text-align:right; line-height:1.45; }
.advisor-input-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.advisor-input-grid label > span { display:block; margin-bottom:5px; color:var(--muted); font-size:10px; font-weight:700; }
.advisor-input-grid .text-input,.advisor-input-grid .select-input { min-height:38px; padding:8px 9px; font-size:11px; }
.duration-input-row { display:grid; grid-template-columns:minmax(54px,1fr) auto minmax(54px,1fr) auto; gap:5px; align-items:center; }
.duration-input-row em { color:var(--muted); font-size:10px; font-style:normal; font-weight:700; }
.weekly-secondary-inputs { margin-top:10px; }
.weekly-plan-summary { margin-top:10px; padding:11px 13px; border-radius:13px; border:1px solid color-mix(in srgb,var(--primary) 24%,var(--border)); background:color-mix(in srgb,var(--primary) 7%,var(--surface)); color:var(--text); font-size:11px; line-height:1.65; }
.weekly-plan-summary strong { color:var(--primary); }

.advisor-result { margin:10px 0; padding:11px 12px; border-radius:12px; background:var(--surface-soft); font-size:11px; line-height:1.62; }
.advisor-result strong { color:var(--primary); }
.advisor-result.status-good { background:var(--success-soft); color:var(--success); }
.advisor-result.status-tight { background:#fff5df; color:#a96a13; }
.advisor-result.status-hard { background:var(--danger-soft); color:var(--danger); }
.reading-control-row { flex-wrap:wrap; }
.active-session-banner.paused { color:#a66b14; background:#fff5df; }

.tabbar { flex-wrap:nowrap; overflow-x:auto; scrollbar-width:thin; }
.tab-button { flex:0 0 auto; }
.dashboard-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.form-grid.three-col { grid-template-columns:repeat(3,minmax(0,1fr)); }
.form-grid.four-col { grid-template-columns:repeat(4,minmax(0,1fr)); }
.date-compact { width:auto; min-width:145px; }
.time-calculator-card { padding:14px; border-radius:16px; background:var(--surface-soft); border:1px solid var(--border); }

.todo-progress { margin-bottom:12px; }
.todo-progress > div:first-child { display:flex; justify-content:space-between; color:var(--muted); font-size:11px; margin-bottom:7px; }
.todo-list { display:grid; gap:8px; }
.todo-item { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:10px; align-items:center; padding:11px 12px; border:1px solid var(--border); border-radius:14px; background:var(--surface-strong); }
.todo-item.done { opacity:.58; }
.todo-item.done .todo-title { text-decoration:line-through; }
.todo-check { width:21px; height:21px; accent-color:var(--primary); }
.todo-title { font-size:12px; font-weight:700; }
.todo-meta { color:var(--muted); font-size:10px; margin-top:3px; }
.todo-actions { display:flex; gap:4px; }
.priority-dot { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:5px; }
.priority-high { background:#e45f70; } .priority-medium { background:#eea23e; } .priority-low { background:#70ad8f; }

.daily-timeline { --hour-height:58px; position:relative; min-height:1044px; margin-top:14px; border:1px solid var(--border); border-radius:18px; overflow:hidden; background:var(--surface-strong); }
.timeline-hour-row { height:var(--hour-height); position:relative; border-top:1px solid color-mix(in srgb,var(--border) 65%,transparent); margin-left:64px; }
.timeline-hour-label { position:absolute; left:-58px; top:-8px; width:48px; text-align:right; color:var(--muted); font-size:10px; }
.timeline-block-layer { position:absolute; inset:0 8px 0 72px; }
.time-block { position:absolute; left:0; right:0; min-height:30px; padding:7px 10px; border-radius:11px; border:1px solid color-mix(in srgb,var(--block-color,var(--primary)) 35%,var(--border)); background:color-mix(in srgb,var(--block-color,var(--primary)) 15%,var(--surface-strong)); color:var(--text); box-shadow:0 5px 12px rgba(50,35,73,.08); touch-action:none; user-select:none; overflow:hidden; }
.time-block.dragging { z-index:12; opacity:.86; box-shadow:0 12px 26px rgba(50,35,73,.2); }
.time-block strong { display:block; font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.time-block span { display:block; font-size:9px; color:var(--muted); margin-top:2px; }

.week-toolbar { display:flex; align-items:center; justify-content:center; gap:14px; margin-bottom:18px; text-align:center; }
.weekly-generator { padding:15px; border:1px solid var(--border); border-radius:17px; background:var(--surface-soft); }
.weekday-checks { display:flex; flex-wrap:wrap; gap:7px; margin:12px 0; }
.weekday-check { display:flex; gap:5px; align-items:center; padding:7px 9px; border:1px solid var(--border); border-radius:999px; background:var(--surface-strong); color:var(--muted); font-size:10px; font-weight:700; }
.weekday-check input { accent-color:var(--primary); }
.weekly-goal-board { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:8px; margin-top:16px; }
.week-goal-day { min-height:148px; padding:10px; border:1px solid var(--border); border-radius:14px; background:var(--surface-strong); }
.week-goal-day.today { border-color:var(--primary); box-shadow:0 0 0 2px color-mix(in srgb,var(--primary) 10%,transparent); }
.week-goal-head { display:flex; justify-content:space-between; gap:5px; font-size:10px; margin-bottom:8px; }
.week-goal-head strong { font-size:12px; }
.week-goal-chip { display:block; margin-top:5px; padding:6px 7px; border-radius:9px; background:var(--primary-soft); color:var(--primary); font-size:9px; line-height:1.4; }
.week-goal-chip.actual { background:var(--success-soft); color:var(--success); }
.week-goal-note { margin-top:7px; color:var(--muted); font-size:9px; line-height:1.4; }

.weekly-time-grid { --week-hour-height:45px; display:grid; grid-template-columns:56px repeat(7,minmax(92px,1fr)); min-width:820px; position:relative; border:1px solid var(--border); border-radius:16px; overflow:hidden; background:var(--surface-strong); }
.weekly-time-grid-wrap { overflow-x:auto; }
.week-time-corner,.week-day-header { position:sticky; top:0; z-index:5; min-height:48px; display:grid; place-items:center; padding:5px; border-bottom:1px solid var(--border); border-right:1px solid var(--border); background:var(--surface-soft); font-size:10px; }
.week-day-header strong { display:block; font-size:11px; }
.week-time-axis { position:relative; border-right:1px solid var(--border); }
.week-time-axis .axis-hour { height:var(--week-hour-height); border-top:1px solid var(--border); padding:4px; color:var(--muted); font-size:9px; text-align:right; }
.week-day-column { position:relative; min-height:810px; border-right:1px solid var(--border); background:repeating-linear-gradient(to bottom,transparent 0 calc(var(--week-hour-height) - 1px),color-mix(in srgb,var(--border) 65%,transparent) calc(var(--week-hour-height) - 1px) var(--week-hour-height)); }
.week-day-column.today { background-color:color-mix(in srgb,var(--primary) 3%,var(--surface-strong)); }
.week-time-block { position:absolute; left:4px; right:4px; min-height:25px; padding:5px 6px; border-radius:9px; background:color-mix(in srgb,var(--block-color,var(--primary)) 18%,var(--surface-strong)); border:1px solid color-mix(in srgb,var(--block-color,var(--primary)) 45%,var(--border)); box-shadow:0 4px 10px rgba(50,35,73,.09); overflow:hidden; touch-action:none; user-select:none; cursor:grab; }
.week-time-block.dragging { z-index:20; cursor:grabbing; opacity:.82; }
.week-time-block strong { display:block; font-size:9px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.week-time-block span { font-size:8px; color:var(--muted); }

.monthly-plan-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:14px; }
.monthly-subject-card { padding:12px; border:1px solid var(--border); border-radius:14px; background:var(--surface-soft); }
.monthly-subject-card h3 { margin:0 0 9px; font-size:13px; }
.monthly-subject-card .form-grid { gap:7px; }
.month-progress { margin-top:9px; font-size:9px; color:var(--muted); }

.stats-dashboard { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.mega-stat { display:block; margin:12px 0 4px; font-size:28px; letter-spacing:-.06em; color:var(--primary); }
.stats-bars { display:grid; gap:11px; }
.stats-bar-row { display:grid; grid-template-columns:70px minmax(0,1fr) 64px; gap:8px; align-items:center; font-size:10px; }
.stats-bar-track { height:10px; border-radius:999px; overflow:hidden; background:var(--surface-soft); }
.stats-bar-track span { display:block; height:100%; border-radius:inherit; background:var(--primary); }
.round-speed-list { display:grid; gap:8px; max-height:390px; overflow:auto; }
.round-speed-item { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:7px; padding:10px 11px; border:1px solid var(--border); border-radius:13px; background:var(--surface-soft); }
.round-speed-item strong { font-size:11px; }
.round-speed-item span { color:var(--muted); font-size:10px; }

.memo-area { min-height:210px; line-height:1.72; resize:vertical; }
.memo-workspace-card { min-width:0; }
.memo-editor-grid { display:grid; grid-template-columns:minmax(0,1fr) 150px; gap:10px; }
.memo-editor-actions { margin-top:10px; }
.memo-list-toolbar { display:grid; grid-template-columns:minmax(0,1fr) 130px auto; gap:8px; align-items:center; margin:18px 0 10px; padding-top:16px; border-top:1px solid var(--border); }
.memo-list { display:grid; gap:10px; max-height:530px; overflow:auto; padding-right:3px; }
.memo-list-card { padding:13px 14px; border:1px solid var(--border); border-radius:15px; background:var(--surface-soft); transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease; }
.memo-list-card:hover { transform:translateY(-1px); border-color:color-mix(in srgb,var(--primary) 35%,var(--border)); box-shadow:0 8px 18px rgba(50,35,73,.07); }
.memo-list-card.pinned { border-color:color-mix(in srgb,#e8a832 52%,var(--border)); background:color-mix(in srgb,#fff5cb 35%,var(--surface-strong)); }
.memo-card-head { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.memo-card-head h3 { margin:4px 0 0; font-size:13px; line-height:1.35; }
.memo-category { display:inline-flex; padding:3px 7px; border-radius:999px; background:color-mix(in srgb,var(--primary) 10%,var(--surface-strong)); color:var(--primary); font-size:8px; font-weight:700; }
.memo-pin-button { flex:0 0 auto; width:28px; height:28px; border:0; border-radius:9px; background:transparent; color:var(--muted); font-size:17px; cursor:pointer; }
.memo-pin-button.active { color:#d89a19; background:rgba(255,210,91,.16); }
.memo-card-content { margin:10px 0 12px; color:var(--text); font-size:10px; line-height:1.7; display:-webkit-box; -webkit-line-clamp:5; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; }
.memo-card-foot { display:flex; align-items:center; justify-content:space-between; gap:8px; color:var(--muted); font-size:8px; }
.memo-card-actions { display:flex; gap:5px; }
.memo-card-actions button { border:0; border-radius:8px; padding:5px 8px; background:var(--surface-strong); color:var(--muted); font:inherit; cursor:pointer; }
.memo-card-actions button:hover { color:var(--primary); }
.memo-card-actions .danger-text:hover { color:var(--danger); }
.memo-empty { min-height:100px; }
.save-indicator { color:var(--success); font-size:10px; }
.ai-answer { margin-top:14px; text-align:left; white-space:pre-wrap; line-height:1.65; font-size:12px; }
.ai-answer:not(.empty-state) { padding:14px; background:var(--surface-soft); border:1px solid var(--border); border-radius:14px; }

/* Timer refinement: closer to a real square digital timer */
.digital-timer-device { width:min(360px,100%); }
.digital-timer-case { padding:14px; border-radius:36px; background:linear-gradient(145deg,#fffefa,#eae7e0); box-shadow:0 24px 44px rgba(27,24,21,.20),inset 2px 2px 4px #fff,inset -4px -4px 8px rgba(92,83,72,.11); }
.digital-timer-brand { height:17px; font-size:8px; }
.digital-timer-screen { min-height:305px; border-radius:25px; padding:9px 12px 12px; background:radial-gradient(circle at 48% 45%,color-mix(in srgb,var(--timer-screen) 82%,#243142),var(--timer-screen) 70%); }
.segment-ring-wrap { width:min(278px,100%); }
.timer-segment { width:8px; }
.timer-center-display { width:51%; }
.timer-center-display strong { font-size:clamp(31px,5vw,40px); }

@media (max-width: 1200px) {
  .stats-dashboard { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .monthly-plan-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .advisor-input-grid { grid-template-columns:1fr 1fr; }
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns:1fr; }
  .weekly-goal-board { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .form-grid.four-col,.form-grid.three-col { grid-template-columns:1fr 1fr; }
  .quote-strip { grid-template-columns:32px minmax(0,1fr) 32px; }
  .quote-strip > .secondary-button { grid-column:1/-1; }
}
@media (max-width: 620px) {
  .remaining-grid,.quick-links-grid,.advisor-input-grid,.form-grid.three-col,.form-grid.four-col,.stats-dashboard,.monthly-plan-grid { grid-template-columns:1fr; }
  .weekly-goal-board { grid-template-columns:1fr; }
  .quote-copy strong { white-space:normal; }
  .daily-timeline { --hour-height:50px; min-height:900px; }
}
.plan-daily-preview { margin-top:14px; display:grid; gap:7px; }
.plan-daily-preview > strong { font-size:12px; margin-bottom:3px; }
.plan-daily-preview > div { display:grid; grid-template-columns:84px 110px minmax(0,1fr); gap:8px; align-items:center; padding:8px 10px; border:1px solid var(--border); border-radius:11px; background:var(--surface-soft); }
.plan-daily-preview span,.plan-daily-preview small { color:var(--muted); font-size:9px; }
.plan-daily-preview b { font-size:10px; }
@media(max-width:620px){.plan-daily-preview > div{grid-template-columns:1fr 1fr}.plan-daily-preview small{grid-column:1/-1}}
.compact-row { margin-top: 0; flex-wrap: wrap; justify-content: flex-end; }

/* =========================
   Study Flow v7 readability
   ========================= */
.today-target-hero {
  max-width: 1680px;
  margin: 14px auto 0;
  padding: 24px clamp(20px, 4vw, 50px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  align-items: center;
  gap: 28px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  border-radius: 28px;
  background:
    radial-gradient(circle at 92% 10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, var(--surface-strong)), var(--surface-strong));
  box-shadow: var(--shadow);
}
.today-target-copy { min-width: 0; }
.today-target-copy > strong {
  display: block;
  margin-top: 7px;
  color: var(--primary);
  font-size: clamp(34px, 5vw, 68px);
  line-height: 1.08;
  letter-spacing: -.065em;
  word-break: keep-all;
}
.today-target-copy > p {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: clamp(13px, 1.4vw, 17px);
  line-height: 1.65;
}
.today-target-progress-wrap { display: grid; grid-template-columns: 1fr auto; gap: 13px; align-items: center; }
.today-target-progress { height: 18px; overflow: hidden; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--border); }
.today-target-progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #b599ff); transition: width .35s ease; }
.today-target-progress-wrap > strong { min-width: 58px; color: var(--primary); font-size: 18px; text-align: right; }

.duration-field { min-width: 0; }
.duration-field > .field-label,
.advisor-label,
.advisor-select-field > span {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.duration-input-row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
}
.duration-input-row .text-input {
  flex: 1 1 0;
  min-width: 58px;
  width: 0;
  text-align: center;
  padding-inline: 8px;
}
.duration-input-row em {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}
.advisor-input-grid {
  grid-template-columns: repeat(2, minmax(230px, 1fr));
  gap: 12px;
}
.advisor-select-field { min-width: 0; }
.advisor-result { font-size: 13px; line-height: 1.72; }
.advisor-head strong { font-size: 15px; }
.advisor-head span { font-size: 12px; }

.calendar-scroll { overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.calendar-weekdays,
.calendar-grid { min-width: 960px; }
.calendar-weekdays span { padding: 12px 8px; font-size: 13px; font-weight: 800; }
.calendar-grid { gap: 9px; }
.calendar-day,
.calendar-day:nth-child(7n),
.calendar-day:nth-last-child(-n + 7) {
  min-height: 154px;
  padding: 11px;
  border-radius: 15px;
}
.calendar-day-number { font-size: 16px; }
.calendar-content { gap: 7px; margin-top: 8px; }
.calendar-chip {
  padding: 7px 8px;
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.42;
  font-weight: 700;
}

@media (max-width: 900px) {
  .today-target-hero { margin-inline: 14px; grid-template-columns: 1fr; gap: 18px; }
  .today-target-progress-wrap { max-width: 520px; }
  .advisor-input-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .today-target-hero { padding: 20px; border-radius: 22px; }
  .today-target-copy > strong { font-size: 38px; }
  .duration-input-row { gap: 5px; }
  .duration-input-row .text-input { min-width: 52px; }
  .calendar-weekdays,
  .calendar-grid { min-width: 850px; }
  .calendar-day,
  .calendar-day:nth-child(7n),
  .calendar-day:nth-last-child(-n + 7) { min-height: 140px; }
  .calendar-chip { font-size: 10px; }
}


/* =========================
   Study Flow v8 planner + memo attachments
   ========================= */
.daily-timeline {
  --slot-height: 24px;
  --timeline-content-height: 2592px;
  min-height: 0;
  height: min(74vh, 820px);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
  background: var(--surface-strong);
}
.timeline-ten-row {
  height: var(--slot-height);
  position: relative;
  margin-left: 72px;
  border-top: 1px dashed color-mix(in srgb, var(--border) 48%, transparent);
}
.timeline-ten-row.hour { border-top: 2px solid color-mix(in srgb, var(--primary) 25%, var(--border)); }
.timeline-ten-label {
  position: absolute;
  left: -67px;
  top: -7px;
  width: 58px;
  text-align: right;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}
.timeline-ten-row.hour .timeline-ten-label { color: var(--text); font-weight: 800; font-size: 10px; }
.timeline-block-layer { position:absolute; left:80px; right:8px; top:0; height:var(--timeline-content-height); }
.time-block { min-height:36px; padding:6px 9px; z-index:2; }
.planned-time-block { left:0; right:51%; cursor:grab; }
.reading-session-block { left:51%; right:0; cursor:pointer; border-style:solid; background:color-mix(in srgb,var(--block-color,var(--success)) 24%,var(--surface-strong)); box-shadow:0 5px 16px color-mix(in srgb,var(--block-color,var(--success)) 16%,transparent); }
.reading-session-block::after { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background:var(--block-color,var(--success)); }
.time-block .block-kind { display:block; margin-bottom:2px; font-size:8px; font-weight:900; letter-spacing:.06em; color:var(--muted); }
.reading-session-block .block-kind { color:var(--success); }
.timeline-now-line { position:absolute; left:72px; right:0; z-index:8; height:2px; background:#f04f65; pointer-events:none; }
.timeline-now-line::before { content:""; position:absolute; left:-4px; top:-4px; width:10px; height:10px; border-radius:50%; background:#f04f65; }
.timeline-now-line span { position:absolute; right:8px; top:-17px; padding:2px 6px; border-radius:999px; background:#f04f65; color:#fff; font-size:8px; font-weight:800; }
.planner-block-legend { display:flex; gap:14px; flex-wrap:wrap; margin-top:8px; font-size:10px; font-weight:800; }
.legend-plan { color:var(--primary); }
.legend-record { color:var(--success); }

.week-day-column {
  min-height: calc(var(--week-hour-height) * 18);
  background-image:
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--week-hour-height) / 6 - 1px), color-mix(in srgb,var(--border) 35%,transparent) calc(var(--week-hour-height) / 6 - 1px) calc(var(--week-hour-height) / 6)),
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--week-hour-height) - 1px), color-mix(in srgb,var(--primary) 22%,var(--border)) calc(var(--week-hour-height) - 1px) var(--week-hour-height));
}
.planned-week-block { left:3px; right:51%; }
.reading-week-block { left:51%; right:3px; cursor:pointer; background:color-mix(in srgb,var(--block-color,var(--success)) 28%,var(--surface-strong)); border-style:solid; }

.monthly-target-fields { display:grid; gap:8px; }
.monthly-auto-note { display:block; margin-top:8px; color:var(--muted); font-size:8px; line-height:1.45; }

.memo-attachment-toolbar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:10px; }
.memo-attachment-toolbar .save-indicator { margin-left:auto; max-width:100%; }
.memo-attachment-preview,.memo-card-attachments { display:grid; grid-template-columns:repeat(auto-fill,minmax(128px,1fr)); gap:9px; margin-top:10px; }
.attachment-empty { grid-column:1/-1; padding:13px; border:1px dashed var(--border); border-radius:12px; color:var(--muted); font-size:10px; text-align:center; }
.memo-attachment { position:relative; min-width:0; border:1px solid var(--border); border-radius:13px; overflow:hidden; background:var(--surface-soft); }
.image-attachment { min-height:116px; }
.image-attachment img { display:block; width:100%; height:112px; object-fit:cover; background:var(--surface-soft); }
.image-attachment > span { display:block; padding:6px 8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:9px; color:var(--muted); }
.file-attachment > a { min-height:72px; display:flex; gap:9px; align-items:center; padding:11px; color:var(--text); text-decoration:none; }
.file-attachment b { font-size:22px; }
.file-attachment span { min-width:0; display:grid; gap:3px; }
.file-attachment strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10px; }
.file-attachment small { color:var(--muted); font-size:8px; }
.attachment-remove { position:absolute; right:5px; top:5px; z-index:3; width:23px; height:23px; border:0; border-radius:50%; background:rgba(19,20,28,.78); color:#fff; cursor:pointer; }
.memo-card-attachments { grid-template-columns:repeat(auto-fill,minmax(105px,1fr)); }
.memo-card-attachments .image-attachment img { height:92px; }
.memo-card-attachments .image-attachment { min-height:96px; }
.memo-card-attachments .file-attachment > a { min-height:58px; padding:8px; }

@media (max-width: 620px) {
  .daily-timeline { height:68vh; }
  .timeline-block-layer { left:68px; }
  .timeline-ten-row { margin-left:62px; }
  .timeline-ten-label { left:-59px; width:52px; font-size:8px; }
  .timeline-now-line { left:62px; }
  .planned-time-block { right:50.5%; }
  .reading-session-block { left:50.5%; }
  .time-block { padding:5px 6px; }
  .time-block strong { font-size:9px; }
  .time-block span { font-size:8px; }
  .memo-attachment-preview,.memo-card-attachments { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* v9: 주간 계획 달성 판정 + 직전 독서속도 비교 */
.weekly-progress-summary {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin:16px 0 12px;
  padding:14px 16px;
  border:1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
  border-radius:16px;
  background:linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 72%, var(--card)), var(--card));
}
.weekly-progress-summary strong { font-size:15px; color:var(--text); }
.weekly-progress-summary span { font-size:12px; line-height:1.55; color:var(--muted); text-align:right; }
.weekly-plan-item {
  margin-top:8px;
  padding:9px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--card);
  box-shadow:0 5px 16px rgba(31, 25, 52, .045);
}
.weekly-plan-item.achieved { border-color:color-mix(in srgb, var(--success) 42%, var(--border)); background:color-mix(in srgb, var(--success-soft) 56%, var(--card)); }
.weekly-plan-item.partial { border-color:color-mix(in srgb, #d89a28 48%, var(--border)); background:color-mix(in srgb, #fff2d7 58%, var(--card)); }
.weekly-plan-main { min-width:0; }
.weekly-plan-title-row { display:flex; align-items:flex-start; justify-content:space-between; gap:5px; }
.weekly-plan-title-row strong { min-width:0; font-size:10px; line-height:1.35; word-break:keep-all; }
.weekly-plan-range { display:block; margin-top:4px; font-size:9px; line-height:1.4; color:var(--text); }
.weekly-plan-main small { display:block; margin-top:4px; font-size:8px; line-height:1.4; color:var(--muted); }
.weekly-status-badge { flex:0 0 auto; padding:3px 5px; border-radius:999px; font-size:8px; font-weight:800; white-space:nowrap; }
.weekly-status-badge.pending { background:var(--surface); color:var(--muted); }
.weekly-status-badge.achieved { background:var(--success-soft); color:var(--success); }
.weekly-status-badge.partial { background:#fff0cb; color:#a86600; }
.weekly-plan-actions { display:grid; grid-template-columns:1fr 1fr; gap:4px; margin-top:7px; }
.weekly-plan-actions button { min-height:26px; padding:4px 5px; border-radius:8px; border:1px solid var(--border); font:inherit; font-size:8px; font-weight:800; cursor:pointer; }
.weekly-achieve-button { background:var(--success-soft); color:var(--success); }
.weekly-partial-button { background:#fff0cb; color:#995f00; }
.weekly-reset-button { grid-column:1 / -1; background:var(--surface); color:var(--muted); }
.weekly-check-plan-summary { display:flex; flex-direction:column; gap:5px; padding:13px 14px; border-radius:14px; background:var(--primary-soft); }
.weekly-check-plan-summary strong { font-size:16px; }
.weekly-check-plan-summary span { color:var(--muted); }
.weekly-check-page-input { font-size:24px; font-weight:850; text-align:center; }
.weekly-check-result-preview { margin-top:12px; padding:14px; border-radius:14px; background:var(--surface); line-height:1.6; }
.warning-button { border:0; border-radius:12px; padding:11px 15px; background:#e6a12b; color:#fff; font-weight:800; cursor:pointer; }
.speed-compare-badge { display:inline-flex; align-items:center; justify-content:center; min-width:72px; padding:5px 8px; border-radius:999px; font-size:11px; font-weight:850; white-space:nowrap; }
.speed-compare-badge.faster { background:var(--success-soft); color:var(--success); }
.speed-compare-badge.slower { background:#ffe7e7; color:#c54d5b; }
.speed-compare-badge.same, .speed-compare-badge.neutral { background:var(--surface); color:var(--muted); }

@media (max-width: 980px) {
  .weekly-progress-summary { flex-direction:column; }
  .weekly-progress-summary span { text-align:left; }
}

/* =========================
   Study Flow v10 — linked targets, readable planner
   ========================= */
.today-target-title-row,
.daily-target-card-head,
.field-label-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.hero-edit-button {
  border:1px solid color-mix(in srgb,var(--primary) 30%,var(--border));
  border-radius:999px;
  padding:7px 12px;
  background:color-mix(in srgb,var(--primary) 8%,var(--surface-strong));
  color:var(--primary);
  font:inherit;
  font-size:11px;
  font-weight:800;
  cursor:pointer;
}
.today-target-numbers {
  display:flex;
  flex-wrap:wrap;
  gap:9px;
  margin-top:15px;
}
.today-target-numbers span {
  display:inline-flex;
  align-items:center;
  gap:7px;
  padding:8px 11px;
  border:1px solid var(--border);
  border-radius:12px;
  background:color-mix(in srgb,var(--surface-strong) 86%,transparent);
  color:var(--muted);
  font-size:11px;
  font-weight:700;
}
.today-target-numbers b { color:var(--text); font-size:13px; }
.today-target-todos {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:7px;
  margin-top:10px;
}
.today-target-todos strong { color:var(--text); font-size:11px; }
.today-target-todos span,
.today-target-todos em {
  padding:5px 8px;
  border-radius:9px;
  background:var(--surface-soft);
  color:var(--muted);
  font-size:10px;
  font-style:normal;
}
.reading-control-row-prominent {
  position:sticky;
  top:8px;
  z-index:9;
  margin:16px 0 12px;
  padding:10px;
  border:1px solid color-mix(in srgb,var(--primary) 24%,var(--border));
  border-radius:16px;
  background:color-mix(in srgb,var(--surface-strong) 92%,transparent);
  box-shadow:0 10px 24px rgba(49,36,78,.09);
  backdrop-filter:blur(10px);
}
.reading-control-row-prominent button { min-height:46px; font-size:13px; }
.advisor-linked-goal {
  margin:10px 0 12px;
  padding:10px 12px;
  border-radius:12px;
  background:color-mix(in srgb,var(--primary) 8%,var(--surface));
  color:var(--muted);
  font-size:11px;
  line-height:1.55;
}
.advisor-linked-goal strong { color:var(--primary); }
.advisor-input-grid-v10 {
  display:grid;
  grid-template-columns:minmax(250px,1.35fr) minmax(170px,.8fr) minmax(150px,.65fr);
  align-items:end;
}
.daily-target-card {
  margin:12px 0 16px;
  padding:18px;
  border:1px solid color-mix(in srgb,var(--primary) 24%,var(--border));
  border-radius:18px;
  background:linear-gradient(135deg,color-mix(in srgb,var(--primary) 9%,var(--surface-strong)),var(--surface-strong));
}
.daily-target-card-head span { color:var(--muted); font-size:11px; font-weight:800; }
.daily-target-card > strong { display:block; margin-top:10px; color:var(--primary); font-size:clamp(24px,3vw,38px); line-height:1.2; letter-spacing:-.045em; }
.daily-target-card > p { margin:8px 0 12px; color:var(--muted); font-size:12px; line-height:1.55; }
.daily-target-card > small { display:block; margin-top:7px; color:var(--primary); font-weight:800; text-align:right; }
.daily-target-progress { height:12px; }

/* 시간·분 단위가 입력칸과 겹치지 않도록 넉넉하게 고정 */
.duration-input-row {
  display:grid !important;
  grid-template-columns:minmax(64px,1fr) 28px minmax(64px,1fr) 18px !important;
  align-items:center;
  column-gap:6px !important;
  width:100%;
}
.duration-input-row .text-input {
  width:100% !important;
  min-width:0 !important;
  padding-inline:8px;
  text-align:center;
}
.duration-input-row em {
  display:block;
  min-width:0;
  text-align:left;
  white-space:nowrap;
  overflow:visible;
}
.advisor-input-grid-v10 .duration-input-row {
  grid-template-columns:minmax(70px,1fr) 28px minmax(70px,1fr) 18px !important;
}

.calendar-chip.todo {
  background:color-mix(in srgb,#ffc36a 22%,var(--surface-strong));
  color:color-mix(in srgb,#8a5900 88%,var(--text));
  border-color:color-mix(in srgb,#d89a28 28%,var(--border));
}
.goal-dialog-todos {
  display:grid;
  gap:6px;
  margin-bottom:10px;
  padding:11px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--surface-soft);
}
.goal-dialog-todos strong { font-size:11px; color:var(--text); }
.goal-dialog-todos span { font-size:10px; line-height:1.45; color:var(--muted); }
.goal-dialog-todos small { color:var(--primary); }
.derived-todo { border-color:color-mix(in srgb,var(--primary) 22%,var(--border)); background:color-mix(in srgb,var(--primary) 5%,var(--surface-strong)); }
.auto-link-badge { display:inline-flex; padding:4px 7px; border-radius:999px; background:var(--primary-soft); color:var(--primary); font-size:9px; font-weight:850; }
.week-day-open-button {
  width:100%;
  height:100%;
  display:grid;
  place-items:center;
  gap:1px;
  padding:7px 3px;
  border:0;
  background:transparent;
  color:inherit;
  font:inherit;
  cursor:pointer;
}
.week-day-open-button strong { font-size:12px; }
.week-day-open-button small { color:var(--primary); font-size:8px; font-weight:800; }
.week-day-open-button:hover { background:var(--primary-soft); }
.weekly-check-plan-summary { margin-top:4px; }
.memo-category-list { display:grid; gap:8px; margin-top:14px; }
.memo-category-manage-item { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px; border:1px solid var(--border); border-radius:12px; background:var(--surface-soft); }
.memo-category-manage-item span { font-size:12px; font-weight:800; }
.memo-category-manage-item small { color:var(--muted); font-size:9px; }
.memo-category-manage-item button { border:0; background:transparent; color:var(--danger); font:inherit; font-size:10px; font-weight:800; cursor:pointer; }

@media (max-width:1100px) {
  .advisor-input-grid-v10 { grid-template-columns:1fr 1fr; }
  .advisor-input-grid-v10 .duration-field { grid-column:1/-1; }
}
@media (max-width:700px) {
  .today-target-numbers { display:grid; grid-template-columns:1fr 1fr; }
  .today-target-numbers span:last-child { grid-column:1/-1; }
  .advisor-input-grid-v10 { grid-template-columns:1fr; }
  .duration-input-row,
  .advisor-input-grid-v10 .duration-input-row { grid-template-columns:minmax(58px,1fr) 27px minmax(58px,1fr) 17px !important; }
  .reading-control-row-prominent { position:relative; top:auto; display:grid; grid-template-columns:1fr 1fr; }
  .reading-control-row-prominent .grow:last-child { grid-column:1/-1; }
}

/* =========================
   Study Flow v11 layout + book service fixes
   ========================= */
.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-grid > .card,
.form-grid > *,
.duration-field,
.advisor-select-field {
  min-width: 0;
}

.duration-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.duration-input-row .text-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding-inline: 8px;
  text-align: center;
}

.duration-input-row em {
  min-width: 0;
  white-space: nowrap;
}

.today-target-numbers span:nth-child(3) {
  border-color: color-mix(in srgb, var(--primary) 34%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-strong));
}

.today-target-numbers span:nth-child(3) b {
  color: var(--primary);
}

.book-service-status {
  min-height: 0;
  margin-top: 8px;
  padding: 0;
  border-radius: 11px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.book-service-status:not(:empty) {
  padding: 9px 11px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.book-service-status.loading {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-soft));
}

.book-service-status.success {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 28%, var(--border));
  background: var(--success-soft);
}

.book-service-status.warning {
  color: #a96a13;
  border-color: #efd39b;
  background: #fff7e7;
}

.book-service-status.error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 26%, var(--border));
  background: var(--danger-soft);
}

@media (max-width: 1120px) {
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .duration-input-row {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
    gap: 4px;
  }
  .duration-input-row .text-input { min-width: 0; }
}

/* v11.1: 좁은 카드에서 시간·목표 페이지 칸이 밖으로 나가지 않게 고정 */
.advisor-input-grid-v10 {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .85fr) minmax(0, .75fr);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.advisor-input-grid-v10 > * { min-width: 0; max-width: 100%; }
.advisor-input-grid-v10 .select-input,
.advisor-input-grid-v10 .text-input { width: 100%; max-width: 100%; min-width: 0; }
.advisor-label small { margin-left: 5px; color: var(--primary); font-size: 9px; font-weight: 800; white-space: nowrap; }
.settings-grid .duration-input-row { grid-template-columns: minmax(44px,1fr) 27px minmax(44px,1fr) 17px !important; }
@media (max-width: 1180px) {
  .advisor-input-grid-v10 { grid-template-columns: 1fr 1fr; }
  .advisor-input-grid-v10 .duration-field { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .advisor-input-grid-v10 { grid-template-columns: 1fr; }
  .advisor-label small { display:block; margin:3px 0 0; }
}

/* v11.2: 좁은 카드에서도 입력칸이 절대 밖으로 빠져나가지 않게 */
.advisor-input-grid-v10 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.advisor-input-grid-v10 .duration-field { grid-column: 1 / -1; }
.advisor-input-grid-v10 > *,
.settings-grid .form-grid > * { min-width: 0; max-width: 100%; }
.advisor-input-grid-v10 .select-input,
.advisor-input-grid-v10 .text-input,
.settings-grid .text-input,
.settings-grid .select-input { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
.settings-grid .form-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-grid .duration-input-row {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto !important;
  gap: 5px;
}
.settings-grid .duration-input-row em { font-size: 10px; }
.today-target-numbers span { flex: 1 1 150px; justify-content: space-between; }
@media (max-width: 760px) {
  .advisor-input-grid-v10,
  .settings-grid .form-grid.two-col { grid-template-columns: 1fr; }
  .advisor-input-grid-v10 .duration-field { grid-column: auto; }
  .today-target-numbers span { flex-basis: calc(50% - 5px); }
}
@media (max-width: 460px) {
  .today-target-numbers span { flex-basis: 100%; }
}

/* =========================
   Study Flow v12 — visible weekday selector + auto milestone blocks
   ========================= */
.weekly-study-days-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 78%, var(--card)), var(--card));
}
.weekly-study-days-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.weekly-study-days-head strong { display:block; font-size:15px; color:var(--text); }
.weekly-study-days-head span { display:block; margin-top:3px; font-size:11px; line-height:1.45; color:var(--muted); }
.weekday-preset-buttons { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:5px; }
.weekly-study-day-checks { gap:8px; margin:13px 0 0; }
.weekly-study-day-checks .weekday-check {
  min-width: 48px;
  min-height: 42px;
  justify-content:center;
  padding: 9px 12px;
  border-width: 1.5px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.weekly-study-day-checks .weekday-check:hover { transform: translateY(-1px); border-color:var(--primary); }
.weekly-study-day-checks .weekday-check.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 10%, transparent);
}
.weekly-study-day-checks .weekday-check input { width:17px; height:17px; }
.weekly-block-preview {
  margin: 11px 0 13px;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--success-soft) 62%, var(--card));
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
}
.weekly-block-preview strong { color: var(--success); }

.weekly-time-grid { --week-hour-height:72px; }
.week-day-column {
  min-height: calc(var(--week-hour-height) * 18);
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0 calc(var(--week-hour-height) / 6 - 1px),
      color-mix(in srgb, var(--border) 38%, transparent) calc(var(--week-hour-height) / 6 - 1px) calc(var(--week-hour-height) / 6)
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0 calc(var(--week-hour-height) - 1px),
      color-mix(in srgb, var(--border) 80%, transparent) calc(var(--week-hour-height) - 1px) var(--week-hour-height)
    );
}
.week-time-axis .axis-hour { height:var(--week-hour-height); }
.week-time-block { left:4px; right:4px; padding:6px 7px; }
.week-time-block strong { font-size:10px; line-height:1.25; white-space:normal; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }
.week-time-block span { display:block; margin-top:3px; font-size:9px; line-height:1.25; }
.planned-week-block { right:51%; background:color-mix(in srgb,var(--block-color,var(--primary)) 17%,var(--surface-strong)); }
.reading-week-block { left:51%; background:color-mix(in srgb,var(--success) 14%,var(--surface-strong)); border-color:color-mix(in srgb,var(--success) 42%,var(--border)); }
.week-day-open-button small { display:block; margin-top:2px; color:var(--primary); font-size:8px; }

@media (max-width: 760px) {
  .weekly-study-days-head { flex-direction:column; }
  .weekday-preset-buttons { justify-content:flex-start; }
  .weekly-study-day-checks .weekday-check { min-width:44px; flex:1 1 44px; }
}


/* =========================
   Study Flow v14 — compact duration fields + weekly time estimate
   ========================= */
.settings-duration-control {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  width:100%;
  min-width:0;
}
.settings-duration-control label {
  position:relative;
  display:block;
  min-width:0;
}
.settings-duration-control .text-input {
  width:100%;
  min-width:0;
  max-width:100%;
  padding-right:38px;
  text-align:center;
  box-sizing:border-box;
}
.settings-duration-control label span {
  position:absolute;
  right:12px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  font-size:10px;
  font-weight:800;
  pointer-events:none;
  white-space:nowrap;
}
.settings-grid .settings-duration-field {
  width:100%;
  min-width:0;
  overflow:hidden;
}
.weekly-estimate-main { line-height:1.7; }
.weekly-estimate-days {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:7px;
  margin-top:10px;
}
.weekly-estimate-days span {
  display:block;
  min-width:0;
  padding:8px 10px;
  border:1px solid color-mix(in srgb,var(--primary) 18%,var(--border));
  border-radius:11px;
  background:color-mix(in srgb,var(--primary) 5%,var(--surface-strong));
  color:var(--muted);
  font-size:10px;
  line-height:1.55;
}
.weekly-estimate-days b { color:var(--primary); }
.weekly-plan-time {
  display:block;
  margin-top:4px;
  color:var(--primary);
  font-size:9px;
  line-height:1.4;
  font-weight:800;
}
@media (max-width:520px) {
  .settings-duration-control { grid-template-columns:1fr 1fr; gap:6px; }
  .settings-duration-control .text-input { padding-right:34px; }
  .settings-duration-control label span { right:9px; font-size:9px; }
  .weekly-estimate-days { grid-template-columns:1fr; }
}


/* =========================
   Study Flow v16 — planner layout, reliable weekly blocks
   ========================= */
.time-calculator-card { overflow:hidden; }
.planner-time-input-grid {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:12px;
  width:100%;
  min-width:0;
}
.planner-time-field { min-width:0; }
.planner-clock-field { grid-column:1 / -1; }
.planner-duration-control {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:8px;
  width:100%;
  min-width:0;
}
.planner-duration-control label {
  position:relative;
  display:block;
  min-width:0;
}
.planner-duration-control .text-input {
  width:100%;
  min-width:0;
  max-width:100%;
  padding-right:42px;
  text-align:center;
  box-sizing:border-box;
}
.planner-duration-control label span {
  position:absolute;
  right:11px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  font-size:10px;
  font-weight:800;
  pointer-events:none;
  white-space:nowrap;
}
.planner-clock-field .text-input { width:100%; min-width:0; box-sizing:border-box; }
.weekly-time-grid-wrap { min-height:420px; }
.week-time-block { z-index:2; overflow:hidden; }
.week-day-column { min-height:calc(18 * var(--week-hour-height)); }
@media (max-width:560px) {
  .planner-time-input-grid { grid-template-columns:1fr; }
  .planner-clock-field { grid-column:auto; }
}

/* =========================
   Study Flow v17 — reliable weekly blocks + reading result
   ========================= */
.reading-result-summary {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-top:8px;
}
.reading-result-summary > div {
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--surface-soft);
}
.reading-result-summary span { display:block; color:var(--muted); font-size:10px; font-weight:750; }
.reading-result-summary strong { display:block; margin-top:4px; color:var(--text); font-size:15px; }
.reading-result-comparison {
  margin-top:12px;
  padding:14px;
  border-radius:15px;
  background:var(--primary-soft);
  color:var(--primary);
  font-size:13px;
  font-weight:850;
  line-height:1.55;
}
.reading-result-comparison.faster { background:var(--success-soft); color:var(--success); }
.reading-result-comparison.slower { background:var(--danger-soft); color:var(--danger); }
.week-day-header { position:sticky; top:0; z-index:12; }
.week-day-open-button { position:relative; z-index:13; pointer-events:auto; }
.week-time-block { z-index:2; }
.weekly-block-debug {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:8px;
  color:var(--muted);
  font-size:10px;
}
@media (max-width:520px) {
  .reading-result-summary { grid-template-columns:1fr; }
}


/* =========================
   Study Flow v19 — weekly board visibility + compact reading toast
   ========================= */
.toast.reading-result-toast {
  top: 72px;
  width: fit-content;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 12px;
  background: #17151d;
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.55;
  text-align: center;
  white-space: pre-line;
  box-shadow: 0 14px 34px rgba(19, 15, 28, .28);
}
.week-goal-head.week-goal-open-day {
  width: 100%;
  border: 0;
  padding: 0 0 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.week-goal-head.week-goal-open-day:hover strong { color: var(--primary); }
.week-goal-head.week-goal-open-day small {
  margin-left: auto;
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
}


/* =========================
   Study Flow v19 — rotation-plan manager
   ========================= */
.rotation-plan-manager-card { margin-top: 18px; }
.saved-rotation-plans { display:grid; gap:14px; }
.rotation-plan-card {
  padding:16px;
  border:1px solid var(--border);
  border-radius:18px;
  background:linear-gradient(145deg,var(--surface),var(--surface-soft));
  box-shadow:0 10px 24px rgba(78,55,126,.06);
}
.rotation-plan-card-main { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.rotation-plan-card h3 { margin:4px 0 0; font-size:17px; }
.rotation-plan-card p { margin:10px 0; color:var(--muted); font-size:12px; font-weight:700; }
.rotation-plan-date-range { color:var(--primary); font-size:11px; font-weight:850; white-space:nowrap; }
.rotation-plan-days { display:flex; flex-wrap:wrap; gap:7px; margin:10px 0 14px; }
.rotation-day-chip {
  border:1px solid var(--border);
  border-radius:999px;
  padding:7px 10px;
  background:var(--surface);
  color:var(--text);
  font-size:10px;
  font-weight:750;
  cursor:pointer;
}
.rotation-day-chip:hover { border-color:var(--primary); color:var(--primary); transform:translateY(-1px); }
.rotation-plan-actions { display:flex; gap:9px; flex-wrap:wrap; }
@media (max-width:640px) {
  .rotation-plan-card-main { flex-direction:column; }
  .rotation-plan-date-range { white-space:normal; }
  .rotation-plan-actions > button { flex:1 1 100%; }
}

/* =========================
   Study Flow v20 — multi-book Today Target
   ========================= */
.today-target-book-list {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
  gap:10px;
  margin-top:14px;
}
.today-book-target {
  min-width:0;
  padding:12px;
  border:1px solid color-mix(in srgb,var(--target-color) 28%,var(--border));
  border-radius:16px;
  background:color-mix(in srgb,var(--target-color) 7%,var(--surface-strong));
}
.today-book-target-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.today-book-target-title-wrap {
  min-width:0;
  display:flex;
  align-items:center;
  gap:9px;
}
.today-book-target-title-wrap img {
  width:36px;
  height:48px;
  flex:0 0 auto;
  object-fit:cover;
  border-radius:7px;
  border:1px solid var(--border);
  background:var(--surface-soft);
}
.today-book-target-title-wrap div { min-width:0; }
.today-book-target-title-wrap strong {
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--text);
  font-size:12px;
}
.today-book-target-title-wrap span {
  display:block;
  margin-top:3px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--muted);
  font-size:9px;
}
.today-book-target-head > b {
  flex:0 0 auto;
  color:var(--target-color);
  font-size:16px;
}
.today-book-target-progress {
  height:9px;
  margin-top:10px;
  overflow:hidden;
  border-radius:999px;
  background:color-mix(in srgb,var(--target-color) 10%,var(--surface-soft));
  border:1px solid color-mix(in srgb,var(--target-color) 18%,var(--border));
}
.today-book-target-progress > span {
  display:block;
  height:100%;
  border-radius:inherit;
  background:var(--target-color);
  transition:width .3s ease;
}
.today-book-target-stats {
  display:flex;
  flex-wrap:wrap;
  gap:7px 12px;
  margin-top:8px;
  color:var(--muted);
  font-size:9px;
}
.today-book-target-stats b { color:var(--text); }
@media(max-width:700px) {
  .today-target-book-list { grid-template-columns:1fr; }
}

/* v23 — Google 계정 실시간 동기화 */
.cloud-sync-card { grid-column: 1 / -1; }
.sync-status-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--card) 88%, #efe8ff 12%);
}
.sync-status-panel[data-sync-state="synced"] { border-color: rgba(47, 158, 106, .36); background: rgba(47, 158, 106, .08); }
.sync-status-panel[data-sync-state="saving"] { border-color: rgba(119, 80, 212, .38); background: rgba(119, 80, 212, .08); }
.sync-status-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  font-size: 22px;
}
.sync-status-detail { min-width: 0; display: grid; gap: 4px; }
.sync-status-detail strong { font-size: 15px; }
.sync-status-detail span { color: var(--muted); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.cloud-sync-actions { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 10px; margin-top: 12px; }
.cloud-sync-actions button:disabled { opacity: .45; cursor: not-allowed; }
.weekly-plan-manager-card .rotation-plan-card { scroll-margin-top: 120px; }
@media (max-width: 760px) {
  .cloud-sync-actions { grid-template-columns: 1fr; }
  .sync-status-panel { align-items: flex-start; }
}


/* =========================
   Study Flow v23 — target time + pomodoro celebration
   ========================= */
.today-book-target-time {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:7px;
  margin-top:9px;
  padding-top:9px;
  border-top:1px dashed color-mix(in srgb,var(--target-color) 22%,var(--border));
  color:var(--muted);
  font-size:9px;
}
.today-book-target-time > span {
  min-width:0;
  padding:6px 7px;
  border-radius:9px;
  background:color-mix(in srgb,var(--target-color) 5%,var(--surface-soft));
}
.today-book-target-time > span:last-child { grid-column:1 / -1; }
.today-book-target-time b { color:var(--text); }
.pomo-option-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px 12px;
  margin-top:13px;
}
.pomo-option-grid .checkbox-row { margin:0; min-width:0; }
.compact-options { margin:14px 0 2px; }
.pomodoro-celebration-layer {
  position:fixed;
  inset:0;
  z-index:99999;
  overflow:hidden;
  pointer-events:none;
  background:radial-gradient(circle at center,rgba(255,255,255,.08),transparent 48%);
  animation:celebration-fade 1.9s ease both;
}
.pomodoro-firework-burst {
  position:absolute;
  width:1px;
  height:1px;
}
.pomodoro-firework-burst i {
  --angle:0deg;
  --distance:80px;
  --delay:0s;
  --particle-color:#fff;
  position:absolute;
  left:0;
  top:0;
  width:5px;
  height:13px;
  border-radius:999px;
  background:var(--particle-color);
  box-shadow:0 0 8px color-mix(in srgb,var(--particle-color) 80%,transparent);
  transform:rotate(var(--angle)) translateY(0) scale(.25);
  opacity:0;
  animation:pomodoro-firework 1.15s cubic-bezier(.17,.72,.23,1) var(--delay) both;
}
.pomodoro-celebration-message {
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  padding:13px 20px;
  border-radius:999px;
  background:rgba(12,16,23,.9);
  color:#fff;
  box-shadow:0 15px 45px rgba(0,0,0,.28);
  font-size:clamp(18px,4vw,30px);
  font-weight:850;
  animation:celebration-message 1.7s ease both;
}
@keyframes pomodoro-firework {
  0% { opacity:0; transform:rotate(var(--angle)) translateY(0) scale(.25); }
  14% { opacity:1; }
  72% { opacity:1; transform:rotate(var(--angle)) translateY(calc(var(--distance) * -1)) scale(1); }
  100% { opacity:0; transform:rotate(var(--angle)) translateY(calc(var(--distance) * -1.18)) scale(.2); }
}
@keyframes celebration-message {
  0% { opacity:0; transform:translate(-50%,-45%) scale(.82); }
  18%,70% { opacity:1; transform:translate(-50%,-50%) scale(1); }
  100% { opacity:0; transform:translate(-50%,-55%) scale(.96); }
}
@keyframes celebration-fade { 0%,70% { opacity:1; } 100% { opacity:0; } }
@media(max-width:700px) {
  .pomo-option-grid { grid-template-columns:1fr; }
  .today-book-target-time { grid-template-columns:1fr 1fr; }
}
@media(prefers-reduced-motion:reduce) {
  .pomodoro-celebration-layer { display:none !important; }
}

/* =========================
   Study Flow v24 — larger Today Target & weekly goal cards
   ========================= */
.today-target-hero {
  padding: 30px clamp(24px, 4.6vw, 64px);
  gap: 34px;
}
.today-target-title-row .eyebrow {
  font-size: 13px;
  letter-spacing: .12em;
}
.hero-edit-button {
  padding: 9px 15px;
  font-size: 13px;
}
.today-target-copy > p {
  font-size: clamp(16px, 1.55vw, 20px);
  line-height: 1.75;
}
.today-target-numbers {
  gap: 11px;
  margin-top: 18px;
}
.today-target-numbers span {
  gap: 9px;
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
}
.today-target-numbers b {
  font-size: 17px;
}
.today-target-todos {
  gap: 9px;
  margin-top: 14px;
}
.today-target-todos strong {
  font-size: 14px;
}
.today-target-todos span,
.today-target-todos em {
  padding: 7px 11px;
  border-radius: 11px;
  font-size: 13px;
  line-height: 1.45;
}
.today-target-progress-wrap {
  gap: 16px;
}
.today-target-progress {
  height: 22px;
}
.today-target-progress-wrap > strong {
  min-width: 72px;
  font-size: 24px;
}
.today-target-book-list {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.today-book-target {
  padding: 17px;
  border-radius: 19px;
}
.today-book-target-title-wrap {
  gap: 12px;
}
.today-book-target-title-wrap img {
  width: 44px;
  height: 59px;
  border-radius: 9px;
}
.today-book-target-title-wrap strong {
  font-size: 16px;
  line-height: 1.4;
}
.today-book-target-title-wrap span {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.4;
}
.today-book-target-head > b {
  font-size: 21px;
}
.today-book-target-progress {
  height: 12px;
  margin-top: 13px;
}
.today-book-target-stats {
  gap: 9px 15px;
  margin-top: 11px;
  font-size: 13px;
  line-height: 1.5;
}

.weekly-goal-board {
  gap: 12px;
  margin-top: 18px;
}
.week-goal-day {
  min-height: 215px;
  padding: 14px;
  border-radius: 17px;
}
.week-goal-head {
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}
.week-goal-head strong {
  font-size: 17px;
}
.week-goal-head.week-goal-open-day small {
  font-size: 12px;
}
.weekly-plan-item {
  margin-top: 10px;
  padding: 13px;
  border-radius: 15px;
}
.weekly-plan-title-row {
  gap: 8px;
}
.weekly-plan-title-row strong {
  font-size: 14px;
  line-height: 1.45;
}
.weekly-plan-range {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.weekly-plan-time {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
}
.weekly-plan-main small {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.5;
}
.weekly-status-badge {
  padding: 5px 8px;
  font-size: 11px;
}
.weekly-plan-actions {
  gap: 7px;
  margin-top: 10px;
}
.weekly-plan-actions button {
  min-height: 38px;
  padding: 8px 9px;
  border-radius: 10px;
  font-size: 12px;
}
.week-goal-chip {
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 11px;
  font-size: 12px;
  line-height: 1.5;
}
.week-goal-note {
  margin-top: 9px;
  font-size: 11px;
  line-height: 1.55;
}

@media (max-width: 700px) {
  .today-target-hero {
    padding: 24px 19px;
  }
  .today-target-copy > strong {
    font-size: clamp(40px, 12vw, 56px);
  }
  .today-target-copy > p {
    font-size: 16px;
  }
  .today-target-book-list {
    grid-template-columns: 1fr;
  }
  .today-target-numbers span {
    flex-basis: 100%;
  }
  .week-goal-day {
    min-height: 0;
  }
}

/* =========================
   Study Flow v25 — wide weekly goal board
   Seven days stay large and readable; the board scrolls horizontally instead of crushing text.
   ========================= */
.weekly-board-scroll-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-top: 14px;
  padding: 0 0 14px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: color-mix(in srgb, var(--primary) 58%, var(--border)) var(--surface-soft);
  -webkit-overflow-scrolling: touch;
}
.weekly-board-scroll-shell::-webkit-scrollbar { height: 14px; }
.weekly-board-scroll-shell::-webkit-scrollbar-track {
  border-radius: 999px;
  background: var(--surface-soft);
}
.weekly-board-scroll-shell::-webkit-scrollbar-thumb {
  border: 3px solid var(--surface-soft);
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 62%, var(--border));
}
.weekly-board-scroll-hint {
  position: sticky;
  left: 0;
  width: max-content;
  max-width: calc(100vw - 70px);
  margin: 0 0 10px;
  padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary-soft) 58%, var(--surface-strong));
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
}
.weekly-board-scroll-shell .weekly-goal-board {
  grid-template-columns: repeat(7, minmax(260px, 1fr));
  gap: 14px;
  width: max-content;
  min-width: 1930px;
  margin-top: 0;
  padding: 2px 2px 8px;
}
.weekly-board-scroll-shell .week-goal-day {
  width: 260px;
  min-height: 270px;
  padding: 18px;
  border-radius: 20px;
}
.weekly-board-scroll-shell .week-goal-head {
  gap: 10px;
  margin-bottom: 13px;
  font-size: 14px;
  line-height: 1.4;
}
.weekly-board-scroll-shell .week-goal-head strong { font-size: 21px; }
.weekly-board-scroll-shell .week-goal-head > span { font-size: 13px; }
.weekly-board-scroll-shell .week-goal-head.week-goal-open-day small {
  font-size: 12px;
}
.weekly-board-scroll-shell .weekly-plan-item {
  margin-top: 12px;
  padding: 16px;
  border-radius: 17px;
}
.weekly-board-scroll-shell .weekly-plan-title-row {
  align-items: flex-start;
  gap: 10px;
}
.weekly-board-scroll-shell .weekly-plan-title-row strong {
  font-size: 16px;
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.weekly-board-scroll-shell .weekly-status-badge {
  padding: 5px 9px;
  font-size: 11px;
}
.weekly-board-scroll-shell .weekly-plan-range {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.62;
}
.weekly-board-scroll-shell .weekly-plan-time {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.58;
  font-weight: 800;
}
.weekly-board-scroll-shell .weekly-plan-main small {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.55;
}
.weekly-board-scroll-shell .weekly-plan-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 13px;
}
.weekly-board-scroll-shell .weekly-plan-actions button {
  min-height: 44px;
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.25;
}
.weekly-board-scroll-shell .week-goal-chip {
  margin-top: 11px;
  padding: 11px 12px;
  border-radius: 13px;
  font-size: 13px;
  line-height: 1.55;
}
.weekly-board-scroll-shell .week-goal-note {
  margin-top: 11px;
  font-size: 12px;
  line-height: 1.6;
}

/* A little more canvas on wide monitors while keeping the rest of the app unchanged. */
@media (min-width: 1500px) {
  .app-shell { max-width: 1880px; }
}

@media (max-width: 700px) {
  .weekly-board-scroll-hint {
    max-width: calc(100vw - 42px);
    font-size: 11px;
  }
  .weekly-board-scroll-shell .weekly-goal-board {
    grid-template-columns: repeat(7, 240px);
    min-width: 1750px;
  }
  .weekly-board-scroll-shell .week-goal-day {
    width: 240px;
    padding: 16px;
  }
}


/* =========================
   Study Flow v26 — customizable persistent Pomodoro alarm
   ========================= */
.pomo-alarm-customizer {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  border-radius: 18px;
  background: color-mix(in srgb, var(--primary) 4%, var(--surface-soft));
}
.pomo-alarm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.pomo-alarm-field { min-width: 0; }
.pomo-alarm-field .field-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.pomo-alarm-field .field-label b { color: var(--primary); font-size: 13px; }
.pomo-volume-range {
  width: 100%;
  min-height: 42px;
  accent-color: var(--primary);
  cursor: pointer;
}
.pomo-number-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.pomo-number-unit em { font-style: normal; color: var(--muted); font-weight: 750; }
.pomo-alert-options { margin: 14px 0; }
.compact-alarm-customizer { margin-top: 14px; padding: 13px; }
.pomodoro-alarm-layer {
  position: fixed;
  inset: 0;
  z-index: 100200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(8, 10, 16, .32);
  backdrop-filter: blur(4px);
  cursor: pointer;
  animation: pomo-alarm-backdrop-in .18s ease both;
}
.pomodoro-alarm-card {
  width: min(560px, 94vw);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 22px;
  background: rgba(12, 16, 23, .96);
  color: #fff;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
  cursor: default;
  animation: pomo-alarm-card-in .24s cubic-bezier(.2,.8,.2,1) both;
}
.pomodoro-alarm-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--timer-accent, #ff725f) 32%, #222936);
  font-size: 26px;
  animation: pomo-alarm-bell .85s ease-in-out infinite;
}
.pomodoro-alarm-copy { min-width: 0; }
.pomodoro-alarm-copy strong { display: block; font-size: 19px; line-height: 1.35; }
.pomodoro-alarm-copy p { margin: 4px 0 5px; color: rgba(255,255,255,.82); font-size: 14px; }
.pomodoro-alarm-copy small { display: block; color: rgba(255,255,255,.58); font-size: 12px; line-height: 1.45; }
.pomodoro-alarm-stop {
  min-height: 44px;
  padding: 0 17px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: #10131a;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}
.pomodoro-alarm-stop:hover { transform: translateY(-1px); }
@keyframes pomo-alarm-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pomo-alarm-card-in { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pomo-alarm-bell { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-10deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(5deg); } }
@media (max-width: 760px) {
  .pomo-alarm-grid { grid-template-columns: 1fr; }
  .pomodoro-alarm-card { grid-template-columns: auto minmax(0,1fr); }
  .pomodoro-alarm-stop { grid-column: 1 / -1; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .pomodoro-alarm-layer, .pomodoro-alarm-card, .pomodoro-alarm-icon { animation: none !important; }
}
