/* HASH HATCH — Lab arcade chrome, scoped for a checksum console. */

@font-face {
  font-family: "Press Start 2P";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/press-start-2p.woff2") format("woff2");
}
@font-face {
  font-family: "Press Start 2P Fallback";
  src: local("Courier New");
  size-adjust: 166.64%;
  ascent-override: 60%;
  descent-override: 0%;
  line-gap-override: 0%;
}

:root {
  color-scheme: dark;

  --bg: #0a0a12;
  --surface: #12121d;
  --surface-2: #1a1a2a;
  --line: #28283c;
  --text: #e9e9f2;
  --dim: #9aa0b5;
  --cyan: #45f0ff;
  --magenta: #ff3d8b;
  --gold: #ffc857;
  --green: #41ff8b;
  --red: #ff5560;

  --pixel: "Press Start 2P", "Press Start 2P Fallback", "Courier New", monospace;
  --sans: -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 8px;
  --radius-sm: 5px;

  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --glow-cyan: 0 0 14px rgba(69, 240, 255, 0.35);
  --gutter: clamp(0.85rem, 4vw, 2.5rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(1200px 540px at 50% -8%, rgba(69, 240, 255, 0.06), transparent 70%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 61, 139, 0.05), transparent 65%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.0625rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(69, 240, 255, 0.3);
  color: var(--text);
}

a {
  color: var(--cyan);
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(69, 240, 255, 0.18);
  border-radius: 3px;
}

/* ---------- global scanline atmosphere ---------- */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.16) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.55;
}

/* ---------- skip + back-to-lab chrome ---------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -56px;
  z-index: 200;
  background: var(--cyan);
  color: #05050d;
  padding: 10px 16px;
  border-radius: 6px;
  font-family: var(--mono);
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--duration-normal) var(--ease-out);
}
.skip-link:focus-visible {
  transform: translateY(68px);
}

.lab-link {
  position: fixed;
  top: clamp(0.6rem, 2vw, 1.1rem);
  left: clamp(0.6rem, 2vw, 1.1rem);
  z-index: 120;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.5rem 0.85rem;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-decoration: none;
  background: rgba(10, 10, 18, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-out);
}
.lab-link:hover,
.lab-link:focus-visible {
  color: var(--cyan);
  border-color: var(--cyan);
  text-shadow: var(--glow-cyan);
  box-shadow: 0 0 18px rgba(69, 240, 255, 0.22);
  transform: translateX(-2px);
}

/* ---------- shell ---------- */
.app-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(3.75rem, 9vw, 5.5rem) var(--gutter) clamp(3rem, 7vw, 5rem);
}

/* ---------- header / wordmark ---------- */
.app-header {
  display: grid;
  gap: 0.55rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.level {
  margin: 0;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 200, 87, 0.3);
}

.wordmark {
  position: relative;
  margin: 0.1rem 0 0.2rem;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(1.5rem, 0.6rem + 6vw, 3.4rem);
  line-height: 1.12;
  letter-spacing: 0.02em;
  color: var(--text);
  text-shadow: 0 0 22px rgba(69, 240, 255, 0.45), 3px 3px 0 var(--magenta);
}

/* layered chromatic ghost on the wordmark for arcade depth */
.wordmark::before,
.wordmark::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  z-index: -1;
}
.wordmark::before {
  color: var(--cyan);
  transform: translate(-2px, -1px);
  text-shadow: none;
}
.wordmark::after {
  color: var(--magenta);
  transform: translate(2px, 1px);
  text-shadow: none;
}

.tagline {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(0.78rem, 0.7rem + 0.4vw, 0.95rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.cursor {
  color: var(--cyan);
  margin-left: 0.15em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  width: fit-content;
  max-width: 100%;
  margin: 0.7rem 0 0;
  padding: 0.5rem 0.85rem;
  border: 1px solid rgba(65, 255, 139, 0.4);
  border-radius: 999px;
  background: rgba(65, 255, 139, 0.08);
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.privacy-badge__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(65, 255, 139, 0.8);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.78); }
}

/* ---------- layout grid ---------- */
.layout {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.5rem);
  margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
}

/* ---------- panels ---------- */
.panel {
  position: relative;
  padding: clamp(1.05rem, 2.5vw, 1.6rem);
  background:
    linear-gradient(180deg, var(--surface-2), var(--surface) 64%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

/* thin neon top-rail per panel role */
.panel::before {
  content: "";
  position: absolute;
  left: 1.1rem;
  right: 1.1rem;
  top: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--rail, var(--cyan));
  box-shadow: 0 0 12px var(--rail, var(--cyan));
  opacity: 0.75;
}
.input-panel { --rail: var(--cyan); }
.compare-panel { --rail: var(--magenta); }
.results-panel { --rail: var(--gold); }

.section-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1.15rem;
}
.section-heading__title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.panel-tag {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 2.5rem;
  height: 1.6rem;
  padding: 0 0.4rem;
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 0.04em;
  color: var(--bg);
  background: var(--cyan);
  border-radius: 3px;
  box-shadow: 0 0 14px rgba(69, 240, 255, 0.4);
}
.panel-tag--magenta {
  background: var(--magenta);
  box-shadow: 0 0 14px rgba(255, 61, 139, 0.45);
}
.panel-tag--gold {
  background: var(--gold);
  box-shadow: 0 0 14px rgba(255, 200, 87, 0.45);
}

h2 {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(0.72rem, 0.62rem + 0.5vw, 0.95rem);
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: var(--text);
}

/* ---------- fields ---------- */
.field-group {
  display: grid;
  gap: 0.5rem;
}
label {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.text-input,
.compare-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 8, 14, 0.6);
  color: var(--text);
  font-family: var(--mono);
  transition: border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    background-color var(--duration-fast) ease;
}
.text-input::placeholder,
.compare-input::placeholder {
  color: rgba(154, 160, 181, 0.6);
}

.text-input {
  min-height: 9rem;
  padding: 0.9rem;
  resize: vertical;
  font-size: 0.9rem;
  line-height: 1.55;
}
.compare-input {
  min-height: 2.9rem;
  padding: 0.8rem 0.9rem;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.text-input:hover,
.compare-input:hover {
  border-color: rgba(69, 240, 255, 0.45);
}
.text-input:focus,
.compare-input:focus {
  outline: none;
  border-color: var(--cyan);
  background: rgba(8, 8, 14, 0.85);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 18px rgba(69, 240, 255, 0.2);
}

/* ---------- divider ---------- */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0 0.85rem;
  color: var(--dim);
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 0.18em;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

/* ---------- drop zone ---------- */
.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 0.4rem;
  min-height: 8.5rem;
  padding: 1.25rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(45deg, rgba(69, 240, 255, 0.025) 0 10px, transparent 10px 20px),
    rgba(8, 8, 14, 0.4);
  color: var(--dim);
  text-align: center;
  transition: border-color var(--duration-fast) ease,
    background-color var(--duration-fast) ease,
    color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-out);
}
.drop-zone__icon {
  font-size: 1.6rem;
  line-height: 1;
  color: var(--cyan);
  filter: drop-shadow(0 0 8px rgba(69, 240, 255, 0.4));
}
.drop-zone strong {
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text);
  line-height: 1.5;
}
.drop-zone__sub {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.drop-zone:hover {
  border-color: rgba(69, 240, 255, 0.55);
  color: var(--text);
}
.drop-zone:focus-visible {
  border-style: solid;
}
.drop-zone.is-dragging {
  border-color: var(--cyan);
  border-style: solid;
  background:
    repeating-linear-gradient(45deg, rgba(69, 240, 255, 0.08) 0 10px, transparent 10px 20px),
    rgba(69, 240, 255, 0.06);
  color: var(--cyan);
  box-shadow: inset 0 0 28px rgba(69, 240, 255, 0.18), 0 0 22px rgba(69, 240, 255, 0.2);
  transform: scale(1.005);
}
.drop-zone.is-dragging .drop-zone__icon {
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.help-text {
  margin: 0.7rem 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.78rem;
}

/* ---------- buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.6rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    background-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-out);
}

.button-secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--dim);
}
.button-secondary:hover {
  color: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 14px rgba(255, 85, 96, 0.2);
}
.button-secondary:active {
  transform: translateY(1px);
}

/* ---------- compare status ---------- */
.compare-status {
  margin: 1rem 0 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 8, 14, 0.4);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}
.compare-status-match {
  border-color: rgba(65, 255, 139, 0.5);
  border-left-color: var(--green);
  background: rgba(65, 255, 139, 0.09);
  color: var(--green);
  box-shadow: 0 0 18px rgba(65, 255, 139, 0.15);
}
.compare-status-mismatch {
  border-color: rgba(255, 85, 96, 0.5);
  border-left-color: var(--red);
  background: rgba(255, 85, 96, 0.09);
  color: var(--red);
}

/* ---------- results ---------- */
.runtime-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--dim);
}
.runtime-status::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 8px currentColor;
}
.runtime-status[data-state="ready"] { color: var(--green); }
.runtime-status[data-state="busy"] { color: var(--cyan); }
.runtime-status[data-state="busy"]::before { animation: pulse 0.9s ease-in-out infinite; }
.runtime-status[data-state="error"] { color: var(--red); }

.results-list {
  display: grid;
  gap: clamp(0.85rem, 2vw, 1.25rem);
}

.empty-state {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 2.5rem 1.25rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(8, 8, 14, 0.35);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.85rem;
  text-align: center;
}
.empty-state__glyph {
  font-family: var(--mono);
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  color: var(--line);
}

.result-card {
  display: grid;
  gap: 0.85rem;
  padding: clamp(0.95rem, 2vw, 1.3rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 70%);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
}
.result-card h3 {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(69, 240, 255, 0.25);
}
.result-meta {
  margin: 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* ---------- hash table (mobile-first stacked) ---------- */
.hash-table {
  width: 100%;
  border-collapse: collapse;
}
.hash-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.hash-table thead {
  display: none;
}
.hash-table tr {
  display: grid;
  gap: 0.5rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}
.hash-table tbody tr:first-child {
  border-top: 0;
  padding-top: 0;
}
.hash-table th,
.hash-table td {
  padding: 0;
  text-align: left;
  vertical-align: middle;
}
.hash-table th[scope="row"] {
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.hash-value {
  display: block;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 8, 14, 0.7);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-all;
  white-space: normal;
}

.hash-row-match th[scope="row"] { color: var(--green); }
.hash-row-match .hash-value {
  border-color: rgba(65, 255, 139, 0.5);
  background: rgba(65, 255, 139, 0.08);
  color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(65, 255, 139, 0.3), 0 0 16px rgba(65, 255, 139, 0.14);
}
.hash-row-mismatch .hash-value {
  border-color: rgba(255, 85, 96, 0.35);
  background: rgba(255, 85, 96, 0.06);
}

.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.4rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    background-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-out);
}
.copy-button:hover {
  border-color: var(--cyan);
  background: rgba(69, 240, 255, 0.08);
  box-shadow: 0 0 14px rgba(69, 240, 255, 0.2);
}
.copy-button:active {
  transform: translateY(1px);
}
.copy-button.is-copied {
  color: var(--green);
  border-color: var(--green);
  background: rgba(65, 255, 139, 0.1);
  box-shadow: 0 0 14px rgba(65, 255, 139, 0.22);
}

.copy-status {
  min-height: 1.3rem;
  margin: 1rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--dim);
}
.copy-status[data-state="ok"] { color: var(--green); }
.copy-status[data-state="error"] { color: var(--red); }

/* ---------- footer ---------- */
.app-footer {
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  margin-top: clamp(2rem, 5vw, 3.5rem);
  padding-top: clamp(1.5rem, 4vw, 2.5rem);
  border-top: 1px solid var(--line);
  text-align: center;
}
.app-footer__copy {
  margin: 0;
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 0.12em;
  line-height: 2;
  color: var(--dim);
}
.app-footer__algos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
}
.app-footer__algos span {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--dim);
}

/* ---------- responsive: tablet ---------- */
@media (min-width: 40rem) {
  .privacy-badge {
    font-size: 0.82rem;
  }

  .hash-table thead {
    display: table-header-group;
  }
  .hash-table thead th {
    padding: 0 0.75rem 0.6rem 0;
    font-family: var(--pixel);
    font-size: 8px;
    letter-spacing: 0.06em;
    color: var(--dim);
    border-bottom: 1px solid var(--line);
  }
  .hash-table tr {
    display: table-row;
    padding: 0;
  }
  .hash-table tbody tr:first-child {
    padding-top: 0;
  }
  .hash-table th,
  .hash-table td {
    padding: 0.6rem 0.75rem 0.6rem 0;
    border-top: 1px solid var(--line);
  }
  .hash-table tbody tr:first-child th,
  .hash-table tbody tr:first-child td {
    border-top: 0;
  }
  .hash-table th[scope="row"] {
    width: 6.5rem;
    white-space: nowrap;
    vertical-align: top;
    padding-top: 0.95rem;
  }
  .hash-table td:last-child {
    width: 7rem;
    padding-right: 0;
    text-align: right;
    vertical-align: top;
  }
  .copy-button {
    width: auto;
    min-width: 6rem;
  }
}

/* ---------- responsive: desktop layout ---------- */
@media (min-width: 60rem) {
  .layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .cursor,
  .privacy-badge__dot,
  .drop-zone.is-dragging .drop-zone__icon,
  .runtime-status[data-state="busy"]::before {
    animation: none !important;
  }
  .drop-zone.is-dragging {
    transform: none;
  }
}
