/* ============================================================
   COMPLYCAT / $COMPLYCAT - design tokens
   reference: the approved MS-Paint mouse-drawn compliance-board avatar/banner
   signature: click any row, it flashes green, then settles back to what it
              already was. row 40 (COMPLYCAT) always settles back to red.
   palette:   paper cream   #F8F4EA  (page + panel bg, matches the source art)
              panel white   #FFFDF7  (screen surface)
              ink           #1A1A1A  (all linework)
              pass green    #3AA65A  (compliance green)
              fail red      #D6432D  (red X)
   type:      Kalam (display/marker: title, brand, checklist labels)
              Courier Prime (mono: chain badge, status readouts, case number)
   spacing:   4 / 8 / 12 / 16 / 24 / 32 / 48 px
   radius:    crude/uneven border-radius per corner, never a clean rectangle
   motion:    450ms flash-green pulse on click, then reverts to true state
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #F8F4EA;
  overscroll-behavior: none;
}

body {
  font-family: 'Kalam', 'Comic Sans MS', cursive;
  color: #1A1A1A;
  background-color: #F8F4EA;
  background-image: radial-gradient(rgba(26,26,26,0.07) 1px, transparent 1px);
  background-size: 22px 22px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

img { max-width: 100%; display: block; }

.page {
  height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------- topbar ---------- */

.topbar {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 20px;
  border-bottom: 4px solid #1A1A1A;
  background: #F8F4EA;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-avatar {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 14px 10px 16px 8px;
  border: 3px solid #1A1A1A;
  flex: none;
}

.brand-name {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.chain-badge {
  font-family: 'Courier Prime', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #1A1A1A;
  background: #FFFDF7;
  border: 2px solid #1A1A1A;
  border-radius: 10px 4px 10px 4px;
  padding: 4px 9px;
  white-space: nowrap;
  order: 3;
  flex-basis: 100%;
  text-align: center;
  margin: 0 auto;
  width: fit-content;
}

.chain-badge .sep { color: #3AA65A; }

.topnav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.x-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  transition: transform 150ms ease;
}

.x-link:hover { transform: rotate(-6deg) scale(1.06); }
.x-link:focus-visible { outline: 3px solid #3AA65A; outline-offset: 2px; }

.buy-btn {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: #FFFDF7;
  background: #1A1A1A;
  border: 2px solid #1A1A1A;
  border-radius: 12px 4px 12px 4px;
  padding: 9px 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 150ms ease, transform 150ms ease;
}

.buy-btn:hover { background: #3AA65A; transform: translateY(-1px); }
.buy-btn:focus-visible { outline: 3px solid #3AA65A; outline-offset: 2px; }

/* ---------- board / stage ---------- */

.board {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
}

.stage {
  width: 100%;
  max-width: 760px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.monitor {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.monitor-bezel {
  flex: 1;
  min-height: 0;
  background: #1A1A1A;
  border-radius: 22px 16px 24px 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  min-height: 0;
  background: #FFFDF7;
  border-radius: 10px 14px 8px 16px;
  padding: 14px 20px 8px;
  display: flex;
  flex-direction: column;
}

.title {
  flex: none;
  margin: 0;
  font-size: clamp(24px, 4.4vw, 34px);
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
}

.subhead {
  flex: none;
  margin: 2px 0 8px;
  text-align: center;
  font-size: 13px;
  color: #4a4a44;
}

.checklist-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.checklist {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 2px 6px 4px 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 18px;
  align-content: start;
}

.checklist::-webkit-scrollbar { width: 8px; }
.checklist::-webkit-scrollbar-thumb { background: #d8d2c0; border-radius: 8px; }
.checklist::-webkit-scrollbar-track { background: transparent; }

.checklist-fade {
  position: absolute;
  left: 0;
  right: 6px;
  bottom: 0;
  height: 16px;
  background: linear-gradient(to bottom, rgba(255,253,247,0), #FFFDF7);
  pointer-events: none;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 3px 4px;
  text-align: left;
  border-radius: 6px;
}

.row:hover { background: rgba(58, 166, 90, 0.08); }
.row:focus-visible { outline: 2px solid #3AA65A; outline-offset: 1px; }

.box {
  flex: none;
  width: 22px;
  height: 22px;
  border: 3px solid #1A1A1A;
  border-radius: 4px 6px 4px 6px;
  background: #FFFDF7;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.icon {
  width: 20px;
  height: 20px;
  position: absolute;
}

.icon-fail { display: none; }
.row[data-state="fail"] .icon-fail { display: block; }
.row[data-state="fail"] .icon-pass { display: none; }
.row[data-state="fail"] .box { border-color: #D6432D; }

.label {
  font-size: 14.5px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-locked .label { font-weight: 700; }

/* the flash: every row, on click, forces the green check to show and the
   box to pulse, then the JS removes this class and the row's real
   data-state (pass/fail) takes back over */
.row.flashing .box {
  border-color: #3AA65A;
  animation: flashPulse 450ms ease;
}
.row.flashing .icon-pass { display: block !important; }
.row.flashing .icon-fail { display: none !important; }

@keyframes flashPulse {
  0% { box-shadow: 0 0 0 0 rgba(58,166,90,0.55); }
  60% { box-shadow: 0 0 0 7px rgba(58,166,90,0); }
  100% { box-shadow: 0 0 0 0 rgba(58,166,90,0); }
}

.row.snapback .box {
  animation: snapBack 320ms ease;
}

@keyframes snapBack {
  0% { transform: scale(1); }
  35% { transform: scale(0.86) rotate(-4deg); }
  100% { transform: scale(1); }
}

.status-bar {
  flex: none;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 2px dashed #1A1A1A;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  letter-spacing: 0.3px;
  color: #3a3a34;
}

.status-item b { color: #1A1A1A; }

.cat-peek {
  width: 26%;
  min-width: 96px;
  max-width: 170px;
  margin: -6px auto 0;
  pointer-events: none;
  user-select: none;
}

.case-number {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: #FFFDF7;
  border: 2px solid #1A1A1A;
  border-radius: 4px 10px 4px 10px;
  padding: 7px 14px;
  font-family: 'Courier Prime', monospace;
  font-size: 12px;
  max-width: 100%;
}

.case-label { color: #6a6a5f; flex: none; }
.case-value {
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: left;
}
.case-copy {
  flex: none;
  color: #3AA65A;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.case-copy.copied::after { content: 'ED'; }

.case-number:focus-visible { outline: 3px solid #3AA65A; outline-offset: 2px; }

/* ---------- error banner spacing safety ---------- */
/* (banner is injected inline by app.js / head script, no static rule needed) */

/* ---------- responsive ---------- */

@media (min-width: 640px) {
  .chain-badge {
    order: initial;
    flex-basis: auto;
    margin: 0;
    font-size: 11px;
    padding: 5px 10px;
  }
  .checklist {
    grid-template-columns: repeat(2, 1fr);
    gap: 2px 24px;
  }
}

@media (min-width: 900px) {
  .checklist {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px 24px;
  }
  .row { padding: 7px 4px; }
  .stage { max-width: 800px; }
}

@media (max-width: 420px) {
  .brand-name { font-size: 18px; }
  .buy-btn { font-size: 11px; padding: 8px 10px; }
  .title { font-size: 26px; }
  .label { font-size: 13.5px; }
  .box { width: 19px; height: 19px; }
  .icon { width: 17px; height: 17px; }
}

@media (max-height: 700px) {
  .cat-peek { display: none; }
  .subhead { display: none; }
  .topbar { padding: 8px 16px; }
}

@media (max-height: 560px) {
  .title { font-size: 22px; margin-bottom: 2px; }
  .status-bar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .row.flashing .box,
  .row.snapback .box,
  .x-link,
  .buy-btn {
    animation: none !important;
    transition: none !important;
  }
}
