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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #f8f9fa;
  font-family: "LXGW WenKai Mono TC", monospace;
  -webkit-user-select: none;
  user-select: none;
  position: fixed;
  top: 0;
  left: 0;
}

#app {
  width: 100dvw;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* Main Menu */
#mainMenu {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
}

#langPicker {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

#langPicker label {
  font-size: 1.2rem;
  cursor: pointer;
}

button {
  font-family: "LXGW WenKai Mono TC", monospace;
  font-size: 1.5rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 12px;
  background: #ffb3ba;
  color: #2c3e50;
  cursor: pointer;
  transition: background 0.25s;
  touch-action: manipulation;
  min-height: 44px;
  min-width: 44px;
}

button:hover, button:active {
  background: #ffc9c9;
}

button.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* Fullscreen Text Views */
.fullscreenView {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #2c3e50;
  font-family: "LXGW WenKai Mono TC", monospace;
  line-height: 1.1;
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 0;
}

.fullscreenView span {
  display: block;
  font-size: 4rem;
  max-width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Clue Input */
#clueInput {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

#clueForm {
  width: 100%;
  max-width: 500px;
}

.input-container {
  position: relative;
  width: 100%;
  border: 3px solid #ffb3ba;
  border-radius: 12px;
  overflow: hidden;
  background: white;
  height: 70px;
}

#clueField {
  font-family: "LXGW WenKai Mono TC", monospace;
  font-size: 1.5rem;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 1rem 70px 1rem 1rem;
  border: none;
  outline: none;
  background: white;
  box-sizing: border-box;
}

#submitBtn {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 1.5rem;
  padding: 0;
  border: none;
  background: #ffb3ba;
  color: #2c3e50;
  cursor: pointer;
  transition: background 0.25s;
  border-radius: 0;
  width: 60px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#submitBtn:hover, #submitBtn:active {
  background: #ffc9c9;
}

#wordInner,
#clueInner {
  font-weight: 900;
}

/* Blur effect for word text */
#wordText {
  transition: background 0.3s ease;
}

.blurred {
  filter: blur(60px);
  transition: filter 0.3s ease;
}

/* Gray background when word is blurred */
.word-blurred {
  background: #ff9aa2;
}

/* Hold progress indicator */
.hold-progress {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.hold-progress.active {
  opacity: 1;
}

.hold-progress svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.hold-progress-background {
  fill: none;
  stroke: rgba(255, 179, 186, 0.3);
  stroke-width: 8;
}

.hold-progress-ring {
  fill: none;
  stroke: #ffb3ba;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.05s linear;
}

/* Pulse animation when hold starts */
@keyframes holdPulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

.hold-progress.pulse {
  animation: holdPulse 0.3s ease-out;
}

/* Back Button */
#backBtn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  font-size: 1.5rem;
  border-radius: 50%;
  background: #ff9aa2;
  z-index: 10;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#backBtn.hidden {
  display: none;
}

/* Fullscreen Button */
#fsBtn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  border-radius: 50%;
  background: #ff9aa2;
  z-index: 10;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Room Badge */
#roomBadge {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  background: #ff9aa2;
  color: #2c3e50;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 1.2rem;
  font-weight: bold;
  z-index: 10;
  cursor: pointer;
  transition: background 0.25s;
}

#roomBadge:hover {
  background: #ffc9c9;
}

#roomBadge.hidden {
  display: none;
}

/* End Round Button */
#endRoundBtn {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: #ff9aa2;
  color: #2c3e50;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 1.2rem;
  font-weight: bold;
  z-index: 10;
  cursor: pointer;
  transition: background 0.25s;
}

#endRoundBtn:hover {
  background: #ffc9c9;
}

#endRoundBtn.hidden {
  display: none;
}

/* Room Modal */
#roomModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 2rem;
}

#roomModal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.modal-content h2 {
  margin-bottom: 1.5rem;
  color: #2c3e50;
}

.modal-content input {
  font-family: "LXGW WenKai Mono TC", monospace;
  font-size: 1.5rem;
  text-align: center;
  padding: 0.5rem;
  border: 2px solid #ffb3ba;
  border-radius: 8px;
  width: 100%;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.modal-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.modal-buttons button {
  font-size: 1.2rem;
  padding: 0.5rem 1.5rem;
}

/* Submitted Words Display */
#submittedWords {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2rem;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  max-height: 70%;
  overflow-y: auto;
  z-index: 5;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#submittedWords.hidden {
  display: none;
}

#submittedWords h3 {
  margin-bottom: 1rem;
  color: #2c3e50;
  text-align: center;
}

.word-list {
  list-style: none;
  padding: 0;
}

.word-list li {
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 1.2rem;
  text-align: center;
  transition: background 0.3s ease;
}

.word-list li.own-word {
  background: #d0e8ee;
  font-weight: bold;
  position: relative;
}

.word-list li.own-word::after {
  content: "YOUR CLUE";
  position: absolute;
  top: -8px;
  right: -8px;
  background: #bddbe3;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

/* Distance-based coloring - Ultra pastel traffic light system */
.word-list li.distance-0 {
  background: #fce4e4;
  color: #8b1a1a;
  font-weight: bold;
  position: relative;
}

.word-list li.distance-1 {
  background: #ffe8cc;
  color: #963707;
  font-weight: bold;
}

.word-list li.distance-2 {
  background: #fff4cc;
  color: #765d10;
  font-weight: bold;
}

#currentWordDisplay {
  text-align: center;
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: #e8f4f8;
  border-radius: 8px;
  font-size: 1.3rem;
  font-weight: bold;
  color: #2c3e50;
}

#currentWordDisplay.hidden {
  display: none;
}

#showClueBtn {
  width: 100%;
  margin-top: 1rem;
  font-size: 1.2rem;
  padding: 0.8rem;
  position: sticky;
  bottom: 0;
}
