#banner {
  cursor: pointer;
  transition: opacity 0.3s;
  width: 100%;
  max-width: 1920px;
  height: auto;
  max-height: 600px;
  object-fit: cover;
  display: block;
  margin: 0 auto 1em;
}
#banner:hover {
  opacity: 0.8;
}

footer {
  background-color: #fff7cc;
  border-top: 3px solid #ffcc00;
  padding: 1em;
  margin-top: 2em;
  text-align: center;
}

.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
  text-align: left;
}

.footer-section {
  flex: 1 1 150px;
}

.footer-section h3 {
  margin-top: 0;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section li {
  margin: 0.2em 0;
}

footer a {
  text-decoration: none;
  color: inherit;
}

footer a:hover {
  color: #ff6600;
}

.dropdown-menu a {
  text-decoration: none;
  color: inherit;
}

.dropdown-menu a:hover {
  color: #ff6600;
}

.star-award {
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(255,247,204,0.95);
  border: 3px solid #ffcc00;
  border-radius: 12px;
  padding: 1em 2em;
  font-size: 1.2em;
  z-index: 1000;
  pointer-events: none;
  text-align: center;
}
.star-loss {
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #ffcccc;
  border: 3px solid #ff0000;
  border-radius: 12px;
  padding: 1em 2em;
  font-size: 1.2em;
  z-index: 1000;
  pointer-events: none;
  text-align: center;
}
.star-award .star-particle {
  position: absolute;
  animation: star-rise 1.5s ease-out forwards;
  font-size: 1.5em;
}
@keyframes star-rise {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-40px); opacity: 0; }
}

.level-up-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  overflow: hidden;
  text-align: center;
  color: #fff;
}

.level-up-box {
  background-color: rgba(255,247,204,0.95);
  border: 3px solid #ffcc00;
  border-radius: 12px;
  padding: 2em;
  font-size: 1.5em;
  color: #000;
}

.level-up-box button {
  margin-top: 1em;
  padding: 0.5em 1em;
  font-size: 1em;
  background-color: #ffcc00;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.dust-star {
  position: absolute;
  bottom: 0;
  font-size: 1.2em;
  animation: dust-rise 2s linear forwards;
}

@keyframes dust-rise {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-100vh); opacity: 0; }
}

#starGame {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  display: none;
  z-index: 1500;
}

.game-star {
  position: absolute;
  bottom: -30px;
  font-size: 2.5rem;
  cursor: pointer;
  animation: star-fly 6s linear forwards;
  pointer-events: auto;
}

.game-star.bonus-star {
  color: red;
}

.game-star.caught {
  animation: star-glitter 0.5s linear forwards;
}

@keyframes star-fly {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-110vh); opacity: 0; }
}

@keyframes star-glitter {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(2); opacity: 0; }
}

.score-popup {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(255,247,204,0.95);
  border: 3px solid #ffcc00;
  border-radius: 12px;
  padding: 1em 2em;
  font-size: 1.2em;
  z-index: 1600;
}

.score-board {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
  pointer-events: none;
  z-index: 1601;

}

#loading {
  position: relative;
}
.share-icon {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  cursor: pointer;
  font-size: 1.2em;
}
.email-icon {
  position: absolute;
  top: 0.5em;
  right: 3.5em;
  cursor: pointer;
  font-size: 1.2em;
}
.share-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1700;
}
.share-popup {
  background-color: #fff7cc;
  border: 3px solid #ffcc00;
  border-radius: 12px;
  padding: 1em;
  text-align: center;
}
.share-popup input {
  width: 100%;
  margin-bottom: 0.5em;
}


.choice-box,
.story-box {
  width: 100%;
  box-sizing: border-box;
}

/* Header */
.menu-btn {
  display: none;
  background-color: #ffcc00;
  border: none;
  padding: 0.5em 1em;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  margin-bottom: 0.5em;
}

.header-title-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
}

.social-icons {
  display: flex;
  gap: 0.3em;
}

.social-icon {
  width: 1em;
  height: 1em;
}

.login-icons {
  display: flex;
  justify-content: center;
  gap: 0.5em;
  margin-top: 0.5em;
}

#navBox {
  display: flex;
  gap: 0.5em;
  justify-content: center;
}

#loginBtn {
  background: none;
  border: none;
  padding: 0;
}

#loginBtn img {
  width: clamp(150px, 50%, 300px);
  height: auto;
  display: block;
  margin: 0 auto;
}

@media (max-width: 600px) {
  #navBox { display: none; }
  .menu-btn { display: block; }
  .character-box { max-width: 100%; flex-basis: 100%; }
  .story-container { flex-direction: column; }
  .story-box { max-width: 100%; }
  .choice-box { max-width: 100%; }
  .footer-container { flex-direction: column; align-items: center; }
  .footer-section { width: 100%; max-width: 300px; }
}

body {
  font-family: "Comic Sans MS", sans-serif;
  padding: 2em;
  background-color: #fffae6;
  text-align: left;
}
.nav-box {
  border: 3px solid #ffcc00;
  border-radius: 12px;
  padding: 1em;
  background-color: #fff7cc;
  position: relative;
  position: relative;
  position: relative;
  margin-bottom: 1em;
  text-align: center;
}
.nav-box button {
  background-color: #ffcc00;
  border: none;
  padding: 0.5em 1em;
  border-radius: 8px;
  font-size: 1em;
  margin: 0.2em;
  cursor: pointer;
}
.login-btn {
  background-color: #ffaa00;
}
.nav-box button.cta-btn,
button.cta-btn {
  background-color: #66ccff;
}
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  background-color: #fff7cc;
  position: relative;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 0.5em;
  z-index: 1;
  text-align: left;
}
.dropdown-menu a { display: block; margin: 0.2em 0; }
.dropdown-menu div { margin-bottom: 0.2em; font-weight: bold; }
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.story-container {
  display: flex;
  gap: 1em;
  margin-top: 1em;
}
#latestNav {
  display: flex;
  justify-content: space-between;
  margin-top: 1em;
}
#latestNav button {
  background-color: #ffcc00;
  border: none;
  padding: 0.5em 1em;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
}
.story-box {
  border: 3px solid #ffcc00;
  border-radius: 12px;
  padding: 1em;
  background-color: #fff7cc;
  position: relative;
  flex: 1;
  max-width: 400px;
  white-space: pre-wrap;
}
.story-box h4 {
  text-align: center;
}
.audio-controls {
  text-align: center;
}
.audio-controls button {
  background-color: #ffcc00;
  border: none;
  padding: 0.3em 0.6em;
  border-radius: 8px;
  margin-right: 0.5em;
  cursor: pointer;
}
.story-image {
  max-width: 100%;
  border: 2px solid #ccc;
  border-radius: 8px;
  margin-top: 0.5em;
}
.story-text {
  background-color: #fffae6;
  border: 2px solid #ffcc00;
  border-radius: 8px;
  padding: 0.5em;
  margin-top: 0.5em;
  max-height: 25em;
  overflow-y: auto;
}
.author {
  font-style: italic;
  text-align: center;
  margin-top: 0.5em;
}
.thumb-icon {
  float: left;
  cursor: pointer;
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: #c0c0c0;
  stroke-width: 2px;
}
.thumb-icon.filled {
  fill: blue;
  stroke: none;
}
.highlight {
  background-color: #ffff99;
  font-weight: bold;
}
.highlight .word {
  font-weight: normal;
}
.highlight .word.current {
  font-weight: bold;
}
.character-box {
  display: flex;
  align-items: center;
  border: 3px solid #ffcc00;
  border-radius: 12px;
  background-color: #fff7cc;
  position: relative;
  padding: 1em;
  margin: 1em 0;
  gap: 1em;
  flex: 1 1 45%;
  max-width: 45%;
}
.character-audio {
  position: absolute;
  top: 0.2em;
  left: 0.2em;
}
.character-audio button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2em;
  margin-right: 0.2em;
}
.character-box audio { display: none; }
.character-box img {
  width: 150px;
  height: auto;
  border-radius: 8px;
}
.character-container {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
  justify-content: space-between;
}
.info-box {
  border: 3px solid #ffcc00;
  border-radius: 12px;
  background-color: #fff7cc;
  position: relative;
  padding: 1em;
  margin: 1em 0;
  text-align: center;
}
.start-story-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.start-story-btn img {
  width: 50%;
  height: auto;
  transition: transform 0.1s, filter 0.1s;
}
.start-story-btn:hover img {
  transform: scale(1.05);
}
.start-story-btn:active img {
  transform: scale(0.95);
  filter: brightness(0.9);
}

.menu-btn {
  display: none;
  background-color: #ffcc00;
  border: none;
  padding: 0.5em 1em;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  margin-bottom: 0.5em;
}

@media (max-width: 600px) {
  body { padding: 1em; }
  .character-box { flex: 1 1 100%; max-width: 100%; flex-direction: column; align-items: center; }
  .character-box img, .character-box video { width: 100%; max-width: 200px; }
  .story-container { flex-direction: column; }
  .story-box { max-width: 100%; }
  .menu-btn { display: block; }
}

/* Audio progress bar styling */
input[type="range"].progress-bar {
  appearance: none;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right, #ffd700, #ffcc00);
  outline: none;
  transition: background 0.3s ease;
}

input[type="range"].progress-bar::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #ffaa00;
  cursor: pointer;
  box-shadow: 0 0 5px #ffaa00;
}

input[type="range"].progress-bar::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #ffaa00;
  cursor: pointer;
}

/* Top stories card layout */
.top-stories-cards {
  display: flex;
  flex-direction: column;
  gap: 1em;
  max-width: 600px;
  margin: 2em auto;
  padding: 0 1em;
}

.top-card {
  background-color: #fff9dc;
  border: 2px solid #ffd700;
  border-radius: 12px;
  padding: 1em;
  display: flex;
  align-items: stretch;
  gap: 1em;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.1);
  position: relative;
  transition: transform 0.2s ease;
  overflow: hidden;
  height: 120px;
}

.top-card:hover {
  transform: scale(1.02);
  background-color: #fff4b3;
}

.top-card .card-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  flex-grow: 1;
  gap: 1em;
  height: 100%;
}

.top-card .rank {
  font-size: 1.5em;
  font-weight: bold;
  color: #ffaa00;
  min-width: 2em;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-card .thumb {
  width: auto;
  height: 100%;
  max-height: 150px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid #ccc;
  flex-shrink: 0;
}

.top-card .title {
  font-size: 1.2em;
  font-weight: bold;
  color: #444;
  white-space: normal;
}

.top-card .plays {
  margin-left: auto;
  font-size: 0.9em;
  color: #777;
  display: flex;
  align-items: center;
}

.top-card .card-icons {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  display: flex;
  gap: 0.3em;
}

.top-card .card-icons a,
.top-card .card-icons span {
  text-decoration: none;
  cursor: pointer;
}

@media (max-width: 500px) {
  .top-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-card .plays {
    margin-left: 0;
  }
}
