/* ==========================================================================
   mektigboy · ascii
   Black, monospace, one screen. The hero is drawn in characters.
   ========================================================================== */

:root {
  --bg: #000000;
  --ink: #f2efe9;
  --ink-90: rgba(242, 239, 233, 0.9);
  --ink-70: rgba(242, 239, 233, 0.7);
  --ink-50: rgba(242, 239, 233, 0.5);
  --ink-38: rgba(242, 239, 233, 0.38);
  --ink-24: rgba(242, 239, 233, 0.24);
  --line: rgba(242, 239, 233, 0.14);
  --line-soft: rgba(242, 239, 233, 0.08);
  --panel: rgba(10, 10, 10, 0.9);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
  padding: 0;
}
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100svh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
input {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  outline: none;
}
::selection {
  background: var(--ink);
  color: #000;
}
:focus-visible {
  outline: 1px solid var(--ink-70);
  outline-offset: 3px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── ASCII field ────────────────────────────────────────────────────────── */
.grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(to right, rgba(242, 239, 233, 0.021) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(242, 239, 233, 0.021) 1px, transparent 1px);
  background-size: 7px 9px;
  mask-image: radial-gradient(120% 90% at 50% 40%, #000 30%, transparent 92%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 40%, #000 30%, transparent 92%);
}
.glow {
  position: fixed;
  inset: -12%;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(22% 18% at 22% 20%, rgba(233, 193, 122, 0.034), transparent 62%),
    radial-gradient(22% 18% at 80% 16%, rgba(242, 239, 233, 0.018), transparent 64%);
  animation: drift 34s ease-in-out infinite alternate, breathe 13s ease-in-out infinite;
  will-change: transform, opacity;
}
@keyframes drift {
  from {
    transform: translate3d(-3%, -2%, 0) scale(1);
  }
  to {
    transform: translate3d(4%, 3%, 0) scale(1.12);
  }
}
@keyframes breathe {
  0%, 100% {
    opacity: 0.55;
  }
  50% {
    opacity: 0.95;
  }
}

.dust {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
body.is-answering .dust {
  opacity: 0.45;
}

.art {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
.art.is-ready {
  opacity: 1;
  animation: breathe 11s ease-in-out 1.8s infinite;
}
@keyframes breathe {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.93;
  }
}
body.is-answering .art {
  opacity: 0.26;
}
body.is-answering .ghost {
  opacity: 0;
}

/* ── Top bar ────────────────────────────────────────────────────────────── */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 16px 22px;
}
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 33px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(242, 239, 233, 0.035);
  color: var(--ink-70);
  font-size: 12px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color 0.28s ease, border-color 0.28s ease, background-color 0.28s ease,
    transform 0.35s var(--ease);
}
.pill span {
  font-size: 11px;
  opacity: 0.7;
}
.pill:hover {
  color: var(--ink);
  border-color: rgba(242, 239, 233, 0.32);
  background: rgba(242, 239, 233, 0.07);
}
.pill-solid {
  background: var(--ink);
  border-color: var(--ink);
  color: #000;
  font-weight: 500;
}
.pill-solid span {
  opacity: 0.85;
}
.pill-solid:hover {
  background: #fff;
  border-color: #fff;
  color: #000;
  transform: translateY(-1px);
}

/* ── Stage ──────────────────────────────────────────────────────────────── */
.stage {
  position: relative;
  z-index: 10;
  height: 100svh;
}
.console {
  position: absolute;
  top: 69%;
  left: 50%;
  transform: translateX(-50%);
  width: min(680px, calc(100vw - 36px));
  transition: top 0.6s var(--ease);
}
body.is-answering .console {
  top: 27%;
}

/* ── Ask bar ────────────────────────────────────────────────────────────── */
.ask {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 9px 0 20px;
  border: 1px solid rgba(242, 239, 233, 0.16);
  border-radius: 999px;
  background: rgba(9, 9, 9, 0.92);
  box-shadow: inset 0 1px 0 rgba(242, 239, 233, 0.06), 0 24px 70px rgba(0, 0, 0, 0.75);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.ask:focus-within {
  border-color: rgba(242, 239, 233, 0.4);
  box-shadow: inset 0 1px 0 rgba(242, 239, 233, 0.08), 0 24px 70px rgba(0, 0, 0, 0.8),
    0 0 0 4px rgba(242, 239, 233, 0.05);
}
.ask input {
  flex: 1;
  min-width: 0;
  height: 100%;
  font-size: 14.5px;
  letter-spacing: 0.005em;
  color: var(--ink);
  caret-color: var(--ink);
}
/* 输入框自己的聚焦轮廓去掉：整条胶囊的 focus-within 已经是清晰的焦点提示 */
.ask input:focus,
.ask input:focus-visible {
  outline: none;
  box-shadow: none;
}
.ghost {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 14.5px;
  color: var(--ink-38);
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.ghost.is-hidden {
  opacity: 0;
}
.ghost-caret {
  width: 1px;
  height: 15px;
  background: var(--ink-50);
  animation: blink 1.15s steps(1) infinite;
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.key {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #000;
  font-size: 14px;
  transition: transform 0.4s var(--ease), background-color 0.3s ease;
}
.key:hover {
  transform: scale(1.07);
  background: #fff;
}
.key:active {
  transform: scale(0.96);
}

/* ── Chips ──────────────────────────────────────────────────────────────── */
.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 13px;
  transition: opacity 0.35s ease, transform 0.45s var(--ease);
}
body.is-answering .chips {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}
.chip {
  padding: 6px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: var(--ink-50);
  font-size: 11.5px;
  letter-spacing: 0.01em;
  transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}
.chip:hover {
  color: var(--ink);
  border-color: rgba(242, 239, 233, 0.28);
  background: rgba(242, 239, 233, 0.06);
}

/* ── 首屏提示 ───────────────────────────────────────────────────────────── */
.hint {
  margin-top: 16px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-38);
  opacity: 0;
  animation: hintIn 0.9s ease 1.4s forwards;
  transition: opacity 0.6s ease;
}
.hint b {
  font-weight: 400;
  color: var(--ink-50);
}
.hint.is-hidden {
  opacity: 0 !important;
  animation: none;
}
@keyframes hintIn {
  to { opacity: 1; }
}

/* ── CRT 扫描线 ─────────────────────────────────────────────────────────── */
.crt {
  position: fixed;
  inset: 0;
  z-index: 9970;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 3px,
    rgba(0, 0, 0, 0.1) 3px,
    rgba(0, 0, 0, 0.1) 4px
  );
  opacity: 0.35;
}
.crt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 105% at 50% 42%, transparent 52%, rgba(0, 0, 0, 0.55) 100%);
}

/* ── Answer ─────────────────────────────────────────────────────────────── */
.answer {
  position: relative;
  margin-top: 14px;
  padding: 16px 18px 15px;
  border: 1px solid rgba(242, 239, 233, 0.1);
  border-radius: 18px;
  background: var(--panel);
  animation: rise 0.5s var(--ease) both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.answer-close {
  position: absolute;
  top: 9px;
  right: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-38);
  transition: color 0.25s ease, background-color 0.25s ease;
}
.answer-close:hover {
  color: var(--ink);
  background: rgba(242, 239, 233, 0.06);
}
.answer-q {
  padding-right: 64px;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  color: var(--ink-38);
  margin-bottom: 9px;
}
.answer-q::before {
  content: "you › ";
  color: var(--ink-24);
}
.answer-a {
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink-90);
  min-height: 1.9em;
}
.answer-a::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 14px;
  margin-left: 3px;
  transform: translateY(2px);
  background: var(--ink-70);
  animation: blink 1.05s steps(1) infinite;
}
.answer-a.is-done::after {
  content: "";
  display: none;
}
.answer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  font-size: 11.5px;
}
.answer-links:empty {
  display: none;
}
.answer-links a {
  color: var(--ink-50);
  border-bottom: 1px solid rgba(242, 239, 233, 0.16);
  padding-bottom: 1px;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.answer-links a:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-38);
}
.foot .sep {
  color: var(--ink-24);
}
.link {
  color: var(--ink-38);
  transition: color 0.25s ease;
}
.link:hover {
  color: var(--ink);
}

/* ── 左下角时钟 ─────────────────────────────────────────────────────────── */
.clock {
  position: fixed;
  left: 22px;
  bottom: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--ink-38);
  font-variant-numeric: tabular-nums;
}
.clock-sep {
  color: var(--ink-24);
}
.clock-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-70);
  animation: pulseDot 2.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 1; }
}

/* ── Sheet ──────────────────────────────────────────────────────────────── */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 26px 22px 40px;
  background: #050505;
  animation: sheetIn 0.45s var(--ease) both;
}
.sheet[hidden] {
  display: none;
}
@keyframes sheetIn {
  from { opacity: 0; }
}
.sheet-inner {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 46px;
}
.sheet-title {
  font-size: 12px;
  color: var(--ink-38);
}
.sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 42px;
}
.sheet-grid h2 {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-38);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
}
.sheet-grid ul {
  list-style: none;
}
.sheet-grid li {
  font-size: 13px;
  color: var(--ink-70);
  padding: 8px 0;
}
.sheet-grid li a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  transition: color 0.25s ease;
}
.sheet-grid li a:hover {
  color: var(--ink);
}
.copy-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: color 0.25s ease;
}
.copy-row:hover {
  color: var(--ink);
}
.sheet-grid em {
  font-style: normal;
  font-size: 11px;
  color: var(--ink-24);
}
.sheet-grid .muted {
  color: var(--ink-24);
}
.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-24);
}
.sheet-foot a {
  color: var(--ink-38);
  transition: color 0.25s ease;
}
.sheet-foot a:hover {
  color: var(--ink);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .top {
    padding: 14px 16px;
  }
  .nav .pill:not(.pill-solid) {
    display: none;
  }
  .console {
    top: 56%;
  }
  body.is-answering .console {
    top: 22%;
  }
  .ask {
    height: 54px;
    padding: 0 7px 0 16px;
  }
  .ghost {
    left: 16px;
    font-size: 13.5px;
  }
  .ask input {
    font-size: 13.5px;
  }
  .key {
    width: 38px;
    height: 38px;
  }
  .chip {
    font-size: 11px;
  }
  .answer-a {
    font-size: 13px;
  }
  .sheet {
    align-items: flex-start;
  }
  .sheet-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .foot {
    bottom: 16px;
  }
  .clock {
    display: none;
  }
}

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

/* ── 复制提示 ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 54px;
  z-index: 9990;
  transform: translate(-50%, 10px);
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0a0a0a;
  color: var(--ink-70);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.4s var(--ease);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
