/* Flint — stylesheet
   Organized by section: shell/nav, screen/cards, sphere view, composer/modals,
   loading state, and a mobile breakpoint at the bottom. */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ---- shell ---- */
#app {
  all: initial; display: block; font-family: 'Space Grotesk', sans-serif;
  background: #14171b; color: #ece6d9; min-height: 100vh; position: relative;
  -webkit-font-smoothing: antialiased;
}
#app * { box-sizing: border-box; }
#app button:focus-visible, #app input:focus-visible, #app textarea:focus-visible {
  outline: 2px solid #f2a93b; outline-offset: 2px;
}

/* ---- loading state ---- */
.loadingScreen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; background: #14171b; color: #f2a93b; z-index: 200;
}
.loadingScreen svg { animation: loadingPulse 1.1s ease-in-out infinite; }
.loadingScreen span { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #7a8189; }
@keyframes loadingPulse { 0%, 100% { opacity: .35; transform: scale(.92); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .loadingScreen svg { animation: none; } }

/* ---- topbar / nav ---- */
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 18px; padding: 14px 20px; background: #181c21; border-bottom: 1px solid #2b3138; }
.brand { font-weight: 700; font-size: 17px; color: #ffe3ae; display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.brand svg { color: #f2a93b; }
.navtabs { display: flex; gap: 4px; background: #1d2126; padding: 3px; border-radius: 8px; border: 1px solid #2b3138; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.navtabs::-webkit-scrollbar { display: none; }
.navtabs button { border: none; background: transparent; color: #9aa3ac; padding: 7px 13px; border-radius: 6px; font-family: 'Space Grotesk'; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.navtabs button.active { background: #262b31; color: #ece6d9; }
.navtabs button:hover:not(.active) { color: #ece6d9; }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #7a8189; flex-shrink: 0; }
.who input { background: #262b31; border: 1px solid #343b42; color: #ece6d9; border-radius: 6px; padding: 5px 9px; font-size: 12px; font-family: 'IBM Plex Mono', monospace; width: 110px; }

/* ---- screens / cards ---- */
.content { padding: 22px 24px 100px; max-width: 760px; margin: 0 auto; }
.explainer { border: 1px solid #2b3138; background: #1a1e23; border-radius: 12px; padding: 16px 18px; margin-bottom: 20px; font-size: 12.5px; color: #b7c0c8; line-height: 1.55; }
.explainer b { color: #ffe3ae; }
.explainer b.ask { color: #8fe0d4; }
.searchRow { margin-bottom: 18px; }
.searchRow input { width: 100%; background: #1d2126; border: 1px solid #343b42; color: #ece6d9; border-radius: 8px; padding: 11px 14px; font-size: 14px; font-family: 'Space Grotesk'; }
.screenTitle { font-size: 13px; color: #7a8189; font-family: 'IBM Plex Mono', monospace; margin: 0 0 14px; text-transform: uppercase; letter-spacing: .05em; }
.card { background: #1d2126; border: 1px solid #2b3138; border-radius: 12px; padding: 15px 17px; margin-bottom: 10px; cursor: pointer; transition: border-color .15s, transform .1s; }
.card:hover { border-color: #45b3a6; }
.card:active { transform: scale(0.995); }
.cardTop { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cardTitle { font-size: 15px; font-weight: 600; color: #ece6d9; margin: 0; }
.activityBadge { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; padding: 3px 9px; border-radius: 5px; white-space: nowrap; flex-shrink: 0; }
.activityBadge.active { background: rgba(242,169,59,0.2); color: #ffcf85; border: 1px solid rgba(242,169,59,0.5); }
.activityBadge.quiet { background: rgba(180,180,180,0.08); color: #6b737c; border: 1px solid #2b3138; }
.cardMeta { display: flex; gap: 10px; margin-top: 9px; font-size: 11.5px; color: #7a8189; font-family: 'IBM Plex Mono', monospace; flex-wrap: wrap; align-items: center; }
.tagChip { background: #262b31; padding: 2px 8px; border-radius: 4px; }
.linkedList { margin-top: 8px; font-size: 12px; color: #b7c0c8; }
.linkedList span { display: inline-block; background: #262b31; padding: 2px 8px; border-radius: 4px; margin: 2px 4px 0 0; transition: background .15s; }
.linkedList span:hover { background: #2f3640; }
.emptyState { border: 1px dashed #343b42; border-radius: 12px; padding: 34px 20px; text-align: center; color: #7a8189; font-size: 13px; }
.emptyState strong { display: block; color: #ece6d9; font-size: 15px; margin-bottom: 6px; }

/* ---- sphere view ---- */
.sphereWrap { position: relative; height: calc(100vh - 60px); }
.stage { position: absolute; inset: 0; perspective: 1100px; cursor: grab; touch-action: none; }
.stage.dragging { cursor: grabbing; }
.globe { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.tile { position: absolute; left: 0; top: 0; height: 72px; backface-visibility: hidden; display: flex; align-items: center; justify-content: center; padding: 5px 9px; border-radius: 11px; border: 1.5px solid transparent; text-align: center; white-space: normal; word-wrap: break-word; line-height: 1.22; font-size: 11px; pointer-events: auto; cursor: pointer; transition: border-color .15s, filter .15s, background .4s; }
.tile.spark { background: rgba(242,169,59,0.17); border-color: rgba(242,169,59,0.6); color: #ffe3ae; font-weight: 500; }
.tile.ask { background: rgba(69,179,166,0.24); border-color: rgba(69,179,166,0.85); color: #dff7f2; font-weight: 700; }
.tile.filler { background: rgba(242,169,59,0.06); border-color: rgba(242,169,59,0.22); color: rgba(255,223,166,0.5); font-size: 10px; font-weight: 400; text-transform: lowercase; }
.tile:hover, .tile.selected { filter: brightness(1.2); border-color: #ffffff; }
.tile.justAdded { animation: pop 1.4s ease; }
@keyframes pop { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.7); } 100% { box-shadow: 0 0 0 22px rgba(255,255,255,0); } }
.backBtn { position: absolute; top: 14px; left: 18px; z-index: 6; background: #1d2126; border: 1px solid #343b42; color: #ece6d9; border-radius: 7px; padding: 7px 13px; font-size: 12.5px; font-family: 'Space Grotesk'; cursor: pointer; }
.pinBtn { position: absolute; top: 14px; right: 18px; z-index: 6; background: #262b31; border: 1px solid #45b3a6; color: #8fe0d4; border-radius: 7px; padding: 7px 13px; font-size: 12.5px; font-family: 'Space Grotesk'; cursor: pointer; }
.noSparksBanner { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); background: #1d2126; border: 1px solid #343b42; border-radius: 10px; padding: 10px 18px; font-size: 12.5px; color: #b7c0c8; z-index: 6; text-align: center; max-width: 320px; }
.hint { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); font-size: 12px; color: #7a8189; font-family: 'IBM Plex Mono', monospace; pointer-events: none; transition: opacity .6s; z-index: 5; }
.coords { position: absolute; bottom: 20px; left: 18px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #6b737c; z-index: 5; }
.panel { position: absolute; bottom: 0; left: 0; right: 0; background: #1d2126; border-top: 1px solid #343b42; padding: 16px 20px 18px; transform: translateY(100%); transition: transform .25s ease; z-index: 10; }
.panel.open { transform: translateY(0); }
.panel .close { background: none; color: #7a8189; border: none; float: right; cursor: pointer; font-size: 12px; font-family: 'Space Grotesk'; }
.panel h4 { margin: 0 0 6px; font-size: 15px; }
.panel p { margin: 0; font-size: 13px; color: #b7c0c8; line-height: 1.5; max-width: 560px; }

/* ---- composer / modals ---- */
.fab { position: fixed; right: 22px; bottom: 22px; width: 56px; height: 56px; border-radius: 50%; background: #45b3a6; color: #04211d; border: none; font-size: 28px; font-weight: 700; cursor: pointer; z-index: 40; display: flex; align-items: center; justify-content: center; line-height: 1; transition: filter .15s, transform .1s; }
.fab:hover { filter: brightness(1.08); }
.fab:active { transform: scale(0.95); }
.overlay { position: fixed; inset: 0; background: rgba(8,10,12,0.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: #1d2126; border: 1px solid #343b42; border-radius: 14px; width: 100%; max-width: 440px; padding: 22px; max-height: 86vh; overflow-y: auto; }
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .sub { margin: 0 0 16px; font-size: 12.5px; color: #9aa3ac; font-style: italic; }
.typeToggle { display: flex; gap: 8px; margin-bottom: 14px; }
.typeToggle button { flex: 1; padding: 9px; border-radius: 8px; border: 1px solid #343b42; background: transparent; color: #9aa3ac; font-family: 'Space Grotesk'; font-weight: 600; font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.typeToggle button.active.spark { background: rgba(242,169,59,0.22); border-color: #f2a93b; color: #ffe3ae; }
.typeToggle button.active.ask { background: rgba(69,179,166,0.22); border-color: #45b3a6; color: #dff7f2; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 10.5px; font-family: 'IBM Plex Mono', monospace; color: #7a8189; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.field input, .field textarea { width: 100%; background: #262b31; border: 1px solid #343b42; color: #ece6d9; border-radius: 6px; padding: 9px 11px; font-size: 13px; font-family: 'Space Grotesk'; }
.field textarea { min-height: 64px; resize: vertical; }
.modalActions { display: flex; gap: 10px; margin-top: 16px; }
.btnGhost { background: none; border: 1px solid #343b42; color: #9aa3ac; border-radius: 7px; padding: 9px 16px; font-size: 13px; cursor: pointer; font-family: 'Space Grotesk'; transition: border-color .15s, color .15s; }
.btnGhost:hover { border-color: #6b737c; color: #ece6d9; }
.btnPrimary { border: none; border-radius: 7px; padding: 9px 16px; font-size: 13px; font-weight: 600; flex: 1; cursor: pointer; font-family: 'Space Grotesk'; transition: filter .15s; }
.btnPrimary:hover { filter: brightness(1.08); }
.btnPrimary.spark { background: #f2a93b; color: #2b1c04; }
.btnPrimary.ask { background: #45b3a6; color: #04211d; }
.pickList { display: flex; flex-direction: column; gap: 7px; max-height: 220px; overflow-y: auto; margin-top: 6px; }
.pickOption { border: 1px solid #343b42; border-radius: 7px; padding: 9px 12px; font-size: 13px; text-align: left; background: #262b31; color: #ece6d9; cursor: pointer; transition: border-color .15s; }
.pickOption:hover { border-color: #f2a93b; }
.pickOption.selected { border-color: #f2a93b; background: #33291a; }
.errBanner { position: fixed; top: 0; left: 0; right: 0; background: #4a1616; color: #ffc9c9; font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; padding: 10px 16px; z-index: 100; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.errBanner button { background: none; border: 1px solid #7a3030; color: #ffc9c9; border-radius: 5px; padding: 3px 10px; font-size: 11px; cursor: pointer; font-family: 'Space Grotesk'; }

/* ---- mobile ---- */
@media (max-width: 640px) {
  .topbar { padding: 10px 12px; gap: 10px; flex-wrap: nowrap; }
  .brand span, .brand { font-size: 15px; }
  .navtabs button { padding: 6px 10px; font-size: 12px; }
  .who { display: none; }
  .content { padding: 16px 14px 90px; }
  .explainer { padding: 13px 14px; font-size: 12px; }
  .fab { right: 14px; bottom: 14px; width: 50px; height: 50px; font-size: 24px; }
  .modal { padding: 16px; max-width: 100%; }
  .coords { display: none; }
  .backBtn, .pinBtn { padding: 6px 10px; font-size: 11.5px; }
  .noSparksBanner { top: 52px; max-width: 260px; font-size: 11.5px; }
}
