* {
  -webkit-tap-highlight-color: transparent; /* Remove grey highlight on tap */
}
body {
  font-family: "Segoe UI", sans-serif;
  background-color: #fff7fb; /* base background color */
  margin: 0;
  padding: 20px;
  position: relative;
  z-index: 0; /* make sure content stays above the overlay */
  min-width: 350px; /* or a safe width that still looks good */
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;

  background-color: #f2cde2; /* color to tint the pattern */
  mask-image: url("/static/assets/background-pattern.svg");
  -webkit-mask-image: url("/static/assets/background-pattern.svg");

  mask-repeat: repeat;
  -webkit-mask-repeat: repeat;

  mask-size: 200px 200px;
  -webkit-mask-size: 200px 200px;
}

@media (hover: hover) and (pointer: fine) {
  /* Buttons and game-code-btn: subtle scale up */
  #selectTopicBtn:hover,
  #join-btn:hover,
  #leave-btn:hover {
    transform: scale(1.01);
  }

  /* Cards: a bit bigger for playful feel */
  .cards .card:hover,
  .game-code-btn:hover {
    transform: scale(1.02);
  }
}

.container {
  max-width: 480px;
  margin: auto;
  padding: 20px;
  border: 1.5px dashed #d07fae;
  border-radius: 12px;
  background: #f0f8ff;
}

h1,
h2,
h3 {
  text-align: center;
  color: #a44a76;
}

h2.in-game-headers {
  margin-top: 15px;
  margin-bottom: 15px;
}

h1.page-title {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2rem);
  line-height: 1.2;
}

@media (max-width: 400px) {
  h1.page-title {
    font-size: 1.8rem; /* or another value that fits in one line */
  }
}
.title-wrapper-container {
  text-align: center; /* Center inline children */
  margin-bottom: 20px;
}

.title-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.chat-icon {
  width: 50px;
  height: 50px;
  margin-top: 0px;
  flex-shrink: 0;

  /* Use the SVG as mask */
  mask-image: url("/static/assets/message-icon.svg");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;

  -webkit-mask-image: url("/static/assets/message-icon.svg");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;

  /* Set the background color you want the icon to be */
  background-color: #a44a76;
}

.mirrored {
  transform: scaleX(-1); /* flip horizontally */
}

.section-label {
  margin-top: 20px;
  font-weight: bold;
  color: #a44a76;
}

#topic-select:invalid {
  color: #888; /* grey text like placeholder */
}
#topic-select option {
  color: #000; /* default option text */
}
#topic-select option[disabled] {
  color: #888; /* grey for the placeholder option */
}
select,
input,
button {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid #d07fae;
  font-size: 1em;
  box-sizing: border-box;
  background-color: white;
}

button,
.game-code-btn {
  transition: background 0.3s, transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
button {
  background-color: #d07fae;
  color: white;
  border: none;
}
button:hover,
.game-code-btn:hover {
  background-color: #a44a76;
}

.cards {
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}

.card {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden; /* so height animation looks clean */
  transition: height 0.3s ease, opacity 0.3s, text-decoration 0.3s,
    transform 0.25s, box-shadow 0.2s;
  margin-bottom: 10px;
}

.cards .card {
  display: flex;
  justify-content: space-between; /* phrase left, usage/undo right */
  align-items: center; /* vertically center within card */
  flex-wrap: nowrap; /* allow phrase to wrap to 2 lines if needed */
  gap: 8px; /* slight gap between phrase and usage/undo if needed */
  padding: 10px;
  background: #ffe7ef;
  border: 1.5px dashed #d07fae;
  border-radius: 12px;
  flex: 1 1 45%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  color: #a44a76;
  text-align: center; /* left align for phrase wrapping */
}

/* Phrase container (assumed structure, adjust selector if needed) */
.cards .card .phrase {
  flex: 1; /* allow to grow/shrink and wrap */
  min-width: 0; /* allow to shrink below content size */
  word-break: break-word; /* allow phrase to wrap to 2 lines */
  line-height: 1.4; /* nice line spacing */
  overflow-wrap: anywhere;
  text-align: left; /* always align to left */
  margin-left: 8px;
}

.cards .card.used {
  background: #e0e0e0;
  color: #777;
  cursor: default;
}
.cards .card.used .phrase {
  text-decoration: line-through;
  text-decoration-thickness: 0.05em;
}

.card.pressed {
  transform: scale(0.99);
}

.cards .card.used:hover {
  transform: none !important;
  cursor: default !important;
}

.card.pressed:hover {
  transform: scale(0.99); /* keep it pressed even on hover */
}

.leave {
  margin-top: 20px;
  background: #d07fae;
  color: white;
}

.suggested-questions-box {
  background: #fff7fb;
  border: 1px solid #d07fae;
  border-radius: 10px;
  padding: 20px;
  color: #a44a76;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  font-style: normal;
  max-width: 480px; /* optional */
  margin-bottom: 4px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
.suggested-questions-box ol {
  padding-left: 20px;
  margin: 0;
}
.suggested-questions-box li {
  margin-bottom: 0px;
  line-height: 1.4;
  text-align: left;
  margin-left: 0;
  padding-left: 0;
}

#suggested-questions-carousel ol {
  word-break: break-word;
  overflow-wrap: anywhere;
}

#suggested-questions-carousel li {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.carousel-indicators {
  text-align: center;
  margin-top: 0px;
  margin-bottom: 0px;
}
.carousel-indicators .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 4px;
  background-color: #d07fae;
  border-radius: 50%;
  opacity: 0.4;
  transition: opacity 0.3s;
}
.carousel-indicators .dot.active {
  opacity: 1;
  background-color: #a44a76;
}
#suggested-questions-carousel {
  overflow: hidden;
  transition: height 0.4s ease; /* Re-enable this for smooth height changes! */
}
.fade-slide {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.fade-slide.show {
  opacity: 1;
  transform: translateX(0);
}

.fade-slide.no-animation {
  opacity: 1;
  transform: translateY(0);
  transition: none; /* no animation for first render */
}

.game-info {
  display: flex;
  flex-wrap: nowrap; /* no wrap on large screens */
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.game-info-left p {
  color: #a44a76;
  margin: 4px 0;
}

.game-code-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  font-size: 1em;
  line-height: 1.2;
  background-color: #d07fae;
  color: white;
  border: none;
  border-radius: 10px; /* same rounded edges as .leave */
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  position: relative;
  top: -6px;
  min-width: 150px;
  overflow: hidden;
}

.game-code-btn:focus {
  outline: none;
}

.game-code-btn .ghost,
.game-code-btn .text {
  pointer-events: none;
}
.game-code-btn .ghost {
  visibility: hidden; /* invisible but sets width */
  white-space: nowrap;
}

.game-code-btn .text {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
}

@media (max-width: 500px) {
  .game-info {
    flex-direction: column; /* stack vertically */
    align-items: flex-start; /* left-aligned text and button */
  }

  .game-info-right {
    margin-top: 4px; /* slight gap below topic */
  }
}

.copy-prompt {
  margin-top: 4px;
  color: #6d2c45;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.copy-prompt.show {
  opacity: 1;
}

.inner-wrapper {
  flex-direction: column; /* usage-wrapper in column if needed */
  align-items: flex-end; /* align usage-wrapper block to right */
  justify-content: center; /* vertical center */
  flex: 0 0 auto; /* don't shrink usage block */
  min-width: 0; /* allow shrink below content width */
}

.usage-wrapper {
  max-height: 15px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap; /* usage and undo stay together */
  opacity: 1;
  transition: opacity 0.3s ease, max-height 0.3s ease;
}

.usage-wrapper.visible {
  opacity: 1;
}

.usage-wrapper.hidden {
  opacity: 0;
  max-height: 0;
}

.score-row {
  display: flex;
  justify-content: space-around;
  width: 100%;
  gap: 6px;
  z-index: 1;
}

.score-block {
  flex: 1;
  text-align: center;
  color: #a44a76;
  font-weight: bold;
  min-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 1;
}

/* 1) Enable animating --angle */
/* allow animating --angle */
@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

/* wrapper sizing (adjust width/height to match your scoreboard) */
.scoreboard-wrapper {
  position: relative;
  width: 100%; /* full width of container */
  max-width: 480px; /* or whatever your container width is */
  height: auto; /* will grow with content */
  margin: 10px auto;
  min-height: 60px;
}

/* your existing scoreboard visuals */
.scoreboard {
  position: relative;
  z-index: 1;
  background: #fff7fb;
  border: 1.5px solid #d07fae;
  border-radius: 12px;
  padding: 10px 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* the pink-trace overlay */
/* allow animating --angle */
@property --angle {
  syntax: "<angle>";
  initial-value: 315deg;
  inherits: false;
}

/* Overlay draws only colored border tail */
.tracing-scoreboard {
  position: absolute;
  inset: 0;
  border-radius: 12px; /* match scoreboard */
  pointer-events: none;
  z-index: 2;

  /* animation params */
  --border-width: 1.5px;
  --border-color: rgb(255, 210, 236);
  --animation-duration: 0.4s;
}

/* Base state: hidden */
.tracing-scoreboard::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  box-shadow: inset 0 0 0 var(--border-width) var(--border-color);
  /* hide by default */
  mask: conic-gradient(
    from var(--angle, 315deg),
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0) 100%
  );
  mask-composite: subtract;
  -webkit-mask-composite: destination-out;
  opacity: 0;
}

/* keyframes with segments proportional to side lengths */
@keyframes traceBorder {
  0% {
    --angle: 315deg;
    opacity: 0;
  }
  10% {
    /* fade in quickly */
    opacity: 1;
  }
  /* After top side (33.3%): angle = 435deg */
  33.3% {
    --angle: 435deg;
    opacity: 1;
  }
  /* After right side (50%): angle = 495deg */
  50% {
    --angle: 495deg;
    opacity: 1;
  }
  /* After bottom side (83.3%): angle = 615deg */
  83.3% {
    --angle: 615deg;
    opacity: 1;
  }
  90% {
    /* begin fade-out a bit before end */
    opacity: 0.5;
  }
  100% {
    --angle: 675deg; /* = 315+360 */
    opacity: 0;
  }
}

.tracing-scoreboard.trace::before {
  mask: conic-gradient(
    from var(--angle, 315deg),
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 1) 10%,
    rgba(0, 0, 0, 1) 20%,
    rgba(0, 0, 0, 0) 30%,
    rgba(0, 0, 0, 0) 100%
  );
  animation: traceBorder var(--animation-duration) linear 1 forwards;
}

/* Undo icon styling */
.undo-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  fill: #d07fae;
  opacity: 0;
  transition: opacity 0.2s ease;
  margin: 0;
  line-height: 1;
}

/* Show undo icon on hover or on mobile */

@media (hover: none) and (pointer: coarse) {
  .cards .card:hover .undo-icon,
  .undo-icon {
    opacity: 0.85;
  }
}

/* Darker color for undo icon on desktop hover */
@media (hover: hover) and (pointer: fine) {
  .cards .card:hover .undo-icon:hover {
    fill: #a44a76;
  }
}

.card:hover .undo-icon {
  opacity: 0.85;
}

/* On mobile devices, always show undo icon if present */
@media (hover: none) and (pointer: coarse) {
  .undo-icon {
    opacity: 0.85;
  }
}
/* On desctop highlight undo on hover */
@media (hover: hover) and (pointer: fine) {
  .cards .card:hover .undo-icon:hover {
    fill: #a44a76; /* darker color */
  }
}

.usage-count,
.undo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle; /* ensures they sit right with text */
  margin: 0;
}

.usage-count.bump {
  animation: pop-usage 200ms ease;
}

@keyframes pop-usage {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(0.8);
  }
  100% {
    transform: scale(1);
  }
}

/* Usage count styling */
.usage-count {
  display: inline-block;
  background-color: #d07fae;
  color: #ffffff;
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 0.7rem;
  margin-left: 4px;
  opacity: 0.85;
  vertical-align: middle;
  line-height: 1;
  flex-shrink: 0;
}

/* Usage count when card is used */
.used .usage-count {
  background-color: #8c8c8c;
  color: #ebebeb;
  opacity: 0.9;
}
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* let clicks pass through */
  z-index: 9999; /* above everything else */
}

#lobby,
#game {
  opacity: 1;
  transition: opacity 0.2s ease; /* Adjust duration if needed */
}

.fade-out {
  opacity: 0;
}

/* === Animations for prompt-group-label carousel === */
.fade-fade {
  opacity: 0;
  transition: opacity 0.2s ease;
  margin: 15px 0;
}

.fade-fade.show {
  opacity: 1;
}

.fade-fade.no-animation {
  opacity: 1;
  transition: none;
}

input:-webkit-autofill {
  background-color: white !important;
  -webkit-box-shadow: 0 0 0 1000px white inset !important;
  -webkit-text-fill-color: #000 !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* Fix join game row */
/* Join Game row – perfectly balanced */
.join-game-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  margin-bottom: 10px;
}

.join-game-row input,
.join-game-row button {
  height: 38.5px;
  border-radius: 12px;
  margin: 0 !important;
}

/* Fallback media-queries if you prefer discrete steps */
@media (max-width: 420px) {
  .join-game-row input,
  .join-game-row button {
    font-size: 0.85rem;
  }
}

@media (min-width: 421px) {
  .join-game-row input,
  .join-game-row button {
    font-size: 1rem;
  }
}

.join-game-row input {
  width: 100%;
  flex: 2;
  border: 1px solid #d07fae;
}

.join-game-row button {
  flex: 2;
  width: 100%;
  padding: 0 16px;
  background-color: #d07fae;
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hover effect match */
.join-game-row button:hover {
  background-color: #a44a76;
}

#teacher-login-btn {
  height: 38.5px;
}

/* Auth buttons fill width and spread evenly */
.auth-row {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.auth-row button {
  flex: 1;
  height: 38.5px;
  border-radius: 12px;
  font-size: 1rem;
  background-color: #d07fae;
  color: white;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: background 0.3s;
}

.auth-row button:hover {
  background-color: #a44a76;
}

#teacher-or-not {
  margin-bottom: 10px;
}

.game-time-wrapper {
  /* or whatever wrapper holds #game-timer */
  text-align: center;
}

#game-timer {
  display: inline-block; /* back to inline-block */
  margin: 0.5em 0;
  /* remove auto margins */
}
#game-timer {
  display: inline-block;
  margin-top: 20px;
  padding: 0.5em 1em;
  background: #eff8ff;
  border: 1.5px solid #d07fae; /* matching darker pink border */
  border-radius: 1.8em; /* pill shape */
  font-size: 1.1rem;
  font-weight: bold;
  color: #a44a76; /* deep rose text */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* When it’s just a placeholder before start */
#game-timer.timer-placeholder {
  opacity: 0.6;
}

/* 1) Scoreboard is the positioning context */
#scoreboard {
  position: relative;
  overflow: hidden;
}

/* 2) Ghosted: hide the score blocks */
#scoreboard.ghosted .score-block {
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* 3) Overlay styling */

#scoreboard .result-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  /* we’ll handle centering + scaling in JS via transform */
  transform-origin: center center;
  padding: 0 8px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  color: #a44a76;
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1.2;
  text-align: center;
  /* start hidden */
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
}
#scoreboard.ghosted .result-overlay {
  opacity: 1;
}
#scoreboard.ghosted .result-overlay {
  opacity: 1;
}

/* 4) Fading‐out state */
#scoreboard .result-overlay.fading {
  opacity: 0 !important;
}

/* Fade‐out class for the old score blocks */
.score-block {
  transition: opacity 0.4s ease;
}
.score-block.fade-out {
  opacity: 0;
}

/* The result text, centered in the same container */
.result-message {
  opacity: 0;
  transition: opacity 0.4s ease 0.4s;
  font-size: clamp(1rem, 2vw, 1.3rem); /* ✅ responsive text */
  font-weight: bold;
  text-align: center;
  margin: 1rem auto;
  max-width: 100%;
  overflow-wrap: break-word; /* ✅ wrap long words */
  word-break: break-word;
  white-space: normal;
  line-height: 1.3;
}

.result-message.show {
  opacity: 1;
}

#carousel-indicators .page-indicator {
  font-size: 0.9em;
  color: #a44a75ab;
  display: inline-block;
  padding: 0.2em 0.5em;
}

#your-cards {
  margin-bottom: 3px;
}

.hand-controls .icon {
  display: inline;
}
