/* GENERAL */
:root {
  --color-primary: #00ff9f;
  --color-secondary: #00ff9f20;
  --color-tertiary: #00ff9f60;
  --color-red: #ff0033;
  --color-background: black;
}

body {
  margin: 0;
  padding: 0;

  font-family: "Courier New", monospace;
  background: var(--color-background);
  color: var(--color-primary);

  scrollbar-width: none; /* cacher scrollbar Firefox */
  -ms-overflow-style: none; /* cacher scrollbar IE / Edge */
}

/* cacher scrollbar Chrome / safari / Edge */
::-webkit-scrollbar {
  display: none;
}

#appContainer {
  position: relative;
  top: 0;
  left: 0;

  margin: 0;
  padding: 0;

  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  min-width: 630px;

  display: grid;
  grid-template-rows:
    72px /* header-section */
    1fr /* view-section */
    72px; /* count-section */
}

/* SECTIONS */
#header-section, #count-section {
  position: sticky;

  z-index: 9997;
  background: transparent;

  height: 72px;
  width: 100%;

  margin: 0;
  padding: 0;
}

#header-section {
  grid-row: 1;
  top: 0;
}

#count-section {
  grid-row: 3;
  bottom: 0;

  display: flex;
  justify-content: center;
}

#replayVideo-section, #nextVideo-section {
  position: fixed;
  top: 0;
  left: 0;

  width: 100vw;
  height: 100vh;

  background: var(--color-background);
  z-index: 9999;

  display: flex;
  justify-content: center;
  align-items: center;
}

#view-section {
  grid-row: 2;

  overflow: auto;

  min-height: 0;
  width: 100%;
  max-width: 1280px;

  padding: 0;
  margin: 0 auto;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;

  text-align: center;

  position: relative;
}


/* HEADER BUTTON */
#replay-button, #stopReplay-button, #askHint-button {
  position: absolute;
  top: 0;
}

#askHint-button {
  right: 0;
  width: 17em;
}

#replay-button, #stopReplay-button {
  left: 0;
  width: 14em;
}

/* VIDEO */
video {
  width: 100%;
  height: auto;
  max-height: 100vh;
}

/* COUNTER */
#count-section dl {
  display: flex;
  flex-direction: row;
  gap: 40px;

  margin: auto 0;
  padding: 0;
}

#count-section dt {
  margin: 0;
  font-size: 14px;
  color: var(--color-tertiary);
}

#count-section dd {
  margin: 0;

  font-size: 18px;
  font-weight: bold;

  color: var(--color-primary);

  text-shadow: 0 0 5px var(--color-primary);
}

#count-section dt, #count-section dd {
  display: inline-block;
}

#count-section dl > dt {
  margin-right: 5px;
}

/* ELEMENTS GÉNÉRAUX */
.hidden {
  display: none !important;
}

button {
  font-size: 20px;
  padding: 20px 40px;
  margin: 5px;
  cursor: pointer;
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
button:hover {
  background: var(--color-secondary);
}
button:disabled {
  display: none !important;
}
button:active, button.activated {
  box-shadow:
      0 0 5px var(--color-primary),
      0 0 10px var(--color-primary),
      0 0 20px var(--color-primary);

  transform: scale(0.97);
}

.boxed {
  display: inline-block;
  font-size: 30px;
  margin: 0;
  padding: 10px;
  border: 2px solid var(--color-primary);
  border-radius: 10px;
}

#hintContent .boxed {
  border-color: #ffaa00;
}

input {
  font-size: 20px;
  padding: 20px 40px;
  width: auto;
  margin: 5px;
  border: 2px solid var(--color-primary);
  border-radius: 10px;
  color: var(--color-primary);
  background-color: transparent;
}
input::placeholder {
  color: var(--color-tertiary);
}

/* VIEW SECTION ELEMENTS */
#view-title {
  flex: 0 0 auto;
  }
#view-title h1 {
  margin-bottom: 20px;
  text-shadow: 0 0 10px var(--color-primary);
}

#view-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
}

#hintContent {
  flex: 1;
  color: #ffaa00;

  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
}

#solution {
  flex: 0 0 auto;
  margin: 20px 0;
}

/* EFFETS DYNAMIQUES */
.typing::after {
  content: "▌";
  animation: blink 1s infinite;
}
@keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0; }
}

.access-denied {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  font-size: 80px;
  font-weight: 700;

  color: var(--color-red);
  text-shadow: 0 0 15px var(--color-red);

  z-index: 9999;

  opacity: 0;
  pointer-events: none;

  white-space: nowrap;
}
.access-denied.show {
  animation: glitchPopup 4s ease forwards;
}
@keyframes glitchPopup {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.9);
  }
}
#appContainer.red-pulse {
  animation: pulseRed 4s;
}
@keyframes pulseRed {
  0% { background-color: var(--color-red); }
  100% { background-color: black; }
}

.access-granted {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  font-size: 80px;
  font-weight: 700;

  color: var(--color-primary);
  text-shadow: 0 0 15px var(--color-primary);

  white-space: nowrap;

  z-index: 9999;

  opacity: 0;
  pointer-events: none;
}
.access-granted.show {
  animation: grantedAnim 8s ease forwards;
}
@keyframes grantedAnim {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.9);
  }
}

#appContainer.fadeout {
  animation: fadeout 8s;
}
@keyframes fadeout {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* SUBSTITUTION */
.longText {
  border: 2px solid var(--color-primary);
  border-radius: 10px;
  padding: 0 10px;
}
.decoded {
  color: yellow;
}
.encoded {
  color: var(--color-primary);
}

#mapping {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  grid-template-rows: auto auto;
  gap: 15px;
  justify-items: center;
}
.map-item label, .map-item input {
  margin: 0;
  padding: 0;
  width: 2em;
  height: auto;
  text-align: center;
  cursor: pointer;
}
.map-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* ASCII TABLE */
#ascii-container {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--color-primary);
  border-radius: 6px;
}
.ascii-box {
  display: flex;
  gap: 10px;
  padding: 10px 15px;
}
.ascii-pair {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 25px;
}
.ascii-dec {
  font-size: 12px;
  color: var(--color-tertiary);
}
.ascii-sym {
  font-size: 18px;
  color: var(--color-primary);
}

/* XOR MESSAGE */
.xorMessage {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;

  padding: 15px;

  border: 1px solid var(--color-primary);
  border-radius: 8px;
  box-shadow: 0 0 10px var(--color-primary);

  font-family: monospace;
}
.xorMessage dt {
  color: var(--color-tertiary);
  font-size: 13px;
  white-space: nowrap;
}
.xorMessage dd {
  color: var(--color-primary);
  margin: 0;
  font-size: 13px;
  letter-spacing: 1px;
}
.xorMessage dt:not(:first-of-type),
.xorMessage dt:not(:first-of-type) + dd {
  padding-top: 8px;
  border-top: 1px solid var(--color-secondary);
}

#hintContent .xorMessage {
  border-color: #ffaa00;
  box-shadow: 0 0 10px #ffaa00;
}
#hintContent .xorMessage dt {
  color: #ffaa0060;
}
#hintContent .xorMessage dd {
  color: #ffaa00;
}
#hintContent .xorMessage dt:not(:first-of-type),
#hintContent .xorMessage dt:not(:first-of-type) + dd {
  border-top: 1px solid #ffaa0020;
}
/* ADMIN MODE */
#admin-section {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: 600px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;

  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--color-primary);
  border-radius: 8px;

  box-shadow: 0 0 12px var(--color-primary);

  z-index: 9999;
}
#admin-section > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

#admin-section #resetButton {
  border-color: red;
  color: red;
}
#admin-section #resetButton:hover {
  background: red;
  color: black;
  box-shadow: 0 0 6px red;
}

#admin-section select {
  background-color: black;
  color: var(--color-primary);

  border: 2px solid var(--color-primary);
  border-radius: 6px;

  padding: 20px 40px;
  margin: 5px;
  cursor: pointer;

  font-size: 20px;
  font-family: monospace;

  outline: none;

  text-transform: uppercase;
  letter-spacing: 1px;
}
#admin-section select:hover {
  background: var(--color-secondary);
}
#admin-section select:focus {
  box-shadow: 0 0 6px var(--color-primary);
  background-color: black;
}
#admin-section select option {
  background-color: black;
  cursor: pointer;
}

#disable-admin {
  opacity: 0.6;
}
#disable-admin:hover {
  opacity: 1;
}

/* DIFFIE */
.diffieEtapes {
  padding: 15px;

  background: rgba(0, 255, 159, 0.05);
  border: 1px solid var(--color-primary);
  border-radius: 8px;

  box-shadow: 0 0 10px var(--color-primary);

  font-family: monospace;
  margin-bottom: 20px;
}

.diffieVisible {
  color: #ffe066;
  text-shadow: 0 0 6px #ffe066;
}
.diffieCache {
  color: #ff4d4d;
  text-shadow: 0 0 6px #ff4d4d;
}
.diffieEtapes strong {
  text-transform: uppercase;
  text-shadow: 0 0 5px var(--color-primary);
}
.diffieEtapes ol {
  margin: 10px 0 0 20px;
  padding: 0;

  display: flex;
  flex-direction: column;
  gap: 10px;
}
.diffieEtapes li {
  padding: 8px 10px;

  border-left: 3px solid var(--color-secondary);

  background: rgba(0, 255, 159, 0.03);

  border-radius: 4px;

  transition: 0.15s;
}
.diffieEtapes li:hover {
  background: rgba(0, 255, 159, 0.1);
  box-shadow: 0 0 6px var(--color-primary);
}

/* SCORE FINAL */
.end-stats {
  display: flex;
  flex-direction: column;
  gap: 15px;

  width: 100%;
  max-width: 400px;

  padding: 20px;

  border: 2px solid var(--color-primary);
  border-radius: 10px;

  background: rgba(0, 255, 159, 0.05);

  box-shadow: 0 0 12px var(--color-primary);
}
.end-item {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 10px;

  border-bottom: 1px solid var(--color-secondary);
}
.end-item:last-child {
  border-bottom: none;
}
.end-label {
  color: var(--color-tertiary);
  font-size: 16px;
}
.end-value {
  color: var(--color-primary);
  font-size: 16px;
  text-shadow: 0 0 6px var(--color-primary);
}
.end-score .end-value {
  font-size: 20px;
  color: #00ff6a;
  text-shadow: 0 0 10px #00ff6a;
}
.end-item:hover {
  background: rgba(0, 255, 159, 0.1);
  transition: 0.2s;
}