/* The Kipster iPhone app (Obsidian, the default theme) in an iPhone 17 Pro, scoped under .ki.
   Authored at the phone's point size (402 x 874) and scaled to fit its container.
   Values follow kipster-ios Kipster/DesignSystem and Features. */
.ki-wrap { position: relative; width: 100%; display: flex; justify-content: center; touch-action: pan-y; }
.ki-scale { position: absolute; top: 0; left: 50%; transform-origin: 0 0; }
.ki {
  --text: #f5f5f7;
  --text-2: rgba(245, 245, 247, 0.72);
  --text-3: rgba(245, 245, 247, 0.5);
  --surface: #0a0a0c;
  --edge: rgba(255, 255, 255, 0.15);
  --sep: rgba(255, 255, 255, 0.1);
  --working: #dfe3ff;
  --needs: #ff9f0a;
  --bubble: rgba(255, 255, 255, 0.08);
  --glass: rgba(255, 255, 255, 0.075);
  --glass-rim: inset 0 0.5px 0 rgba(255, 255, 255, 0.28), inset 0 0 0 0.5px rgba(255, 255, 255, 0.14);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Helvetica Neue', sans-serif;
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1.05);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  width: 430px; height: 902px;
  font: 400 17px/1.29 var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-align: left;
  user-select: none; -webkit-user-select: none;
}
.ki *, .ki *::before, .ki *::after { box-sizing: border-box; }
:where(.ki) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; -webkit-tap-highlight-color: transparent; }
.ki svg { display: block; }

/* ---------- device ---------- */
.ki-frame { position: absolute; inset: 0; border-radius: 70px; padding: 4px; background: linear-gradient(145deg, #c9c9ce, #6e6e74 30%, #3a3a3e 55%, #8d8d93 80%, #4a4a4f); box-shadow: 0 40px 90px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.ki-bezel { position: absolute; inset: 4px; border-radius: 66px; background: #000; padding: 10px; box-shadow: inset 0 0 0 1.5px #1c1c1e; }
.ki-btn { position: absolute; width: 4px; border-radius: 2px; background: linear-gradient(90deg, #4a4a4f, #8d8d93); }
.ki-btn.l1 { left: -3px; top: 168px; height: 32px; }
.ki-btn.l2 { left: -3px; top: 222px; height: 62px; }
.ki-btn.l3 { left: -3px; top: 296px; height: 62px; }
.ki-btn.r1 { right: -3px; top: 248px; height: 96px; background: linear-gradient(270deg, #4a4a4f, #8d8d93); }
.ki-screen { position: relative; width: 402px; height: 874px; border-radius: 56px; overflow: hidden; background: #000; isolation: isolate; }

/* ---------- scenery (Obsidian) ---------- */
.ki-scenery { position: absolute; inset: 0; z-index: 0; background: #000; }
.ki-scenery::before { content: ''; position: absolute; inset: 0; background: url('assets/scenery-obsidian.jpg') center / cover; }
.ki-scenery::after { content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.075) 1.1px, transparent 1.4px) 7px 7px / 14px 14px,
    radial-gradient(55% 45% at 18% 100%, rgba(255, 255, 255, 0.12), transparent 72%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.3) 70%, rgba(0, 0, 0, 0.45)); }

/* ---------- status bar and Dynamic Island ---------- */
.ki-status { position: absolute; z-index: 30; top: 0; left: 0; right: 0; height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 6px 30px 0 46px; font-weight: 600; font-size: 17px; transition: opacity 0.3s; pointer-events: none; }
.ki-status.hide { opacity: 0; }
.ki-status .icons { display: flex; align-items: center; gap: 6px; }
.ki-status svg { fill: #fff; }
.ki-island { position: absolute; z-index: 31; top: 11px; left: 50%; width: 126px; height: 37px; transform: translateX(-50%); border-radius: 20px; background: #000; overflow: hidden; transition: width 0.55s var(--spring); }
.ki-island.on { width: 292px; }
.ki-island canvas { position: absolute; left: 14px; top: 8px; opacity: 0; transition: opacity 0.3s 0.15s; }
.ki-island .word { position: absolute; right: 16px; top: 0; line-height: 37px; font-size: 15px; font-weight: 600; color: var(--working); opacity: 0; transition: opacity 0.3s 0.15s, color 0.3s; white-space: nowrap; }
.ki-island.on canvas, .ki-island.on .word { opacity: 1; }
.ki-island.wait .word { color: var(--needs); }

/* ---------- top bar ---------- */
.ki-top { position: absolute; z-index: 20; top: 0; left: 0; right: 0; padding: 58px 16px 10px; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.92) 70%, rgba(0, 0, 0, 0)); }
.ki-glass { background: var(--glass); box-shadow: var(--glass-rim); backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6); }
.ki-who { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 5px 16px 5px 5px; border-radius: 999px; }
.ki-av { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10.2px; background: #0a0a0c; box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.14); }
.ki-av svg { width: 23px; height: 23px; }
.ki-who b { display: block; font-size: 17px; font-weight: 600; line-height: 20px; }
.ki-who small { display: block; font-size: 12px; font-weight: 600; line-height: 15px; color: var(--text-2); transition: color 0.3s; }
.ki-who small.wait { color: var(--needs); }
.ki-who small:empty { display: none; }
.ki-gear { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; }
.ki-gear svg { width: 21px; height: 21px; fill: none; stroke: var(--text); stroke-width: 1.7; }

/* ---------- task feed ---------- */
.ki-feed { position: absolute; z-index: 1; left: 0; right: 0; top: 112px; bottom: 156px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 0 16px 6px; }
.ki-day { align-self: center; height: 26px; padding: 0 12px; display: grid; place-items: center; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 0.5px var(--edge), 0 2px 6px rgba(0, 0, 0, 0.3); font-size: 13px; font-weight: 600; margin: 6px 0 0; flex: none; }
.ki-card { flex: none; position: relative; padding: 16px; border-radius: 22px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge); cursor: pointer; transition: box-shadow 0.35s; }
.ki-card.needs { box-shadow: inset 0 0 0 1.5px rgba(255, 159, 10, 0.75); }
.ki-card.fresh { animation: ki-up 0.55s var(--spring) both; }
@keyframes ki-up { from { opacity: 0; transform: translateY(40px); } }
.ki-row { display: flex; align-items: baseline; gap: 8px; }
.ki-row .t { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; line-height: 22px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ki-row time { flex: none; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ki-dot { position: relative; flex: none; width: 16px; height: 16px; align-self: center; }
.ki-dot::before, .ki-dot::after { content: ''; position: absolute; border-radius: 50%; background: var(--working); }
.ki-dot::before { inset: 0; opacity: 0.25; animation: ki-breathe 2.8s ease-in-out infinite; }
.ki-dot::after { inset: 4px; animation: ki-breathe 2.8s ease-in-out infinite; box-shadow: 0 0 6px rgba(223, 227, 255, 0.7); }
@keyframes ki-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.ki-stop { flex: none; align-self: center; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.ki-stop i { width: 9px; height: 9px; border-radius: 2px; background: var(--text); }
.ki-sub { margin-top: 8px; font-size: 15px; line-height: 20px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ki-shimmer { background: linear-gradient(90deg, var(--text-2) 0%, var(--text-2) 35%, var(--text) 50%, var(--text-2) 65%, var(--text-2) 100%) 0 0 / 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: ki-sweep 1.6s linear infinite; }
@keyframes ki-sweep { from { background-position: 120% 0; } to { background-position: -100% 0; } }
.ki-ask { margin-top: 8px; display: grid; gap: 10px; }
.ki-ask .ctx { font-size: 15px; line-height: 20px; color: var(--text-2); }
.ki-ask .q { font-size: 20px; font-weight: 600; line-height: 25px; }
.ki-opts { display: grid; gap: 8px; margin-top: 2px; }
.ki-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: 999px; font-size: 17px; font-weight: 600; transition: transform 0.2s var(--spring), background 0.2s, opacity 0.3s; }
.ki-opt:active { transform: scale(0.97); }
.ki-opt svg { width: 18px; height: 18px; flex: none; stroke: var(--text); stroke-width: 2.4; fill: none; }
.ki-opt.chosen svg { stroke-width: 2.6; }
.ki-opt.dim { opacity: 0.4; }

/* ---------- dock ---------- */
.ki-dock { position: absolute; z-index: 20; left: 0; right: 0; bottom: 0; padding: 8px 0 30px; background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.55) 40%); }
.ki-chips { display: flex; gap: 8px; padding: 0 16px; overflow: hidden; white-space: nowrap; }
.ki-chip { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; font-size: 15px; font-weight: 500; }
.ki-chip svg { width: 16px; height: 16px; fill: none; stroke: var(--text); stroke-width: 1.7; }
.ki-compose { display: flex; align-items: flex-end; gap: 10px; padding: 10px 14px 0; }
.ki-plus { width: 50px; height: 50px; flex: none; display: grid; place-items: center; border-radius: 50%; }
.ki-plus svg { width: 20px; height: 20px; stroke: var(--text); stroke-width: 1.8; }
.ki-field { flex: 1; min-width: 0; min-height: 50px; display: flex; align-items: center; gap: 6px; padding: 0 6px 0 18px; border-radius: 25px; }
.ki-field .ph { flex: 1; min-width: 0; font-size: 17px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ki-field .ph.typed { color: var(--text); }
.ki-field .ph.typed::after { content: ''; display: inline-block; width: 2px; height: 20px; margin-left: 1px; vertical-align: -4px; background: var(--text); animation: ki-caret 1s steps(1) infinite; }
@keyframes ki-caret { 50% { opacity: 0; } }
.ki-mic, .ki-send { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; }
.ki-mic svg { width: 19px; height: 19px; fill: none; stroke: var(--text-2); stroke-width: 1.7; }
.ki-send { background: var(--text); animation: ki-pop 0.35s var(--spring) both; }
.ki-send svg { width: 17px; height: 17px; stroke: #000; stroke-width: 2.6; fill: none; }
@keyframes ki-pop { from { transform: scale(0.5); opacity: 0; } }

/* ---------- thread sheet ---------- */
.ki-dim { position: absolute; z-index: 40; inset: 0; background: rgba(0, 0, 0, 0.45); opacity: 0; pointer-events: none; transition: opacity 0.35s; }
.ki.sheet-open .ki-dim { opacity: 1; pointer-events: auto; }
.ki-home { position: absolute; inset: 0; transition: transform 0.45s var(--ease), border-radius 0.45s; transform-origin: 50% 100%; }
.ki-sheet { position: absolute; z-index: 41; left: 0; right: 0; bottom: 0; height: 56%; border-radius: 38px 38px 56px 56px; background: #000; box-shadow: 0 -0.5px 0 rgba(255, 255, 255, 0.18), 0 -10px 40px rgba(0, 0, 0, 0.6); transform: translateY(105%); transition: transform 0.5s var(--spring), height 0.45s var(--ease); display: flex; flex-direction: column; overflow: hidden; }
.ki.sheet-open .ki-sheet { transform: none; }
.ki-sheet.large { height: calc(100% - 64px); }
.ki-grab { flex: none; height: 18px; display: grid; place-items: center; cursor: grab; }
.ki-grab::before { content: ''; width: 36px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.3); }
.ki-sheet-head { flex: none; position: relative; display: grid; justify-items: center; gap: 1px; padding: 0 64px 12px; }
.ki-sheet-head b { max-width: 250px; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ki-sheet-head small { font-size: 12px; font-weight: 500; color: var(--text-2); }
.ki-sheet-head small.wait { color: var(--needs); }
.ki-close { position: absolute; right: 16px; top: -6px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.ki-close svg { width: 15px; height: 15px; stroke: var(--text); stroke-width: 2.4; }
.ki-transcript { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; gap: 16px; padding: 4px 20px 12px; -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 18px); mask-image: linear-gradient(180deg, transparent 0, #000 18px); }
.ki-transcript::-webkit-scrollbar { display: none; }
.ki-transcript > :first-child { margin-top: auto; }
.ki-stamp { align-self: center; font-size: 12px; font-weight: 500; color: var(--text-3); }
.ki-you { align-self: flex-end; max-width: 300px; padding: 10px 15px; border-radius: 21px; background: var(--bubble); box-shadow: inset 0 0 0 1px var(--edge); font-size: 17px; }
.ki-kip { font-size: 17px; line-height: 25px; }
.ki-event { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.ki-event svg { width: 17px; height: 13px; fill: var(--text-2); }
.ki-askcard { padding: 16px; border-radius: 22px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge); display: grid; gap: 12px; }
.ki-askcard.open { background: linear-gradient(rgba(255, 159, 10, 0.12), rgba(255, 159, 10, 0.12)), var(--surface); box-shadow: inset 0 0 0 1px rgba(255, 159, 10, 0.5); }
.ki-askcard .q { font-size: 17px; font-weight: 600; }
.ki-askcard .ki-opt { min-height: 50px; font-weight: 500; }
.ki-working { display: flex; align-items: center; justify-content: space-between; font-size: 17px; }
.ki-sheet .ki-compose { padding: 6px 14px 30px; }
.ki-sheet .fresh { animation: ki-in 0.45s var(--ease) both; }
@keyframes ki-in { from { opacity: 0; transform: translateY(10px); } }

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