/* 빌더 화면 (프리셋, 블록 편집, 내 스케줄) */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 14px clamp(16px, 4vw, 40px); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--mode-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mode-color) 25%, transparent); }
.brand-sub { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.builder { max-width: 1120px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 60px; display: flex; flex-direction: column; gap: 28px; }
.preset-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(176px, 1fr); gap: 12px; overflow-x: auto; padding: 4px 4px 10px; scroll-snap-type: x proximity; }
.preset-card { scroll-snap-align: start; text-align: left; padding: 16px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; transition: all var(--dur); box-shadow: var(--shadow-1); }
.preset-card:hover { transform: translateY(-2px); border-color: var(--border-2); }
.preset-card.on { border-color: var(--mode-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mode-color) 25%, transparent); }
.preset-name { font-weight: 700; font-size: 15px; }
.preset-meta { color: var(--muted); font-size: 12.5px; }
.preset-tl { display: flex; gap: 3px; height: 6px; }
.preset-tl span { display: block; border-radius: 3px; background: var(--mode-color); flex-basis: 0; }

.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.editor { padding: 22px; }
.editor-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.schedule-name { font-size: 20px; font-weight: 800; letter-spacing: -.02em; background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 4px 0; min-width: 200px; flex: 1; }
.schedule-name:focus { border-bottom-color: var(--mode-color); }
.schedule-name::placeholder { color: var(--muted); }
.editor-summary { color: var(--text-2); font-size: 13.5px; }

.blocks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.block-row { display: grid; grid-template-columns: auto auto minmax(120px, 1fr) auto auto auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-m); background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--mode-color); transition: opacity var(--dur), box-shadow var(--dur); }
.block-row.dragging { opacity: .4; }
.block-row.drop-before { box-shadow: 0 -3px 0 0 var(--mode-color); }
.block-row.drop-after { box-shadow: 0 3px 0 0 var(--mode-color); }
.grip { color: var(--muted); cursor: grab; display: grid; place-items: center; }
.grip:active { cursor: grabbing; }
.block-num { font-family: var(--mono); font-size: 12px; color: var(--muted); width: 18px; text-align: center; }
.mode-select-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mode-icon { font-size: 18px; }
.mode-select { font-weight: 700; padding: 6px 28px 6px 10px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.duration { display: flex; align-items: center; gap: 4px; }
.minutes { width: 64px; text-align: center; font-weight: 700; padding: 6px 4px; }
.unit { color: var(--muted); font-size: 13px; margin-right: 4px; white-space: nowrap; }
.duration-human { color: var(--text-2); font-size: 13px; white-space: nowrap; min-width: 72px; text-align: right; }
.row-actions { display: flex; gap: 2px; }
.blocks-empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--border-2); border-radius: var(--r-m); }

.add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.add-label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 600; margin-right: 4px; }
.chip-add { border-left: 3px solid var(--mode-color); padding-left: 10px; }
.chip-add:hover { background: color-mix(in srgb, var(--mode-color) 14%, transparent); }
.chip-min { color: var(--muted); font-weight: 500; }
.editor-foot { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.repeat { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.repeat .label { font-weight: 700; font-size: 14px; }
.stepper-group { display: inline-flex; align-items: center; gap: 6px; }
.repeat-value { min-width: 48px; text-align: center; font-weight: 700; }
.timeline-preview { display: flex; gap: 4px; height: 34px; }
.validation { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.val-error, .val-warn { font-size: 13px; padding: 8px 12px; border-radius: 10px; }
.val-error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.val-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: #b57600; }
.editor-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.btn-start { padding: 12px 28px; font-size: 16px; border-radius: var(--r-m); }

.my-schedules { padding: 18px; }
.saved-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.saved { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; transition: all var(--dur); }
.saved:hover { background: var(--surface-2); }
.saved.on { border-color: var(--mode-color); background: color-mix(in srgb, var(--mode-color) 10%, transparent); }
.saved-main { flex: 1; min-width: 0; }
.saved-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-meta { color: var(--muted); font-size: 12px; }
.saved-confirm { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.empty { color: var(--muted); font-size: 13.5px; padding: 8px 2px; }
.builder-foot { color: var(--muted); font-size: 13px; text-align: center; }

/* 타임라인 (빌더 + 플레이어 공용) */
.tl-seg { position: relative; flex-basis: 0; min-width: 28px; border-radius: 8px; background: color-mix(in srgb, var(--mode-color) 22%, transparent); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.tl-fill { position: absolute; inset: 0; width: 0; background: var(--mode-color); opacity: .85; transition: width 1s linear; }
.tl-seg.current { box-shadow: 0 0 0 2px var(--mode-color); }
.tl-seg.past .tl-fill { opacity: .55; }
.tl-label { position: relative; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; padding: 0 6px; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.tl-empty { color: var(--muted); font-size: 13px; align-self: center; }

@media (max-width: 860px) {
  .builder-grid { grid-template-columns: 1fr; }
  .block-row { grid-template-columns: auto auto 1fr auto; grid-template-areas: "grip num mode actions" "grip num dur human"; }
  .grip { grid-area: grip; }
  .block-num { grid-area: num; }
  .mode-select-wrap { grid-area: mode; }
  .duration { grid-area: dur; }
  .duration-human { grid-area: human; text-align: left; }
  .row-actions { grid-area: actions; justify-content: flex-end; }
  .tl-text { display: none; }
}
@media (max-width: 520px) {
  .brand-sub { display: none; }
  .editor { padding: 16px; }
  .editor-actions .btn { flex: 1; justify-content: center; }
}

/* 블록 끝 알림 버튼 */
.block-row { grid-template-columns: auto auto minmax(110px, 1fr) auto auto minmax(0, 150px) auto; }
.bell-btn { display: inline-flex; align-items: center; gap: 6px; max-width: 150px; padding: 6px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--text-2); transition: all var(--dur); white-space: nowrap; overflow: hidden; }
button.bell-btn:hover { border-color: var(--mode-color); color: var(--text); }
.bell-btn.muted { color: var(--muted); }
.bell-btn.custom { border-color: color-mix(in srgb, var(--mode-color) 60%, transparent); color: var(--text); }
.bell-btn.bell-none { background: transparent; border-style: dashed; cursor: default; }
.bell-text { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) {
  .block-row { grid-template-columns: auto auto 1fr auto; grid-template-areas: "grip num mode actions" "grip num dur dur" "grip num bell bell"; }
  .duration-human { display: none; }
  .bell-btn { grid-area: bell; justify-self: start; max-width: 100%; }
}
.builder-foot .legal { display: block; margin-top: 8px; font-size: 12px; }
.builder-foot .legal a, .legal-links a, .consent-links a { color: var(--text-2); }
.legal-links, .consent-links { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.9; }

/* 진행 방식 */
.flow-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.flow-row .label { font-weight: 700; font-size: 14px; }
.flow-hint { margin: -4px 0 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--mode-color) 10%, transparent); color: var(--text-2); font-size: 13px; }

/* 오늘 공부 칩 */
.today-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.today-chip .streak { color: #ff9a3d; }

/* 지금 추천 */
.now-rec { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 18px 20px; border-radius: var(--r-l); background: linear-gradient(120deg, color-mix(in srgb, var(--mode-color) 18%, var(--surface)), var(--surface)); border: 1px solid var(--border); box-shadow: var(--shadow-1); }
.nr-text { flex: 1 1 220px; }
.nr-title { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.nr-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.nr-options { display: flex; gap: 8px; flex-wrap: wrap; }
.nr-opt { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-align: left; transition: all var(--dur); }
.nr-opt:hover { border-color: var(--mode-color); transform: translateY(-1px); }
.nr-opt.primary { border-color: var(--mode-color); box-shadow: 0 6px 20px -10px var(--mode-color); }
.nr-icon { font-size: 22px; }
.nr-label { display: flex; flex-direction: column; font-size: 13px; }
.nr-label strong { font-size: 14px; }
.nr-label span { color: var(--muted); font-size: 11.5px; }
@media (max-width: 640px) { .today-chip { display: none; } .nr-opt { flex: 1 1 100%; } }
/* 프리셋: 가로 스크롤 대신 줄바꿈 → 잘리는 카드 없음 */
.preset-row { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); overflow: visible; padding: 2px 0 4px; }
.preset-name { overflow-wrap: anywhere; }
.bell-btn { max-width: 180px; }
@media (max-width: 860px) { .bell-btn { max-width: 100%; } }
.nr-plan { border-style: dashed; }
/* 추천 일정 창 */
.planner { display: flex; flex-direction: column; gap: 14px; }
.pl-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pl-label { min-width: 78px; font-weight: 700; font-size: 13.5px; }
.pl-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pl-preview { padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.pl-head { display: flex; flex-direction: column; gap: 2px; }
.pl-tl { height: 28px; }
.pl-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12.5px; }
.pl-step { padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--mode-color) 18%, transparent); border: 1px solid color-mix(in srgb, var(--mode-color) 40%, transparent); white-space: nowrap; }
.pl-arrow { color: var(--muted); }
.pl-reasons { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-2); line-height: 1.7; }
.pl-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pl-spacer { flex: 1; }
.modal.planner-modal { width: min(94vw, 600px); }
.modal.planner-modal .modal-actions { display: none; }

/* 오른쪽: 할 일 / 내 스케줄 */
.side { padding: 14px; }
.side-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--border); }
.side-tabs button { flex: 1; padding: 8px 10px; border-radius: 9px; font-weight: 700; font-size: 13.5px; color: var(--text-2); }
.side-tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.side-tabs .count { display: inline-block; min-width: 18px; font-size: 11px; color: #fff; background: #5b8cff; border-radius: 999px; padding: 0 5px; margin-left: 2px; }
.side-tabs .count:empty { display: none; }
.tasks-head { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.select.sm { padding: 6px 8px; font-size: 13px; width: auto; }
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.task { display: flex; align-items: flex-start; gap: 8px; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--mode-color); }
.task.done { opacity: .6; }
.task-status { width: 18px; text-align: center; color: var(--mode-color); font-weight: 800; padding-top: 1px; }
.task-main { flex: 1; min-width: 0; cursor: pointer; }
.task-title { font-weight: 700; font-size: 13.5px; overflow-wrap: anywhere; line-height: 1.4; }
.task.done .task-title { text-decoration: line-through; }
.task-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.task-meta.urgent { color: var(--danger); font-weight: 700; }
.task-progress { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.task-progress i { display: block; height: 100%; background: var(--mode-color); }
.prio { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 2px; }
.prio.p3 { background: var(--danger); } .prio.p2 { background: var(--warn); } .prio.p1 { background: var(--muted); }
.task-go { flex: none; color: var(--mode-color); }
.tasks-done-toggle { margin: 10px 0 6px; font-size: 12.5px; }

/* 할 일 창 */
.task-form { display: flex; flex-direction: column; gap: 14px; }
.tf-field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 13.5px; }
.tf-field input { font-weight: 500; font-size: 15px; padding: 10px 12px; }
.tf-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tf-label { min-width: 64px; font-weight: 700; font-size: 13.5px; }
.tf-est { width: 80px; }
.tf-log { font-size: 12.5px; color: var(--text-2); }
.tf-log ul { margin: 6px 0 0; padding-left: 18px; }
.tf-actions { display: flex; gap: 8px; align-items: center; }
.modal.task-modal { width: min(94vw, 540px); }
.modal.task-modal .modal-actions { display: none; }
/* 메모 · 진행 기록 타임라인 */
.tf-notes { display: flex; flex-direction: column; gap: 8px; }
.note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.note { position: relative; padding: 8px 34px 8px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.note time { display: block; font-size: 11px; color: var(--muted); }
.note p { margin: 2px 0 0; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note.check { background: transparent; border-style: dashed; padding-right: 12px; }
.note.check p { font-size: 12.5px; color: var(--text-2); }
.note-del { position: absolute; top: 6px; right: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.note-del:hover { background: var(--surface-3); color: var(--text); }
.note-del.armed { background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; }
.note-add { display: flex; gap: 8px; align-items: flex-end; }
.note-add textarea, .tf-field textarea { flex: 1; resize: vertical; min-height: 44px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; color: var(--text); font: inherit; font-size: 14px; outline: none; }
.note-add textarea:focus, .tf-field textarea:focus { border-color: var(--mode-color); }
.tf-field textarea { font-weight: 500; }

/* 시한폭탄 카운트다운 */
.bomb-chip { display: inline-flex; align-items: center; margin-top: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums; background: #1d1f27; color: #ffd166; border: 1px solid rgba(255, 209, 102, .5); }
.bomb-chip.soon { animation: tick 1s steps(2) infinite; border-color: #ff5d6c; color: #ff8a8a; }
@keyframes tick { 50% { opacity: .55; } }
.task.failed { opacity: .55; }
.task.failed .task-title { text-decoration: line-through; }
.tf-bomb { border: 1px dashed var(--border-2); border-radius: 12px; padding: 10px 12px; }

/* 할 일 관리 화면 */
.modal.task-board-modal { width: min(96vw, 860px); max-height: 92vh; overflow-y: auto; }
.modal.task-board-modal .modal-actions { display: none; }
.board { display: flex; flex-direction: column; gap: 12px; color: var(--text); }
.board-summary { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--text-2); }
.board-summary b { color: var(--text); }
.board-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.board-search { flex: 1 1 200px; padding: 8px 12px; border-radius: 10px; background: var(--input-bg); border: 1px solid var(--border); color: var(--text); font: inherit; }
.board-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.bt-group h4 { margin: 8px 0 6px; font-size: 13px; color: var(--text-2); }
.bt-group h4 span { color: var(--muted); font-weight: 500; }
.bt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bt { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--mode-color); display: flex; flex-direction: column; gap: 8px; }
.bt.done, .bt.failed { opacity: .7; }
.bt-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.bt-status button { font-size: 12px; padding: 5px 9px; }
.bt-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bt-title { font-weight: 800; font-size: 15px; overflow-wrap: anywhere; }
.bt.done .bt-title, .bt.failed .bt-title { text-decoration: line-through; }
.bt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bchip { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.bchip.urgent { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); font-weight: 700; }
.bchip.prio.p3 { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.bchip.prio.p2 { background: color-mix(in srgb, var(--warn) 18%, transparent); color: #b57600; }
.bchip.failed { background: #1d1f27; color: #ff8a8a; font-weight: 700; }
.bt-progress { display: flex; flex-direction: column; gap: 6px; }
.bt-pchips { display: flex; gap: 6px; flex-wrap: wrap; }
.bt-last { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.bt-last time { color: var(--muted); font-size: 11.5px; margin-right: 4px; }
.bt-notes { max-height: 160px; }
.tasks-head .pl-spacer { flex: 1; }

/* 할 일 관리: 우선순위 칩이 예전 "점" 스타일(.prio 7px)을 물려받아 세로로 찌그러지던 문제 */
.bchip.prio { display: inline-block; width: auto; height: auto; margin: 0; vertical-align: baseline; border-radius: 999px; }
.bt-last { display: block; width: 100%; text-align: left; padding: 6px 10px; border-radius: 10px; background: var(--surface-3); border: 0; font: inherit; }
.bt-last:hover { background: color-mix(in srgb, var(--mode-color) 12%, var(--surface-3)); }
.bt-last em { font-style: normal; color: var(--mode-color); font-weight: 700; margin-left: 4px; white-space: nowrap; }
.bt-notes-head { font-size: 12px; font-weight: 800; color: var(--text-2); margin-top: 6px; }
.bt-notes { max-height: 240px; overflow-y: auto; }

/* 로고: 계란이 얼굴 + 집중 (누르면 책상으로) */
.brand-egg { width: 30px; height: 30px; flex: none; display: grid; place-items: center; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .3)); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.brand-egg .buddy { width: 100%; height: auto; overflow: visible; }
.brand-egg .buddy *, .brand-egg .buddy { animation: none !important; }
.brand-egg .bd-notes, .brand-egg .bd-shadow { display: none; }
.brand:hover .brand-egg, .brand:focus-visible .brand-egg { transform: translateY(-2px) rotate(-8deg) scale(1.08); }
