/* Flyware Terminal. Graphite, white pixel type, lime states. Pixeloid is drawn on a 9 px grid,
   so every type size is a multiple of 9 and nothing is ever resampled. */

@font-face { font-family: "Pixeloid Sans"; src: url("../assets/fonts/PixeloidSans.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pixeloid Sans"; src: url("../assets/fonts/PixeloidSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Pixeloid Mono"; src: url("../assets/fonts/PixeloidMono.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  /* measured off his plates */
  --bg: #181b20;
  --face: #2c2f33;
  --fg: #fefefe;
  --lime: #d0fd0d;
  --lime-ink: #1a1e08;
  --dim: #a3a9b1;      /* 6.4:1 on the plate face, every word with information in it */
  --muted: #7a7b7f;    /* the plate's own rule grey, rules and texture only */
  --edge: #5a5e66;

  /* type ramp, multiples of 9 */
  --t-1: 18px;
  --t-2: 27px;
  --t-3: 36px;
  --t-4: 45px;
  --t-5: 63px;

  /* spacing scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;

  --row: 72px;
  --logrow: 54px;
  --key-h: 54px;
  --key-s: 40px;

  --sans: "Pixeloid Sans", "Courier New", monospace;
  --mono: "Pixeloid Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--t-1) / 1.5 var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: none;
  font-smooth: never;
  cursor: url("../assets/img/cursor@1x.png") 1 1, auto;
  cursor: -webkit-image-set(url("../assets/img/cursor@1x.png") 1x, url("../assets/img/cursor@2x.png") 2x) 1 1, auto;
  cursor: image-set(url("../assets/img/cursor@1x.png") 1x, url("../assets/img/cursor@2x.png") 2x) 1 1, auto;
}
a, button, select, input, .task { cursor: pointer; }
input[type="text"] { cursor: text; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
::selection { background: var(--lime); color: var(--lime-ink); }

.shell {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-height: 100vh;
  padding: var(--s-5) var(--s-6);
}

/* ------------------------------------------------------------------ header */
.top {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas: "lockup links mark";
  align-items: end;
  column-gap: var(--s-6);
}
.lockup { grid-area: lockup; }
.wordmark {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-wrap: balance;
}
.wordmark .w1 { font-size: var(--t-5); }
.wordmark .w2 { font-size: var(--t-3); margin-top: var(--s-2); }
.prompt {
  margin: var(--s-4) 0 0;
  font-family: var(--mono);
  color: var(--dim);
  height: 27px;
  line-height: 27px;
  white-space: nowrap;
}
.caret {
  display: inline-block;
  width: 12px;
  height: 22px;
  margin-left: var(--s-2);
  vertical-align: -4px;
  background: var(--lime);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.links {
  grid-area: links;
  display: flex;
  gap: var(--s-3);
  justify-content: flex-end;
  align-self: start;
}
.mark {
  grid-area: mark;
  justify-self: end;
  width: 150px;
  height: 120px;
  background: url("../assets/img/fly-sheet@3x.png") 0 0 / 300px 120px no-repeat;
  image-rendering: pixelated;
}
.mark.live { animation: flap-mark 0.34s steps(2, jump-none) infinite; }
@keyframes flap-mark { to { background-position: -150px 0; } }

/* ------------------------------------------------------------------ keys (generated keycaps, nine sliced) */
.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: var(--key-h);
  padding: 0 var(--s-5) 0;
  border-style: solid;
  border-width: 6px 10px 16px 10px;
  border-image: url("../assets/img/key-lime.webp") 6 10 16 10 fill / 6px 10px 16px 10px stretch;
  background: none;
  color: var(--lime-ink);
  font: 700 var(--t-2) / 1 var(--sans);
  letter-spacing: 0.02em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
  transition: transform 80ms steps(2), filter 80ms;
}
.key-graphite {
  border-width: 3px 5px 12px 5px;
  border-image: url("../assets/img/key-graphite.webp") 3 5 12 5 fill / 3px 5px 12px 5px stretch;
  color: var(--fg);
}
.key.small {
  height: var(--key-s);
  padding: 0 var(--s-4);
  font-size: var(--t-1);
  font-weight: 700;
}
.key-lime.small { border-width: 4px 7px 11px 7px; border-image-slice: 6 10 16 10; border-image-width: 4px 7px 11px 7px; }
.key-icon {
  width: var(--key-h);
  height: var(--key-h);
  padding: 0;
  border-width: 3px 5px 12px 5px;
  border-image: url("../assets/img/key-graphite.webp") 3 5 12 5 fill / 3px 5px 12px 5px stretch;
  position: relative;
}
.key-icon img {
  position: absolute;
  left: 50%; top: 50%;
  translate: -50% -50%;
  width: 24px;
  height: auto;
  display: block;
}
.key-icon img[src$="pons.png"] { width: 22px; }
.key-icon img[src$="dexscreener.png"] { width: 22px; }
.key:hover { filter: brightness(1.08); }
.key:active, .key.pressed { transform: translateY(3px); filter: brightness(0.92); }
.key[aria-disabled="true"], .key:disabled {
  filter: saturate(0.15) brightness(0.7);
  cursor: not-allowed;
  transform: none;
}
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--lime);
  font: 700 var(--t-1) / 1.5 var(--sans);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------------ panels (generated graphite plate) */
.grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--s-4);
  flex: 1 1 auto;
  min-height: 0;
}
.panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
  border: 8px solid transparent;
  border-image: url("../assets/img/panel.webp") 8 / 8px stretch;
  background: var(--face) url("../assets/img/grain.webp") 0 0 / 512px 512px repeat;
}
.flies { grid-column: span 4; }
.events { grid-column: span 2; }
.notify, .balance, .contract { grid-column: span 2; }

.panel-head {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "h key" "sub key";
  align-items: center;
  column-gap: var(--s-4);
  margin-bottom: var(--s-3);
}
.panel-head h2 {
  grid-area: h;
  margin: 0;
  font-size: var(--t-2);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
}
.panel-head .sub { grid-area: sub; margin: 0; color: var(--dim); height: 27px; line-height: 27px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-head .key { grid-area: key; }

/* fly list */
.fly-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 0 1 auto;
  min-height: 0;
  overflow: hidden;
}
.fly-list.all { overflow-y: auto; flex: 1 1 auto; scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
.fly {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  grid-template-rows: 32px 40px;
  grid-template-areas: "sprite line1 status" "sprite line2 keys";
  column-gap: var(--s-4);
  align-items: center;
  height: var(--row);
  border-top: 1px solid var(--edge);
}
.fly:first-child { border-top: 0; }
.sprite {
  grid-area: sprite;
  width: 50px;
  height: 40px;
  background: url("../assets/img/fly-sheet@2x.png") 0 0 / 100px 40px no-repeat;
  image-rendering: pixelated;
  opacity: 0.55;
}
.fly.running .sprite { opacity: 1; animation: flap 0.34s steps(2, jump-none) infinite; }
@keyframes flap { to { background-position: -50px 0; } }
.line1, .line2 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line1 { grid-area: line1; font-family: var(--mono); }
.line1 .name { color: var(--fg); }
.line1 .job { color: var(--lime); margin-left: var(--s-3); }
.line1 .target { color: var(--dim); margin-left: var(--s-3); }
.line2 { grid-area: line2; color: var(--dim); }
.status { grid-area: status; justify-self: end; font-weight: 700; white-space: nowrap; }
.status.on { color: var(--lime); }
.status.off { color: var(--dim); }
.fly .keys { grid-area: keys; display: flex; gap: var(--s-2); justify-self: end; }
.fly .keys .key { height: 36px; padding: 0 var(--s-3); font-size: var(--t-1); }
.empty { margin: 0; color: var(--dim); min-height: var(--row); display: flex; align-items: center; }
.empty[hidden] { display: none; }
.foot { margin: auto 0 0; display: flex; justify-content: space-between; gap: var(--s-4); color: var(--dim); height: 27px; line-height: 27px; white-space: nowrap; }

/* journal: the one scroll region of the screen */
.log {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--edge) transparent;
}
.log::-webkit-scrollbar { width: 8px; }
.log::-webkit-scrollbar-track { background: transparent; }
.log::-webkit-scrollbar-thumb { background: var(--edge); }
.log::-webkit-scrollbar-button { display: none; }
.entry {
  height: var(--logrow);
  padding: var(--s-1) 0;
  border-top: 1px solid var(--edge);
  font-family: var(--mono);
  line-height: 23px;
  overflow: hidden;
}
.entry:first-child { border-top: 0; }
.entry .l1 { display: flex; gap: var(--s-3); color: var(--dim); white-space: nowrap; overflow: hidden; }
.entry .l1 .who { color: var(--fg); }
.entry .l1 .kind { margin-left: auto; font-weight: 700; }
.entry.hit .l1 .kind { color: var(--lime); }
.entry.fail .l1 .kind { color: var(--dim); }
.entry .l2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
.entry .l2 a { color: inherit; text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 3px; }
.entry.sys .l2 { color: var(--dim); }

/* rows in the small panels */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  column-gap: var(--s-3);
  height: 32px;
  border-top: 1px solid var(--edge);
}
.row:first-child { border-top: 0; }
.row .lbl { color: var(--dim); white-space: nowrap; }
.row .val { font-family: var(--mono); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row .val.lime, .val.lime { color: var(--lime); }
.row .in { justify-self: end; }
.big { grid-area: key; margin: 0; font-family: var(--mono); font-size: var(--t-4); line-height: 1; white-space: nowrap; text-align: right; }
.big .unit { font: 400 var(--t-2) / 1 var(--sans); color: var(--dim); }
.keys { display: flex; gap: var(--s-3); align-items: center; flex-wrap: nowrap; margin-top: var(--s-4); }
.panel > .keys { margin-top: auto; padding-top: var(--s-4); }
.ca {
  margin: 0 0 var(--s-4);
  font-family: var(--mono);
  line-height: 27px;
  height: 54px;
  overflow-wrap: anywhere;
  color: var(--dim);
}
.ca.live { color: var(--fg); user-select: all; }
#copy-state { color: var(--dim); font-family: var(--mono); min-width: 9ch; }
#copy-state.ok { color: var(--lime); }

/* ------------------------------------------------------------------ dialog */
.deploy-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 8px solid transparent;
  border-image: url("../assets/img/panel.webp") 8 / 8px stretch;
  background: var(--face) url("../assets/img/grain.webp") 0 0 / 512px 512px repeat;
  color: var(--fg);
}
.deploy-dialog::backdrop { background: rgba(24, 27, 32, 0.82); }
.deploy-dialog form { display: flex; flex-direction: column; padding: var(--s-5); min-height: 520px; }
.d-head {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "h key" "sub sub";
  align-items: center;
  column-gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.d-head h2 { grid-area: h; margin: 0; font-size: var(--t-2); line-height: 1.2; letter-spacing: 0.04em; }
.d-head .sub { grid-area: sub; margin: 0; color: var(--dim); min-height: 27px; line-height: 27px; }
.d-head .key { grid-area: key; }
.d-step { flex: 1 1 auto; }
.d-step[hidden] { display: none; }
.d-foot { display: flex; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-5); }
.d-foot .key:only-child { margin-left: auto; }

.task-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.task {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  height: 160px;
  padding: var(--s-4);
  text-align: left;
  color: var(--fg);
  font: inherit;
  border-style: solid;
  border-width: 3px 5px 12px 5px;
  border-image: url("../assets/img/key-graphite.webp") 3 5 12 5 fill / 3px 5px 12px 5px stretch;
  background: none;
}
.task .t-name { font-weight: 700; font-size: var(--t-2); line-height: 1.2; }
.task .t-what { color: var(--dim); line-height: 1.35; text-wrap: pretty; }
.task .t-cost { margin-top: auto; font-family: var(--mono); color: var(--lime); }
.task[aria-checked="true"] { border-image-source: url("../assets/img/key-lime.webp"); color: var(--lime-ink); }
.task[aria-checked="true"] .t-what, .task[aria-checked="true"] .t-cost { color: var(--lime-ink); }
.task:active { transform: translateY(3px); }

.fields .row { height: auto; min-height: 56px; grid-template-columns: 1fr; row-gap: var(--s-1); align-items: start; padding: var(--s-2) 0; }
.fields .row .lbl { display: flex; justify-content: space-between; gap: var(--s-3); }
.fields .row .hint { color: var(--muted); font-family: var(--mono); }
.in {
  width: 100%;
  height: 40px;
  padding: 0 var(--s-3);
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--edge);
  border-radius: 0;
  font: 400 var(--t-1) / 1 var(--mono);
  caret-color: var(--lime);
}
.in:focus { border-color: var(--lime); outline: none; }
select.in { appearance: none; padding-right: var(--s-5); }
.row select.in, .row input.in { width: 220px; }
.fields .row .in { width: 100%; }
.seg { display: flex; gap: var(--s-2); }
.seg .key { height: var(--key-s); padding: 0 var(--s-3); font-size: var(--t-1); }
.seg .key[aria-checked="true"] { border-image-source: url("../assets/img/key-lime.webp"); color: var(--lime-ink); }
.d-step .rows .row { height: 44px; }
.field-error { margin: var(--s-2) 0 0; color: var(--lime); height: 27px; line-height: 27px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ app shell on a big screen */
@media (min-width: 1100px) and (min-height: 800px) {
  body { overflow: hidden; }
  .shell { height: 100vh; }
}

/* ------------------------------------------------------------------ narrow */
@media (max-width: 1099px) {
  .grid { grid-template-columns: 1fr; grid-template-rows: none; }
  .flies, .events, .notify, .balance, .contract { grid-column: auto; }
  .events { min-height: 420px; max-height: 60vh; }
  .fly-list { overflow: visible; }
}
@media (max-width: 720px) {
  :root { --t-5: 45px; --t-3: 27px; }
  .shell { padding: var(--s-4); gap: var(--s-3); }
  .top { grid-template-columns: auto 1fr; grid-template-areas: "mark links" "lockup lockup"; column-gap: var(--s-4); row-gap: var(--s-4); align-items: start; }
  .big { text-align: left; }
  .mark { width: 100px; height: 80px; background-size: 200px 80px; justify-self: start; }
  .mark.live { animation-name: flap-mark-s; }
  @keyframes flap-mark-s { to { background-position: -100px 0; } }
  .panel { padding: var(--s-4); }
  .panel-head { grid-template-columns: 1fr; grid-template-areas: "h" "sub" "key"; row-gap: var(--s-2); }
  .panel-head .key { justify-self: start; }
  .fly { grid-template-columns: 50px 1fr; grid-template-rows: 32px 32px 27px auto; grid-template-areas: "sprite line1" "sprite line2" "status status" "keys keys"; height: auto; padding: var(--s-2) 0 var(--s-3); row-gap: var(--s-1); }
  .status { justify-self: start; }
  .fly .keys { justify-self: start; gap: var(--s-1); flex-wrap: wrap; }
  .fly .keys .key { padding: 0 var(--s-2); }
  .panel > .keys { flex-wrap: wrap; }
  .fly-list { max-height: none !important; }
  .deploy { font-size: var(--t-1); height: 48px; border-width: 5px 8px 13px 8px; border-image-width: 5px 8px 13px 8px; }
  .task-grid { grid-template-columns: 1fr; }
  .task { height: auto; min-height: 120px; }
  .row select.in, .row input.in { width: 160px; }
  .deploy-dialog form { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .caret, .mark.live, .fly.running .sprite { animation: none; }
}
@media (max-width: 400px) {
  .panel-head h2, .d-head h2 { font-size: var(--t-1); }
}
