html {
  font-size: 62.5%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display",
    "SF Pro Text", system-ui, sans-serif;
  height: 100%;
  width: auto;
  overflow: hidden;
  scroll-behavior: smooth;
  align-items: center;
}

html > * {
  overflow: hidden;
}

body {
  font-size: 2rem;
  line-height: 1.5;
  background: linear-gradient(10deg, rgba(225, 250, 242, 1) 0%, #34c759 100%);
  height: 100%;
  width: auto;
  align-items: center;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #FFFFFF;
  opacity: 0;
  transition: opacity 1s ease;
  z-index: -1;
}

body.character-selected::before {
  opacity: 1;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  width: auto;
  font-size: 1.5rem;
}

header {
  background: #F5F5F5;
  width: 100%;
  height: 15rem;
  position: fixed;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  border-bottom: 1px solid #E0E0E0;
}

h1 {
  font-family: "Libre Baskerville", serif;
  font-size: 5rem;
  font-weight: bolder;
  color: #34C759;
  height: 15rem;
  margin: 0;
  line-height: 15rem;
  width: 100%;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 2px 2px 5px #333;
}

#select-profile-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 2rem;
  font-style: italic;
  margin-top: 15rem;
  -webkit-animation: profilesAnimation 1000s forwards;
  animation: profilesAnimation 1000s forwards;
}

@keyframes profilesAnimation {
  0% {
    opacity: 0;
  }
  0.5% {
    opacity: 0;
  }
  0.7% {
    opacity: 1;
  }
}
@-webkit-keyframes profilesAnimation {
  0% {
    opacity: 0;
  }
  0.5% {
    opacity: 0;
  }
  0.7% {
    opacity: 1;
  }
}

.fade-in {
  opacity: 0;
  animation: fadeIn 2s forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-out {
  animation: fadeOut 1s forwards !important;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.h1-fade-out {
  animation: h1FadeOut 1s forwards;
}

@keyframes h1FadeOut {
  from {
    opacity: 1;
    width: 100%;
  }
  99% {
    opacity: 0;
    width: 100%;
  }
  to {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }
}

.wiz-profile-fade-in {
  opacity: 0;
  animation: wizProfileFadeIn 1s forwards;
}

@keyframes wizProfileFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#wiz-head {
  margin-top: 15rem;
  max-width: 100vw;
  max-height: calc(100vh - 15rem);
  width: auto;
  height: auto;
  object-fit: contain;
  -webkit-animation: headAnimation 5s forwards;
  animation: headAnimation 5s forwards;
}

@keyframes headAnimation {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  99% {
    opacity: 0;
  }
  100% {
    opacity: 0;
    display: none;
  }
}
@-webkit-keyframes headAnimation {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  99% {
    opacity: 0;
  }
  100% {
    opacity: 0;
    display: none;
  }
}

#who-are-you {
  padding: 2rem;
  padding-top: 4rem;
}

#profiles {
  max-width: 50rem;
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
}

#profiles > div {
  height: 20rem;
  width: 20rem;
  display: flex;
  flex-basis: 50%;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.wiz-profile-container {
  height: 13rem;
  width: 13rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.wiz-profile-img {
  height: 6rem;
  width: 6rem;
}

.wiz-profile-text {
  margin-top: 0.5rem;
}

.profile-img {
  height: 15rem;
  width: 15rem;
}

.profile-img:hover {
  cursor: pointer;
}
#chat-log-container {
  margin-top: 15rem;
  padding-top: 2rem;
  width: 100%;
  max-width: 600px;
  display: none;
  flex-wrap: wrap;
  flex-direction: column;
  flex: 1;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 12rem;
  background-color: #FFFFFF;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#chat-log-container::-webkit-scrollbar {
  display: none;
}

#chat-log {
  width: 100%;
  padding: 3rem 2rem;
  box-sizing: border-box;
}

#form-container {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  display: none;
  opacity: 0;
}

form {
  width: 100%;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

#message {
  width: 100%;
  padding: 1.2rem 6.4rem 1.2rem 1.8rem;
  border: 2px solid #e0e0e0;
  border-radius: 25px;
  font-size: 1.6rem;
  outline: none;
  background: white;
  transition: all 0.3s ease;
}

#message:focus {
  border-color: #34c759;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

button {
  position: absolute;
  right: 0.7rem;
  top: 0.6rem;
  background: #E0E0E0;
  color: white;
  border: none;
  border-radius: 50%;
  width: 3.4rem;
  height: 3.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  font-size: 3.6rem;
  font-weight: 600;
}

button.button-active {
  background: #34C759;
}

button.button-inactive {
  background: #E0E0E0;
  cursor: default;
}

button.button-active:hover {
  background: #2fb653;
  transform: scale(1.05);
}

button.button-active:active {
  transform: scale(0.95);
}

.message {
  margin-bottom: 1.5rem;
  display: flex;
  width: 100%;
}

.message--sent {
  justify-content: flex-end;
}

.message--received {
  justify-content: flex-start;
}

.message__text {
  max-width: 70%;
  padding: 1.2rem 1.6rem;
  border-radius: 20px;
  font-size: 1.6rem;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.message--sent .message__text {
  background: #34c759;
  color: white;
  border-bottom-right-radius: 6px;
}

.message--received .message__text {
  background: #f0f0f0;
  color: #333;
  border-bottom-left-radius: 6px;
}

/* Thinking animation styles */
.thinking-indicator {
  margin-bottom: 1.5rem;
  display: flex;
  width: 100%;
  justify-content: flex-start;
}

.thinking-indicator .message__text {
  max-width: 70%;
  padding: 1.2rem 1.6rem;
  border-radius: 20px;
  font-size: 1.6rem;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  background: #f0f0f0;
  color: #333;
  border-bottom-left-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5rem;
}

.thinking-dots {
  display: flex;
  gap: 0.4rem;
}

.thinking-dot {
  width: 0.8rem;
  height: 0.8rem;
  background-color: #999;
  border-radius: 50%;
  animation: thinking-pulse 1.4s infinite ease-in-out;
}

.thinking-dot:nth-child(1) {
  animation-delay: 0s;
}

.thinking-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinking-pulse {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Mobile responsive styles */
@media (max-width: 499px) {
  h1 {
    font-size: 3.5rem;
    padding: 0;
    box-sizing: border-box;
  }
  
  header {
    padding: 0 1rem;
  }

  #who-are-you {
    padding-top: 1.5rem;
    padding-bottom: 0;
  }
}

@media (max-width: 640px) {
  #form-container {
    max-width: calc(100vw - 40px);
  }
}
