/* 既読のまま、何分待つ？ — 色はすべてCSS変数 */
:root {
  --accent: #5b4bd6; --accent-ink: #ffffff; --accent-soft: #e9e6ff;
  --app: #2a2350; --app-ink: #f6f3ff; --scr: #f6f3ff; --b-in: #ffffff; --b-in-line: #d9d2ff; --b-out: #ffd36e; --b-out-ink: #2a2350;
  --skin: #f3cfb0; --ink-face: #2a2a2a; --glass: rgba(255, 255, 255, .4);
  --p0: #ffd36e; --p1: #ff9db5; --p2: #8fb3ff; --p3: #9ad8b5; --hair: #3a2e2a; --read: #8a80b8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #a99cff; --accent-ink: #17132e; --accent-soft: #2b2652;
    --app: #17132e; --scr: #1d1936; --b-in: #2a2550; --b-in-line: #3c3670; --b-out: #e6b94d; --b-out-ink: #1b1636; --read: #a99cff;
  }
}
:root[data-theme="dark"] {
  --accent: #a99cff; --accent-ink: #17132e; --accent-soft: #2b2652;
  --app: #17132e; --scr: #1d1936; --b-in: #2a2550; --b-in-line: #3c3670; --b-out: #e6b94d; --b-out-ink: #1b1636; --read: #a99cff;
}

/* 顔 */
.kd-face { width: 100%; height: 100%; display: block; }
.kd-bgc { fill: var(--p0); } .kd-p1 .kd-bgc { fill: var(--p1); } .kd-p2 .kd-bgc { fill: var(--p2); } .kd-p3 .kd-bgc { fill: var(--p3); }
.kd-skin { fill: var(--skin); } .kd-hair { fill: var(--hair); } .kd-hairline { stroke: var(--hair); stroke-width: 3; fill: none; stroke-linecap: round; }
.kd-glass { fill: var(--glass); stroke: var(--hair); stroke-width: 2; }
.kd-eye { fill: var(--ink-face); } .kd-mouth { stroke: var(--ink-face); stroke-width: 2.4; fill: none; stroke-linecap: round; }

/* スタートの絵 */
.kd-hero { text-align: center; }
.kd-art { width: 100%; max-width: 340px; height: auto; }
.kd-a-phone { fill: var(--app); } .kd-a-scr { fill: var(--scr); } .kd-a-bar { fill: var(--accent); }
.kd-a-bart { fill: var(--accent-ink); font-size: 11px; font-weight: 800; }
.kd-a-bin { fill: var(--b-in); stroke: var(--b-in-line); stroke-width: 1.5; } .kd-a-bout { fill: var(--b-out); }
.kd-a-t { fill: var(--text); font-size: 10px; font-weight: 700; } .kd-a-to { fill: var(--b-out-ink); font-size: 10px; font-weight: 700; }
.kd-a-read { fill: var(--read); font-size: 9px; font-weight: 700; }
.kd-a-dot { fill: var(--accent); animation: kd-dot 1.2s infinite; } .kd-d2 { animation-delay: .2s; } .kd-d3 { animation-delay: .4s; }
.kd-a-clock { fill: var(--surface); } .kd-a-rim { fill: none; stroke: var(--accent); stroke-width: 6; }
.kd-a-hand { stroke: var(--text); stroke-width: 4; stroke-linecap: round; } .kd-a-pin { fill: var(--text); }
.kd-a-min { transform-origin: 262px 96px; animation: kd-spin 5s linear infinite; }
.kd-a-cap { fill: var(--text-sub); font-size: 13px; font-weight: 800; }
.kd-a-heart { fill: none; stroke: var(--p1); stroke-width: 5; stroke-linecap: round; } .kd-a-lines { stroke: var(--line); stroke-width: 4; stroke-linecap: round; }
.kd-a-in { animation: kd-pop 3s infinite; }
@keyframes kd-spin { to { transform: rotate(360deg); } }
@keyframes kd-dot { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes kd-pop { 0%, 10% { opacity: 0; } 20%, 100% { opacity: 1; } }

/* プレイ */
.kd-play > * + * { margin-top: 10px; }
.kd-apphead { display: flex; align-items: center; gap: 8px; background: var(--app); color: var(--app-ink); border-radius: 14px; padding: 8px 14px; }
.kd-appname { font-weight: 900; letter-spacing: .1em; }
.kd-apptag { font-size: 11px; border: 1px solid currentColor; border-radius: 99px; padding: 0 8px; opacity: .8; }
.kd-count { color: var(--app-ink); opacity: .9; }
.kd-prog { height: 6px; }
.kd-meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.kd-meter { display: flex; gap: 6px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; min-width: 0; transition: border-color .2s; }
.kd-meter.kd-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.kd-meter-face { width: 28px; height: 28px; flex: none; }
.kd-meter-body { flex: 1; min-width: 0; }
.kd-meter-n { font-size: 12px; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd-meter-bar { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.kd-meter-bar > i { display: block; height: 100%; background: var(--p1); border-radius: 99px; transition: width .5s; }
.kd-meter-bar.kd-low > i { background: var(--bad); }
.kd-meter-top { display: flex; gap: 4px; align-items: baseline; min-width: 0; }
.kd-meter-top .kd-meter-n { flex: 1; min-width: 0; }
.kd-meter-delta { flex: none; font-size: 12px; font-weight: 900; }
.kd-up { color: var(--good); } .kd-down { color: var(--bad); }
.kd-phone { background: var(--scr); border: 6px solid var(--app); border-radius: 22px; overflow: hidden; }
.kd-chat { min-height: 250px; max-height: 46vh; overflow-y: auto; padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.kd-chathead { display: flex; gap: 8px; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--b-in-line); }
.kd-chathead small { display: block; color: var(--text-sub); font-size: 12px; line-height: 1.3; }
.kd-chathead b { line-height: 1.3; }
.kd-date { align-self: center; font-size: 12px; color: var(--text-sub); background: var(--surface-2); border-radius: 99px; padding: 1px 10px; }
.kd-av { width: 34px; height: 34px; flex: none; display: inline-block; }
.kd-row { display: flex; gap: 6px; align-items: flex-end; max-width: 88%; animation: mn-in .3s ease-out; }
.kd-in { align-self: flex-start; } .kd-out { align-self: flex-end; flex-direction: row-reverse; }
.kd-bwrap { display: flex; flex-direction: column; min-width: 0; }
.kd-out .kd-bwrap { align-items: flex-end; }
.kd-who { font-size: 11px; color: var(--text-sub); margin-left: 4px; }
.kd-bubble { padding: 8px 12px; border-radius: 16px; line-height: 1.55; font-size: 15px; }
.kd-in .kd-bubble { background: var(--b-in); border: 1.5px solid var(--b-in-line); border-bottom-left-radius: 4px; }
.kd-out .kd-bubble { background: var(--b-out); color: var(--b-out-ink); border-bottom-right-radius: 4px; font-weight: 600; }
.kd-sub { font-size: 11px; color: var(--read); margin: 2px 4px 0; }
.kd-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.kd-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: kd-dot 1s infinite; }
.kd-typing i:nth-child(2) { animation-delay: .15s; } .kd-typing i:nth-child(3) { animation-delay: .3s; }
.kd-wait { align-self: center; display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-sub); }
.kd-wait-ic { width: 20px; height: 20px; }
.kd-wc { fill: none; stroke: var(--accent); stroke-width: 2; } .kd-wh { stroke: var(--text-sub); stroke-width: 2; stroke-linecap: round; }
.kd-wspin { transform-origin: 12px 12px; animation: kd-spin 1s linear infinite; }
.kd-action { align-self: center; font-size: 13px; color: var(--text-sub); text-align: center; background: var(--surface-2); border-radius: 10px; padding: 6px 10px; }
.kd-ctrl > * + * { margin-top: 10px; }
.kd-q { font-weight: 800; margin: 4px 0 0; }
.kd-read { display: inline-block; font-size: 12px; color: var(--accent-ink); background: var(--read); border-radius: 6px; padding: 0 6px; vertical-align: 2px; }
.kd-times { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kd-time { text-align: left; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; min-height: 56px; }
.kd-time b { display: block; line-height: 1.3; } .kd-time small { color: var(--text-sub); font-size: 12px; }
.kd-time:hover { border-color: var(--accent); }
.kd-time-skip { grid-column: 1 / -1; border-style: dashed; }
.kd-note { background: var(--warn-soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.kd-note-bad { background: var(--bad-soft); }
.kd-note b { display: block; } .kd-note p { margin: 0; }

/* 結果 */
.kd-type { font-size: clamp(30px, 9vw, 44px); font-weight: 900; color: var(--accent); line-height: 1.25; margin: 4px 0 10px; }
.kd-final { display: grid; gap: 8px; margin-top: 8px; }
.kd-final-row { display: grid; grid-template-columns: 34px 64px minmax(0, 1fr) 36px; gap: 8px; align-items: center; }
.kd-final-n { font-size: 14px; font-weight: 700; }
.kd-final-bar { height: 10px; }
.kd-final-row > b { text-align: right; }
.kd-match { font-size: 24px; color: var(--accent); }
.kd-cmp-list { padding-left: 0; list-style: none; margin: 8px 0; }
.kd-cmp-list li { border-top: 1px solid var(--line); padding: 6px 0; display: grid; gap: 0 8px; grid-template-columns: auto minmax(0, 1fr); }
.kd-cmp-who { font-weight: 700; }
.kd-cmp-msg { color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd-cmp-v { grid-column: 1 / -1; }
.kd-zukan { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
