/* =========================================================
   SlackTick — 회사에서 몰래 쓰는 공책
   모눈종이, 볼펜, 형광펜, 마스킹 테이프. 색은 세 가지만.
   ========================================================= */

@font-face {
  font-family: 'Boadmarker';
  src: url('./fonts/HakgyoansimBoardmarkerR.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  /* 종이 */
  --paper: #fbf6e9;
  --paper-2: #f4ecd8;
  --paper-3: #ebe0c6;
  --grid: rgba(64, 104, 180, 0.15);
  --margin-line: rgba(216, 50, 47, 0.35);

  /* 잉크 세 가지 */
  --ink: #1b2f66;          /* 볼펜 파랑 */
  --ink-deep: #101d40;     /* 진하게 눌러 쓴 곳 */
  --ink-soft: #5f6a84;     /* 연필 메모 */
  --marker: #ffdf3d;       /* 형광펜 */
  --marker-soft: #fff2a8;
  --red: #cc2a26;          /* 빨간펜 */

  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'D2Coding', 'Courier New', monospace;
  --sans: 'Boadmarker', 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --display: 'Boadmarker', 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --paper-sans: 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;

  /* 손으로 그린 상자 (모서리 반지름을 비대칭으로 줘 삐뚤하게) */
  /* 손으로 그린 상자. 같은 흔들림이 반복되면 도장 찍은 티가 나므로 여러 벌을 둔다. */
  --hand-1: 240px 14px 210px 16px / 16px 200px 14px 230px;
  --hand-2: 16px 220px 18px 200px / 210px 16px 230px 14px;
  --hand-3: 200px 18px 240px 12px / 14px 240px 16px 200px;
  --hand-4: 12px 190px 22px 250px / 230px 14px 190px 18px;
  --hand-5: 260px 16px 180px 20px / 18px 250px 12px 190px;
  --hand-6: 22px 240px 14px 190px / 190px 20px 240px 16px;
  --hand-7: 180px 22px 260px 14px / 16px 190px 18px 250px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  color: var(--ink-deep);
  font-family: var(--sans);
  font-weight: 400;
  background-color: var(--paper);
  /* 모눈 + 왼쪽 여백선 + 종이 결 */
  background-image:
    linear-gradient(90deg, transparent 27px, var(--margin-line) 27px, var(--margin-line) 28px, transparent 28px),
    repeating-linear-gradient(to bottom, transparent 0 25px, var(--grid) 25px 26px),
    repeating-linear-gradient(to right, transparent 0 25px, var(--grid) 25px 26px);
  background-attachment: fixed, fixed, fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }

.a11y-live {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* 종이 결 (전체를 덮는 노이즈) */
.scanline {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)' opacity='0.045'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* ------------------------- 공통 부품 ------------------------- */

.btn {
  appearance: none;
  border: 2.5px solid var(--ink);
  border-radius: var(--hand-1);
  padding: 12px 18px;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  color: var(--ink-deep);
  background: var(--paper);
  cursor: pointer;
  box-shadow: 2px 3px 0 rgba(27, 47, 102, 0.45);
  transition: transform 0.07s ease, box-shadow 0.07s ease, background 0.15s ease;
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translate(2px, 3px); box-shadow: 0 0 0 rgba(27, 47, 102, 0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

/* 형광펜으로 칠한 버튼 */
.btn-primary {
  background: var(--marker);
  border-radius: var(--hand-2);
  box-shadow: 2px 3px 0 rgba(27, 47, 102, 0.5);
}
.btn-primary:hover { background: #ffe86a; }
.btn-outline { background: transparent; }
.btn-ghost {
  background: transparent; border-color: transparent; box-shadow: none;
  color: var(--ink-soft);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-style: wavy;
}
.btn-ghost:hover { background: transparent; color: var(--ink); }
.btn-ghost:active { transform: translateY(1px); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); border-radius: var(--hand-3); }
.btn-danger:hover { background: rgba(204, 42, 38, 0.1); }
.btn-return:hover { background: #ffe86a; }
.btn-return {
  background: var(--marker);
  border-radius: var(--hand-3);
  padding: 15px 18px;
  font-size: 18px;
}
.btn-sm { padding: 7px 13px; font-size: 14px; }
.btn-block { display: block; width: 100%; }
.btn-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
/* 나란한 두 칸. 한쪽이 숨으면(공유를 못 하는 기기) 남은 하나가 줄을 다 쓴다 */
.btn-row.even { display: flex; }
.btn-row.even > .btn { flex: 1 1 0; min-width: 0; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(27, 47, 102, 0.4);
}
.icon-btn svg { width: 17px; height: 17px; fill: currentColor; }
.icon-btn:hover { background: var(--marker-soft); }
.icon-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.icon-btn[aria-pressed='true'] { background: var(--paper-3); color: var(--ink-soft); }

.link-btn {
  border: 0; background: none; padding: 0;
  color: var(--ink);
  font-family: var(--sans); font-size: 13px;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-style: wavy;
  cursor: pointer;
}
.link-btn:hover { color: var(--red); }

.mini-toast {
  margin: 10px 0 0; min-height: 18px;
  font-size: 13px; color: var(--red); text-align: center;
}
.mini-toast.error { color: var(--red); text-decoration: underline wavy; }

/* ------------------------- 오버레이 ------------------------- */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  /* 열 폭을 명시하지 않으면 모달의 width:100%가 화면보다 커진다 */
  display: grid; grid-template-columns: minmax(0, 1fr); place-items: center;
  padding: 18px 20px;
  /* 흐린 막 위에 밝은 글씨를 얹으면 안 읽힌다. 대비가 나오도록 충분히 어둡게. */
  background: rgba(52, 42, 24, 0.78);
  overflow-y: auto;
}

/* 뜯어낸 종이 한 장 */
.modal {
  position: relative;
  width: min(430px, 100%);
  max-width: 100%;
  background: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 25px, var(--grid) 25px 26px);
  border: 2.5px solid var(--ink);
  border-radius: var(--hand-1);
  padding: 26px 20px 22px;
  box-shadow: 4px 5px 0 rgba(27, 47, 102, 0.35), 0 18px 40px rgba(40, 30, 10, 0.35);
  transform: rotate(-0.22deg);
}
/* 위쪽에 붙인 마스킹 테이프 */
.modal::before {
  content: '';
  position: absolute;
  top: -12px; left: 50%;
  width: 104px; height: 26px;
  transform: translateX(-50%) rotate(-2.5deg);
  background: rgba(255, 223, 61, 0.55);
  border-left: 1px dashed rgba(27, 47, 102, 0.25);
  border-right: 1px dashed rgba(27, 47, 102, 0.25);
  box-shadow: 0 1px 0 rgba(27, 47, 102, 0.12);
}

/* ---------------------- 화면 1: 설정 ---------------------- */

/* 워드마크: 고정폭 글자 + 시계처럼 깜빡이는 콜론 */
.brand-mark {
  margin: 0;
  font-family: var(--mono);
  font-size: 17px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--ink-deep);
}
.brand-mark .t { color: var(--red); }
.brand-mark .tick {
  color: var(--red);
  animation: tick 1s steps(1) infinite;
}
.brand-mark.small { font-size: 15px; }
@keyframes tick { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0.15; } }

.setup-title {
  margin: 10px 0 12px;
  font-family: var(--display);
  font-size: 34px; line-height: 1.12; letter-spacing: -0.01em;
  color: var(--ink-deep);
}
/* 제목 아래 형광펜 밑줄 */
.setup-title::after {
  content: '';
  display: block;
  width: 62%; height: 11px;
  margin-top: 4px;
  background: var(--marker);
  border-radius: 60% 40% 55% 45% / 100% 100% 100% 100%;
  transform: rotate(-0.8deg);
  opacity: 0.85;
}
.setup-close { position: absolute; top: 10px; right: 10px; z-index: 2; }

.field { display: block; margin-bottom: 15px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/*
 * 주 근무일 · 하루 근무 · 휴게 세 칸.
 * number 입력은 기본 폭이 넓어서 min-width를 풀어주지 않으면 칸이 모달을 넘는다.
 */
.field-row.three { grid-template-columns: 0.8fr 1fr 0.9fr; gap: 9px; }
.field-row.three .field,
.field-row.three .field-input { min-width: 0; }
.field-row.three .field-input { gap: 4px; }
.field-row.three .field-input input {
  width: 100%; min-width: 0; font-size: 19px;
}
.field-row.three .field-input .suffix { flex: none; font-size: 12.5px; }
@media (max-width: 360px) {
  .field-row.three { gap: 7px; }
  .field-row.three .field-input input { font-size: 17px; }
  .field-row.three .field-label { font-size: 13px; }
  .field-row.three .field-input .suffix { font-size: 11.5px; }
}
.field-label {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
  font-size: 14px; color: var(--ink-soft);
}

.field-input {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 13px;
  border: 0;
  border-bottom: 2.5px solid var(--ink);  /* 밑줄에 적어 넣기 */
  background: transparent;
}
.field-input:focus-within { border-bottom-color: var(--red); background: rgba(255, 223, 61, 0.18); }
.field-input input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; color: var(--ink-deep);
  font-family: var(--mono); font-size: 21px; font-weight: 700;
  outline: none;
}
.field-input input.invalid { color: var(--red); }
.field-input input::placeholder { color: rgba(107, 117, 144, 0.5); }
.field-input .prefix { color: var(--ink); font-family: var(--mono); font-size: 19px; font-weight: 700; }
.field-input .suffix { color: var(--ink-soft); font-size: 14px; }
/* 밑줄 입력칸 오른쪽에 붙는 작은 실행 버튼 */

.field-error { margin: 7px 0 0; font-size: 13px; color: var(--red); }

.toggle-row { margin: 2px 0 14px; }
.toggle-row .chip { border-color: var(--ink-soft); color: var(--ink-soft); }
.toggle-row .chip[aria-pressed='true'] { border-color: var(--ink); color: var(--ink-deep); background: var(--marker); }

/* 여백에 계산해 본 메모 */

/* 설정 하위 묶음 */
.panel { margin-top: 16px; padding-top: 14px; border-top: 2px dashed var(--ink-soft); }
.fold > summary {
  list-style: none;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--display); font-size: 17px; color: var(--ink);
  cursor: pointer;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before {
  content: '';
  width: 11px; height: 11px;
  border: 2.5px solid var(--red);
  border-radius: 60% 40% 55% 45%;
  transform: rotate(8deg);
}
.fold[open] > summary::before { background: var(--red); }
.fold > *:not(summary) { margin-top: 12px; }
.section-title { margin: 0; font-family: var(--display); font-size: 17px; color: var(--ink); }

.alert-name { display: flex; align-items: center; gap: 7px; font-size: 15px; }
.alert-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alert-actions input[type='time'] {
  min-width: 0; max-width: 140px;
  padding: 5px 9px;
  border: 0; border-bottom: 2.5px solid var(--ink);
  background: transparent;
  color: var(--ink-deep);
  font-family: var(--mono); font-size: 14px; font-weight: 700;
}
.alert-actions input[type='time']:focus { outline: none; border-bottom-color: var(--red); }

.cats-list { list-style: none; margin: 0 0 11px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.cats-item {
  --accent: var(--ink);
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center; gap: 9px;
  min-width: 0;
}
.cats-mark { display: grid; place-items: center; color: var(--ink); }
.cats-mark svg { width: 20px; height: 20px; }
.cats-item input,
.cats-add input {
  width: 100%;
  min-width: 0;
  padding: 6px 4px;
  border: 0; border-bottom: 2px solid var(--ink-soft);
  background: transparent;
  color: var(--ink-deep);
  font-family: var(--sans); font-size: 16px;
}
.cats-item input:focus, .cats-add input:focus { outline: none; border-bottom-color: var(--red); }
.cats-remove {
  border: 2px solid var(--ink-soft); border-radius: 50%;
  width: 24px; height: 24px;
  background: transparent; color: var(--ink-soft);
  font-size: 11px; cursor: pointer; padding: 0;
}
.cats-remove:hover { color: var(--red); border-color: var(--red); }
.cats-remove[hidden] { display: none; }
.cats-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: end; min-width: 0; }
.cats-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin: 12px 0 0; font-size: 13px; color: var(--ink-soft);
}

.backup-confirm {
  margin-top: 12px; padding: 12px 14px;
  border: 2.5px solid var(--red);
  border-radius: var(--hand-2);
  background: rgba(216, 50, 47, 0.07);
  display: flex; flex-direction: column; gap: 9px;
  transform: rotate(-0.5deg);
}
.backup-summary { margin: 0; font-size: 14px; }
.backup-warn { margin: 0; font-size: 13px; color: var(--red); }

/* ---------------------- 화면 2: 전광판 ---------------------- */

.board {
  position: relative;
  max-width: 520px; margin: 0 auto;
  padding: 18px 16px 34px;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; gap: 15px;
}
.board > * { position: relative; z-index: 2; }

.board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head-actions { display: flex; align-items: center; gap: 8px; }

/* 하루 진행: 화면 맨 위 얇은 선 하나 */
.daybar {
  position: fixed; top: 0; left: 0; right: 0; height: 4px;
  z-index: 4;
  background: rgba(27, 47, 102, 0.1);
}
.daybar-fill { height: 100%; background: var(--marker); transition: width 0.25s linear; }
/* 정규 시간을 넘기면 띠가 빨간펜으로 바뀐다. "퇴근까지 몇 분" 같은 글자 대신이다. */
.daybar.overdue { background: rgba(216, 50, 47, 0.18); }
.daybar.overdue .daybar-fill { background: var(--red); }

@keyframes wiggle {
  0%, 100% { transform: rotate(-1.4deg); }
  50% { transform: rotate(0.6deg); }
}

/* 출근 도장 */
.stamp-zone {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 12px 0;
}
/* 도장 옆에 끄적인 화살표 */
.stamp-cue {
  display: flex; align-items: flex-end; gap: 2px;
  margin: 0 0 -18px -120px;
  align-self: center;
  font-family: var(--display); font-size: 20px; color: var(--ink);
  transform: rotate(-9deg);
}
.stamp-cue svg { width: 52px; height: 40px; color: var(--ink); }

.stamp-btn {
  position: relative;
  width: min(226px, 62vw);
  aspect-ratio: 1;
  border: 6px double var(--red);
  border-radius: 50%;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  display: grid; place-items: center;
  transform: rotate(-6deg);
  transition: transform 0.08s ease, background 0.15s ease;
}
.stamp-btn::after {
  content: '';
  position: absolute; inset: 12px;
  border: 2.5px solid var(--red);
  border-radius: 50%;
  opacity: 0.65;
}
.stamp-btn:hover { background: rgba(204, 42, 38, 0.07); }
.stamp-btn:active { transform: rotate(-6deg) scale(0.94); background: rgba(204, 42, 38, 0.16); }
.stamp-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 8px; }
.stamp-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stamp-title {
  font-family: var(--display); font-size: 40px; line-height: 1.02; letter-spacing: 0.04em;
}
.stamp-sub {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em;
  animation: blink 1.2s steps(1) infinite;
}
@keyframes blink { 0%, 65% { opacity: 1; } 66%, 100% { opacity: 0.2; } }
.stamp-foot { margin: 0; font-size: 14px; color: var(--ink-soft); text-align: center; }
/* 홈 화면 추가 안내: 이미 설치했거나 방법이 없는 환경에서는 나오지 않는다 */
.install-hint { margin: -6px 0 0; text-align: center; font-size: 13px; }
.install-how { display: block; margin-top: 4px; color: var(--ink-soft); }

/* 지난 기록 */
.history {
  width: 100%; max-width: 360px;
  margin-top: 2px; padding-top: 14px;
  border-top: 2px dashed var(--ink-soft);
  display: flex; flex-direction: column; gap: 7px;
}
.history-caption {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 0; font-size: 15px; color: var(--ink);
}
.streak { margin: 0; font-size: 14px; color: var(--red); }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.history-list li {
  display: grid; grid-template-columns: 46px 1fr auto;
  align-items: baseline; gap: 10px; font-size: 13.5px;
}
.history-date { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }
.history-body { color: var(--ink-soft); }
.history-score { font-family: var(--mono); font-weight: 700; color: var(--ink); }
.history-week { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-soft); }

/* 실시간 금액 */
.ticker-zone {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0; padding: 8px 0;
  min-height: 0;
}

.ticker-caption {
  margin: 0; font-size: 15px; color: var(--ink-soft);
  transition: color 0.2s ease;
}
/* 딴짓 중에는 제목 자리가 지금 하는 짓의 이름이 된다 */
.ticker-caption.is-live { color: var(--red); font-size: 17px; }
.ticker {
  position: relative;
  display: flex; align-items: baseline; justify-content: center; gap: 2px;
  padding: 16px 34px 18px;
  max-width: 100%;
  font-family: var(--mono); line-height: 1;
  color: var(--ink-deep);
}

/* 중요한 숫자에 볼펜으로 두른 동그라미 */
.ticker::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 120' preserveAspectRatio='none'%3E%3Cpath d='M156 9C74 4 16 30 13 60c-3 31 55 53 141 51 84-2 135-26 133-55C285 27 232 8 146 12' fill='none' stroke='%231b2f66' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  opacity: 0.75;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* 일하는 동안 큰 숫자는 멈춰 있다. 멈춰 있다는 걸 색으로 알린다 */
.ticker.idle { color: var(--ink-soft); }
.ticker.idle::before { opacity: 0.28; }
.ticker.idle .ticker-currency { color: var(--ink-soft); }
.ticker-currency { font-size: 28px; font-weight: 700; color: var(--ink); }
.ticker-int {
  font-size: clamp(44px, 15vw, 80px); font-weight: 700; letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.ticker-dec {
  font-size: clamp(24px, 7.5vw, 38px); font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.ticker.bump { animation: bump 0.22s ease-out; }
@keyframes bump {
  0% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* 출근 시각과 남은 시간: 상자 없이 한 줄 */
.day-line { margin: 6px 0 0; font-size: 14px; color: var(--ink-soft); }
.day-line .dot { margin: 0 7px; }
/* 출근 시각은 눌러서 고칠 수 있다 */
.clockin-btn {
  border: 0; background: none; padding: 0;
  font: inherit; color: inherit;
  text-decoration: underline dotted; text-underline-offset: 3px;
  cursor: pointer;
}
.clockin-btn:hover { color: var(--ink); }
.clockin-edit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 8px 0 0;
}
.clockin-edit input {
  padding: 3px 6px;
  border: 0; border-bottom: 2px solid var(--ink);
  background: transparent; color: var(--ink-deep);
  font-family: var(--mono); font-size: 15px; font-weight: 700;
}
.clockin-edit input:focus { outline: none; border-bottom-color: var(--red); }

/* 보상: 형광펜이 차오르는 한 줄이 곧 게이지 */
.reward {
  position: relative;
  display: inline-block;
  align-self: center;
  margin: 16px 0 0;
  padding: 3px 10px 4px;
  font-size: 15px;
  color: var(--ink-deep);
}
.reward-fill {
  position: absolute;
  left: 0; top: 12%; bottom: 12%;
  background: var(--marker);
  transition: width 0.35s ease;
  z-index: 0;
}
.reward-text { position: relative; z-index: 1; }

/* 딴짓 중 한 줄 */
.slack-line {
  display: flex; align-items: baseline; justify-content: center;
  flex-wrap: wrap; gap: 8px;
  margin: 18px 0 0;
  font-size: 15px; color: var(--red);
}
.slack-line strong { font-family: var(--mono); font-size: 20px; color: var(--ink-deep); }
.slack-tier:empty { display: none; }
.slack-tier { width: 100%; text-align: center; font-size: 14px; color: var(--red); }
.live-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--red);
  align-self: center;
  animation: blink 0.9s steps(1) infinite;
}

/* 루팡 중에는 종이 테두리에 빨간펜으로 동그라미 */
.board.is-slacking::after {
  content: '';
  position: fixed; inset: 6px;
  pointer-events: none; z-index: 3;
  /* 빨간펜으로 한 번 두른 자국. 펜 자국은 숨쉬지 않는다. */
  border: 3px solid var(--red);
  border-radius: 260px 20px 240px 22px / 22px 240px 20px 260px;
  opacity: 0.45;
}

/* --------------------- 화면 3: 액션 도크 --------------------- */

.dock { display: flex; flex-direction: column; gap: 11px; }

.dock-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dock-btn {
  border: 2.5px solid var(--ink);
  border-radius: var(--hand-1);
  background: rgba(251, 246, 233, 0.7);
  box-shadow: 2px 3px 0 rgba(27, 47, 102, 0.3);
  color: var(--ink-deep);
  padding: 10px 5px 9px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: transform 0.07s ease, box-shadow 0.07s ease, background 0.15s ease;
}
/* 같은 상자를 여덟 번 찍어낸 것처럼 보이지 않도록 기울기와 테두리를 흩어 놓는다 */
.dock-btn:nth-child(5n + 1) { transform: rotate(-0.7deg); border-radius: var(--hand-1); }
.dock-btn:nth-child(5n + 2) { transform: rotate(0.6deg);  border-radius: var(--hand-4); }
.dock-btn:nth-child(5n + 3) { transform: rotate(-0.3deg); border-radius: var(--hand-5); }
.dock-btn:nth-child(5n + 4) { transform: rotate(0.9deg);  border-radius: var(--hand-6); }
.dock-btn:nth-child(5n + 5) { transform: rotate(-1.1deg); border-radius: var(--hand-7); }
.dock-btn:active { transform: translate(2px, 3px); box-shadow: none; }
.dock-btn:hover:not(:disabled) { background: rgba(255, 223, 61, 0.2); }
.dock-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.dock-btn.active { background: var(--marker); border-color: var(--red); }
.dock-mark {
  display: grid; place-items: center;
  color: var(--ink);   /* 색은 세 가지만 쓰므로 아이콘은 전부 볼펜색 */
}
.dock-mark svg { width: 26px; height: 26px; }
.dock-label { font-size: 12.5px; line-height: 1.15; text-align: center; word-break: keep-all; }

.today > summary {
  list-style: none;
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft);
  cursor: pointer;
}
/* 밑줄은 글자에만 긋는다(화살표까지 밑줄이 지나가지 않도록) */
.today > summary #dock-summary { text-decoration: underline dotted; text-underline-offset: 3px; }
.today > summary::-webkit-details-marker { display: none; }
.today[open] > summary { color: var(--ink); }

/* 접히고 펼쳐진다는 걸 알아볼 수 있게 화살표를 붙인다 */
.today-summary { display: flex; align-items: center; gap: 7px; }
.fold-mark {
  display: inline-flex;
  color: var(--ink-soft);
  transition: transform 0.18s ease, color 0.18s ease;
}
.fold-mark svg { width: 15px; height: 10px; }
.today[open] .fold-mark { transform: rotate(180deg); color: var(--ink); }
@media (prefers-reduced-motion: reduce) {
  .fold-mark { transition: none; }
}

.today-foot { margin: 6px 0 0; text-align: right; }

.session-list {
  list-style: none; margin: 2px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 5px;
  max-height: 160px; overflow-y: auto;
}
.session-item {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto auto;
  align-items: center; gap: 8px;
  padding: 5px 8px;
  border-bottom: 1.5px dashed rgba(27, 47, 102, 0.28);
}
.session-item.editing { grid-template-columns: 22px 72px auto auto auto; }
.session-item input {
  width: 100%; min-width: 0;
  padding: 4px 6px;
  border: 0; border-bottom: 2px solid var(--ink);
  background: transparent; color: var(--ink-deep);
  font-family: var(--mono); font-size: 15px; font-weight: 700;
}
.session-item input:focus { outline: none; border-bottom-color: var(--red); }
.session-unit { font-size: 13px; color: var(--ink-soft); }
.session-mark { display: grid; place-items: center; color: var(--ink); }
.session-mark svg { width: 17px; height: 17px; }
.session-body { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.session-label { font-size: 14px; }
.session-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.session-amount { font-family: var(--mono); font-size: 13px; font-weight: 700; }
.session-btn {
  border: 0; background: none; padding: 2px 3px;
  color: var(--ink-soft);
  font-family: var(--sans); font-size: 12.5px;
  text-decoration: underline dotted; text-underline-offset: 3px;
  cursor: pointer;
}
.session-btn:hover { color: var(--ink); }
.session-btn.remove:hover { color: var(--red); }

/* ---------------------------- 전적 ---------------------------- */

.stats-modal { width: min(460px, 100%); max-width: 100%; max-height: 90vh; overflow-y: auto; }
.stats-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stats-title { margin: 0; font-family: var(--display); font-size: 26px; color: var(--ink-deep); }
.stats-empty { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-soft); }
.stats-body { display: flex; flex-direction: column; gap: 20px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  border: 2.5px solid var(--ink);
  border-radius: var(--hand-2);
  background: rgba(251, 246, 233, 0.7);
  padding: 11px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.tile:nth-child(2n) { transform: rotate(0.6deg); }
.tile:nth-child(2n + 1) { transform: rotate(-0.6deg); }
.tile-key { font-size: 13px; color: var(--ink-soft); }
.tile-value {
  font-family: var(--mono); font-size: 21px; font-weight: 700; letter-spacing: -0.03em;
  white-space: nowrap; color: var(--ink-deep);
}
.tile-note { font-size: 12px; color: var(--ink-soft); }

.weekly-cta { display: flex; flex-direction: column; gap: 7px; }
.weekly-note { margin: 0; font-size: 13px; color: var(--ink-soft); text-align: center; }
.weekly-image {
  display: block; width: 100%;
  border: 2.5px solid var(--ink);
  box-shadow: 4px 5px 0 rgba(27, 47, 102, 0.35);
  transform: rotate(-0.6deg);
}

.chart { margin: 0; --series-1: var(--marker); }
.chart-title { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; font-size: 16px; }
.chart-sub { font-size: 12.5px; color: var(--ink-soft); }
.bars {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
  align-items: end; padding-bottom: 6px;
  border-bottom: 2.5px solid var(--ink);
}
.bar-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bar-value { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
.bar-track { width: 100%; height: 92px; display: flex; align-items: flex-end; }
.bar-fill {
  width: 100%; min-height: 4px;
  border: 2.5px solid var(--ink); border-bottom: 0;
  border-radius: 12px 8px 0 0 / 10px 12px 0 0;
  background: var(--series-1);
}
.bar-cell.empty .bar-fill { background: transparent; border-style: dashed; }
.bar-cell.today .bar-fill { background: var(--red); }
.bar-label { font-size: 13px; color: var(--ink-soft); }
.bar-cell.today .bar-label { color: var(--red); }

.stats-list-wrap { display: flex; flex-direction: column; gap: 9px; }
.stats-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.stats-list li {
  display: grid; grid-template-columns: 48px 1fr auto;
  align-items: baseline; gap: 10px; font-size: 13.5px;
  border-bottom: 1.5px dashed rgba(27, 47, 102, 0.22);
  padding-bottom: 4px;
}
.stats-list .date { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }
.stats-list .body { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-list .score { font-family: var(--mono); font-weight: 700; color: var(--ink); }

/* -------------------------- 영수증 -------------------------- */

.receipt-overlay { z-index: 60; align-items: flex-start; }

.receipt-modal {
  position: relative; z-index: 62;
  width: min(400px, 100%); max-width: 100%; margin: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 12px 0 26px;
}

.paper {
  position: relative;
  color: #12141c;
  font-family: var(--mono);
  filter: drop-shadow(4px 6px 0 rgba(27, 47, 102, 0.35)) drop-shadow(0 20px 34px rgba(40, 30, 10, 0.4));
  animation: slip-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  transform: rotate(-0.7deg);
}
@keyframes slip-in {
  from { transform: translateY(-22px) rotate(-3deg) scale(0.97); opacity: 0; }
  to { transform: rotate(-0.7deg); opacity: 1; }
}

.paper-edge { height: 12px; background-repeat: repeat-x; background-size: 20px 12px; }
.paper-edge.top {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='12'%3E%3Cpath d='M0 12 L10 0 L20 12 Z' fill='%23fffdf6'/%3E%3C/svg%3E");
}
.paper-edge.bottom {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='12'%3E%3Cpath d='M0 0 L10 12 L20 0 Z' fill='%23fffdf6'/%3E%3C/svg%3E");
}
.paper-body { background: #fffdf6; padding: 8px 22px 22px; }

.paper-title { margin: 8px 0 6px; text-align: center; font-size: 20px; font-weight: 800; letter-spacing: 0.06em; line-height: 1.35; }
.paper-sub { margin: 0; text-align: center; font-size: 12.5px; color: #5b6070; }
.paper-note { margin: 8px 0 0; text-align: center; font-size: 11.5px; color: #b4402f; }

.paper-rule { height: 1px; margin: 14px 0; }
.paper-rule.dashed { border-top: 1.5px dashed rgba(18, 20, 28, 0.32); }

.paper-rows { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.paper-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.paper-row dt { font-size: 12.5px; color: #5b6070; font-family: var(--paper-sans); }
.paper-row dd { margin: 0; font-size: 14px; font-weight: 700; }

.paper-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.paper-total span { font-size: 13px; font-family: var(--paper-sans); font-weight: 700; }
.paper-total strong { font-size: 20px; font-weight: 800; }
.paper-total.loot strong { color: #b4402f; }
.paper-total.overtime { margin-top: 10px; }
.paper-total.overtime strong { font-size: 18px; white-space: nowrap; }
.paper-ratio { margin: 0; text-align: right; font-size: 12px; color: #5b6070; }

.paper-section { margin: 0 0 8px; font-size: 12px; font-family: var(--paper-sans); font-weight: 700; color: #5b6070; }
.paper-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.paper-items li { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.paper-items span { font-family: var(--paper-sans); color: #3a3f4d; }
.paper-items strong { font-weight: 700; white-space: nowrap; }

.paper-score { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.paper-score span { font-size: 13px; font-family: var(--paper-sans); font-weight: 700; }
.paper-score strong { font-size: 20px; font-weight: 800; white-space: nowrap; }
.paper-grade { margin: 4px 0 0; text-align: center; font-family: var(--paper-sans); font-size: 12.5px; color: #5b6070; }

.paper-punch {
  margin: 12px 0 0; padding: 12px;
  background: rgba(18, 20, 28, 0.07);
  font-family: var(--paper-sans); font-size: 13.5px; font-weight: 800; line-height: 1.55;
  text-align: center;
}
.paper-qr { margin: 16px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.paper-qr svg { width: 132px; height: 132px; padding: 8px; background: #fffdf6; shape-rendering: crispEdges; }
.paper-qr-caption { margin: 0; font-family: var(--paper-sans); font-size: 11.5px; color: #5b6070; }
.paper-barcode {
  height: 42px; margin: 16px 0 8px;
  background: repeating-linear-gradient(90deg, #12141c 0 2px, transparent 2px 5px, #12141c 5px 8px, transparent 8px 12px, #12141c 12px 13px, transparent 13px 17px);
}
.paper-foot { margin: 0; text-align: center; font-size: 11px; color: #5b6070; letter-spacing: 0.04em; }

.receipt-actions { display: flex; flex-direction: column; gap: 9px; }
/* 영수증 조작부는 종이가 아니라 어두운 막 위에 놓인다. 여기 버튼은 밝은 쪽으로 뒤집는다. */
.receipt-actions .btn-outline { border-color: var(--paper); color: var(--paper); }
.receipt-actions .btn-outline:hover { background: rgba(251, 246, 233, 0.15); }
.receipt-actions .btn-ghost { color: var(--paper); }
.receipt-actions .btn-ghost:hover { color: #fff; }

.undo-row { margin: 0; text-align: center; }

.privacy-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 2px 2px; }
.privacy-chips-label { font-size: 13px; color: var(--paper); }
.chip {
  border: 2.5px solid var(--paper);
  font-family: var(--sans);
  border-radius: 180px 14px 200px 12px / 12px 200px 14px 180px;
  background: transparent;
  color: var(--paper);
  font-family: var(--sans); font-size: 14px;
  padding: 4px 13px; cursor: pointer;
}
.chip[aria-pressed='true'] { background: var(--marker); border-color: var(--marker); color: var(--ink-deep); }

/* ------------------------ 레벨업 스티커 ------------------------ */

.level-toast {
  position: fixed;
  left: 50%; top: 20%;
  z-index: 75;
  transform: translate(-50%, 0) rotate(-5deg);
  padding: 14px 24px;
  border: 3px solid var(--ink);
  border-radius: var(--hand-3);
  background: var(--marker);
  box-shadow: 3px 5px 0 rgba(27, 47, 102, 0.45);
  color: var(--ink-deep);
  font-family: var(--display);
  font-size: 22px;
  text-align: center;
  pointer-events: none;
  animation: pop-in 1.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.level-toast small { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; color: var(--red); }
@keyframes pop-in {
  0% { transform: translate(-50%, 0) rotate(-5deg) scale(1.06); opacity: 0; }
  14% { transform: translate(-50%, 0) rotate(-5deg) scale(1); opacity: 1; }
  26% { transform: translate(-50%, 0) rotate(-5deg) scale(1); }
  80% { transform: translate(-50%, 0) rotate(-5deg) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -20px) rotate(-5deg) scale(0.95); opacity: 0; }
}

/* --------------------------- 반응형 --------------------------- */

@media (min-width: 560px) {
  .board { padding: 26px 22px 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
