/* Conduit Safety Layer styles. Self-contained; var() fallbacks so it works
   in any of the three apps. */

/* Cover screen — looks like a plain desk clock, nothing Conduit about it. */
html.cs-hidden { overflow: hidden; }
#cs-cover {
  position: fixed; inset: 0; z-index: 2147483646;
  display: none; align-items: center; justify-content: center;
  background: #0b0d10; color: #f4f6f8;
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}
#cs-cover.on { display: flex; }
@media (prefers-color-scheme: light) { #cs-cover { background: #f3f4f6; color: #111; } }
.cs-clock { text-align: center; user-select: none; }
.cs-time { font-size: clamp(3rem, 14vw, 9rem); font-weight: 200; letter-spacing: .02em; }
.cs-date { font-size: clamp(1rem, 3vw, 1.6rem); opacity: .65; margin-top: .3rem; }
.cs-back {
  position: fixed; right: 14px; bottom: 12px; width: 30px; height: 30px;
  border: none; border-radius: 50%; background: transparent; color: inherit;
  opacity: .18; font-size: 1.4rem; cursor: pointer; line-height: 1;
}
.cs-back:hover { opacity: .5; }

/* Floating safety chip */
#cs-chip {
  position: fixed; left: 14px; bottom: 14px; z-index: 2147483640;
  display: flex; align-items: center; gap: 8px;
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}
#cs-chip .cs-hide {
  background: var(--c-danger, var(--danger, #c8102e)); color: #fff; border: none;
  font-weight: 700; font-size: .8rem; padding: 7px 13px; border-radius: 999px;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
#cs-chip .cs-hide:hover { filter: brightness(1.08); }
#cs-chip .cs-dots {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(10,49,97,.25);
  background: var(--surface, var(--c-surface, #fff));
  color: var(--brand, var(--c-primary, var(--primary, #0a3161)));
  font-size: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
#cs-chip .cs-menu {
  display: none; flex-direction: column; gap: 2px; position: absolute;
  left: 0; bottom: 44px; background: var(--surface, #fff);
  border: 1px solid rgba(10,49,97,.18); border-radius: 10px; padding: 6px;
  box-shadow: 0 8px 26px rgba(10,24,51,.18); min-width: 190px;
}
#cs-chip.open .cs-menu { display: flex; }
#cs-chip .cs-menu button {
  background: none; border: none; text-align: left; padding: 8px 10px;
  border-radius: 7px; cursor: pointer; font-size: .9rem;
  color: var(--ink, var(--c-text, var(--text, #0b1b33)));
}
#cs-chip .cs-menu button:hover { background: rgba(10,49,97,.07); }

/* Modal */
.cs-modal {
  position: fixed; inset: 0; z-index: 2147483645; display: flex;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(7,18,38,.5);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.cs-card {
  background: var(--surface, #fff); color: var(--ink, var(--c-text, #0b1b33));
  border-radius: 14px; padding: 22px 24px; max-width: 440px; width: 100%;
  position: relative; box-shadow: 0 18px 50px rgba(7,18,38,.35);
  border-top: 4px solid var(--accent, var(--c-accent, #b31942));
}
.cs-card h3 { margin: 0 0 10px; font-size: 1.15rem; }
.cs-x {
  position: absolute; top: 10px; right: 12px; border: none; background: none;
  font-size: 1.4rem; cursor: pointer; color: #8893a6; line-height: 1;
}
.cs-muted { color: var(--soft, var(--c-text-secondary, #51607a)); font-size: .88rem; }
.cs-list { margin: .3rem 0 0; padding-left: 1.1rem; }
.cs-list li { margin: .45rem 0; font-size: .92rem; }
.cs-fp {
  font-family: ui-monospace, Menlo, monospace; font-size: 1.35rem; font-weight: 700;
  letter-spacing: .04em; text-transform: capitalize; text-align: center;
  background: var(--brand-soft, var(--c-primary-soft, var(--primary-soft, #e7edf8)));
  color: var(--brand, var(--c-primary, var(--primary, #0a3161)));
  border-radius: 10px; padding: .7rem 1rem; margin: .4rem 0 .7rem;
}
.cs-canary { margin-top: .8rem; font-size: .85rem; }
.cs-canary.cs-ok { color: var(--ok, var(--c-success, #15803d)); }
.cs-canary.cs-warn { color: var(--danger, var(--c-danger, #c8102e)); font-weight: 600; }
.cs-modal select { width: 100%; padding: 9px 10px; border-radius: 8px;
  border: 1px solid var(--line, var(--c-border, #dde3ee)); font: inherit; margin: .3rem 0; }

/* Offline indicator */
#cs-offline {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147483641;
  display: none; padding: 8px 14px; text-align: center; font-size: .82rem;
  background: var(--warn-bg, var(--c-warn-bg, #fbf7ee));
  color: var(--warn-text, var(--c-warn-text, #6b5318));
  border-top: 1px solid var(--warn-line, var(--c-warn-line, #ecdcb6));
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
}
#cs-offline.on { display: block; }

/* American flag — gentle wave, respects reduced motion */
.us-flag {
  border-radius: 2px; box-shadow: 0 1px 3px rgba(10,24,51,.25);
  transform-origin: left center; will-change: transform;
}
.us-flag-inline {
  display: inline-block; vertical-align: middle; margin-left: 12px;
  animation: us-wave 6s ease-in-out infinite;
}
.us-flag-fixed {
  position: fixed; top: 10px; right: 12px; z-index: 2147483639; width: 52px; height: auto;
  animation: us-wave 6s ease-in-out infinite;
}
@keyframes us-wave {
  0%,100% { transform: perspective(120px) rotateY(0deg) skewY(0deg); }
  25%     { transform: perspective(120px) rotateY(-7deg) skewY(0.8deg); }
  60%     { transform: perspective(120px) rotateY(6deg) skewY(-0.8deg); }
}
@media (prefers-reduced-motion: reduce) { .us-flag { animation: none; } }
