:root {
  --ink: #111;
  --paper: #f7f5ee;
  --accent: #d94f30;
  --blue: #2b5bd7;
  --shadow: 5px 5px 0 var(--ink);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Courier New", Courier, monospace;
  background: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(17,17,17,.045) 31px, rgba(17,17,17,.045) 32px);
  color: var(--ink);
  padding: 2rem 1rem 4rem;
  line-height: 1.45;
}
.wrap { max-width: 900px; margin: 0 auto; }

/* ---------- header ---------- */
header { border: 3px solid var(--ink); box-shadow: var(--shadow); background: #fff; padding: 1.5rem; margin-bottom: 1.5rem; position: relative; }
h1 { font-size: 1.6rem; letter-spacing: .08em; text-transform: uppercase; }
h1 .accent { color: var(--accent); }
.sub { font-size: .8rem; margin-top: .3rem; }
.stamp {
  position: absolute; top: -14px; right: 14px; transform: rotate(3deg);
  border: 2px solid var(--accent); color: var(--accent); background: #fff;
  padding: 2px 10px; font-size: .7rem; font-weight: bold; letter-spacing: .15em;
}
#meta { font-size: .7rem; margin-top: 1rem; border-top: 2px dashed var(--ink); padding-top: .6rem; color: #444; }
#meta.err { color: var(--accent); font-weight: bold; }

/* ---------- controls ---------- */
.controls {
  display: flex; gap: .75rem; flex-wrap: wrap; align-items: stretch;
  border: 3px solid var(--ink); box-shadow: var(--shadow); background: #fff; padding: .75rem; margin-bottom: 2rem;
}
#search {
  flex: 1; min-width: 220px; border: 2px solid var(--ink); padding: .55rem .7rem;
  font-family: inherit; font-size: .85rem; background: var(--paper);
}
#search:focus { outline: 3px solid var(--blue); outline-offset: 1px; }
.fbtn {
  border: 2px solid var(--ink); background: #fff; padding: .5rem .8rem;
  font-family: inherit; font-size: .75rem; font-weight: bold; cursor: pointer;
  letter-spacing: .05em; box-shadow: 3px 3px 0 var(--ink); transition: all .05s;
}
.fbtn:hover { background: var(--ink); color: #fff; }
.fbtn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.fbtn.on { background: var(--ink); color: #fff; }

/* ---------- sections ---------- */
h2 {
  display: flex; align-items: baseline; gap: .6rem;
  font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em;
  margin: 2.2rem 0 1rem;
}
h2 .count { font-size: .75rem; border: 2px solid var(--ink); padding: 0 .45rem; background: #fff; }
h2 .rule { flex: 1; border-bottom: 3px solid var(--ink); }
h2.wip { color: var(--accent); }
h2.wip .count { border-color: var(--accent); }
h2.wip .rule { border-bottom-style: dashed; border-bottom-color: var(--accent); }

/* ---------- cards ---------- */
.card {
  border: 3px solid var(--ink); box-shadow: var(--shadow); background: #fff;
  padding: 1rem 1.1rem; margin-bottom: 1.1rem; transition: transform .05s;
}
.card:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--ink); }
.card-top { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.name { font-size: 1rem; font-weight: bold; text-decoration: none; color: var(--ink); word-break: break-all; }
.name:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.name:hover::after { content: " ↗"; color: var(--accent); }
.desc { font-size: .82rem; margin-top: .35rem; max-width: 56ch; }
.desc.none { color: #999; font-style: italic; }
.meta { font-size: .68rem; color: #555; margin-top: .5rem; letter-spacing: .03em; }
.meta b { color: var(--ink); }
.card-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; }
.abtn {
  display: inline-block; border: 2px solid var(--ink); padding: .4rem .75rem;
  font-size: .72rem; font-weight: bold; text-decoration: none; color: var(--ink);
  background: var(--paper); letter-spacing: .05em; cursor: pointer; font-family: inherit;
  box-shadow: 3px 3px 0 var(--ink);
}
.abtn:hover { background: var(--ink); color: #fff; }
.abtn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.abtn.site { background: var(--accent); color: #fff; border-color: var(--ink); }
.abtn.site:hover { background: var(--ink); }
/* ---------- needs-work ---------- */
.card.wip {
  border: 2px dashed var(--ink); box-shadow: 3px 3px 0 var(--ink);
  background: var(--paper);
}
.card.wip:hover { box-shadow: 5px 5px 0 var(--ink); }
.miss {
  display: inline-block; font-size: .62rem; font-weight: bold; letter-spacing: .1em;
  border: 2px solid var(--accent); color: var(--accent); background: #ffe9e2;
  padding: 2px 7px; transform: rotate(-1.5deg);
}
.wip-head {
  font-size: .62rem; font-weight: bold; letter-spacing: .12em; text-transform: uppercase;
  color: #777; margin-top: .45rem;
}

/* ---------- keyboard ---------- */
.keys { display: flex; gap: 1.4rem; flex-wrap: wrap; font-size: .7rem; color: #555; margin: -1.2rem 0 1.8rem; padding: 0 .25rem; }
.kbd {
  display: inline-block; border: 2px solid var(--ink); background: #fff;
  padding: 0 .38em; font-weight: bold; font-size: .64rem; line-height: 1.4;
  box-shadow: 2px 2px 0 var(--ink); color: var(--ink);
}
.abtn .kbd { margin-left: .45em; background: var(--paper); }
.abtn:hover .kbd { background: #fff; color: var(--ink); }
.card.sel { outline: 4px solid var(--blue); outline-offset: 3px; background: #fffbcc; }
.card.sel .name::before { content: "▸ "; color: var(--blue); }
.preview { margin-top: .9rem; display: none; }
.preview.open { display: block; }
.preview iframe { width: 100%; height: 420px; border: 2px dashed var(--ink); background: #fff; }
.preview-note { font-size: .65rem; color: #777; margin-top: .3rem; }

.readme-view { margin-top: .9rem; display: none; }
.readme-view.open { display: block; }
.readme-head { font-size: .65rem; color: #555; margin-bottom: .35rem; letter-spacing: .03em; }
.readme-head a { color: var(--blue); }
.readme-head b { color: var(--ink); }
.readme-body {
  border: 2px dashed var(--ink); background: #fff; padding: .8rem 1rem;
  font-size: .72rem; line-height: 1.5; max-height: 420px; overflow: auto;
  white-space: pre-wrap; word-break: break-word; font-family: inherit;
}

.empty { border: 3px dashed var(--ink); padding: 2rem; text-align: center; font-size: .85rem; margin: 1.5rem 0; }

footer { margin-top: 3rem; font-size: .68rem; color: #666; text-align: center; }

/* ---------- marquee shell (marquee.html) ----------
   Scoped under body.shell so none of this touches the dashboard page. */
body.shell {
  padding: 1rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden; /* page never scrolls — the viewer eats all the space */
  line-height: 1.45;
}
.shell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}
.shell-header h1 {
  font-size: 1.5rem;
  letter-spacing: -.05em;
  background: var(--ink);
  color: #fff;
  padding: .3rem .6rem;
}
.shell-nav {
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: .45rem .8rem;
  font-size: .75rem;
  font-weight: bold;
  letter-spacing: .05em;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink);
  white-space: nowrap;
}
.shell-nav:hover { background: var(--ink); color: #fff; }
.shell-nav:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
/* when dropped into the dashboard header it needs to sit on its own line */
header .shell-nav { display: inline-block; margin-top: 1rem; }

/* scrolling banner — same card language as the dashboard */
.marquee-container {
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--accent);
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  height: 58px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.marquee-track {
  display: inline-block;
  animation: scroll 20s linear infinite;
  padding-left: 100%; /* start fully offscreen right */
}
.marquee-link {
  display: inline-block;
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--ink);
  text-decoration: none;
  margin-right: 50px;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.marquee-link:hover {
  background: var(--ink);
  color: var(--paper);
  border-bottom: 3px solid var(--ink);
}
@keyframes scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* fullscreen iframe viewer */
.viewport {
  flex-grow: 1;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  background: #fff;
  position: relative;
  min-height: 0; /* let flex actually shrink it */
}
.viewport-label {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--ink);
  color: #fff;
  padding: 4px 10px;
  font-size: .78rem;
  font-weight: bold;
  border-bottom: 3px solid var(--ink);
  border-right: 3px solid var(--ink);
  z-index: 10;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewport iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

@media (max-width: 600px) {
  body.shell { padding: .5rem; gap: .6rem; }
  .shell-header h1 { font-size: 1.1rem; }
  .shell-nav { font-size: .65rem; padding: .35rem .55rem; }
  .marquee-link { font-size: 1.1rem; }
}
