/* ============================================================
   DmytroOS — app content (chrome-agnostic: rendered inside a
   desktop window OR an iOS sheet)
   ============================================================ */

/* ---------- column-view shell (App Store browser + More Info) ---------- */

.finder { flex: 1; min-height: 0; display: flex; }

.finder-side {
  flex: 0 0 190px;
  padding: 12px 8px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--separator);
  overflow-y: auto;
}
.fs-title {
  padding: 0 10px 6px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.fs-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 10px;
  border-radius: 7px;
  color: var(--text-1);
  text-align: left;
}
.fs-item svg { width: 16px; height: 16px; color: var(--accent); flex: 0 0 auto; }
.fs-item:hover { background: var(--row-hover); }
.fs-item.is-active { background: var(--selection); }
.fs-count { margin-left: auto; font-size: var(--fs-sm); color: var(--text-3); }

.finder-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.finder-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border-bottom: 1px solid var(--separator);
}
.ft-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  border-radius: var(--r-ctl);
  color: var(--accent);
}
.ft-back:hover { background: var(--ctl-bg); }
.ft-back svg { width: 16px; height: 16px; }
.ft-title { font-weight: 700; font-size: var(--fs-md); }
.ft-count { margin-left: auto; font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; }

.finder-scroll { flex: 1; min-height: 0; overflow-y: auto; }

.finder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 6px;
  padding: 14px;
}
.fg-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 6px 10px;
  border-radius: 10px;
  text-align: center;
}
.fg-item:hover { background: var(--row-hover); }
.fg-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--r-icon);
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.fg-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fg-sub { font-size: var(--fs-xs); color: var(--text-3); }

/* ---------- App Store: sidebar tiles + toolbar search ---------- */

.appstore .fs-title { color: var(--text-2); }
.appstore .fs-item { gap: 9px; }
.as-side-ico {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}
.appstore .as-side-ico svg { width: 13px; height: 13px; color: #fff; }

.as-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--ctl-bg);
  color: var(--text-3);
  max-width: 190px;
  flex: 0 1 auto;
}
.as-search-ico svg { width: 14px; height: 14px; display: block; }
.as-search input {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-body);
  color: var(--text-1);
  background: none;
  border: 0;
}
.as-search input::placeholder { color: var(--text-3); }
.as-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------- App Store: GET pill ---------- */

.as-get {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 5px 16px;
  border-radius: 999px;
  background: var(--ctl-bg);
  color: var(--accent);
  font-weight: 800;
  font-size: var(--fs-body);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.as-get:hover { background: var(--ctl-bg-hover); text-decoration: none; }
.as-get.is-lg { min-width: 96px; padding: 7px 24px; font-size: var(--fs-md); }
.as-get.is-off { color: var(--text-3); cursor: default; }
.as-get.is-off:hover { background: var(--ctl-bg); }

/* ---------- App Store: browse (hero + cards) ---------- */

.as-browse { padding: 16px 18px 22px; }

.as-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 20px 22px;
  margin-bottom: 18px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(120deg, #0a84ff 0%, #6248e6 100%);
  box-shadow: 0 12px 28px rgba(28, 64, 170, .34);
}
.as-hero-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.as-hero-kicker { font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.as-hero-title { font-size: var(--fs-xl); font-weight: 800; line-height: 1.15; }
.as-hero-sub { font-size: var(--fs-body); opacity: .92; }
.as-hero .as-get { margin-top: 11px; align-self: flex-start; background: rgba(255, 255, 255, .92); color: #0a63e6; }
.as-hero .as-get:hover { background: #fff; }
.as-hero-art { width: 96px; height: 96px; border-radius: var(--r-icon); flex: 0 0 auto; object-fit: cover; box-shadow: 0 8px 20px rgba(0, 0, 0, .3); }

.as-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0 26px;
}
.as-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 8px;
  text-align: left;
  border-bottom: 1px solid var(--separator);
}
.as-card:hover { background: var(--row-hover); }
.as-card-icon { width: 60px; height: 60px; border-radius: var(--r-icon); object-fit: cover; flex: 0 0 auto; }
.as-card-text { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.as-card-name { font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-card-sub { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-card-cta { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto; }
.as-card-dl { font-size: 10px; font-weight: 700; color: var(--text-3); }

.as-empty { padding: 32px 4px; color: var(--text-3); text-align: center; }

/* ---------- App Store: product page ---------- */

.as-product { padding: 20px 22px 28px; }
.as-phead { display: flex; gap: 18px; align-items: center; }
.as-picon { width: 110px; height: 110px; border-radius: var(--r-icon); object-fit: cover; flex: 0 0 auto; box-shadow: 0 8px 22px rgba(0, 0, 0, .24); }
.as-pmeta { min-width: 0; flex: 1; }
.as-ptitle { font-size: var(--fs-xxl); font-weight: 800; line-height: 1.12; }
.as-pdev { margin-top: 4px; color: var(--accent); font-size: var(--fs-md); font-weight: 500; }
.as-pcta { margin-top: 14px; }

.as-stats {
  display: flex;
  align-items: stretch;
  margin: 22px 0 4px;
  padding: 6px 0;
  border-top: 1px solid var(--separator);
  border-bottom: 1px solid var(--separator);
  overflow-x: auto;
}
.as-stat { flex: 1; min-width: 80px; padding: 6px 16px; text-align: center; }
.as-stat b { display: block; font-size: var(--fs-lg); font-weight: 800; color: var(--text-2); white-space: nowrap; }
.as-stat span { display: block; margin-top: 3px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); }
.as-stat-div { width: 1px; background: var(--separator); flex: 0 0 auto; margin: 8px 0; }

.as-shots {
  display: flex;
  gap: 12px;
  margin: 20px 0 4px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.as-shots img {
  height: 250px;
  border-radius: 14px;
  flex: 0 0 auto;
  scroll-snap-align: start;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}

.as-h3 { font-size: var(--fs-lg); font-weight: 800; margin: 22px 0 8px; color: var(--text-1); }
.as-desc { max-width: 580px; color: var(--text-1); font-size: var(--fs-md); line-height: 1.55; }

.as-info { display: grid; max-width: 620px; }
.as-info div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--separator); }
.as-info div:last-child { border-bottom: 0; }
.as-info dt { color: var(--text-3); font-weight: 500; flex: 0 0 auto; }
.as-info dd { color: var(--text-1); text-align: right; min-width: 0; }
.as-info dd a { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
.as-info dd a svg { width: 12px; height: 12px; }
.as-info-sep { color: var(--text-3); }

/* ---------- About (About This Mac) ---------- */

.about {
  flex: 1;
  display: flex;
  gap: 26px;
  align-items: center;
  justify-content: center;
  padding: 28px 32px;
  overflow-y: auto;
}
.about-avatar {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.about-name { font-size: var(--fs-xxl); font-weight: 800; line-height: 1.15; }
.about-os { color: var(--text-2); margin-top: 2px; font-size: var(--fs-md); }
.about-specs { margin-top: 14px; display: grid; gap: 4px; font-size: var(--fs-body); }
.about-specs div { display: flex; gap: 8px; }
.about-specs dt { font-weight: 700; color: var(--text-1); white-space: nowrap; }
.about-specs dd { color: var(--text-2); }
.about-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.about-btn {
  padding: 5px 14px;
  border-radius: var(--r-ctl);
  background: var(--ctl-bg);
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
}
.about-btn:hover { background: var(--ctl-bg-hover); text-decoration: none; }
.about-btn.is-primary { background: var(--accent); color: #fff; }
/* green to match the AI Chat icon (g-chat gradient) */
.about-btn.is-chat { background: linear-gradient(#34d399, #0d9488); color: #fff; }
.about-btn.is-chat:hover { filter: brightness(1.06); background: linear-gradient(#34d399, #0d9488); }

/* ---------- More Info (System Settings style — the old site, integrated) ---------- */

.si-content { padding: 20px 24px 28px; }

/* overview */
.si-hero { display: flex; gap: 18px; align-items: center; }
.si-avatar {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .22);
}
.si-name { font-size: var(--fs-xl); font-weight: 800; line-height: 1.15; }
.si-sub { color: var(--text-2); margin-top: 2px; font-size: var(--fs-md); }
.si-tagline { color: var(--text-1); margin-top: 6px; font-style: italic; }
.si-specs { margin-top: 20px; display: grid; gap: 0; }
.si-specs div { display: flex; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--separator); }
.si-specs dt { font-weight: 800; color: var(--text-1); flex: 0 0 64px; }
.si-specs dd { color: var(--text-2); }
.si-lead, .si-about p, .si-asset p { max-width: 600px; }
.si-lead { margin-top: 16px; color: var(--text-1); line-height: 1.55; font-size: var(--fs-md); }
.si-secsub { color: var(--text-2); margin-bottom: 12px; line-height: 1.5; }

/* chips */
.si-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.si-chip {
  padding: 4px 10px; border-radius: 999px; background: var(--ctl-bg);
  font-size: var(--fs-sm); color: var(--text-1); font-weight: 600;
}

/* career timeline */
.si-timeline { display: grid; }
.si-job { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--separator); }
.si-job:last-child { border-bottom: 0; }
.si-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; margin-top: 5px; box-shadow: 0 0 0 3px var(--row-hover); }
.si-jobmain { min-width: 0; }
.si-jobhead { font-size: var(--fs-md); }
.si-jobrole { font-weight: 800; color: var(--text-1); }
.si-jobco { color: var(--text-2); font-weight: 600; }
.si-now { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--selection); color: var(--accent); font-size: var(--fs-xs); font-weight: 700; vertical-align: middle; }
.si-jobmeta { color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; }
.si-points { margin: 8px 0 0; padding-left: 17px; display: grid; gap: 4px; }
.si-points li { color: var(--text-2); line-height: 1.45; list-style: disc; }
.si-joblinks { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.si-joblinks a { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); font-weight: 600; font-size: var(--fs-sm); }
.si-joblinks svg { width: 12px; height: 12px; }

/* list rows (featured / contact) */
.si-list { display: grid; gap: 2px; }
.si-game, .si-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 10px; border-radius: var(--r-ctl); text-align: left; color: var(--text-1);
}
.si-game:hover, .si-row:hover { background: var(--row-hover); text-decoration: none; }
.si-gicon { width: 44px; height: 44px; border-radius: var(--r-icon); object-fit: cover; flex: 0 0 auto; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
.si-gtext { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.si-gname { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-grole { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-gdl { font-size: var(--fs-sm); font-weight: 800; color: var(--accent); flex: 0 0 auto; }
.si-arrow { color: var(--text-3); flex: 0 0 auto; }
.si-arrow svg { width: 15px; height: 15px; display: block; }

/* games grid reuses .finder-grid / .fg-item */
.si-grid { padding: 4px 0 0; }

/* asset store */
.si-asset p { color: var(--text-1); line-height: 1.55; margin-bottom: 12px; }
.si-quote { font-size: var(--fs-md); font-weight: 700; font-style: italic; }
.si-pub { display: flex; align-items: center; gap: 10px; margin: 14px 0 16px; color: var(--text-2); font-weight: 600; }
.si-unity {
  width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  background: var(--text-1); color: var(--win-bg); font-weight: 800; flex: 0 0 auto;
}
.si-asset .about-btn { display: inline-flex; align-items: center; gap: 5px; }
.si-asset .about-btn svg { width: 13px; height: 13px; }

/* about */
.si-about p { color: var(--text-1); line-height: 1.6; margin-bottom: 12px; }

/* ---------- Terminal ---------- */

.terminal {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 20px;
  background: #161620;
  color: #e8e8f0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
}
.term-line { white-space: pre-wrap; word-break: break-word; min-height: 1.6em; }
.term-prompt { color: #34d399; font-weight: 700; }
.term-dim { color: #8b8b9a; }
.term-link { color: #7ab8ff; text-decoration: underline; }
.term-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: #e8e8f0;
  vertical-align: -2px;
  animation: term-blink 1s steps(1) infinite;
}
@keyframes term-blink { 50% { opacity: 0; } }

/* terminal window gets dark chrome in both themes */
.window[data-app="terminal"] .win-titlebar { background: #2a2a36; box-shadow: 0 .5px 0 rgba(255,255,255,.08); }
.window[data-app="terminal"] .win-title { color: #b8b8c4; }
.window[data-app="terminal"].is-active .win-title { color: #ececf4; }
.window[data-app="terminal"] { background: #161620; }

/* ---------- Mail ---------- */

.mail { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
.mail-fields { flex: 0 0 auto; padding: 4px 18px; }
.mail-field {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--separator);
  font-size: var(--fs-body);
}
.mail-field b { color: var(--text-3); font-weight: 600; }
.mail-body { padding: 16px 18px 22px; font-size: var(--fs-md); line-height: 1.6; color: var(--text-1); }
.mail-body p + p { margin-top: 10px; }
.mail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.mail-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--ctl-bg);
  font-weight: 700;
  color: var(--text-1);
}
.mail-btn:hover { background: var(--ctl-bg-hover); text-decoration: none; }
.mail-btn.is-primary { background: var(--accent); color: #fff; }
.mail-btn svg { width: 14px; height: 14px; }
.mail-sig { margin-top: 18px; color: var(--text-2); }

/* ---------- narrow content (iOS sheets / small windows) ---------- */

@media (max-width: 899px) {
  .finder { flex-direction: column; }
  .finder-side {
    flex: 0 0 auto;
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--separator);
    overflow-x: auto;
    overflow-y: hidden;
  }
  .fs-title { display: none; }
  .fs-item { width: auto; white-space: nowrap; border-radius: 999px; padding: 5px 12px; background: var(--ctl-bg); }
  .fs-item.is-active { background: var(--accent); color: #fff; }
  .fs-item.is-active .fs-count { color: rgba(255, 255, 255, .8); }
  .fs-item svg { display: none; }
  .fs-count { margin-left: 4px; }

  /* App Store sidebar collapses to chips like the rest of the shell */
  .appstore .as-side-ico { display: none; }
  .appstore .ft-count { display: none; }

  .as-browse { padding: 12px 14px 20px; }
  /* minmax(0,1fr) — a bare 1fr is minmax(auto,1fr) and the auto floor grows
     the track to the card's nowrap min-content, overflowing narrow screens */
  .as-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .as-hero { padding: 16px 18px; }
  .as-hero-title { font-size: var(--fs-lg); }
  .as-hero-art { width: 76px; height: 76px; }
  .as-search { max-width: 150px; }
  .as-product { padding: 16px; }
  .as-phead { gap: 14px; }
  .as-picon { width: 88px; height: 88px; }
  .as-ptitle { font-size: var(--fs-xl); }
  .as-shots img { height: 200px; }

  .about { flex-direction: column; text-align: center; }
  .about-specs div { justify-content: center; flex-wrap: wrap; }
  .about-actions { justify-content: center; }

  .si-content { padding: 16px; }
  .si-hero { gap: 14px; }
  .si-avatar { width: 68px; height: 68px; }
}

/* ---------- AI Chat ---------- */

.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.chat-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--separator);
}
.chat-head-title { font-weight: 700; color: var(--text-1); }
.chat-head-model {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-3);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ctl-bg);
}
.chat-clear {
  margin-left: auto;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
  padding: 4px 8px;
  border-radius: var(--r-ctl);
}
.chat-clear:hover { background: var(--ctl-bg); }

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-msg { display: flex; }
.chat-msg.is-user { justify-content: flex-end; }
.chat-msg.is-bot, .chat-msg.is-error { justify-content: flex-start; }

.chat-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: var(--fs-md);
  line-height: 1.45;
  color: var(--text-1);
  background: var(--ctl-bg);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.chat-msg.is-user .chat-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.chat-msg.is-bot .chat-bubble { border-bottom-left-radius: 5px; }
.chat-msg.is-error .chat-bubble {
  background: rgba(255, 95, 87, .14);
  color: var(--text-1);
  border: 1px solid rgba(255, 95, 87, .4);
}

.chat-bubble p { margin: 0 0 6px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul { margin: 4px 0; padding-left: 20px; }
.chat-bubble ul:last-child { margin-bottom: 0; }
.chat-bubble li { margin: 2px 0; }
.chat-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.chat-msg.is-bot .chat-bubble a { color: var(--accent); }
.chat-bubble code {
  font-family: var(--font-mono);
  font-size: .9em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--row-hover);
}
.chat-msg.is-user .chat-bubble code { background: rgba(255, 255, 255, .22); }
.chat-bubble pre {
  margin: 6px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--win-chrome);
  overflow-x: auto;
}
.chat-bubble pre code { padding: 0; background: none; font-size: var(--fs-sm); }

/* typing indicator (before the first token) */
.chat-typing { display: inline-flex; gap: 4px; align-items: center; padding: 2px 0; }
.chat-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  animation: chat-bounce 1.2s infinite ease-in-out both;
}
.chat-typing i:nth-child(2) { animation-delay: .16s; }
.chat-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes chat-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* opening choreography: greeting bubble + each suggestion chip fade up into place */
@keyframes chat-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.chat-msg.chat-enter { animation: chat-enter .3s var(--ease-out) both; }
.chat-chip { animation: chat-enter .32s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  .chat-typing i { animation: none; }
  .chat-log { scroll-behavior: auto; }
  .chat-msg.chat-enter, .chat-chip { animation: none; }
}

/* suggestion chips (empty state) */
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 4px; }
.chat-chip {
  font-size: var(--fs-sm);
  color: var(--text-1);
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--ctl-bg);
  border: 1px solid var(--separator);
  text-align: left;
}
.chat-chip:hover { background: var(--ctl-bg-hover); }

.chat-retry {
  display: block;
  margin-top: 8px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
  padding: 5px 12px;
  border-radius: var(--r-ctl);
  background: var(--ctl-bg);
}
.chat-retry:hover { background: var(--ctl-bg-hover); }

.chat-input-row {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--separator);
  background: var(--win-bg);
}
.chat-input {
  flex: 1;
  min-width: 0;
  resize: none;
  max-height: 140px;
  padding: 9px 12px;
  border-radius: 18px;
  border: 1px solid var(--win-border);
  background: var(--ctl-bg);
  color: var(--text-1);
  font-family: var(--font-sys);
  font-size: var(--fs-md);
  line-height: 1.4;
}
.chat-input:focus { outline: none; border-color: var(--accent); background: var(--win-bg); }
.chat-input:disabled { opacity: .6; }
.chat-send {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--accent);
}
.chat-send svg { width: 20px; height: 20px; }
.chat-send:hover { filter: brightness(1.06); }
.chat-send.is-stop { background: var(--tl-close); }

/* iOS: 16px input avoids Safari's focus-zoom; roomier tap targets */
[data-mode="ios"] .chat-input { font-size: 16px; padding: 11px 14px; }
[data-mode="ios"] .chat-send { width: 42px; height: 42px; }
[data-mode="ios"] .chat-bubble { font-size: 16px; }

/* ============================================================
   Canvas apps (Election Night) — shared host rules.
   The bitmap is sized in JS (mountCanvas); the element is just
   pinned to its relatively-positioned stage.
   ============================================================ */
.cv { display: block; }
.elections-stage .cv { position: absolute; top: 0; left: 0; }

/* ---------- Election Night ---------- */
.elections { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.elections-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.elections-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 1px solid var(--separator);
  background: var(--win-bg);
}
.el-controls { display: flex; align-items: center; gap: 8px; }
.el-btn {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--ctl-bg);
  font-weight: 700;
  color: var(--text-1);
  font-size: var(--fs-sm);
}
.el-btn:hover { background: var(--ctl-bg-hover); }
.el-seg { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--ctl-bg); }
.el-seg button { padding: 4px 11px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); }
.el-seg button.is-on { background: var(--accent); color: #fff; }
.el-credit { margin-left: auto; font-size: var(--fs-sm); color: var(--text-3); text-align: right; }
.el-credit span { color: var(--accent); font-weight: 700; }
.el-credit:hover { color: var(--text-1); }

/* ---------- Brick Tower JS (vanilla remake) ---------- */
.bt { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.bt-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
.bt-stage .cv { position: absolute; top: 0; left: 0; }
.bt-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 1px solid var(--separator);
  background: var(--win-bg);
}
.bt-pad { display: flex; align-items: center; gap: 6px; }
.bt-key {
  min-width: 42px;
  padding: 7px 12px;
  border-radius: 12px;
  background: var(--ctl-bg);
  font-weight: 800;
  font-size: 15px;
  color: var(--text-1);
  user-select: none;
  touch-action: none;
}
.bt-key:hover { background: var(--ctl-bg-hover); }
.bt-key:active { transform: translateY(1px); }
.bt-drop { background: var(--accent); color: #fff; font-size: var(--fs-sm); }
.bt-credit { margin-left: auto; font-size: var(--fs-sm); color: var(--text-3); text-align: right; line-height: 1.3; }
.bt-credit span { color: var(--accent); font-weight: 700; display: block; }
.bt-credit:hover { color: var(--text-1); }

/* ---------- Maps: career journey ---------- */
.maps {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* ocean */
  background: linear-gradient(180deg, #a6cdf0 0%, #7fb1e0 100%);
}
:root[data-theme="dark"] .maps { background: linear-gradient(180deg, #102a48 0%, #0a1a30 100%); }
.maps-stage { position: relative; flex: 1; min-height: 0; }
.mp-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mp-grat line { stroke: rgba(255, 255, 255, .35); stroke-width: .5; }
:root[data-theme="dark"] .mp-grat line { stroke: rgba(255, 255, 255, .08); }
/* land */
.mp-land { fill: rgba(74, 124, 96, .58); stroke: rgba(38, 66, 52, .5); stroke-width: .6; }
:root[data-theme="dark"] .mp-land { fill: rgba(150, 180, 158, .20); stroke: rgba(190, 215, 198, .22); }
.mp-route {
  fill: none;
  stroke: #ffd23f;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  filter: drop-shadow(0 0 5px rgba(255, 200, 40, .75));
  transition: stroke-dashoffset 1.6s var(--ease-out);
}
.maps.is-live .mp-route { stroke-dashoffset: 0; }
.mp-plane { fill: #fff; opacity: 0; filter: drop-shadow(0 0 4px #ffd23f); }
.maps.is-live .mp-plane { opacity: 1; transition: opacity .4s ease 1.4s; }
.mp-pin { cursor: pointer; opacity: 0; }
.maps.is-live .mp-pin { opacity: 1; transition: opacity .5s ease 1.2s; }
.mp-pin:focus-visible { outline: none; }
.mp-pin:focus-visible .mp-dot { stroke: #fff; stroke-width: 3; }
.mp-dot { fill: #ffd23f; stroke: #fff; stroke-width: 1.6; }
.mp-pulse {
  fill: #ffd23f;
  opacity: .55;
  animation: mp-pulse 2.2s ease-out infinite;
}
@keyframes mp-pulse { 0% { r: 6; opacity: .55; } 100% { r: 16; opacity: 0; } }
.mp-city {
  fill: #fff;
  font: 800 15px var(--font-sys);
  paint-order: stroke;
  stroke: rgba(4, 16, 36, .6);
  stroke-width: 3px;
}
.maps-legend {
  position: absolute;
  left: 14px;
  bottom: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--glass-border);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-1);
}
.maps-rail {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  border-top: 1px solid var(--separator);
  background: var(--win-bg);
}
.mp-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--ctl-bg);
  color: var(--text-1);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px);
  animation: mp-chip-in .4s var(--ease-out) forwards;
  animation-delay: calc(var(--i) * .06s + .25s);
}
.mp-chip:hover { background: var(--ctl-bg-hover); }
.mp-chip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--job); flex: 0 0 auto; }
.mp-chip-co { font-weight: 700; font-size: var(--fs-sm); }
.mp-chip-yr { font-size: var(--fs-xs); color: var(--text-3); }
@keyframes mp-chip-in { to { opacity: 1; transform: none; } }

.maps-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .32);
  opacity: 0;
  transition: opacity .2s ease;
}
.maps-overlay.is-in { opacity: 1; }
.mp-card {
  width: min(440px, 100%);
  max-height: 88%;
  overflow-y: auto;
  position: relative;
  padding: 20px 22px;
  border-radius: var(--r-panel);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: .5px solid var(--glass-border);
  border-top: 3px solid var(--job);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
  transform: scale(.96);
  transition: transform .22s var(--ease-spring);
}
.maps-overlay.is-in .mp-card { transform: none; }
.mp-card-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--text-3);
}
.mp-card-x:hover { background: var(--ctl-bg); color: var(--text-1); }
.mp-card-head { display: flex; gap: 10px; align-items: flex-start; padding-right: 24px; }
.mp-card-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--job); margin-top: 5px; flex: 0 0 auto; box-shadow: 0 0 0 3px var(--row-hover); }
.mp-card-role { font-weight: 800; font-size: var(--fs-lg); color: var(--text-1); }
.mp-now { margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--selection); color: var(--accent); font-size: var(--fs-xs); font-weight: 700; vertical-align: middle; }
.mp-card-co { color: var(--text-2); font-weight: 600; }
.mp-card-meta { color: var(--text-3); font-size: var(--fs-sm); margin: 8px 0 4px; }
.mp-card-points { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 5px; }
.mp-card-points li { color: var(--text-2); line-height: 1.45; list-style: disc; }
.mp-card-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.mp-card-links a { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); font-weight: 600; font-size: var(--fs-sm); }
.mp-card-links svg { width: 12px; height: 12px; }
.mp-card-actions { margin-top: 16px; }
.mp-cta { padding: 7px 14px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: var(--fs-sm); }
.mp-cta:hover { filter: brightness(1.06); }
