:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  width: 100%;
  height: 100%;
  background-color: #0076d5;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.poster-page {
  position: relative;
  width: 100%;
  height: 100svh;
  height: 100dvh;
  overflow: hidden;
}

.stage-canvas {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  touch-action: manipulation;
  cursor: pointer;
}

/* Visually hidden semantic fallback for screen readers & SEO */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Hide debug FX controls until Shift+D */
body.hud-hidden .fx-toggle,
body.hud-hidden .fx-tuner {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

/* Transparent accessible hit-areas synced directly over the WebGL-rendered CRT keys */
.poker-console {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
}

.poker-hit {
  position: fixed;
  display: block;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.poker-hit:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Temporary FX Tuner panel */
.fx-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 210;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 6px;
  background: rgba(10, 14, 22, 0.94);
  color: #f3f7ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: opacity 0.18s ease, background 0.15s ease, transform 0.15s ease;
}

.fx-toggle:hover {
  background: rgba(20, 26, 40, 0.98);
  transform: translateY(-1px);
}

.fx-tuner {
  position: fixed;
  right: 16px;
  bottom: 56px;
  z-index: 205;
  width: 286px;
  max-height: calc(100svh - 76px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(9, 13, 21, 0.95);
  color: #e9f0fa;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.fx-tuner.is-collapsed {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
}

.fx-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.fx-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #ffe58a;
}

.fx-icon-btn {
  border: none;
  background: transparent;
  color: rgba(233, 240, 250, 0.72);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.fx-icon-btn:hover {
  color: #ffffff;
}

.fx-presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.fx-preset {
  padding: 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  color: #dce7f7;
  font: inherit;
  font-size: 10.5px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.fx-preset:hover {
  background: rgba(255, 255, 255, 0.12);
}

.fx-preset.is-active {
  background: rgba(228, 49, 94, 0.28);
  border-color: rgba(228, 49, 94, 0.85);
  color: #ffffff;
}

.fx-body {
  padding: 8px 10px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.fx-static-group {
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.fx-stack-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #ffe58a;
}

.fx-stack-hint {
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(233, 240, 250, 0.5);
}

.fx-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fx-card {
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  transition: border-color 0.14s ease, opacity 0.14s ease, transform 0.14s ease;
}

.fx-card.is-disabled {
  opacity: 0.54;
}

.fx-card.is-dragging {
  opacity: 0.35;
}

.fx-card.drop-before {
  border-top: 2px solid #e4315e;
}

.fx-card.drop-after {
  border-bottom: 2px solid #e4315e;
}

.fx-card-head {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 7px;
  background: rgba(255, 255, 255, 0.03);
}

.fx-drag {
  color: rgba(233, 240, 250, 0.38);
  font-size: 11px;
  letter-spacing: -2px;
  cursor: grab;
  padding: 0 2px;
  user-select: none;
}

.fx-drag:active {
  cursor: grabbing;
}

.fx-card-title {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: #6bc8ff;
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: left;
  cursor: pointer;
  padding: 0;
}

.fx-card-title:hover {
  color: #a6deff;
}

.fx-chev {
  display: inline-block;
  font-size: 10px;
  transition: transform 0.14s ease;
}

.fx-card.is-folded .fx-chev {
  transform: rotate(-90deg);
}

.fx-card.is-folded .fx-card-body {
  display: none;
}

.fx-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.fx-move-btn {
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(233, 240, 250, 0.8);
  font: inherit;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.fx-move-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.fx-move-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.fx-enable {
  width: 14px;
  height: 14px;
  margin-left: 3px;
  accent-color: #e4315e;
  cursor: pointer;
}

.fx-card-body {
  padding: 6px 9px 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fx-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fx-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6bc8ff;
  margin-bottom: 1px;
}

.fx-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3px 8px;
}

.fx-row > span {
  color: rgba(233, 240, 250, 0.85);
}

.fx-row > output {
  color: #ffe58a;
  font-variant-numeric: tabular-nums;
}

.fx-row > input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  height: 4px;
  accent-color: #e4315e;
  cursor: pointer;
}

.fx-row-toggle {
  padding-top: 2px;
  cursor: pointer;
}

.fx-row-toggle > input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #e4315e;
  cursor: pointer;
}

.fx-select {
  grid-column: 1 / -1;
  width: 100%;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: rgba(20, 28, 42, 0.95);
  color: #f3f7ff;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.fx-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.fx-btn {
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: #e9f0fa;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease;
}

.fx-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.fx-btn-primary {
  background: rgba(228, 49, 94, 0.82);
  border-color: rgba(255, 118, 152, 0.65);
  color: #ffffff;
}

.fx-btn-primary:hover {
  background: rgba(228, 49, 94, 0.98);
}

@media (max-width: 680px) {
  .fx-tuner {
    right: 12px;
    bottom: calc(56px + var(--sab));
    width: calc(100vw - 24px);
    max-width: 340px;
    max-height: calc(100dvh - 80px - var(--sat) - var(--sab));
  }

  .fx-toggle {
    right: 12px;
    bottom: calc(14px + var(--sab));
  }
}
