

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
  height: auto;
  min-height: 100vh;
  overflow-y: auto;      /* allow scroll */
  font-family: 'Segoe UI', Roboto, sans-serif;
  background-color: #f9f9f9;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background 0.8s ease;
}

/* Make sure body stacks header + content vertically */
#body {
  display: flex;
  flex-direction: column;
  align-items: center;
 /* padding-top: 90px; */    /* height of fixed header */
  box-sizing: border-box;
}
body {
  background: linear-gradient(
    120deg,
    #a1c4fd,  /* soft blue */
    #c2e9fb,  /* pale cyan */
    #fbc2eb,  /* pink-magenta */
    #fcdfe5,  /* rose */
    #d7fbe8,  /* mint */
    #e8d8ff,  /* lavender */
    #ffe8d6,  /* peach */
    #d4f1f4,   /* aqua */
    #ffe68a,
    #f5ff99,
    #6786f5
  );
  background-size: 900% 900%; /* Larger = smoother, slower shifts */
  animation: gradientMove 42s ease infinite;
}

@keyframes gradientMove {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Centered app container */
.app-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 90%;
  max-width: 700px;
  min-width: 300px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 2em;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  margin: 0 auto 4em auto;
}

/* The image container */
#topicImage {
  transition: opacity 1s ease-in-out;
}

.topic-image img {
    opacity: 0;
    transition: opacity 1s ease;
}

.topic-image img.show {
    opacity: 1;
}


/* Wrap centering */
.topic-image {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5em;
}

/* Base image styling */
.topic-image img {
    display: block;
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    opacity: 0;               /* default hidden */
    transition: opacity 1s ease; /* unified fade duration */
}

/* When visible */
.topic-image img.show {
    opacity: 1;
}


textarea[name="PhraseBox"] {
	width: 100%;
	height: 30vh;
	color: #2e7d32;
	font-size: 1.6em;
	font-family: 'Segoe UI', Roboto, sans-serif, serif;
	padding: 10px;
	resize: none;
	border: none;
	border-radius: 10px;
	background-color: #f2f2f2;
	text-align: center;
	opacity: 0;
	transition: opacity 0.6s ease;
}

textarea[name="PhraseBox"].show {
	opacity: 1;
}

.button-container {
    display: flex;
    flex-wrap: wrap;        /* wrap buttons on small screens */
    justify-content: center;
    gap: 10px;              /* spacing between buttons */
    margin-top: 20px;
    width: 100%;
}

select, input[type=button], input[type=reset] {
    flex: 1 1 auto;        /* flexible sizing with min width */
   max-width: 100%; 
	padding: 0.5em 1em;
	border: 1px solid #2e7d32;
	border-radius: 6px;
	background-color: transparent;
	color: #2e7d32;
	font-size: 1em;
	cursor: pointer;
	transition: all 0.3s ease;
	  white-space: normal;  /* allow text to wrap */
    text-align: center;
    word-break: break-word; /* break long words if necessary */
    box-sizing: border-box;
}

input[type=button]:hover, input[type=reset]:hover, select:hover {
	background-color: #2e7d32;
	color: white;
}
.button-container {
    display: flex;
    flex-wrap: wrap;       /* wrap buttons on small screens */
    justify-content: center;
    gap: 10px;
}
#topicImage {
    opacity: 0;
    transition: opacity 0.6s ease;
}

#topicImage.show {
    opacity: 1;
}


@media screen and (max-width: 500px) {
    textarea[name="PhraseBox"] {
        font-size: 1.2em;
        height: 20vh;
    }

    .topic-image img {
        max-width: 70%;
    }
}

/*ARROW BACK*/

.back {
    margin-left: 5%;
}
button {
  margin-left: 50%;
  margin-top: 5%;
  border-radius: 50% !important;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: none !important;
  padding: 15px 15px !important;
  -webkit-transition: background-color 1s, color 1s, -webkit-transform 0.5s;
     transition: background-color 1s, transform 0.5s;
}

button:hover {
  background-color: rgba(255, 255, 255, 0.8);
  color: black;
  -webkit-transform: translateX(-5px);
  -webkit-box-shadow: 5px 0px 18px 0px rgba(105,105,105,0.8);
  -moz-box-shadow: 5px 0px 18px 0px rgba(105,105,105,0.8);
  box-shadow: 5px 0px 18px 0px rgba(105,105,105,0.8);
}

