/* ─────────────────────────────────────────
   Variables – 和風水彩 Spring Edition
───────────────────────────────────────── */
:root {
  /* ── Backgrounds ── */
  --bg:           #f4eeea;
  --bg-card:      rgba(255, 250, 246, 0.74);
  --border:       rgba(200, 178, 165, 0.45);
  --border-soft:  rgba(190, 168, 155, 0.24);

  /* ── Bowl teal (kept cool for contrast inside dark bowl) ── */
  --teal:         #00c8a8;
  --teal-glow:    rgba(0, 200, 168, 0.32);
  --teal-dim:     rgba(0, 200, 168, 0.10);

  /* ── Rose / pink ── */
  --purple:       #e0507a;
  --purple-glow:  rgba(224, 80, 122, 0.28);

  /* ── Warm amber ── */
  --sky:          #c87020;
  --sky-glow:     rgba(200, 112, 32, 0.25);

  /* ── Text (DARK on light background) ── */
  --white:        #2e2420;   /* 深みのある墨色 */
  --dim:          rgba(60, 40, 30, 0.52);
  --dim2:         rgba(60, 40, 30, 0.28);

  /* ── Bowl decoration ── */
  --bowl-stroke:  rgba(122, 195, 230, 0.60); /* matches SVG stroke */
  --funnel-color: rgba(140, 215, 245, 0.65);
}

/* ─────────────────────────────────────────
   Reset & Base
───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html, body { height: 100%; overflow: hidden; }

body {
  /* 和風水彩: 青・ピンク・黄・オレンジの淡いグラデーション */
  background:
    /* 和紙テクスチャ（SVG fractalNoise） */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72 0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E"),
    /* 青 – 左上 */
    radial-gradient(ellipse 62% 55% at 12% 18%, rgba(148, 208, 232, 0.68) 0%, transparent 72%),
    /* 黄 – 右上 */
    radial-gradient(ellipse 55% 48% at 82% 12%, rgba(252, 224, 148, 0.62) 0%, transparent 68%),
    /* オレンジ – 右中 */
    radial-gradient(ellipse 44% 56% at 90% 52%, rgba(250, 198, 148, 0.52) 0%, transparent 62%),
    /* ピンク – 中央下 */
    radial-gradient(ellipse 58% 50% at 44% 80%, rgba(240, 168, 192, 0.64) 0%, transparent 70%),
    /* 淡い黄 – 下右 */
    radial-gradient(ellipse 42% 40% at 78% 78%, rgba(252, 230, 178, 0.42) 0%, transparent 58%),
    /* 淡い青 – 下左 */
    radial-gradient(ellipse 38% 36% at 8% 82%,  rgba(168, 218, 238, 0.38) 0%, transparent 55%),
    /* 中央ぼかし（和紙の白み） */
    radial-gradient(ellipse 75% 68% at 50% 46%, rgba(255, 252, 248, 0.38) 0%, transparent 80%),
    /* ベース: 温かみのあるクリーム */
    #f0ece6;
  color: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

/* ─────────────────────────────────────────
   View layout
───────────────────────────────────────── */
.view {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 18px 12px;
}

/* ─────────────────────────────────────────
   Header
───────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 0 10px;
  flex-shrink: 0;
}

.app-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  /* Spring gradient: coral → amber */
  background: linear-gradient(110deg, #d05030 0%, #c87828 55%, #b04060 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.salary-sub {
  font-size: 13px;
  color: var(--dim);
  margin-top: 5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.btn-pill {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255, 245, 238, 0.75);
  border: 1px solid var(--border);
  color: var(--white);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 2px 8px rgba(180, 80, 40, 0.10);
  transition: background 0.2s, border-color 0.2s;
}
.btn-pill:hover { background: rgba(255, 245, 238, 0.92); }

.btn-circle {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: rgba(255, 245, 238, 0.68);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--dim);
  font-size: 16px; cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 2px 8px rgba(180, 80, 40, 0.08);
  transition: border-color 0.2s, color 0.2s;
}
.btn-circle:hover { border-color: #c87020; color: #c87020; }

/* ─────────────────────────────────────────
   Datetime Bar
───────────────────────────────────────── */
.datetime-bar {
  text-align: center;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--dim);
  letter-spacing: 0.07em;
  font-variant-numeric: tabular-nums;
  padding: 0 0 10px;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────
   Info Cards – warm frosted glass
───────────────────────────────────────── */
.info-cards {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 10px;
  flex-shrink: 0;
  margin-bottom: 10px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 4px 16px rgba(180, 80, 30, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.card-header {
  display: flex; align-items: center;
  gap: 7px; margin-bottom: 10px;
}

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-purple {
  background: var(--purple);
  box-shadow: 0 0 8px var(--purple-glow);
}
.dot-teal {
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal-glow);
}
.dot-teal.pulse { animation: dotPulse 1.8s ease-in-out infinite; }
@keyframes dotPulse {
  0%,100% { opacity: 1;   box-shadow: 0 0 10px var(--teal-glow); }
  50%      { opacity: 0.4; box-shadow: 0 0  2px var(--teal-dim);  }
}

.card-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--dim);
  text-transform: uppercase;
}

.elapsed-value {
  font-size: 28px; font-weight: 800;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  /* Warm dark gradient for elapsed number */
  background: linear-gradient(120deg, #2c1810 0%, #6a3020 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.session-earned {
  margin-top: 7px;
  font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  color: #007a62;
  letter-spacing: 0.01em;
  opacity: 0.88;
}

.earned-rows  { display: flex; flex-direction: column; gap: 5px; }
.earned-row   { display: flex; justify-content: space-between; align-items: baseline; }
.row-label    { font-size: 12px; color: var(--dim); }
.row-value    {
  font-size: 20px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  color: var(--white);
  letter-spacing: -0.3px;
}
.row-accent {
  /* Teal pop on light card – use darker teal for readability */
  color: #007a62;
  text-shadow: 0 0 14px rgba(0, 180, 150, 0.25);
}

/* ─────────────────────────────────────────
   Bowl Area
───────────────────────────────────────── */
.bowl-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  overflow: visible; /* コインはclip-path:ellipseでクリップ済み; wrapperで切らない */
  position: relative;
  padding-top: 0px; /* 2cm上げ: 50px → 0px (75px減) → マイナスにしてさらに上げる場合は margin-top を使う */
  margin-top: -25px; /* 合計 75px 上移動 */
}

.funnel {
  display: none; /* 矢印・ファネルは非表示 */
}
.funnel-body {
  width: 0; height: 0;
  border-left:  30px solid transparent;
  border-right: 30px solid transparent;
  border-bottom: 40px solid var(--funnel-color);
  filter: drop-shadow(0 0 10px rgba(80, 200, 240, 0.60));
}
.funnel-neck {
  width: 10px; height: 14px;
  background: var(--teal);
  border-radius: 0 0 5px 5px;
  opacity: 0.82;
  box-shadow: 0 0 18px var(--teal-glow);
}

/* ══════════════════════════════════════════════
   Bowl shell: suiso.png ベースのレイアウト
   z-index 積み重ね:
     1 → bowl-img (器画像: 背面, コインが前面に見える)
     2 → #bowl / canvas (コイン, 器内側にellipseクリップ)
     4 → water-svg (水面アニメーション)
══════════════════════════════════════════════ */
.bowl-shell {
  position: relative;
  z-index: 1;
  width: min(88vw, 416px);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
}

/* ① 実際の金魚鉢画像 (suiso.png: 500×500 透過PNG)
   z-index:1 = コインの背面 → コインが器の中でしっかり見える
   320px ボウルに対して 350px 画像 (= 320 × 284/260)
*/
.bowl-img {
  position: absolute;
  width: 455px;
  height: 455px;
  top: -20px;   /* (455-416)/2 ≈ 20px */
  left: -20px;
  pointer-events: none;
  z-index: 1;
  object-fit: fill;
  filter:
    drop-shadow(0 4px 18px rgba(150, 100, 60, 0.13))
    drop-shadow(0 0  22px rgba(200, 150, 90, 0.08));
}

/* スマホ小画面 (bowlW = 88vw < 416px) は比率でスケール */
@media (max-width: 470px) {
  .bowl-img {
    width: 96.2vw;   /* 88vw × (455/416) */
    height: 96.2vw;
    top: -4.2vw;
    left: -4.1vw;
  }
}

/* ② コイン物理キャンバス領域
   - clip-path: ellipse で器の内側形状にコインをクリップ
     物理ボウル: center(160,160), radius 156 → floor y≈316
     横44%(129px): 左右を大きく広げ → 側面コインが切れない
     中心y=57%(167px), 縦40%(117px): bottom=284px → ガラス内側底にコインが自然に見える
       top 50px: ガラス開口部内側から自然にコインが出現
       bottom 284px: ガラス底面(y≈302)より18px上でクリップ → 底付近に自然に溜まる
   コインはy=316から積み上がりy=284で視覚クリップ→内側底に自然に溜まって見える
   - overflow:hidden でcanvas境界でも確実にクリップ
*/
.bowl {
  position: relative;
  z-index: 2;
  width:  min(88vw, 416px);
  height: min(88vw, 416px);
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  clip-path: ellipse(44% 40% at 50% 57%);
  overflow: hidden;
  flex-shrink: 0;
}

/* ③ 水面アニメーション SVG
   - キャンバスと同じ位置・サイズで重ねる
   - z-index:4 でコインの上に表示
*/
.water-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: min(88vw, 416px);
  height: min(88vw, 416px);
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}

.bowl-shine {
  position: absolute;
  top: 4%; left: 7%;
  width: 50%; height: 36%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 36% 30%,
    rgba(255,255,255,0.76) 0%,
    rgba(255,255,255,0.36) 38%,
    rgba(255,255,255,0.08) 62%,
    transparent 78%);
  pointer-events: none; z-index: 3;
}

/* Glass arc at the top rim – curved inner reflection */
.bowl-glass-arc {
  position: absolute;
  top: 3.5%; left: 5%;
  width: 90%; height: 24%;
  border-radius: 50%;
  border-top: 2px solid rgba(255,255,255,0.50);
  background: transparent;
  pointer-events: none; z-index: 3;
}

/* Right-side vertical shimmer streak */
.bowl-glass-side {
  position: absolute;
  top: 18%; right: 9%;
  width: 7%; height: 36%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
    rgba(255,255,255,0.32) 0%, transparent 75%);
  pointer-events: none; z-index: 3;
}

/* 3-D water surface – elliptical cross-section viewed at a slight angle */
.bowl-water-surface {
  position: absolute;
  top: 25%;
  left: 10%; right: 10%;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.80) 0%,    /* back rim highlight */
    rgba(205, 246, 255, 0.65) 25%,   /* upper water sheen */
    rgba(178, 234, 255, 0.50) 60%,   /* mid surface */
    rgba(150, 220, 255, 0.62) 100%   /* front edge (shadow) */
  );
  box-shadow:
    0  3px 12px rgba(130, 210, 255, 0.40),
    0 -1px  6px rgba(255, 255, 255, 0.55),
    inset 0 2px 5px rgba(255, 255, 255, 0.65),
    inset 0 -2px 5px rgba(120, 200, 255, 0.30);
  pointer-events: none; z-index: 2;
}

/* Subtle shimmer streak just below the water surface */
.bowl-water-reflex {
  position: absolute;
  top: 31%;
  left: 22%; right: 22%;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(180deg,
    rgba(220, 250, 255, 0.38) 0%,
    rgba(200, 244, 255, 0.18) 60%,
    transparent 100%
  );
  pointer-events: none; z-index: 2;
}

/* Bottom caustic / underwater light pool */
.bowl-glass-bottom {
  position: absolute;
  bottom: 7%; left: 18%;
  width: 64%; height: 22%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
    rgba(155, 228, 255, 0.22) 0%, transparent 72%);
  pointer-events: none; z-index: 1;
}

/* Outer glass rim highlight – rendered ABOVE the canvas */
.bowl-glass-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.38);
  box-shadow:
    inset 0 2px 8px rgba(255,255,255,0.30),
    inset 0 -3px 10px rgba(140,220,255,0.20);
  pointer-events: none; z-index: 4;
}

#coinCanvas {
  position: absolute;
  top: 0; left: 0;
  display: block;
  z-index: 2;
}

/* ─────────────────────────────────────────
   Status Bar
───────────────────────────────────────── */
.status-bar {
  display: flex; align-items: center;
  gap: 8px; padding: 10px 4px 0;
  flex-shrink: 0;
}

.status-indicator { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-indicator.working {
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal-glow);
  animation: dotPulse 1.6s ease-in-out infinite;
}
.status-indicator.off  { background: var(--purple); box-shadow: 0 0 8px var(--purple-glow); }
.status-indicator.rest { background: rgba(80, 40, 20, 0.28); }

.status-text           { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; }
/* Darker tones so text is readable on light background */
.status-text.working   { color: #007858; }
.status-text.off       { color: #b03460; }
.status-text.rest      { color: var(--dim); }

.progress-chip {
  margin-left: auto;
  background: rgba(200, 112, 32, 0.12);
  border: 1px solid rgba(200, 112, 32, 0.32);
  color: #a05818;
  font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 12px;
  letter-spacing: 0.04em;
}

/* ─────────────────────────────────────────
   Welcome Screen
───────────────────────────────────────── */
.welcome-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 62% 55% at 12% 18%, rgba(148,208,232,0.55) 0%, transparent 70%),
    radial-gradient(ellipse 55% 48% at 82% 12%, rgba(252,224,148,0.50) 0%, transparent 68%),
    radial-gradient(ellipse 58% 50% at 44% 82%, rgba(240,168,192,0.52) 0%, transparent 70%),
    #f0ece6;
  opacity: 1;
  transition: opacity 0.4s ease;
}
.welcome-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.welcome-card {
  width: 100%; max-width: 360px;
  background: rgba(255, 252, 248, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 28px;
  border: 1px solid rgba(200, 185, 170, 0.35);
  box-shadow: 0 8px 40px rgba(160, 100, 60, 0.10);
  padding: 36px 28px 32px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}

.welcome-emoji {
  font-size: 48px;
  margin-bottom: 12px;
  line-height: 1;
}

.welcome-title {
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(110deg, #d05030 0%, #c87828 55%, #b04060 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.welcome-lead {
  font-size: 13px; color: var(--dim);
  margin-bottom: 28px;
}

.welcome-list {
  list-style: none;
  width: 100%;
  display: flex; flex-direction: column; gap: 14px;
  margin-bottom: 32px;
  text-align: left;
}
.welcome-list li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13.5px; color: var(--white); line-height: 1.55;
}
.welcome-icon {
  font-size: 18px; flex-shrink: 0; margin-top: 1px;
}

.welcome-btn {
  width: 100%;
  background: linear-gradient(110deg, #e06848 0%, #d08830 60%, #c05068 100%);
  color: #fff;
  font-size: 16px; font-weight: 700;
  border: none; border-radius: 14px;
  padding: 15px 0;
  cursor: pointer; letter-spacing: 0.3px;
  box-shadow: 0 4px 18px rgba(200, 80, 60, 0.22);
  transition: transform 0.15s, opacity 0.15s;
}
.welcome-btn:active { transform: scale(0.97); opacity: 0.88; }

.welcome-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px;
  background: rgba(180, 130, 100, 0.12);
  border: none; border-radius: 50%;
  font-size: 14px; color: var(--dim);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.welcome-close:hover { background: rgba(180, 130, 100, 0.22); }
.welcome-card { position: relative; }

/* ─────────────────────────────────────────
   Settings Sheet
───────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(80, 30, 10, 0.30);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.overlay.open { opacity: 1; pointer-events: all; }

.sheet {
  width: 100%; max-width: 480px;
  background: rgba(255, 244, 238, 0.96);
  border: 1px solid rgba(240, 185, 145, 0.50);
  border-radius: 24px 24px 0 0;
  padding: 10px 20px 48px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 -8px 40px rgba(160, 60, 20, 0.12);
  transform: translateY(30px);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.overlay.open .sheet { transform: translateY(0); }

.sheet-handle {
  width: 36px; height: 4px;
  background: rgba(180, 90, 40, 0.22);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.sheet-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.sheet-title { font-size: 20px; font-weight: 700; color: var(--white); }

.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 10px; font-weight: 700;
  color: var(--dim);
  letter-spacing: 0.10em; text-transform: uppercase;
  margin-bottom: 8px;
}
.form-label-sm { display: block; font-size: 10px; color: var(--dim); margin-bottom: 6px; }

.form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.80);
  border: 1px solid rgba(220, 155, 110, 0.40);
  border-radius: 13px;
  padding: 14px 15px;
  color: var(--white);
  font-size: 16px; outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  box-shadow: inset 0 1px 3px rgba(160, 60, 20, 0.06);
}
.form-input:focus { border-color: #c87020; }

.time-row { display: flex; align-items: flex-end; gap: 10px; }
.time-col  { flex: 1; }
.time-sep  { color: var(--dim); font-size: 18px; padding-bottom: 12px; flex-shrink: 0; }

.save-btn {
  width: 100%;
  /* Spring gradient button: peach → salmon */
  background: linear-gradient(110deg, #F09E6F 0%, #e06060 100%);
  color: #ffffff;
  border: none; border-radius: 14px;
  padding: 17px;
  font-size: 16px; font-weight: 800;
  cursor: pointer; letter-spacing: 0.02em;
  box-shadow: 0 4px 20px rgba(240, 100, 60, 0.30);
  transition: opacity 0.15s, transform 0.1s;
  margin-top: 4px;
}
.save-btn:active { transform: scale(0.98); opacity: 0.88; }

.sheet-hint {
  text-align: center; font-size: 11px;
  color: var(--dim2); margin-top: 14px;
}

/* ─────────────────────────────────────────
   Settings Info Block
───────────────────────────────────────── */
.settings-info {
  background: rgba(240, 215, 190, 0.28);
  border: 1px solid rgba(220, 155, 100, 0.28);
  border-radius: 13px;
  padding: 13px 15px 10px;
  margin-bottom: 20px;
}
.settings-info-row {
  display: flex; justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
}
.settings-info-label {
  font-size: 10px; font-weight: 700;
  color: var(--dim); letter-spacing: 0.10em;
  text-transform: uppercase;
}
.settings-info-val {
  font-size: 13px; font-weight: 600;
  color: var(--white);
}
.settings-info-note {
  font-size: 10.5px; color: var(--dim2);
  margin-top: 6px; line-height: 1.5;
  border-top: 1px solid rgba(200, 140, 90, 0.18);
  padding-top: 8px;
}

/* ─────────────────────────────────────────
   Calendar Popover
───────────────────────────────────────── */
.cal-overlay {
  position: fixed; inset: 0;
  z-index: 150;
  opacity: 0; pointer-events: none;
  transition: opacity 0.20s;
}
.cal-overlay.open { opacity: 1; pointer-events: all; }

.cal-popup {
  position: absolute;
  top: 68px; right: 14px;
  width: min(330px, calc(100vw - 28px));
  background: rgba(255, 248, 242, 0.97);
  border: 1px solid rgba(220, 170, 125, 0.42);
  border-radius: 20px;
  padding: 15px 16px 15px;
  box-shadow:
    0 8px 40px rgba(160, 60, 20, 0.16),
    0 2px 10px rgba(160, 60, 20, 0.08);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transform: translateY(-10px) scale(0.96);
  transform-origin: top right;
  transition:
    transform 0.28s cubic-bezier(0.32, 0.72, 0, 1),
    opacity   0.20s;
}
.cal-overlay.open .cal-popup {
  transform: translateY(0) scale(1);
}

.cal-popup-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-popup-month {
  font-size: 15px; font-weight: 800;
  color: var(--white);
}
.cal-close-btn {
  width: 30px; height: 30px;
  font-size: 13px;
}

/* ── Mini calendar grid ── */
.cal-grid { margin-bottom: 10px; }

.cal-week-header {
  display: grid; grid-template-columns: repeat(7, 1fr);
  margin-bottom: 3px;
}
.cal-day-header {
  text-align: center;
  font-size: 9.5px; font-weight: 700;
  color: var(--dim2); padding: 1px 0;
  letter-spacing: 0.02em;
}
.cal-day-header.is-sun { color: #c04040; }
.cal-day-header.is-sat { color: #4060c0; }

.cal-week-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; margin-bottom: 2px;
}
.cal-day-cell {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 500;
  border-radius: 50%;
  color: rgba(80, 35, 14, 0.40);
}
.cal-day-cell.empty { visibility: hidden; }
.cal-day-cell.is-today {
  background: linear-gradient(135deg, #F09E6F 0%, #e06060 100%);
  color: #ffffff; font-weight: 800;
  box-shadow: 0 2px 8px rgba(230, 90, 60, 0.38);
}
.cal-day-cell.is-past-work {
  background: rgba(245, 185, 120, 0.38);
  color: #7a3a18; font-weight: 600;
}
.cal-day-cell.is-past-off {
  color: rgba(80, 35, 14, 0.22);
}
.cal-day-cell.is-future-off {
  color: rgba(80, 35, 14, 0.20);
}
.cal-day-cell.is-future-work {
  color: rgba(80, 35, 14, 0.38);
}

/* ── Progress bars ── */
.cal-divider {
  height: 1px;
  background: rgba(200, 150, 100, 0.20);
  margin: 10px 0;
}
.cal-stat { margin-bottom: 9px; }
.cal-stat:last-of-type { margin-bottom: 0; }

.cal-stat-row {
  display: flex; justify-content: space-between;
  align-items: baseline; margin-bottom: 5px;
}
.cal-stat-label {
  font-size: 9.5px; font-weight: 700;
  color: var(--dim); letter-spacing: 0.10em;
  text-transform: uppercase;
}
.cal-stat-val {
  font-size: 12px; font-weight: 700;
  color: var(--white);
}
.cal-bar-track {
  height: 7px;
  background: rgba(200, 155, 110, 0.18);
  border-radius: 4px; overflow: hidden;
}
.cal-bar-fill {
  height: 100%; width: 0%;
  border-radius: 4px;
  transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cal-bar-month {
  background: linear-gradient(90deg, #FAD082 0%, #F09E6F 100%);
}
.cal-bar-work {
  background: linear-gradient(90deg, #80d8f8 0%, #38a8e0 100%);
}

/* ── Footer ── */
.cal-footer {
  text-align: center;
  font-size: 11px; font-weight: 500;
  color: var(--dim);
}
