/* ==========================================================================
   BECOME INVISIBLE - Minimalist Interactive Art Piece
   ========================================================================== */

:root {
  --bg-dark: #080a0f;
  --bg-card: rgba(18, 22, 30, 0.95);
  --color-text: #f4efe6;
  --color-dim: #a8a29e;
  --color-accent: #c5a059;
  --color-border: rgba(197, 160, 89, 0.3);

  --font-typewriter: 'Special Elite', 'Courier Prime', 'Courier New', Courier, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  font-family: var(--font-typewriter);
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  overscroll-behavior: none;
  background-color: var(--bg-dark);
  color: var(--color-text);
  font-family: var(--font-typewriter);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Typewriter Typography: Subtle Mechanical Misalignment
   Simulates authentic vintage typewriter typebars striking slightly off-baseline
   ========================================================================== */
.typewriter-misaligned,
:is(h1, h2, h3, p, span, label, a, button) {
  display: inline-block;
  vertical-align: baseline;
  text-rendering: geometricPrecision;
}

:is(h1, h2, h3, p, span, label, a, button):nth-child(odd) {
  transform: rotate(-0.32deg) translateY(-0.45px);
}

:is(h1, h2, h3, p, span, label, a, button):nth-child(even) {
  transform: rotate(0.26deg) translateY(0.55px);
}

:is(h1, h2, h3, p, span, label, a, button):nth-child(3n) {
  transform: rotate(-0.18deg) translateY(-0.65px);
}

:is(h1, h2, h3, p, span, label, a, button):nth-child(5n) {
  transform: rotate(0.35deg) translateY(0.4px);
}

/* Individual character & element typewriter tuning */
.game-title {
  transform: rotate(-0.35deg) translateY(-0.4px);
}
.attrib-author {
  transform: rotate(0.24deg) translateY(0.5px);
}
.attrib-sep {
  transform: rotate(-0.15deg) translateY(-0.6px);
}
.attrib-dev {
  transform: rotate(0.28deg) translateY(0.3px);
}
.stage-tag {
  transform: rotate(-0.25deg) translateY(0.4px);
}
.stage-sep {
  transform: rotate(0.2deg) translateY(-0.5px);
}
.gameplay-hint {
  transform: rotate(-0.2deg) translateY(-0.35px);
}
.performer-label {
  transform: rotate(0.28deg) translateY(0.45px);
}
.footer-text {
  transform: rotate(-0.22deg) translateY(-0.3px);
}
.footer-text a:nth-of-type(1) {
  transform: rotate(0.35deg) translateY(0.55px);
}
.footer-text a:nth-of-type(2) {
  transform: rotate(-0.28deg) translateY(-0.45px);
}
.dialog-title {
  transform: rotate(-0.32deg) translateY(-0.4px);
}
.dialog-subtitle {
  transform: rotate(0.25deg) translateY(0.45px);
}
.dialog-prompt {
  transform: rotate(-0.2deg) translateY(-0.3px);
}
.dialog-bio {
  transform: rotate(0.22deg) translateY(0.35px);
}
.dialog-attribution {
  transform: rotate(-0.24deg) translateY(-0.3px);
}
.banner-text {
  transform: rotate(-0.25deg) translateY(-0.35px);
}
.banner-perform-btn {
  transform: rotate(0.28deg) translateY(0.4px);
}

#game-container {
  position: relative;
  width: 100%;
  width: 100vw;
  width: 100dvw;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  overscroll-behavior: none;
  background: radial-gradient(circle at 50% 50%, #11151e 0%, #06070a 100%);
}

#puzzleCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Header */
#game-header {
  position: absolute;
  top: 1.4rem;
  left: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  z-index: 20;
  pointer-events: none;
  background: rgba(8, 10, 14, 0.75);
  border: 1px solid rgba(197, 160, 89, 0.25);
  border-radius: 4px;
  padding: 0.85rem 1.4rem;
  backdrop-filter: blur(8px);
}

.header-top-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.2rem;
  border-bottom: 1px dashed rgba(197, 160, 89, 0.2);
  padding-bottom: 0.45rem;
}

.game-title {
  font-family: var(--font-typewriter);
  font-size: 1.35rem;
  letter-spacing: 2.5px;
  color: var(--color-accent);
  font-weight: 700;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.2);
  white-space: nowrap;
}

.header-attribution {
  font-family: var(--font-typewriter);
  font-size: 0.85rem;
  color: var(--color-dim);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.attrib-author {
  color: #e2e8f0;
}

.attrib-sep {
  color: var(--color-accent);
}

.attrib-dev {
  color: #94a3b8;
}

/* Second Line: Stage, Gameplay Hint & Performer Field */
.header-stage-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  font-family: var(--font-typewriter);
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

.stage-info-group {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  flex: 1;
  min-width: 0;
}

.stage-tag {
  color: var(--color-accent);
  font-weight: 700;
  background: rgba(197, 160, 89, 0.12);
  border: 1px solid rgba(197, 160, 89, 0.35);
  padding: 0.25rem 0.55rem;
  border-radius: 3px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.35;
  display: inline-block;
  vertical-align: baseline;
}

.stage-sep {
  color: rgba(255, 255, 255, 0.3);
  display: inline-block;
  vertical-align: baseline;
}

.gameplay-hint {
  color: #f1f5f9;
  line-height: 1.35;
  display: inline-block;
  vertical-align: baseline;
}

.header-performer-container {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  pointer-events: auto;
  white-space: nowrap;
}

.performer-label {
  font-family: var(--font-typewriter);
  font-size: 1rem;
  letter-spacing: 1.2px;
  color: var(--color-accent);
  font-weight: 700;
}

.gameplay-performer-input {
  font-family: var(--font-typewriter);
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  color: #ffffff;
  background: rgba(12, 16, 24, 0.88);
  border: 1px solid rgba(197, 160, 89, 0.45);
  border-radius: 3px;
  padding: 0.3rem 0.75rem;
  width: 160px;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.gameplay-performer-input:focus {
  border-color: var(--color-accent);
  background: rgba(18, 24, 34, 0.96);
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.4), inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.gameplay-performer-input:disabled,
.gameplay-performer-input[readonly] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  color: #94a3b8;
}

/* Slow, breathing pulse effect on performer name input for scores b & e */
@keyframes performerInputPulse {
  0%, 100% {
    border-color: rgba(197, 160, 89, 0.45);
    background: rgba(12, 16, 24, 0.88);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 0 rgba(250, 204, 21, 0);
    transform: scale(1);
  }
  50% {
    border-color: rgba(250, 204, 21, 0.95);
    background: rgba(28, 36, 52, 0.98);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 14px rgba(250, 204, 21, 0.7), 0 0 28px rgba(197, 160, 89, 0.4);
    transform: scale(1.03);
  }
}

@keyframes performerLabelPulse {
  0%, 100% {
    color: var(--color-accent);
    text-shadow: none;
  }
  50% {
    color: #fef08a;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.6);
  }
}

.gameplay-performer-input.pulse-hint {
  animation: performerInputPulse 2.4s ease-in-out infinite;
}

.header-performer-container:has(.gameplay-performer-input.pulse-hint) .performer-label {
  animation: performerLabelPulse 2.4s ease-in-out infinite;
}

.gameplay-performer-input.pulse-hint:focus {
  animation: none;
  border-color: #facc15;
  background: rgba(24, 32, 46, 0.98);
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.7), inset 0 1px 3px rgba(0, 0, 0, 0.5);
  transform: scale(1.02);
}

/* Footer: Fluxus Biographical Attribution */
#game-footer {
  position: absolute;
  bottom: 1.2rem;
  left: 2rem;
  right: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  pointer-events: none;
  background: rgba(8, 10, 14, 0.75);
  border: 1px solid rgba(197, 160, 89, 0.25);
  border-radius: 4px;
  padding: 0.65rem 1.4rem;
  backdrop-filter: blur(8px);
  text-align: center;
}

.footer-text {
  font-family: var(--font-typewriter);
  font-size: 0.85rem;
  color: var(--color-dim);
  letter-spacing: 0.5px;
  line-height: 1.45;
  margin: 0;
}

.footer-text a,
.dialog-bio a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-color: rgba(197, 160, 89, 0.5);
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
  pointer-events: auto;
}

.footer-text a:hover,
.dialog-bio a:hover {
  color: #fef08a;
  text-decoration-color: #fef08a;
}

/* Initial Performer Registration Modal Screen */
.performer-modal {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 9, 0.88);
  backdrop-filter: blur(10px);
  opacity: 1;
  transition: opacity 0.4s ease;
}

.performer-modal.dissolving {
  opacity: 0;
  pointer-events: none;
}

.performer-modal.hidden {
  display: none;
}

.performer-dialog {
  background: rgba(12, 16, 22, 0.96);
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  padding: 2.2rem 2.8rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95), 0 0 25px rgba(197, 160, 89, 0.2);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.performer-dialog-header .dialog-title {
  font-family: var(--font-typewriter);
  font-size: 1.5rem;
  letter-spacing: 3px;
  color: var(--color-accent);
  font-weight: 700;
}

.performer-dialog-header .dialog-subtitle {
  font-family: var(--font-typewriter);
  font-size: 0.9rem;
  color: var(--color-dim);
  margin-top: 0.25rem;
  letter-spacing: 1px;
}

.dialog-divider {
  height: 1px;
  background: dashed rgba(197, 160, 89, 0.3);
  border-bottom: 1px dashed rgba(197, 160, 89, 0.3);
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
}

.dialog-prompt {
  font-family: var(--font-typewriter);
  font-size: 1.15rem;
  color: var(--color-text);
  letter-spacing: 0.5px;
}

.dialog-input-wrapper {
  width: 100%;
}

.initial-performer-input {
  width: 100%;
  font-family: var(--font-typewriter);
  font-size: 1.3rem;
  letter-spacing: 1px;
  text-align: center;
  color: #ffffff;
  background: rgba(8, 10, 14, 0.9);
  border: 1px solid var(--color-accent);
  border-radius: 3px;
  padding: 0.6rem 1rem;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.2s ease;
}

.initial-performer-input:focus {
  box-shadow: 0 0 12px rgba(197, 160, 89, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.initial-performer-input.error {
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.initial-performer-input:read-only {
  cursor: default;
  user-select: none;
  background: rgba(14, 18, 24, 0.95);
  color: var(--color-accent);
  border-color: rgba(197, 160, 89, 0.5);
}

.dialog-error-msg {
  font-family: var(--font-typewriter);
  font-size: 0.82rem;
  color: #ef4444;
  letter-spacing: 0.5px;
}

.dialog-error-msg.hidden {
  display: none;
}

.dialog-footer {
  margin-top: 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.dialog-attribution {
  font-family: var(--font-typewriter);
  font-size: 0.8rem;
  color: #94a3b8;
  letter-spacing: 0.5px;
  line-height: 1.4;
  margin: 0;
  text-align: center;
}

.dialog-bio {
  font-family: var(--font-typewriter);
  font-size: 0.78rem;
  color: #cbd5e1;
  letter-spacing: 0.4px;
  line-height: 1.45;
  margin: 0.1rem 0 0 0;
  text-align: center;
}

.dialog-btn {
  font-family: var(--font-typewriter);
  font-size: 1rem;
  letter-spacing: 2px;
  color: #080a0f;
  background: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: 3px;
  padding: 0.55rem 2.2rem;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.dialog-btn:hover {
  background: #d4b26f;
  box-shadow: 0 0 14px rgba(197, 160, 89, 0.4);
}

.dialog-btn:active {
  transform: scale(0.98);
}

/* Centered Invisibility Solved Banner */
.invisibility-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
  background: rgba(8, 10, 14, 0.95);
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  padding: 2.2rem 3.2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95), 0 0 20px rgba(197, 160, 89, 0.25);
  backdrop-filter: blur(8px);
  text-align: center;
  max-width: 650px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
  opacity: 1;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: auto;
}

.invisibility-banner.hidden {
  opacity: 0;
  transform: translate(-50%, -46%);
  visibility: hidden;
  pointer-events: none;
}

.banner-text {
  font-family: var(--font-typewriter);
  font-size: 1.35rem;
  color: #ffffff;
  letter-spacing: 1px;
  line-height: 1.6;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
  margin: 0;
}

.banner-perform-btn {
  font-family: var(--font-typewriter);
  font-size: 1rem;
  letter-spacing: 2px;
  color: #080a0f;
  background: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: 3px;
  padding: 0.55rem 2.4rem;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.banner-perform-btn:hover {
  background: #d4b26f;
  box-shadow: 0 0 16px rgba(197, 160, 89, 0.45);
}

.banner-perform-btn:active {
  transform: scale(0.98);
}

/* Cinematic Transition Overlay */
.transition-overlay {
  position: absolute;
  inset: 0;
  background: #040507;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 860px) {
  #game-header {
    left: 0.8rem;
    right: 0.8rem;
    top: 0.6rem;
    padding: 0.6rem 0.9rem;
    gap: 0.4rem;
  }
  .header-top-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding-bottom: 0.35rem;
  }
  .game-title {
    font-size: 1.15rem;
    letter-spacing: 1.5px;
  }
  .header-attribution {
    font-size: 0.75rem;
    white-space: normal;
    flex-wrap: wrap;
    line-height: 1.35;
  }
  .header-stage-line {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    font-size: 0.95rem;
  }
  .stage-info-group {
    font-size: 0.92rem;
    line-height: 1.35;
  }
  .stage-tag {
    font-size: 0.92rem;
    padding: 0.22rem 0.5rem;
  }
  .header-performer-container {
    align-self: flex-start;
  }
  .performer-label {
    font-size: 0.95rem;
  }
  .gameplay-performer-input {
    width: 145px;
    font-size: 0.98rem;
    padding: 0.25rem 0.55rem;
  }
  .banner-text {
    font-size: 1.15rem;
  }
  #game-footer {
    left: 0.8rem;
    right: 0.8rem;
    bottom: 0.6rem;
    padding: 0.5rem 0.8rem;
  }
  .footer-text {
    font-size: 0.75rem;
    line-height: 1.35;
  }
  .dialog-bio {
    font-size: 0.74rem;
  }
}

@media (max-width: 480px) {
  #game-header {
    left: 0.4rem;
    right: 0.4rem;
    top: 0.4rem;
    padding: 0.5rem 0.75rem;
    gap: 0.35rem;
  }
  .game-title {
    font-size: 1.1rem;
    letter-spacing: 1px;
  }
  .header-attribution {
    font-size: 0.76rem;
  }
  .stage-tag {
    font-size: 0.86rem;
    padding: 0.18rem 0.4rem;
  }
  .gameplay-hint {
    font-size: 0.86rem;
  }
  .performer-label {
    font-size: 0.92rem;
  }
  .gameplay-performer-input {
    width: 145px;
    font-size: 16px; /* Prevents auto-zoom in mobile Safari */
    padding: 0.38rem 0.6rem;
    min-height: 40px;
  }
  .invisibility-banner {
    padding: 1.5rem 1.6rem;
    gap: 1.1rem;
    width: 92%;
  }
  .banner-text {
    font-size: 1.05rem;
    line-height: 1.45;
  }
  .banner-perform-btn {
    font-size: 0.95rem;
    padding: 0.65rem 2.2rem;
    min-height: 48px;
  }
  .dialog-btn {
    min-height: 48px;
  }
  #game-footer {
    left: 0.4rem;
    right: 0.4rem;
    bottom: 0.4rem;
    padding: 0.4rem 0.6rem;
  }
  .footer-text {
    font-size: 0.72rem;
    line-height: 1.35;
  }
  .dialog-bio {
    font-size: 0.70rem;
  }
}

/* =========================================================================
   Orientation & Short Vertical Space Warning Overlay
   ========================================================================= */
.orientation-warning {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(2, 3, 7, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999999;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  box-sizing: border-box;
}

@media (max-height: 500px) and (orientation: landscape),
       (max-height: 440px) {
  .orientation-warning {
    display: flex;
  }
}

.orientation-warning.active {
  display: flex;
}

.orientation-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1.4rem 1.8rem;
  max-width: 520px;
  background: #0e1118;
  border: 1px solid #c5a059;
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8), 0 0 20px rgba(197, 160, 89, 0.15);
  text-align: center;
  animation: fadeInWarning 0.3s ease-out;
}

@keyframes fadeInWarning {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.orientation-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rotatePrompt 2.6s ease-in-out infinite alternate;
}

@keyframes rotatePrompt {
  0%, 25% {
    transform: rotate(0deg);
  }
  75%, 100% {
    transform: rotate(90deg);
  }
}

.orientation-text {
  font-family: 'Courier Prime', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
  color: #faf7ee;
  letter-spacing: 0.4px;
  margin: 0;
}

.orientation-subtext {
  font-family: 'Special Elite', cursive, monospace;
  font-size: 0.78rem;
  color: #c5a059;
  letter-spacing: 1.2px;
  opacity: 0.85;
}
