/* Controller Simulator — style.css
   Dark space theme with a twinkling starfield, a glowy aim ring
   and radar-like particle bursts. */

:root {
  --bg: #060b24;
  --panel: #0d1236;
  --panel-2: #111644;
  --border: #1d2762;
  --text: #e8ebff;
  --dim: #6b75b8;
  --red: #ff5e5e;
  --purple: #9d4edd;
  --accent: #06d6a0;
  --amber: #ffb347;
  --font: "Space Grotesk", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  cursor: pointer;
  user-select: none;
}

/* ---- header ---- */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
}
.header-row {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
}
.logo span {
  color: var(--purple);
}
.sub {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
}

/* ---- layout ---- */

main {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 22px;
  align-items: start;
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 24px 40px;
}

.panel-col,
.field-col {
  min-width: 0;
}

.gamepad-card {
  position: sticky;
  top: 30px;
  z-index: 5;
}

.field-wrap {
  position: relative;
  height: 62vh;
  min-height: 360px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #080a1e;
}
#field {
  display: block;
}

/* ---- gamepad card ---- */

.gamepad {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 234px;
  margin: 0 auto;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-items: center;
  gap: 14px;
}

.triggers {
  grid-column: 1 / -1;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.trigger {
  width: 52px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.15s ease;
}
.trigger:hover {
  border-color: var(--dim);
}
.trigger:active,
.trigger.active {
  background: var(--border);
  border-color: var(--text);
  box-shadow: 0 0 14px 3px rgba(232, 235, 255, 0.18);
}

/* ---- sticks ---- */

.sticks {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 24px;
  align-items: center;
  padding-top: 4px;
}

.stick {
  display: flex;
  justify-content: center;
}

.stick-base {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.12s ease, box-shadow 0.15s ease;
}
.stick-base::before {
  content: "";
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px dashed var(--border);
}
.stick-base:hover {
  border-color: rgba(232, 235, 255, 0.2);
}
.stick-base.active {
  border-color: var(--purple);
  box-shadow: 0 0 10px rgba(157, 78, 237, 0.6);
}

.stick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 12px 4px rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%);
}

/* ---- d-pad ---- */

.dpad {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: stretch;
}

.dpad-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  transition: background 0.12s ease, color 0.12s ease, box-shadow 0.15s ease;
}
.dpad-btn:hover {
  color: var(--text);
}
.dpad-btn.active {
  background: var(--border);
  color: var(--text);
}
.dpad-left,
.dpad-right {
  width: 44px;
  height: 34px;
}
.dpad-up,
.dpad-down {
  width: 34px;
  height: 44px;
}

/* ---- buttons ---- */

.buttons {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, 54px);
  justify-content: center;
  gap: 12px;
}
.buttons .btn-x { grid-area: 1 / 1; }
.buttons .btn-y { grid-area: 1 / 2; }
.buttons .btn-a { grid-area: 2 / 1; }
.buttons .btn-b { grid-area: 2 / 2; }

.btn {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.12s ease;
}
.btn:hover {
  box-shadow: 0 0 14px 3px rgba(255, 255, 255, 0.12);
}
.btn:active,
.btn.active {
  transform: scale(0.9);
  box-shadow: 0 0 22px 6px rgba(255, 255, 255, 0.22);
}
.btn-a { border-color: var(--red); }
.btn-a.active { box-shadow: 0 0 22px 6px rgba(255, 94, 94, 0.5); }
.btn-b { border-color: var(--accent); }
.btn-b.active { box-shadow: 0 0 22px 6px rgba(6, 214, 160, 0.5); }
.btn-x { border-color: var(--purple); }
.btn-x.active { box-shadow: 0 0 22px 6px rgba(157, 78, 237, 0.5); }
.btn-y { border-color: var(--amber); }
.btn-y.active { box-shadow: 0 0 22px 6px rgba(255, 179, 71, 0.5); }

/* ---- status ---- */

#status {
  grid-column: 1 / -1;
  margin-top: 12px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  min-height: 16px;
}

/* ---- footer ---- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  color: var(--dim);
}
.footer-row {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-link {
  color: var(--dim);
  transition: color 0.12s ease;
}
.footer-link:hover {
  color: var(--text);
}
.footer-copy {
  font-size: 12px;
  margin: 0;
}

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

@media (max-width: 1000px) {
  main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .panel-col {
    order: 2;
  }
  .gamepad-card {
    position: static;
  }
  .field-wrap {
    height: 45vh;
    min-height: 300px;
  }
  .gamepad {
    width: auto;
  }
}
