:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2d3348;
  --text: #e8eaef;
  --muted: #9aa3b5;
  --accent: #7c9cff;
  --ok: #4ade80;
  --err: #f87171;
  --warn: #fbbf24;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body.preview-modal-open {
  overflow: hidden;
}

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


.site-header, .site-footer {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.site-header {
  text-align: center;
}

@media (max-width: 640px) {
  .site-header, .site-footer {
    padding: 0.6rem 0.5rem;
  }
  
  .site-header h1 {
    font-size: 1.1rem;
    margin: 0;
  }
  
  .tagline {
    font-size: 0.8rem;
    margin-top: 0.1rem;
  }
}

.container-centered {
  text-align: center;
}

.container-centered .step {
  text-align: center;
}

.container-centered input[type="file"],
.container-centered button {
  margin-left: auto;
  margin-right: auto;
}

.container-centered .build-list {
  display: inline-block;
  text-align: left;
  max-width: 100%;
}

.container-centered .step.hack-credits {
  text-align: left;
}

.hack-credits-list {
  list-style: disc;
  padding-left: 1.5rem;
  margin: 0;
  max-width: none;
  text-align: left;
}

.hack-credits-list li {
  margin-bottom: 0.65rem;
}

.hack-credits-list li:last-child {
  margin-bottom: 0;
}

.container-centered .verify-table {
  margin-left: auto;
  margin-right: auto;
}

.container-centered .log {
  text-align: left;
}

.back {
  text-align: left;
  margin: 0 0 0.75rem;
}

.patcher-header .back {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1rem;
}

.patcher-title {
  margin: 0 0 1.25rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 640px) {
  .patcher-header .back {
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    padding: 0 0.5rem;
  }

  .patcher-title {
    margin: 0 0 0.6rem;
    font-size: clamp(1rem, 5vw, 1.5rem);
    line-height: 1.2;
    padding: 0 0.5rem;
    word-break: break-word;
  }
}

.patcher-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2rem;
  max-width: 720px;
  margin: 0 auto;
  align-items: start;
  text-align: center;
}

.patcher-hero .header-preview {
  width: 100%;
  max-width: 320px;
  height: 240px;
  margin: 0 auto;
}

.patcher-hero .hack-links {
  text-align: left;
  justify-self: stretch;
}

@media (max-width: 640px) {
  .patcher-hero {
    grid-template-columns: 1fr;
    max-width: 100%;
    gap: 0.5rem;
    padding: 0 0.5rem;
  }
  
  .patcher-hero .header-preview {
    max-width: 100%;
    height: auto;
    max-height: 200px;
  }

  .hack-links {
    font-size: 0.8rem;
    line-height: 1.4;
  }

  .hack-links a,
  .hack-links p,
  .hack-links li {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

.site-footer {
  border-bottom: none;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}

@media (max-width: 640px) {
  .container {
    padding: 0.5rem;
  }
}

.tagline { color: var(--muted); margin-top: 0.25rem; }

.disclaimer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .disclaimer {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.3;
  }

  .disclaimer p,
  .step p,
  .step li,
  .status,
  .verify-table,
  .build-list .compatibility-note {
    font-size: 0.75rem;
    line-height: 1.4;
  }
}

.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.step h2 { margin-top: 0; font-size: 1.1rem; }

@media (max-width: 640px) {
  .step {
    padding: 0.7rem 0.75rem;
    margin-bottom: 0.5rem;
  }
  
  .step h2 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    margin-top: 0;
  }

  .build-list label {
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .build-list label > input[type="radio"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
  }
}

.hack-list h2 {
  margin-top: 0;
}

.cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
  gap: 1rem;
}

@media (min-width: 721px) {
  .cards > li:last-child:nth-child(3n + 1) {
    grid-column: 2;
  }
}

@media (max-width: 720px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

.card {
  display: block;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
  overflow: hidden;
}

.card h3,
.card p {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  text-align: center;
}

.card h3 {
  margin: 0.75rem 0 0.5rem;
  color: var(--accent);
}

.card p {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .card h3,
  .card p {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }
  
  .card h3 {
    margin: 0.35rem 0 0.2rem;
    font-size: 0.85rem;
    line-height: 1.2;
  }
  
  .card p {
    margin: 0 0 0.6rem;
    font-size: 0.75rem;
    line-height: 1.25;
  }
}

.card-links {
  margin: -0.5rem 0 0;
  padding: 0 1.25rem 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: center;
}

@media (max-width: 640px) {
  .card-links {
    padding: 0 0.7rem 0.4rem;
    font-size: 0.7rem;
    line-height: 1.3;
    margin: 0 0 0 0;
  }
}
  margin: 0;
  padding: 0.65rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: #141824;
}

.wip-list {
  margin-top: 2.5rem;
}

@media (max-width: 640px) {
  .wip-list {
    margin-top: 0.8rem;
  }
}

.hack-view-switch {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 2.5rem 0 1.25rem;
}

@media (max-width: 640px) {
  .hack-view-switch {
    margin: 0.6rem 0 0.4rem;
    gap: 0.3rem;
  }
  
  .hack-view-switch button {
    padding: 0.35rem 0.7rem;
    font-size: 0.7rem;
  }
}

.hack-view-switch button {
  margin-top: 0;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.hack-view-switch button.is-active,
.hack-view-switch button:hover {
  background: var(--accent);
  color: #0f1117;
  border-color: var(--accent);
}

.secondary-hack-list {
  margin-bottom: 2.5rem;
}

.preview-slideshow {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0c10;
  overflow: hidden;
}

.card-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 640px) {
  .card-preview {
    aspect-ratio: 16 / 9;
    min-height: 100px;
  }
}

.header-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.hack-links {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.hack-link-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-right: 0.25rem;
  color: var(--accent);
  text-decoration: none;
}

.hack-link-with-icon img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  object-fit: contain;
  vertical-align: middle;
}

.preview-slide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity: 0;
  transition: opacity 0.45s ease-in-out;
  pointer-events: none;
}

.preview-slide.is-active {
  opacity: 1;
}

.preview-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 999;
}

.preview-modal.is-open {
  display: block;
}

.preview-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 12, 0.8);
}

.preview-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 980px);
  max-height: 92vh;
  margin: 4vh auto;
  padding: 1rem 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #121821;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  overflow: auto;
  overscroll-behavior: contain;
}

.preview-modal__close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  width: 2.2rem;
  height: 2.2rem;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
}

.preview-modal__content {
  padding-top: 0.5rem;
}

.preview-modal__content h2 {
  margin: 0 2.25rem 0.85rem 0;
  font-size: clamp(1.1rem, 2.2vw, 1.7rem);
}

.preview-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
  align-items: start;
  padding-bottom: 0.5rem;
}

.preview-gallery__item {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #0a0c10;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.preview-gallery__item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.preview-gallery__item img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 32vh;
  object-fit: contain;
  background: #0a0c10;
}

input[type="file"] {
  display: block;
  margin: 0.75rem 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  input[type="file"] {
    margin: 0.35rem 0;
    font-size: 0.75rem;
    max-width: 100%;
  }

  .log {
    font-size: 0.72rem;
    line-height: 1.4;
    padding: 0.55rem;
  }
}

button {
  margin-top: 1rem;
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: #0f1117;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.preview-link-button {
  margin: 0;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.14);
  color: var(--accent);
  border: 1px solid rgba(124, 156, 255, 0.45);
}

@media (max-width: 640px) {
  button {
    margin-top: 0.4rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.75rem;
    width: auto;
    max-width: 100%;
  }
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.build-list label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  cursor: pointer;
}

.build-list .compatibility-note {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.support-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.build-option .support-tag + .support-tag {
  margin-left: 0.45rem;
}

.support-tag.direct {
  background: rgba(42, 196, 116, 0.16);
  color: var(--ok);
  border: 1px solid rgba(42, 196, 116, 0.4);
}

.support-tag.indirect {
  background: rgba(255, 184, 77, 0.14);
  color: var(--warn);
  border: 1px solid rgba(255, 184, 77, 0.4);
}

.status { color: var(--muted); min-height: 1.5em; }

.log {
  background: #0a0c10;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  min-height: 120px;
  max-height: 280px;
  overflow: auto;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

.verify-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.verify-table th,
.verify-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  text-align: left;
}

.row-pass td:nth-child(2) { color: var(--ok); }
.row-fail td:nth-child(2) { color: var(--err); }
.row-missing td:nth-child(2) { color: var(--warn); }

.msg-ok { color: var(--ok); font-weight: 600; }
.msg-err { color: var(--err); font-weight: 600; }

code {
  background: #0a0c10;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.file-notice {
  border-color: var(--warn);
}
