/* KJC Board — 時間帯テーマ（日本時間：朝 HALO 7-12時／昼 High Noon 12-16時／夕 HORIZON 16-19時／夜 Lapis 19-7時）
   カードは iOS フォルダ風のガラス：時間帯色の薄いティント＋背景ぼかし 34px＋上端・下端だけ白いフロストと縁の光 */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  --radius: 14px;
  --gap: 12px;
  --row: 230px;
  --up: #d23c3c;
  --down: #2a6fd6;
  --blur: 34px;
  --card: rgba(255,255,255,.65);
}
[data-theme="HORIZON"], [data-theme="Lapis"] { --card: rgba(255,255,255,.08); }
[data-theme="HALO"] {
  --bg: linear-gradient(160deg, #F4FBFF 0%, #D7E6E8 32%, #FFF2D6 58%, #C7CCFF 82%, #a9b0ff 100%);
  --bg-solid: #eef4fb;
  --glass: rgba(91,184,255,.13);
  --text: #1c2540; --muted: #56607e; --on-bg: #1c2540; --on-bg-muted: #4a5577;
  --accent: #6E73F5; --accent-ink: #fff; --chip: rgba(255,255,255,.34); --line: rgba(40,50,110,.14); --card-border: rgba(255,255,255,.55);
}
[data-theme="HighNoon"] {
  --bg: linear-gradient(180deg, #2D7FD3 0%, #5FA4E8 33%, #A9CFF3 67%, #E9F4FD 100%);
  --bg-solid: #e9f4fd;
  --glass: rgba(169,207,243,.34);
  --text: #0f2747; --muted: #3d5878; --on-bg: #ffffff; --on-bg-muted: rgba(255,255,255,.82);
  --accent: #1f6fd0; --accent-ink: #fff; --chip: rgba(255,255,255,.38); --line: rgba(15,39,71,.14); --card-border: rgba(255,255,255,.6);
}
[data-theme="HORIZON"] {
  --bg: linear-gradient(180deg, #081C5C 0%, #1D5FD6 25%, #7B4DFF 50%, #E84E8A 68%, #FF7A3D 85%, #FFC46B 100%);
  --bg-solid: #2a3f6e;
  --glass: rgba(10,42,106,.18);
  --text: #ffffff; --muted: rgba(255,255,255,.78); --on-bg: #ffffff; --on-bg-muted: rgba(255,255,255,.82);
  --accent: #ffb982; --accent-ink: #0A2A6A; --chip: rgba(255,255,255,.16); --line: rgba(255,255,255,.2); --card-border: rgba(255,255,255,.42);
  --up: #ffb4a8; --down: #b9dcff;
  color-scheme: dark;
}
[data-theme="Lapis"] {
  --bg: linear-gradient(180deg, #070F2E 0%, #11246E 40%, #2A4D88 75%, #7FA2EC 100%);
  --bg-solid: #0d1a4a;
  --glass: rgba(42,77,136,.14);
  --text: #eef2ff; --muted: #b3c0e6; --on-bg: #eef2ff; --on-bg-muted: #b3c0e6;
  --accent: #9fb9ff; --accent-ink: #070F2E; --chip: rgba(255,255,255,.1); --line: rgba(220,228,255,.14); --card-border: rgba(255,255,255,.26);
  --up: #ff8f8f; --down: #9cc2ff;
  color-scheme: dark;
}
/* 夜は星空 */
[data-theme="Lapis"] body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1px 1px at 72% 9%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1.5px 1.5px at 38% 32%, rgba(255,255,255,.85), transparent 60%),
    radial-gradient(1px 1px at 88% 41%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1px 1px at 22% 57%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 61% 24%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1px 1px at 51% 66%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1px 1px at 6% 80%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1px 1px at 93% 72%, rgba(255,255,255,.55), transparent 60%);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg-solid);
  min-height: 100vh; -webkit-text-size-adjust: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
/* 背景のグラデーションは1画面分の高さで固定（スクロールしても動かない）。
   iOS Safari は background-attachment: fixed が効かないため、固定配置の疑似要素に描く */
body::before { content: ''; position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; background: var(--bg-solid); background-image: var(--bg); z-index: -1; pointer-events: none; }
/* 背景モード「ライブな空」：canvas に空を描き、従来テーマの背景層（星空を含む）は隠す */
#sky { position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; z-index: -1; pointer-events: none; display: none; }
html.live-sky #sky { display: block; }
html.live-sky body::before { display: none; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); }

/* ヘッダー */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px 6px; }
.topbar { color: var(--on-bg); }
.brand { font-weight: 800; letter-spacing: .02em; font-size: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.theme-name { font-size: 11px; color: var(--on-bg-muted); letter-spacing: .12em; }
.spacer { flex: 1; }
.iconbtn { border: 1px solid var(--card-border); background: var(--chip); color: var(--on-bg); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); border-radius: 10px; padding: 6px 10px; font-size: 14px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border-radius: 12px; color: var(--text); padding: 6px 10px; font-size: 12px; line-height: 1.35; min-width: 96px; }
.chip b { display: block; font-size: 15px; }

/* ボード */
.board { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); grid-auto-rows: var(--row); grid-auto-flow: row dense; gap: var(--gap); padding: 4px 16px 40px; }
.card, .chip, .panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.30) 0%, rgba(255,255,255,.08) 9%, rgba(255,255,255,0) 22%, rgba(255,255,255,0) 80%, rgba(255,255,255,.07) 92%, rgba(255,255,255,.22) 100%),
    var(--glass);
  border: 1px solid var(--card-border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -1px 0 rgba(255,255,255,.35), 0 8px 26px rgba(10,20,50,.10);
  backdrop-filter: blur(var(--blur)) saturate(150%); -webkit-backdrop-filter: blur(var(--blur)) saturate(150%);
}
.card { border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; isolation: isolate; }
.card-h { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 10px 12px 6px; font-weight: 700; font-size: 14px; }
.card-h .t { flex: 1 1 auto; min-width: 5em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-b { padding: 2px 12px 12px; overflow: auto; flex: 1; min-height: 0; font-size: 13px; -webkit-overflow-scrolling: touch; }
.btn { border: 1px solid var(--card-border); background: var(--chip); border-radius: 9px; padding: 4px 9px; font-size: 12px; white-space: nowrap; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: #c33; }
.btn:disabled { opacity: .5; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.big { font-size: 26px; font-weight: 800; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.kv > :nth-child(2n) { text-align: right; }
.tag { display: inline-block; font-size: 11px; border-radius: 6px; padding: 1px 6px; background: var(--chip); border: 1px solid var(--line); }
.tag.ok { background: #2e9e5b; color: #fff; border: 0; }
.tag.ng { background: #9a9a9a; color: #fff; border: 0; }
.tag.k { background: #3a6fd8; color: #fff; border: 0; }
.tag.kj { background: #d8793a; color: #fff; border: 0; }
.bar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.empty { color: var(--muted); padding: 10px 0; text-align: center; }
table.t { width: 100%; border-collapse: collapse; font-size: 12px; }
table.t th, table.t td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.t td.r, table.t th.r { text-align: right; }

/* 天気 */
.hours { display: flex; gap: 10px; overflow-x: auto; padding: 6px 0; }
.hours > div { flex: none; text-align: center; font-size: 11px; min-width: 40px; }
.wx { font-size: 20px; }

/* カレンダー */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; font-size: 10px; }
.cal .dow { text-align: center; color: var(--muted); font-weight: 700; padding: 2px 0; }
/* カレンダー：5週分でカードの高さを埋め、それ以降はスクロール */
.card-b:has(> .cal) { container-type: size; }
.card-b > .cal { grid-auto-rows: max(54px, calc((100cqh - 32px) / 5)); grid-template-rows: auto; }
.cal .dow { position: sticky; top: -2px; z-index: 1; background: var(--chip); backdrop-filter: blur(8px); border-radius: 4px; }
.cal .d { min-height: 54px; border-radius: 6px; background: var(--chip); padding: 2px 3px; overflow: hidden; }
.cal .d.today { outline: 2px solid var(--accent); }
.cal .d .n { font-weight: 700; font-size: 11px; }
.cal .d .sun { color: var(--up); } .cal .d .sat { color: var(--down); }
.cal .m { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 3px; padding: 0 2px; margin-top: 1px; }
.cal .m.ev { background: rgba(127,162,255,.25); }
.cal .m.task { background: rgba(46,158,91,.22); }
.cal .m.k { background: rgba(58,111,216,.22); }
.cal .m.kj { background: rgba(216,121,58,.25); }

/* お客さん登録 */
.cust { display: flex; gap: 8px; align-items: flex-start; }
.cust .main { flex: 1; min-width: 0; }
.thumbs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.thumbs img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* チャット */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat .msgs { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.bubble { max-width: 82%; padding: 6px 10px; border-radius: 12px; background: var(--chip); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border: 0; }
.chat form { display: flex; gap: 6px; padding-top: 6px; }
.chat textarea { flex: 1; resize: none; height: 38px; border-radius: 10px; border: 1px solid var(--card-border); background: var(--chip); padding: 8px; }

/* レイアウト編集 */
body.editing .card { outline: 2px dashed var(--accent); outline-offset: -2px; }
.edit-bar { display: none; gap: 4px; align-items: center; }
body.editing .edit-bar { display: flex; }
body.editing .card-h { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
body.editing .card-h .t { grid-column: 1; grid-row: 1; min-width: 0; }
body.editing .card-h .edit-bar { grid-column: 2; grid-row: 1; }
body.editing .card-h .tools { display: none; } /* 並べ替え中はカード独自のボタンを隠す */
.handle { cursor: grab; touch-action: none; user-select: none; padding: 2px 8px; border-radius: 6px; background: var(--chip); border: 1px solid var(--card-border); }
.card.dragging { opacity: .5; }
/* ドラッグ：持ち上げ（影・少し拡大・少し傾き）→ 置き場所の枠 → 吸着 */
.card.drag-float { position: fixed; z-index: 60; margin: 0; pointer-events: none; transform-origin: center; will-change: left, top, transform;
  transition: transform .12s ease, box-shadow .12s ease; }
.card.drag-float.lifted { transform: scale(1.03) rotate(1.5deg); box-shadow: 0 18px 40px rgba(0,0,0,.35), 0 4px 12px rgba(0,0,0,.2); cursor: grabbing; }
.card.drag-float.landing { transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease, transform .18s ease, box-shadow .18s ease; transform: none; }
.card.drag-ph { background: color-mix(in srgb, var(--accent) 16%, transparent) !important; border: 2px dashed color-mix(in srgb, var(--accent) 70%, transparent) !important; box-shadow: none !important; backdrop-filter: none !important; }
.card.drag-ph > * { visibility: hidden; }
body.card-dragging, body.card-dragging * { cursor: grabbing !important; user-select: none; }
body.card-dragging .board { touch-action: none; }
.card.pinned .pin { background: var(--accent); color: var(--accent-ink); }
.drop-ghost { position: fixed; pointer-events: none; border: 2px solid var(--accent); border-radius: var(--radius); background: rgba(127,162,255,.15); z-index: 50; }

/* モーダル */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; z-index: 100; }
@media (min-width: 700px) { .modal-bg { align-items: center; } }
.modal { background: var(--bg-solid); color: var(--text); width: min(560px, 100%); max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .modal { border-radius: 16px; } }
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; }
.field > span { color: var(--muted); font-size: 12px; }
.field input, .field select, .field textarea { border: 1px solid var(--card-border); background: var(--card); border-radius: 10px; padding: 9px 10px; font-size: 16px; width: 100%; }
.field textarea { min-height: 70px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { border: 1px solid var(--card-border); border-radius: 9px; padding: 6px 10px; background: var(--card); font-size: 14px; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.modal .actions .btn { padding: 9px 16px; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #222; color: #fff; padding: 9px 14px; border-radius: 10px; font-size: 13px; z-index: 200; max-width: 90vw; }
.menu { position: absolute; right: 12px; top: 52px; background: var(--bg-solid); border: 1px solid var(--card-border); border-radius: 12px; padding: 6px; z-index: 90; box-shadow: 0 8px 24px rgba(0,0,0,.18); min-width: 220px; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; }
.menu button:hover { background: var(--chip); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 150; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 96vw; max-height: 90vh; }

/* ログイン・出退勤 */
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.panel { border-radius: 18px; padding: 24px; width: min(380px, 100%); }
.panel h1 { font-size: 20px; margin: 0 0 16px; }
.bigbtn { width: 100%; padding: 18px; font-size: 20px; font-weight: 700; border-radius: 14px; border: 0; margin-top: 10px; }
.bigbtn.in { background: #2e9e5b; color: #fff; } .bigbtn.out { background: #c8553d; color: #fff; }
.bigbtn:disabled { opacity: .4; }
.err { color: #d33; font-size: 13px; min-height: 18px; }
/* 波紋：タップ位置から細めの縁がぼけた白い輪が、カードの外側まで約1.6秒でゆっくり広がり、最後は完全に消える */
.ripple {
  position: absolute; pointer-events: none; z-index: 5; border-radius: 50%;
  width: 0; height: 0; transform: translate(-50%, -50%);
  border: 2.5px solid rgba(255,255,255,.95); filter: blur(1.5px);
  box-shadow: 0 0 8px 1px rgba(255,255,255,.6), inset 0 0 6px rgba(255,255,255,.4), 0 1px 4px rgba(0,0,0,.12);
  opacity: 0;
  animation: kjc-ripple 1.6s cubic-bezier(.25,.55,.35,1) forwards;
}
@keyframes kjc-ripple {
  0% { width: 0; height: 0; opacity: .95; }
  60% { opacity: .75; }
  85% { opacity: .4; }
  100% { width: var(--ripple-size, 600px); height: var(--ripple-size, 600px); opacity: 0; }
}
.card.bounce { animation: kjc-bounce .55s cubic-bezier(.3,.7,.4,1); }
@keyframes kjc-bounce {
  0% { transform: scale(1); }
  30% { transform: scale(.955); }
  65% { transform: scale(1.018); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .ripple, .card.bounce { animation-duration: .01s; } }
/* 夕は画面下が明るいので、カード内の白文字に薄い影を付けて読みやすくする */
[data-theme="HORIZON"] .card, [data-theme="HORIZON"] .chip { text-shadow: 0 1px 2px rgba(10,30,70,.45); }
/* 天気の日別リスト：列幅を固定して縦にそろえる */
.list > li.wxrow { display: grid; grid-template-columns: 6.6em 1.7em minmax(0,5.5em) 2.4em .9em 1.9em 4.2em 1fr; align-items: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wxrow .c { text-align: center; } .wxrow .r { text-align: right; } .wxrow .mm { grid-column: span 2; text-align: left; padding-left: .31em; white-space: pre; } .wxrow .lbl { overflow: hidden; text-overflow: ellipsis; }
/* 天気カードが狭いとき（スマホの半幅など）は天気名を省いて列を詰め、同じようにそろえる */
#weather .card-b { container-type: inline-size; }
@container (max-width: 300px) {
  .list > li.wxrow { grid-template-columns: 5.4em 1.5em 0 2.2em .7em 2.2em minmax(0, 1fr) 0; font-size: 12px; }
  .wxrow .lbl { visibility: hidden; }
  .wxrow .mm { padding-left: .2em; }
}
/* Event Schedule：日ごとの見出し＋会場ごとに1行 */
.es-day { padding: 6px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.es-day:last-child { border-bottom: 0; }
.es-day.today .es-h { color: var(--accent); }
.es-h { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; margin-bottom: 2px; }
.es-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-left: .6em; }
.es-line > .small { flex: none; white-space: nowrap; }
/* 人件費：予約・来店の件数入力 */
tr.cnt-row td { border-top: 0; padding-top: 0; }
.cnt-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.cnt { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.cnt .btn { min-width: 28px; padding: 3px 0; text-align: center; font-size: 14px; }
.cnt b { min-width: 1.6em; text-align: center; }
/* ヘッダーの市場の参考値（金・銀・プラチナ・日経平均・S&P500）。1項目1コマ */
.chip.mk b small { font-size: 11px; font-weight: 600; }
.chip.mk .mk-note, .chips > .chip .mk-note { display: block; font-size: 10px; }
/* 市場のコマ（金〜オルカン）は同じ幅・同じ4行にそろえ、長い文字は…で省く */
/* ヘッダーのコマは左の要約も右の市場も、すべて同じ幅・同じ高さ（4行分）。長い文字は…で省く */
.chips > .chip { box-sizing: border-box; width: 120px; min-width: 120px; height: 82px; overflow: hidden; }
.chips > .chip > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.mk .mk-c { white-space: pre; }
/* 出退勤の管理：打刻履歴 */
table.clock-hist { margin-top: 4px; }
table.clock-hist .btn { padding: 2px 8px; }
/* Calendar：バイト担当者名を現場名の右に小さく */
.cal .m.has-side { display: flex; gap: 3px; align-items: baseline; }
.cal .m.has-side .v { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cal .m .side { flex: 0 1000 auto; margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 8.5px; opacity: .75; }
/* Event Schedule：複数日まとめ編集の日付選択 */
.bulk-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.bulk-days .bd { display: flex; align-items: center; gap: 2px; font-size: 12px; padding: 4px 2px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; white-space: nowrap; }
.bulk-days .bd.past { opacity: .55; }
.bulk-days .bd:has(input:checked) { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.bulk-days .bd:has(input:checked) span { color: inherit; }
/* お客さん登録：日付＋会場ごとの見出し（締めの状態） */
.list > li.cl-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 2px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.list > li.cl-h .tag { font-size: 12px; }

/* 編集モード：ヘッダーのコマもドラッグで並べ替え */
body.editing .chips > .chip[data-key] { cursor: grab; touch-action: none; user-select: none; outline: 1px dashed var(--card-border); outline-offset: -1px; }
.chip.drag-float { position: fixed; z-index: 60; margin: 0; pointer-events: none; box-sizing: border-box; overflow: hidden; transition: transform .12s ease, box-shadow .12s ease; }
.chip.drag-float > * { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.drag-float.lifted { transform: scale(1.06) rotate(2deg); box-shadow: 0 14px 30px rgba(0,0,0,.35), 0 3px 10px rgba(0,0,0,.2); }
.chip.drag-float.landing { transition: left .18s ease, top .18s ease, transform .18s ease, box-shadow .18s ease; transform: none; }
.chip.drag-ph { background: color-mix(in srgb, var(--accent) 16%, transparent) !important; outline: 2px dashed color-mix(in srgb, var(--accent) 70%, transparent) !important; box-shadow: none !important; backdrop-filter: none !important; }
.chip.drag-ph > * { visibility: hidden; }

/* PC：ヘッダーのコマはカード列と同じ幅に、均等幅で伸び縮み（高さはそのまま。列数は app.js の fitChips が決める。狭いときは2段） */
@media (min-width: 900px) {
  .chips { display: grid; grid-template-columns: repeat(var(--hcols, 12), minmax(0, 1fr)); overflow: visible; }
  .chips > .chip { width: auto; min-width: 0; padding: 6px 8px; container-type: inline-size; }
  /* コマが細くなったら文字も少し小さく（広いときは今の大きさのまま） */
  .chips > .chip > b { font-size: clamp(11px, 17cqi, 15px); }
  .chips > .chip > span { font-size: clamp(9px, 14cqi, 12px); }
  .chips > .chip .mk-note { font-size: clamp(8px, 12cqi, 10px); }
}
/* KJC Lynk：アカウント別の未読タイル（横一列・正方形に近い形。名前の下に未読数、未読ありは赤） */
.lynk-tiles { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 5px; margin: 4px 0 6px; }
.lynk-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 56px; padding: 4px 1px; text-decoration: none; color: var(--text); white-space: normal; overflow: hidden; container-type: inline-size; }
@media (min-width: 900px) { .lynk-tile { aspect-ratio: 1 / .82; min-height: 0; max-height: 92px; } }
.lynk-tile .lt-name { max-width: 100%; font-size: clamp(8px, 19cqi, 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lynk-tile .lt-n { font-size: clamp(18px, 30cqi, 28px); font-weight: 800; line-height: 1.1; }
.lynk-tile .lt-n.on { color: var(--up); }
/* ===== ガラスの質感「リキッド」（glass.js。html[data-glass="liquid"] のときだけ効く。従来は上の .card, .chip の指定のまま） =====
   色味とティントの濃さは従来と同じ（background は変えない）。足すのは縁の光・わずかな色のにじみ・縁の屈折（Chromium のみ） */
[data-glass="liquid"] .card, [data-glass="liquid"] #chips > .chip {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55), inset 0 -1px 0 rgba(255,255,255,.28),
    inset 1px 0 0 rgba(255,140,170,.10), inset -1px 0 0 rgba(130,190,255,.12),
    inset 0 0 22px rgba(255,255,255,.07),
    0 8px 26px rgba(10,20,50,.12);
}
/* 縁の光：左上から光が当たる向き（左と上が明るく、右下に反射の弱い光） */
[data-glass="liquid"] .card::after, [data-glass="liquid"] #chips > .chip::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3;
  padding: 1.3px;
  background: linear-gradient(135deg, rgba(255,255,255,.85) 0%, rgba(255,255,255,.28) 18%, rgba(255,255,255,0) 42%, rgba(255,255,255,0) 62%, rgba(255,255,255,.22) 84%, rgba(255,255,255,.5) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
#chips > .chip { position: relative; }
/* 屈折（Chrome・Edge）：見た目は「従来のぼかし・彩度のうえで、縁だけ曲げる」。
   動いている間だけ屈折を休ませられるよう、層に分けて重ねる（下から）
   ::before … 従来と同じぼかし・彩度（いつも出ている）
   .lg-lens … 縁だけ曲げる（屈折。スクロール・ドラッグ・弾み・画面を開いている間は消える＝計算されない）
   .lg-tint … ティント（従来の background と同じ）
   ::after  … 縁の光　／　中身はいちばん上なので歪まない */
.lg-lens, .lg-tint { display: none; }
.lg-refract[data-glass="liquid"] .card, .lg-refract[data-glass="liquid"] #chips > .chip { backdrop-filter: none; -webkit-backdrop-filter: none; isolation: auto; background: transparent; }
.lg-refract[data-glass="liquid"] .card::before, .lg-refract[data-glass="liquid"] #chips > .chip::before,
.lg-refract[data-glass="liquid"] .lg-lens, .lg-refract[data-glass="liquid"] .lg-tint {
  content: ''; display: block; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
}
.lg-refract[data-glass="liquid"] .card::before, .lg-refract[data-glass="liquid"] #chips > .chip::before {
  backdrop-filter: blur(var(--blur)) saturate(150%);
}
/* 屈折は縁の4本の帯だけ（上下は角丸ごと、左右はその間） */
.lg-refract[data-glass="liquid"] .lg-lens {
  z-index: 2;
  transition: opacity .25s ease, visibility 0s;
}
.lg-refract[data-glass="liquid"] .lg-lens.t { inset: 0 0 auto 0; height: var(--lg-band, 0); border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; backdrop-filter: var(--lg-ft, none); }
.lg-refract[data-glass="liquid"] .lg-lens.b { inset: auto 0 0 0; height: var(--lg-band, 0); border-radius: inherit; border-top-left-radius: 0; border-top-right-radius: 0; backdrop-filter: var(--lg-fb, none); }
.lg-refract[data-glass="liquid"] .lg-lens.l { inset: var(--lg-band, 0) auto var(--lg-band, 0) 0; width: var(--lg-band, 0); border-radius: 0; backdrop-filter: var(--lg-fl, none); }
.lg-refract[data-glass="liquid"] .lg-lens.r { inset: var(--lg-band, 0) 0 var(--lg-band, 0) auto; width: var(--lg-band, 0); border-radius: 0; backdrop-filter: var(--lg-fr, none); }
.lg-refract.lg-moving[data-glass="liquid"] .lg-lens, .lg-refract.lg-hold[data-glass="liquid"] .lg-lens,
.lg-refract[data-glass="liquid"] .lg-busy > .lg-lens {
  opacity: 0; visibility: hidden;
  transition: opacity .12s ease, visibility 0s .12s;
}
.lg-refract[data-glass="liquid"] .lg-tint {
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(255,255,255,.30) 0%, rgba(255,255,255,.08) 9%, rgba(255,255,255,0) 22%, rgba(255,255,255,0) 80%, rgba(255,255,255,.07) 92%, rgba(255,255,255,.22) 100%),
    var(--glass);
}
.lg-refract[data-glass="liquid"] .card > .card-h, .lg-refract[data-glass="liquid"] .card > .card-b,
.lg-refract[data-glass="liquid"] #chips > .chip > :not(.lg-lens):not(.lg-tint) { position: relative; z-index: 3; }
.lg-refract[data-glass="liquid"] .card::after, .lg-refract[data-glass="liquid"] #chips > .chip::after { z-index: 4; }
/* ドラッグ中の置き場所の表示は従来どおり */
[data-glass="liquid"] .drag-ph::after, [data-glass="liquid"] .drag-ph > .lg-lens, [data-glass="liquid"] .drag-ph > .lg-tint, .lg-refract[data-glass="liquid"] .drag-ph::before { display: none; }

/* ===== App Dev のリンクボタン（リキッドのときだけ。従来は .btn.primary の青いボタンのまま） =====
   ガラスは「Liquid Glass Recorder」のデモと同じ作り：すりガラスの土台（blur 14px・彩度 160%・明るさ 1.06）、
   白の縦グラデーション、上端の細い光と下端の返り光、縁の虹色（左ピンク寄り・右青寄り）、上半分の艶。
   色は時間帯テーマのティント（--glass）を下に薄く敷く。屈折は Chrome のみ・縁だけ（glass.js が --lg-bf を付ける） */
[data-glass="liquid"] .lg-link.btn {
  position: relative;
  isolation: isolate;
  color: var(--text);
  font-weight: 700;
  /* 縁は線にしない：枠線は透明にして、縁の光はぼかした内側の光（上を少し強め）と外側のごく薄いにじみで描く */
  border: 1px solid transparent;
  background:
    linear-gradient(180deg, rgba(255,255,255,.20), rgba(255,255,255,.07) 55%, rgba(255,255,255,.12)),
    var(--glass);
  box-shadow:
    inset 0 0 12px rgba(255,255,255,.28),
    inset 0 6px 10px -6px rgba(255,255,255,.55),
    inset 0 -5px 10px -7px rgba(255,255,255,.25),
    inset 6px 0 10px -7px rgba(255,120,190,.30),
    inset -6px 0 10px -7px rgba(110,190,255,.32),
    0 0 8px rgba(255,255,255,.16),
    0 8px 18px rgba(3,6,20,.22),
    0 2px 6px rgba(3,6,20,.16);
  backdrop-filter: blur(14px) saturate(160%) brightness(1.06);
  -webkit-backdrop-filter: blur(14px) saturate(160%) brightness(1.06);
  transition: background-color .2s, box-shadow .2s;
}
/* 上半分の艶（文字の下に敷く） */
[data-glass="liquid"] .lg-link.btn::before {
  content: ''; position: absolute; left: 4%; right: 4%; top: 3px; height: 46%; z-index: -1; pointer-events: none;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.34), rgba(255,255,255,0));
}
[data-glass="liquid"] .lg-link.btn:hover {
  background:
    linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.11) 55%, rgba(255,255,255,.16)),
    var(--glass);
}
/* 縁だけ曲げる（Chrome・Edge。中央は変位0なので文字の下は平ら）。動いている間は休む */
.lg-refract[data-glass="liquid"] .lg-link.btn { backdrop-filter: blur(14px) saturate(160%) brightness(1.06) var(--lg-bf, saturate(100%)); }
.lg-refract.lg-moving[data-glass="liquid"] .lg-link.btn, .lg-refract.lg-hold[data-glass="liquid"] .lg-link.btn,
.lg-refract[data-glass="liquid"] .lg-busy .lg-link.btn { backdrop-filter: blur(14px) saturate(160%) brightness(1.06); }
/* 押したとき少し縮む（デモと同じ）。文字は明るいテーマでは濃い文字、暗いテーマでは白い文字に影 */
[data-glass="liquid"] .lg-link.btn:active { transform: scale(.96); }
[data-glass="liquid"] .lg-link.btn { transition: background-color .2s, box-shadow .2s, transform .15s ease; }
[data-theme="HORIZON"][data-glass="liquid"] .lg-link.btn, [data-theme="Lapis"][data-glass="liquid"] .lg-link.btn { text-shadow: 0 1px 10px rgba(0,0,0,.30); }
/* ===== ロイヤルブルーのボタン（.btn-royal：＋登録・締め・通知を受け取る・送信、Planner の選ばれたタブ） =====
   ガラスの質感（リキッド／従来）に関係なく同じ見た目。#2563eb のベタ塗り＋上半分の光沢。
   押すと沈み、光の帯が左から右へ流れ、離すと軽く弾んで戻る。形（丸み）と文字の大きさは元のまま */
.btn.btn-royal, #calendar .seg label:has(input:checked) {
  position: relative; overflow: hidden; isolation: isolate;
  background: #2563eb; color: #fff; border-color: transparent;
  text-shadow: none;
  box-shadow: 0 3px 8px rgba(37,99,235,.35), inset 0 1px 0 rgba(255,255,255,.28), inset 0 -1px 0 rgba(0,0,0,.12);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  transition: transform .45s cubic-bezier(.34,1.7,.5,1), box-shadow .3s ease;
}
/* つや（上半分：上が明るい白の半透明 → 下へ透明） */
.btn.btn-royal::before, #calendar .seg label:has(input:checked)::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 52%; z-index: -1; pointer-events: none;
  border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.42), rgba(255,255,255,.10) 70%, rgba(255,255,255,0));
}
/* 流れる光の帯（ふだんは左の外に隠れている） */
.btn.btn-royal::after, #calendar .seg label:has(input:checked)::after {
  content: ''; position: absolute; top: -20%; bottom: -20%; left: 0; width: 45%; z-index: 0; pointer-events: none;
  background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,255,255,.55) 50%, rgba(255,255,255,0));
  transform: translateX(-120%) skewX(-18deg);
  opacity: 0;
}
.btn.btn-royal.rp::after, #calendar .seg label.rp:has(input:checked)::after { animation: royal-shine .45s ease-out; }
@keyframes royal-shine {
  0% { transform: translateX(-120%) skewX(-18deg); opacity: 1; }
  100% { transform: translateX(260%) skewX(-18deg); opacity: 1; }
}
/* 押している間は少し沈み、影が浅くなる。離すと transition（少し行き過ぎる曲線）で弾んで戻る */
.btn.btn-royal:active:not(:disabled), #calendar .seg label:has(input:checked):active {
  transform: scale(.95);
  box-shadow: 0 1px 2px rgba(37,99,235,.35), inset 0 1px 0 rgba(255,255,255,.2), inset 0 -1px 0 rgba(0,0,0,.12);
  transition: transform .08s ease, box-shadow .08s ease;
}
/* 描き直しで作り直されたタブ（Planner）には、沈んで弾む動きをアニメーションで付ける */
#calendar .seg label.rp-pop:has(input:checked) { animation: royal-pop .5s cubic-bezier(.34,1.7,.5,1); }
@keyframes royal-pop { 0% { transform: scale(.95); } 100% { transform: scale(1); } }
.btn.btn-royal:disabled { opacity: .55; box-shadow: none; }
@media (prefers-reduced-motion: reduce) {
  .btn.btn-royal.rp::after, #calendar .seg label.rp:has(input:checked)::after { animation: none; }
  #calendar .seg label.rp-pop:has(input:checked) { animation: none; }
  .btn.btn-royal, #calendar .seg label:has(input:checked) { transition: box-shadow .2s ease; }
  .btn.btn-royal:active:not(:disabled), #calendar .seg label:has(input:checked):active { transform: none; }
}
/* 色だけロイヤルブルー（つや・動きなし）：AI Usage の使用量メーターのバー */
#ai-usage .bar > i { background: #2563eb; }
/* Planner の場所リンク（Google マップ） */
#calendar a.loc-link { color: #2563eb; }

/* リキッドで弾み・波紋の間（.lg-busy）は、そのカードだけ従来と同じ1枚のガラスで描く（見た目は同じ：ぼかし・彩度・ティント）。
   層に分けたまま波紋を動かすと、大きなカードでは毎コマ層を合成し直して重くなるため */
.lg-refract[data-glass="liquid"] .card.lg-busy {
  background:
    linear-gradient(180deg, rgba(255,255,255,.30) 0%, rgba(255,255,255,.08) 9%, rgba(255,255,255,0) 22%, rgba(255,255,255,0) 80%, rgba(255,255,255,.07) 92%, rgba(255,255,255,.22) 100%),
    var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(150%); -webkit-backdrop-filter: blur(var(--blur)) saturate(150%);
  isolation: isolate;
}
.lg-refract[data-glass="liquid"] .card.lg-busy::before, .lg-refract[data-glass="liquid"] .card.lg-busy > .lg-tint { display: none; }