.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
body.grok-page {
  background: #071411;
  color: #e8f6f2;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color-scheme: dark;
}
body.grok-page .top {
  position: sticky;
  background: #071411;
  border-bottom-color: #1e3d36;
  flex-wrap: nowrap;
  gap: 0.65rem;
  overflow: hidden;
}
body.grok-page .top::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 1.6rem;
  pointer-events: none;
  background: linear-gradient(to right, transparent, #071411);
}
body.grok-page .wordmark { color: #e8f6f2; flex: none; }
body.grok-page .tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
}
body.grok-page .tabs::-webkit-scrollbar { display: none; }
body.grok-page .tabs a, body.grok-page .tabs button {
  background: transparent;
  color: #c5e4dc;
  border-color: #2a5a50;
  flex: none;
  white-space: nowrap;
}
body.grok-page .tabs a.on, body.grok-page .tabs button.on {
  background: #49eacb;
  color: #071411;
  border-color: #49eacb;
}
body.grok-page a { color: #49eacb; }
.gk-app {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 48rem;
  width: 100%;
  margin: 0 auto;
  padding: 0 0.85rem calc(0.55rem + env(safe-area-inset-bottom));
}
.gk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0 0.35rem;
}
.gk-brand { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.gk-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #49eacb;
  box-shadow: 0 0 0 4px rgba(73, 234, 203, 0.15);
  flex: none;
}
body.gk-busy .gk-dot {
  animation: gk-dot-pulse 1s ease-in-out infinite;
}
.gk-pill {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8aa8a0;
  border: 1px solid #2a5a50;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.gk-bar-actions { display: flex; gap: 0.35rem; flex: none; }
.gk-ghost {
  font: inherit;
  font-size: 0.88rem;
  color: #c5e4dc;
  background: transparent;
  border: 1px solid #2a5a50;
  padding: 0.25rem 0.7rem;
  min-height: 36px;
  cursor: pointer;
  border-radius: 999px;
}
.gk-ghost:hover, .gk-chips button:hover { border-color: #49eacb; }
.gk-ghost:focus-visible, .gk-chips button:focus-visible, .gk-send:focus-visible, .gk-stop:focus-visible {
  outline: 2px solid #49eacb;
  outline-offset: 2px;
}
.gk-slow {
  margin: 0 0 0.45rem;
  color: #d7efe8;
  font-size: 0.92rem;
  line-height: 1.35;
}
.gk-thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.gk-empty {
  padding: 0.15rem 0 0.8rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.gk-empty strong { white-space: nowrap; }
.gk-hero-wrap {
  margin: 0;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid #1e3d36;
  background: #0d1c18;
  line-height: 0;
}
.gk-hero {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 8;
  object-fit: cover;
  object-position: 50% 18%;
}
.gk-empty h1 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  margin: 0.75rem 0 0.3rem;
  letter-spacing: -0.03em;
}
.gk-empty p { color: #b7d4cc; max-width: 36rem; margin: 0; }
.gk-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.85rem 0 0;
}
.gk-chips button {
  font: inherit;
  font-size: 0.88rem;
  color: #e8f6f2;
  background: #0d1c18;
  border: 1px solid #2a5a50;
  padding: 0.35rem 0.7rem;
  min-height: 40px;
  border-radius: 999px;
  cursor: pointer;
}
.gk-log { display: flex; flex-direction: column; gap: 1rem; padding: 0.85rem 0 1.1rem; flex: 1; }
.gk-thread:has(.gk-think:not(.is-done):not(.is-writing)) .gk-log { justify-content: center; }
.gk-msg { max-width: 42rem; }
.gk-msg.user {
  align-self: flex-end;
  max-width: min(42rem, 85%);
  background: #12352e;
  border: 1px solid #2a5a50;
  padding: 0.65rem 0.85rem;
  border-radius: 1.1rem 1.1rem 0.25rem 1.1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.gk-msg.assistant { color: #e8f6f2; width: 100%; }
.gk-msg .gk-md { line-height: 1.65; font-size: 1.08rem; }
.gk-msg .gk-md p { margin: 0.45rem 0; }
.gk-msg .gk-md p:first-child { margin-top: 0; font-size: 1.18rem; }
.gk-msg .gk-md ul, .gk-msg .gk-md ol { margin: 0.35rem 0; padding-left: 1.2rem; }
.gk-msg .gk-md code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.85em;
  background: #0d1c18;
  padding: 0.05rem 0.3rem;
  border-radius: 0.25rem;
}
.gk-msg .gk-md pre {
  overflow: auto;
  background: #0d1c18;
  border: 1px solid #1e3d36;
  padding: 0.7rem 0.8rem;
  border-radius: 0.6rem;
}
.gk-msg .gk-md a { color: #49eacb; }
.gk-md.streaming::after {
  content: "▍";
  color: #49eacb;
  animation: gk-caret 1s step-end infinite;
}
@keyframes gk-caret { 50% { opacity: 0; } }
.gk-think {
  margin: 0 0 1rem;
  border: 2px solid #49eacb;
  background: #0d1c18;
  border-radius: 1.15rem;
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: 0 0 0 8px rgba(73, 234, 203, 0.14);
}
.gk-think:not(.is-done) {
  position: sticky;
  top: 0.35rem;
  z-index: 4;
  animation: gk-think-pulse 1.5s ease-in-out infinite;
}
.gk-think-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  width: 100%;
  background: none;
  border: 0;
  color: #49eacb;
  font: inherit;
  cursor: pointer;
  padding: 0.05rem 0;
  text-align: left;
}
.gk-think-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.gk-think-title {
  display: flex;
  align-items: flex-start;
  gap: 0.2rem;
}
.gk-think-label {
  flex: 1;
  min-width: 0;
  font-size: clamp(1.45rem, 4.6vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.2;
}
.gk-think-meta {
  margin: 0;
  color: #49eacb;
  font-size: clamp(1rem, 2.6vw, 1.2rem);
  font-weight: 650;
}
.gk-dots {
  display: inline-flex;
  gap: 0.18rem;
  margin-top: 0.62rem;
  flex: none;
}
.gk-dots i {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: #49eacb;
  opacity: 0.25;
  animation: gk-dot 1.1s ease-in-out infinite;
}
.gk-dots i:nth-child(2) { animation-delay: 0.18s; }
.gk-dots i:nth-child(3) { animation-delay: 0.36s; }
.gk-think.is-done .gk-dots,
.gk-think.is-done .gk-think-live { display: none; }
.gk-spin {
  width: 1.7rem;
  height: 1.7rem;
  margin-top: 0.18rem;
  border: 3px solid #2a5a50;
  border-top-color: #49eacb;
  border-radius: 50%;
  animation: gk-spin 0.7s linear infinite;
  flex: none;
}
.gk-think.is-writing:not(.is-done) {
  padding: 0.55rem 0.85rem 0.6rem;
  box-shadow: none;
  animation: none;
}
.gk-think.is-writing:not(.is-done) .gk-think-label {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.gk-think.is-writing:not(.is-done) .gk-spin {
  width: 1rem;
  height: 1rem;
  margin-top: 0.12rem;
  border-width: 2px;
}
.gk-think.is-writing:not(.is-done) .gk-think-note,
.gk-think.is-writing:not(.is-done) .gk-think-steps,
.gk-think.is-writing:not(.is-done) .gk-think-reason { display: none; }
.gk-think.is-done {
  border-color: #1e3d36;
  box-shadow: none;
  padding: 0.4rem 0.8rem;
  animation: none;
}
.gk-think.is-done .gk-spin { display: none; }
.gk-think.is-done .gk-think-toggle { align-items: center; }
.gk-think.is-done .gk-think-label {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.gk-think-time { font-variant-numeric: tabular-nums; }
.gk-think.is-done .gk-think-meta,
.gk-think.is-done .gk-think-note { display: none; }
.gk-think-note {
  color: #c5e4dc;
  font-size: 1.05rem;
  margin: 0.55rem 0 0.5rem;
}
.gk-think-steps {
  margin: 0;
  padding-left: 1.25rem;
  color: #b7d4cc;
  font-size: 1rem;
}
.gk-think.is-done .gk-think-steps { font-size: 0.84rem; }
.gk-think-steps li { margin: 0.22rem 0; }
.gk-think-steps li.on { color: #49eacb; font-weight: 650; }
.gk-think-reason {
  color: #8aa8a0;
  font-size: 0.8rem;
  white-space: pre-wrap;
  max-height: 7.5rem;
  overflow: auto;
  margin: 0.4rem 0 0;
  line-height: 1.4;
  border-top: 1px solid #1e3d36;
  padding-top: 0.4rem;
}
.gk-think[data-open="0"] .gk-think-note,
.gk-think[data-open="0"] .gk-think-steps,
.gk-think[data-open="0"] .gk-think-reason { display: none; }
@keyframes gk-spin { to { transform: rotate(360deg); } }
@keyframes gk-think-pulse {
  50% { box-shadow: 0 0 0 14px rgba(73, 234, 203, 0.28); border-color: #7ef5dc; }
}
@keyframes gk-dot {
  0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
@keyframes gk-dot-pulse {
  50% { box-shadow: 0 0 0 8px rgba(73, 234, 203, 0.28); transform: scale(1.15); }
}
.gk-actions { display: flex; gap: 0.35rem; margin: 0.45rem 0 0; }
.gk-actions[hidden], .gk-send[hidden], .gk-stop[hidden], .gk-status[hidden], .gk-empty[hidden], .gk-log[hidden], .gk-modal[hidden], .gk-think-reason[hidden] {
  display: none !important;
}
.gk-actions button {
  font: inherit;
  font-size: 0.78rem;
  color: #8aa8a0;
  background: transparent;
  border: 1px solid #1e3d36;
  padding: 0.2rem 0.55rem;
  min-height: 32px;
  cursor: pointer;
  border-radius: 999px;
}
.gk-cites {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.55rem 0 0;
}
.gk-cites a {
  color: #c5e4dc;
  font-size: 0.78rem;
  border: 1px solid #2a5a50;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  text-decoration: none;
}
.gk-cites a:hover { border-color: #49eacb; color: #49eacb; }
.gk-status {
  color: #8aa8a0;
  font-size: 0.82rem;
  margin: 0 0 0.3rem;
}
.gk-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  background: #0d1c18;
  border: 1px solid #2a5a50;
  border-radius: 1.6rem;
  padding: 0.4rem 0.4rem 0.4rem 0.95rem;
}
.gk-composer:focus-within { border-color: #49eacb; }
.gk-composer textarea {
  flex: 1;
  resize: none;
  border: 0;
  background: transparent;
  color: #e8f6f2;
  font: inherit;
  line-height: 1.4;
  max-height: 8.5rem;
  padding: 0.5rem 0;
  outline: none;
}
.gk-send, .gk-stop {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
}
.gk-send { background: #49eacb; color: #071411; }
.gk-send:disabled { opacity: 0.35; cursor: not-allowed; }
.gk-stop { background: #e8f6f2; color: #071411; }
.gk-foot {
  color: #6e8c84;
  font-size: 0.75rem;
  text-align: center;
  margin: 0.4rem 0 0;
}
.gk-foot a { color: #8aa8a0; }
.gk-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  cursor: pointer;
}
.gk-modal-card {
  background: #0d1c18;
  color: #e8f6f2;
  border: 1px solid #2a5a50;
  width: min(32rem, 100%);
  max-height: min(86dvh, 36rem);
  overflow: auto;
  padding: 1rem 1.1rem 1.15rem;
  border-radius: 1rem;
  cursor: default;
}
.gk-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}
.gk-modal-head h2 { margin: 0; font-size: 1.05rem; }
.gk-modal-card p { color: #b7d4cc; }
@media (max-width: 700px) {
  .gk-pill { display: none; }
  .gk-app { padding: 0 0.65rem calc(0.45rem + env(safe-area-inset-bottom)); }
  .gk-hero { aspect-ratio: 16 / 9; object-position: 50% 22%; }
  .gk-empty h1 { font-size: 1.22rem; }
  .gk-chips button { min-height: 38px; font-size: 0.84rem; padding: 0.28rem 0.6rem; }
  .gk-think { padding: 1rem 0.9rem 1.1rem; }
  .gk-think-label { font-size: 1.4rem; }
}
