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

body {
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  background: #ffffff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#app { 
  max-width: 800px; 
  width: 100%;
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 20px; 
}

#main { 
  text-align: center; 
  width: 100%; 
}

#terminal-container {
  font-size: 2.42rem;
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.05em;
  position: relative;
  min-height: 4rem;
  width: 100%;
  cursor: pointer;
}

.command-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.prompt-text {
  position: absolute;
  right: calc(100% + 0.5rem);
  opacity: 0.85;
  font-weight: 400;
  animation: fadeInPrompt 0.5s ease-out forwards;
  pointer-events: none;
  white-space: nowrap;
}

.typing-text {
  font-weight: 700;
  font-size: 3.63rem;
  display: inline-block;
  white-space: nowrap;
  user-select: none;
  color: #000000;
  overflow: hidden;
  max-width: 0;
  animation: typing 1s steps(20) forwards 1.5s;
}

.typing-text.visible {
  max-width: none;
}

.prompt-text.hide {
  animation: fadeOutPrompt 1.2s ease-out forwards;
}

.space.hide {
  animation: fadeOutPrompt 1.2s ease-out forwards;
}

@keyframes fadeOutPrompt {
  from {
    opacity: 0.85;
  }
  to {
    opacity: 0;
  }
}

.typing-text:hover {
  opacity: 0.7;
}

.space {
  display: none;
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 3.63rem;
  background: #000000;
  margin-left: 4px;
  animation: cursorBlink 1s infinite 1.5s;
  opacity: 0;
}

.cursor.hidden-cursor {
  animation: none;
  opacity: 0;
}

#terminal-container.focused {
  text-align: center;
  width: 100%;
  justify-content: center;
}

#terminal-container.focused .prompt-text {
  display: none;
}

#terminal-container.focused .typing-text {
  font-size: 4.84rem;
}

#explanation { 
  background: transparent;
  padding: 40px 20px 20px 20px; 
  margin-top: 30px; 
  text-align: left; 
  animation: fadeIn 0.4s ease;
}

#explanation p {
  font-size: 1.1rem;
  color: #000000;
  margin-bottom: 30px;
  line-height: 1.8;
}

#explanation ul {
  list-style: none;
  padding: 0;
  margin-bottom: 30px;
}

#explanation li {
  background: #f8f8f8;
  padding: 14px 16px;
  margin: 10px 0;
  border-radius: 4px;
  border-left: 3px solid #000000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#explanation li.visible {
  opacity: 1;
  transform: translateY(0);
}

.example-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#explanation li code {
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  color: #000000;
  font-weight: 600;
  display: block;
  font-size: 0.95rem;
}

.example-desc {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
  padding-left: 8px;
}

.hidden { 
  display: none; 
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
  width: 100%;
}

.nav-left {
  display: flex;
  gap: 15px;
}

.nav-command { 
  font-size: 1rem; 
  color: #ffffff;
  cursor: pointer; 
  transition: all 0.3s;
  padding: 8px 16px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  border: 2px solid #000000;
  border-radius: 4px;
  background: #000000;
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
}

.nav-command.visible {
  opacity: 1;
  pointer-events: auto;
}

.nav-command:hover { 
  background: #333;
}



#share-btn { 
  padding: 8px 16px; 
  border: 2px solid #000000; 
  border-radius: 4px; 
  font-size: 1rem; 
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  background: #ffffff;
  color: #000000;
  opacity: 0;
  pointer-events: none;
}

#share-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

#share-btn:hover { 
  background: #000000;
  color: #ffffff;
}



.copy-btn {
  background: #000000;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 3px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
  font-weight: 600;
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
}

.copy-btn:hover {
  background: #333;
}

.copy-btn.copied {
  background: #28a745;
}

.protip {
  background: #f5f5f5;
  padding: 20px;
  border-radius: 4px;
  margin-top: 20px;
  border-left: 3px solid #666;
  color: #000000;
  line-height: 1.8;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.protip.visible {
  opacity: 1;
  transform: translateY(0);
}

.protip strong {
  color: #000000;
}

#coffee-link {
  font-size: 0.85rem;
  color: #999;
  text-decoration: none;
  margin-top: 20px;
  display: block;
  text-align: center;
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  transition: color 0.3s ease;
  opacity: 0;
  pointer-events: none;
  white-space: normal;
  word-wrap: break-word;
  max-width: 100%;
}

#coffee-link.visible {
  opacity: 1;
  pointer-events: auto;
}

#coffee-link:hover {
  color: #666;
}

@media (max-width: 767px) {
  #terminal-container {
    font-size: 1.45rem;
    min-height: 6rem;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 1rem 0;
    overflow: hidden;
  }

  .command-wrapper {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-rows: 2.1rem auto;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    overflow: hidden;
  }

  .prompt-text {
    position: static;
    transform: none;
    font-size: 1.3rem;
    font-weight: 700;
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
    height: 1.6rem;
    line-height: 1.6rem;
    align-self: start;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  .typing-text {
    font-size: 2.8rem;
    grid-column: 1;
    grid-row: 2;
    text-align: right;
    align-self: start;
  }

  .cursor {
    height: 2.8rem;
    margin-left: 3px;
    width: 2px;
    grid-column: 2;
    grid-row: 2;
    align-self: start;
  }

  #terminal-container.focused {
    margin-top: 30px;
  }

  #terminal-container.focused .typing-text {
    font-size: 3.03rem;
  }
  
  #explanation {
    padding: 30px 10px 10px 10px;
  }
  
  #explanation p {
    font-size: 1rem;
  }
  
  .nav-command { 
    font-size: 0.85rem; 
    padding: 6px 10px;
  }
  
  .nav-left {
    gap: 8px;
  }
  
  #share-btn {
    font-size: 0.85rem;
    padding: 6px 10px;
  }
  

  
  .example-content {
    flex-direction: column;
  }
  
  #explanation li {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .copy-btn {
    align-self: flex-end;
  }
}

@keyframes fadeInPrompt {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.85;
  }
}

@keyframes typing {
  0% {
    max-width: 0;
  }
  100% {
    max-width: 20em;
  }
}



@keyframes cursorBlink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

@keyframes blink {
  0%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0;
  }
}

@keyframes fadeIn { 
  from { 
    opacity: 0; 
    transform: translateY(-10px); 
  } 
  to { 
    opacity: 1; 
    transform: translateY(0); 
  } 
}
