/* ==========================================================
   CraftTheBlade.com — pixel arcade theme
   ========================================================== */

:root {
  /* Colors */
  --bg:          #0b0f1c;   /* night navy */
  --bg-2:        #121a2e;   /* panels */
  --bg-3:        #1b2640;   /* raised panels */
  --steel-dark:  #2b3a57;
  --steel:       #5b6f8c;
  --steel-light: #9fb4d1;
  --white:       #e8f1ff;
  --accent:      #3d8bff;   /* blade blue */
  --accent-dark: #1f4fa3;
  --accent-glow: #7fb6ff;
  --warn:        #ffd23f;   /* "coming soon" yellow */

  /* Type */
  --font-pixel: "Press Start 2P", monospace;
  --font-body:  "VT323", monospace;

  /* Pixel size used for borders and shadows */
  --px: 4px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  /* tiny starfield */
  background-image:
    radial-gradient(var(--steel) 1px, transparent 1px),
    radial-gradient(var(--steel-dark) 1px, transparent 1px);
  background-size: 64px 64px, 37px 37px;
  background-position: 0 0, 19px 23px;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 22px;
  line-height: 1.35;
  -webkit-font-smoothing: none;
  image-rendering: pixelated;
}

/* Subtle CRT scanlines over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px
  );
  z-index: 100;
}

a { color: var(--accent-glow); }
a:hover { color: var(--white); }

img, svg { display: block; }

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

h1, h2, h3 {
  font-family: var(--font-pixel);
  font-weight: normal;
  line-height: 1.4;
  margin: 0 0 0.6em;
}

/* ---------- Pixel frame (stepped corners) ---------- */
.pixel-frame {
  position: relative;
  background: var(--bg-2);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--steel),
    0 var(--px) 0 0 var(--steel),
    calc(var(--px) * -1) 0 0 0 var(--steel),
    var(--px) 0 0 0 var(--steel),
    0 calc(var(--px) * 2) 0 0 #000;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 28, 0.94);
  border-bottom: var(--px) solid var(--steel-dark);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--white);
}

.logo img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-pixel);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 1px;
}

.logo-text span { color: var(--accent); }

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nav a {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--steel-light);
  text-decoration: none;
  padding: 10px 12px;
  border: var(--px) solid transparent;
}

.nav a:hover {
  color: var(--white);
  border-color: var(--steel-dark);
}

.nav a[aria-current="page"] {
  color: var(--white);
  background: var(--accent-dark);
  border-color: var(--accent);
}

.nav a[aria-current="page"]::before { content: "> "; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
  color: var(--white);
  background: var(--accent);
  padding: 16px 20px;
  border: none;
  cursor: pointer;
  box-shadow:
    inset calc(var(--px) * -1) calc(var(--px) * -1) 0 0 var(--accent-dark),
    inset var(--px) var(--px) 0 0 var(--accent-glow),
    0 0 0 var(--px) #000;
  transition: transform 60ms steps(1);
}

.btn:hover {
  color: var(--white);
  background: #5199ff;
}

.btn:active {
  transform: translateY(var(--px));
  box-shadow:
    inset var(--px) var(--px) 0 0 var(--accent-dark),
    0 0 0 var(--px) #000;
}

.btn-ghost {
  background: var(--bg-3);
  color: var(--steel-light);
  box-shadow:
    inset calc(var(--px) * -1) calc(var(--px) * -1) 0 0 var(--steel-dark),
    inset var(--px) var(--px) 0 0 var(--steel),
    0 0 0 var(--px) #000;
}

.btn-ghost:hover { background: var(--steel-dark); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 10px;
  padding: 8px 10px;
  color: #241c00;
  background: var(--warn);
  box-shadow: 0 0 0 var(--px) #000;
}

.badge-blue {
  color: var(--white);
  background: var(--accent-dark);
}

/* ---------- Hero ---------- */
.hero {
  padding: 72px 0 56px;
  text-align: center;
}

.hero .badge { margin-bottom: 28px; }

.hero-title {
  font-size: clamp(32px, 9vw, 72px);
  color: var(--white);
  letter-spacing: 4px;
  margin-bottom: 20px;
  text-shadow:
    var(--px) var(--px) 0 var(--accent-dark),
    calc(var(--px) * 2) calc(var(--px) * 2) 0 #000;
}

.hero-sub {
  max-width: 560px;
  margin: 0 auto 36px;
  color: var(--steel-light);
  font-size: 26px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.press-start {
  margin-top: 48px;
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--accent-glow);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ---------- Teaser screen ---------- */
.teaser {
  margin: 0 auto 72px;
  max-width: 820px;
  padding: 32px;
}

.teaser-screen {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background:
    linear-gradient(to bottom, transparent 62%, var(--steel-dark) 62%, var(--steel-dark) 64%, #0f1626 64%),
    linear-gradient(to bottom, #0e1a36, #1c3466 62%);
  position: relative;
  overflow: hidden;
}

/* pixel mountains */
.teaser-screen::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: 36%;
  height: 22%;
  clip-path: polygon(
    0 100%, 0 70%, 8% 70%, 8% 50%, 14% 50%, 14% 30%, 20% 30%, 20% 10%, 26% 10%, 26% 40%,
    34% 40%, 34% 60%, 42% 60%, 42% 25%, 50% 25%, 50% 0, 56% 0, 56% 35%, 64% 35%, 64% 55%,
    72% 55%, 72% 20%, 80% 20%, 80% 45%, 88% 45%, 88% 65%, 100% 65%, 100% 100%
  );
  background: #2a4a8a;
}

.teaser-screen .moon {
  position: absolute;
  top: 14%;
  right: 16%;
  width: 48px;
  height: 48px;
  background: var(--white);
  box-shadow: inset -12px -8px 0 0 var(--steel-light);
}

.teaser-screen p {
  position: relative;
  margin: 0;
  font-family: var(--font-pixel);
  font-size: clamp(10px, 2.2vw, 14px);
  color: var(--white);
  text-shadow: 2px 2px 0 #000;
}

.teaser-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  color: var(--steel-light);
}

.teaser-caption strong {
  font-family: var(--font-pixel);
  font-weight: normal;
  font-size: 12px;
  color: var(--white);
}

/* ---------- Sections ---------- */
.section { padding: 0 0 72px; }

.section-title {
  font-size: 16px;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.section-title::before {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--accent);
  box-shadow: 0 0 0 var(--px) #000;
  flex-shrink: 0;
}

.page-head {
  padding: 56px 0 40px;
}

.page-head h1 {
  font-size: clamp(22px, 5vw, 36px);
  text-shadow: var(--px) var(--px) 0 var(--accent-dark);
}

.page-head p {
  color: var(--steel-light);
  max-width: 600px;
  margin: 0;
}

/* ---------- Game grid ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 32px;
}

.game-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--white);
  transition: transform 80ms steps(2);
}

a.game-card:hover {
  color: var(--white);
  transform: translateY(calc(var(--px) * -1));
}

a.game-card:hover .game-thumb { outline: var(--px) solid var(--accent); }

.game-thumb {
  aspect-ratio: 4 / 3;
  background: var(--bg-3);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.game-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-info {
  padding: 16px;
}

.game-info h3 {
  font-size: 12px;
  margin-bottom: 8px;
}

.game-info p {
  margin: 0 0 12px;
  color: var(--steel-light);
  font-size: 20px;
}

/* "?" block used for placeholder games */
.mystery-block {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  font-family: var(--font-pixel);
  font-size: 28px;
  color: #241c00;
  background: var(--warn);
  box-shadow:
    inset -6px -6px 0 0 #c99a00,
    inset 6px 6px 0 0 #fff0a8,
    0 0 0 var(--px) #000;
  animation: bob 1.6s steps(2) infinite;
}

@keyframes bob {
  50% { transform: translateY(calc(var(--px) * -1)); }
}

.game-card.is-locked { opacity: 0.85; }

/* ---------- Account ---------- */
.auth-box {
  max-width: 460px;
  padding: 28px 24px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.auth-tabs a {
  font-family: var(--font-pixel);
  font-size: 10px;
  text-decoration: none;
  color: var(--steel-light);
  padding: 10px 12px;
  background: var(--bg-3);
  border: var(--px) solid transparent;
}

.auth-tabs a.on {
  color: var(--white);
  background: var(--accent-dark);
  border-color: var(--accent);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: flex-start;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.auth-form label span {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--steel-light);
}

.auth-form input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 24px;
  color: var(--white);
  background: var(--bg);
  border: var(--px) solid var(--steel-dark);
  padding: 8px 10px;
  outline: none;
}

.auth-form input:focus { border-color: var(--accent); }

.auth-note {
  margin: 0;
  color: var(--steel-light);
  font-size: 20px;
}

.auth-error {
  margin: 0 0 18px;
  padding: 10px 12px;
  color: #ffb4a8;
  background: #3a1410;
  box-shadow: 0 0 0 var(--px) #000;
}

.auth-hello { margin: 0 0 10px; font-size: 24px; }
.auth-hello strong { color: var(--accent-glow); font-weight: normal; }
.auth-box form + * , .auth-box .auth-note + form { margin-top: 20px; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  border-top: var(--px) solid var(--steel-dark);
  background: var(--bg-2);
  padding: 24px 0;
  color: var(--steel);
  font-size: 20px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Shop ---------- */
.btn-small { font-size: 10px; padding: 10px 12px; }
.good { color: #9dff9d; }
.small { font-size: 18px; }

.shop-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

.shop-tabs a {
  font-family: var(--font-pixel);
  font-size: 14px;
  text-decoration: none;
  color: var(--steel-light);
  padding: 14px 18px;
  background: var(--bg-3);
  border: var(--px) solid var(--steel-dark);
}

.shop-tabs a.on {
  color: var(--white);
  background: var(--accent-dark);
  border-color: var(--accent);
}

.shop-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 24px;
  padding: 10px 12px;
  background: var(--bg-3);
  box-shadow: 0 0 0 var(--px) #000;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 32px;
}

.shop-card { display: flex; flex-direction: column; }
.shop-card.is-focus { outline: var(--px) solid var(--warn); }

.shop-thumb {
  aspect-ratio: 16 / 9;
  background: var(--bg-3);
  overflow: hidden;
}

.shop-thumb img { width: 100%; height: 100%; object-fit: cover; }

.shop-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px;
}

.shop-info h3 { font-size: 12px; margin-bottom: 8px; }
.shop-info p { margin: 0 0 10px; color: var(--steel-light); font-size: 20px; }
.shop-info .shop-gets { color: var(--accent-glow); }

.shop-buy {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.shop-price { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.shop-price strong { font-family: var(--font-pixel); font-weight: normal; font-size: 14px; }
.shop-price s { color: var(--steel); }
.shop-price small { flex-basis: 100%; color: var(--warn); font-size: 18px; }

.shop-add { display: flex; align-items: center; gap: 8px; }

.shop-qty input,
.basket-qty input {
  width: 64px;
  font-family: var(--font-body);
  font-size: 22px;
  color: var(--white);
  background: var(--bg);
  border: var(--px) solid var(--steel-dark);
  padding: 2px 6px;
}

.basket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 32px;
  align-items: start;
}

.basket-lines { padding: 8px 16px; }

.basket-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 2px solid var(--steel-dark);
}

.basket-line:last-child { border-bottom: none; }
.basket-line strong { font-weight: normal; font-size: 24px; }
.basket-line small { display: block; color: var(--steel-light); font-size: 18px; }
.basket-line small.good { color: #9dff9d; }
.basket-controls { display: flex; align-items: center; gap: 12px; }
.basket-qty { display: flex; gap: 6px; align-items: center; }
.basket-sum { font-family: var(--font-pixel); font-size: 12px; min-width: 80px; text-align: right; }

.basket-pay { padding: 20px; }

.basket-totals {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  margin: 0 0 16px;
}

.basket-totals dd { margin: 0; text-align: right; }
.basket-totals .basket-pay-now { font-family: var(--font-pixel); font-size: 13px; padding-top: 8px; }
#stripe-element { margin-bottom: 16px; }
#pay-box .btn, #pay-start > .btn { width: 100%; }
.pay-or { text-align: center; color: var(--steel-light); margin: 12px 0; }
#paypal-buttons { min-height: 48px; }

.order-box, .account-shop { max-width: 640px; }

.order-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.order-table td { padding: 6px 0; border-bottom: 2px solid var(--steel-dark); }
.order-table td:last-child { text-align: right; }
.order-table .order-total td { font-family: var(--font-pixel); font-size: 12px; border-bottom: none; padding-top: 12px; }

.ref-link {
  width: 100%;
  font-family: var(--font-body);
  font-size: 22px;
  color: var(--accent-glow);
  background: var(--bg);
  border: var(--px) solid var(--steel-dark);
  padding: 8px 10px;
}

@media (max-width: 860px) {
  .basket-layout { grid-template-columns: 1fr; }
}

/* ---------- Shop admin ---------- */
.admin .shop-tabs a { font-size: 11px; padding: 10px 12px; }
.admin-logout { margin-left: auto; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  padding-bottom: 32px;
}

.admin-stats > div { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.admin-stats small { color: var(--steel-light); font-size: 18px; }
.admin-stats strong { font-family: var(--font-pixel); font-weight: normal; font-size: 16px; }
.admin-stats span { color: var(--steel-light); }

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  max-width: 720px;
}

.admin-form label { display: flex; flex-direction: column; gap: 4px; }
.admin-form label span { font-family: var(--font-pixel); font-size: 9px; color: var(--steel-light); line-height: 1.5; }
.admin-form .admin-check { flex-direction: row; align-items: center; gap: 10px; }
.admin-form p { margin: 0; }
.admin-form fieldset { border: 2px solid var(--steel-dark); padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.admin-form legend { font-family: var(--font-pixel); font-size: 10px; padding: 0 6px; }

.admin input:not([type="checkbox"]),
.admin select,
.admin textarea {
  font-family: var(--font-body);
  font-size: 22px;
  color: var(--white);
  background: var(--bg);
  border: var(--px) solid var(--steel-dark);
  padding: 4px 8px;
}

.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 19px; }
.admin-table th { font-family: var(--font-pixel); font-weight: normal; font-size: 9px; text-align: left; color: var(--steel-light); }
.admin-table th, .admin-table td { padding: 8px; border-bottom: 2px solid var(--steel-dark); vertical-align: top; }
.admin-table tr.off td { color: var(--steel); }
.admin-actions { white-space: nowrap; }
.admin-actions form { display: inline-flex; gap: 6px; }
.admin-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.admin code { font-size: 20px; color: var(--accent-glow); word-break: break-all; }

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  body { font-size: 20px; }
  .logo-text { font-size: 10px; }
  .logo img { width: 32px; height: 32px; }
  .nav a { font-size: 9px; padding: 8px; }
  .hero { padding-top: 48px; }
  .teaser { padding: 16px; }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  .press-start, .mystery-block { animation: none; }
  html { scroll-behavior: auto; }
}
