/* let me prompt that for you — a fake opencode TUI, rebuilt in CSS.
   Visual reference: packages/web/src/assets/lander/screenshot.png in sst/opencode. */

:root {
  --desk:      #22242d;
  --desk-edge: #16171d;
  --chrome:    #2e313c;
  --chrome-fg: #c9ccd6;
  --bg:        #0a0a0a;
  --panel:     #151515;
  --panel-2:   #111111;
  --fg:        #e4e4e4;
  --fg-strong: #ffffff;
  --dim:       #6f6f6f;
  --dimmer:    #4a4a4a;
  --blue:      #57a5e0;
  --rule:      #262626;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, "Cascadia Mono",
          "Roboto Mono", "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  padding: 28px 20px;
  background: radial-gradient(120% 90% at 50% 0%, var(--desk) 0%, var(--desk-edge) 100%);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── window chrome ───────────────────────────────────────────── */

.window {
  width: 100%;
  max-width: 940px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.75), 0 0 0 1px rgba(255,255,255,.05);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 56px);
  min-height: min(560px, calc(100vh - 56px));
}

.titlebar {
  background: var(--chrome);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 40px;
  flex: none;
}

.lights { display: flex; gap: 8px; margin-right: 4px; }
.lights b { width: 12px; height: 12px; border-radius: 50%; display: block; }
.l-r { background: #ff5f57; }
.l-y { background: #febc2e; }
.l-g { background: #28c840; }

.tb-icon { color: #6ea8dc; font-size: 13px; }

.tb-title {
  color: var(--chrome-fg);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── screen ──────────────────────────────────────────────────── */

.screen {
  background: var(--bg);
  padding: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.session { display: flex; flex-direction: column; gap: 14px; min-height: 0; flex: 1; }

.session-head {
  margin: 0 16px;
  padding: 10px 16px;
  background: var(--panel-2);
  border-left: 2px solid #8a8a8a;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex: none;
}

.session-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-strong);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-meta { color: var(--dim); font-size: 13px; white-space: nowrap; }

.stream {
  flex: 1;
  min-height: 140px;
  overflow-y: auto;
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.stream::-webkit-scrollbar { width: 8px; }
.stream::-webkit-scrollbar-thumb { background: #2c2c2c; border-radius: 4px; }

.msg-user {
  background: var(--panel);
  border-left: 2px solid var(--blue);
  padding: 12px 16px;
  color: var(--fg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.line { color: var(--fg); white-space: pre-wrap; overflow-wrap: anywhere; }
.line-dim { color: var(--dim); }
.line-tool { color: var(--dim); overflow-wrap: anywhere; }
.line-tool .mark { color: var(--dimmer); margin-right: 8px; }
.line-tool .verb { color: #8a8a8a; }

.fade-in { animation: fade .22s ease-out both; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ── prompt box ──────────────────────────────────────────────── */

.prompt {
  margin: 0 16px;
  padding: 12px 16px;
  background: var(--panel);
  border-left: 2px solid var(--blue);
  flex: none;
}

.prompt-input { position: relative; }

#promptField {
  display: block;
  width: 100%;
  min-height: 1.55em;
  max-height: 7.75em;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  line-height: inherit;
  resize: none;
  outline: none;
  overflow-y: auto;
  caret-color: var(--fg);
  caret-shape: block;
}

#promptField::placeholder { color: var(--dimmer); }

.playback { display: none; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.55em; }

.caret {
  display: inline-block;
  width: .58em;
  height: 1.15em;
  background: var(--fg);
  vertical-align: text-bottom;
  animation: blink 1.05s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.prompt-model {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-top: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}

.agent { color: var(--blue); }
.provider { color: var(--dimmer); }

#targetSelect {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  padding: 0 14px 0 0;
  margin: 0;
  cursor: pointer;
  outline-offset: 3px;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
                    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: right 4px center, right 0 center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
#targetSelect option { background: #1b1b1b; color: var(--fg); }
body[data-mode="play"] #targetSelect { pointer-events: none; background-image: none; }

/* ── status bar ──────────────────────────────────────────────── */

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px 14px;
  font-size: 12.5px;
  color: var(--dim);
  flex: none;
  flex-wrap: wrap;
}

.dots { color: var(--dimmer); letter-spacing: 2px; }
.hints { display: flex; gap: 18px; flex-wrap: wrap; }

.hint {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--dim);
  cursor: pointer;
}
.hint:hover .k, .hint:focus-visible .k { color: var(--blue); }
.hint .k { color: var(--fg); margin-right: 7px; }
span.hint { cursor: default; }

/* the donation hint is a real <a>; strip the UA link look so it reads as
   one more keybinding next to the buttons. */
.hint[href] { text-decoration: none; color: var(--dim); }
.hint[href]:hover, .hint[href]:focus-visible { text-decoration: none; }
.hint[href]:hover .k, .hint[href]:focus-visible .k { color: var(--blue); }

/* ── link result ─────────────────────────────────────────────── */

.result {
  background: var(--panel);
  border-left: 2px solid #8a8a8a;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-url {
  color: var(--blue);
  overflow-wrap: anywhere;
  user-select: all;
  font-size: 13px;
}

.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  font: inherit;
  font-size: 12.5px;
  color: var(--fg);
  background: #1d1d1d;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 5px 11px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover, .btn:focus-visible { border-color: var(--blue); color: var(--blue); }

/* ── fake mouse pointer ──────────────────────────────────────── */

.pointer {
  position: fixed;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.6));
  will-change: transform;
}

/* ── modes ───────────────────────────────────────────────────── */

body[data-mode="play"] #promptField { display: none; }
body[data-mode="play"] .playback { display: block; }

@media (max-width: 720px) {
  body { padding: 0; align-items: stretch; }
  .window { max-width: none; border-radius: 0; max-height: none; min-height: 100vh; box-shadow: none; }
  .screen { font-size: 13px; }
  .session-head { margin: 0 10px; padding: 9px 12px; }
  .stream { padding: 0 12px; }
  .prompt { margin: 0 10px; padding: 11px 12px; }
  .statusbar { padding: 10px 12px 12px; gap: 10px; }
  .hints { gap: 12px; }
  .pointer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
  .fade-in { animation: none; }
  .pointer { display: none; }
}

/* ── Windows 11 chrome ───────────────────────────────────────────
   Additive only: everything above is the finished macOS window, so a
   visitor with no JS, a thrown detection or an unknown platform still
   gets a coherent theme. There is deliberately no mac-side selector
   anywhere — macOS is the absence of this block.
   Sizes follow Microsoft's own window/title-bar guidance: 8px corner
   radius, 32px title bar, 46px caption buttons. */

body[data-os="win"] {
  --chrome:    #202020;
  --chrome-fg: #ffffff;
  --bg:        #0c0c0c;                       /* Windows Terminal "Campbell" */
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace,
          "Liberation Mono", monospace;
}

body[data-os="win"] .window {
  border-radius: 8px;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.75), 0 0 0 1px rgba(255,255,255,.09);
}

body[data-os="win"] .titlebar {
  height: 32px;
  padding: 0 0 0 14px;                        /* caption buttons run to the edge */
  gap: 8px;
}

body[data-os="win"] .tb-title {
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 400;
}

/* the three macOS lights become minimise / maximise / close on the right.
   They stay decorative (.lights is aria-hidden): no roles, no tab stops —
   only the hover plates, which are what sells the frame. */

body[data-os="win"] .lights {
  order: 3;
  margin: 0 0 0 auto;
  gap: 0;
  flex: none;
  align-self: stretch;
}

body[data-os="win"] .lights b {
  width: 46px;
  height: 100%;
  border-radius: 0;
  background: none;
  position: relative;
  cursor: default;
}

body[data-os="win"] .l-y { order: 1; }        /* minimise */
body[data-os="win"] .l-g { order: 2; }        /* maximise */
body[data-os="win"] .l-r { order: 3; }        /* close    */

body[data-os="win"] .lights b::before,
body[data-os="win"] .l-r::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 0 solid var(--chrome-fg);
}

/* These carry the extra .lights class deliberately: the shared rule above is
   (0,2,3) thanks to `.lights b`, so a plain `.l-y::before` at (0,2,2) would lose
   to it no matter how far down the file it sits, and every glyph would vanish. */
body[data-os="win"] .lights .l-y::before { width: 10px; height: 0;    border-top-width: 1px; }
body[data-os="win"] .lights .l-g::before { width: 10px; height: 10px; border-width: 1px; }

body[data-os="win"] .lights .l-r::before,
body[data-os="win"] .lights .l-r::after { width: 13px; height: 0; border-top-width: 1px; }
body[data-os="win"] .lights .l-r::before { transform: translate(-50%, -50%) rotate(45deg); }
body[data-os="win"] .lights .l-r::after  { transform: translate(-50%, -50%) rotate(-45deg); }

body[data-os="win"] .l-y:hover,
body[data-os="win"] .l-g:hover { background: rgba(255,255,255,.06); }
body[data-os="win"] .l-r:hover { background: #c42b1c; }
body[data-os="win"] .l-r:hover::before,
body[data-os="win"] .l-r:hover::after { border-color: #fff; }

/* the breakpoint above hard-codes .window{border-radius:0}, but this
   block's selectors are more specific, so full-bleed has to be restated. */
@media (max-width: 720px) {
  body[data-os="win"] .window { border-radius: 0; box-shadow: none; }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
