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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  height: 100dvh;
}

.app-container {
  width: 100%;
  max-width: 480px;
  height: 100%;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Header */
.chat-header {
  background-color: #f9f9f9;
  border-bottom: 1px solid #e5e5e5;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background-color: rgba(249, 249, 249, 0.9);
}

.bot-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-container {
  position: relative;
}

.avatar {
  width: 40px;
  height: 40px;
  background-color: #e5e5ea;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
}

.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background-color: #34c759;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.bot-details h2 {
  font-size: 16px;
  font-weight: 600;
  color: #000;
}

.bot-details p {
  font-size: 12px;
  color: #8e8e93;
}

.score-pill {
  background-color: #007aff;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Chat Body */
.chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: scroll;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #ffffff;
  scroll-behavior: smooth;
}

.chat-body::-webkit-scrollbar {
  width: 0;
  background: transparent;
}

.message {
  max-width: 75%;
  padding: 10px 16px;
  font-size: 15px;
  line-height: 1.4;
  word-wrap: break-word;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
}

@keyframes popIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.bot-message {
  align-self: flex-start;
  background-color: #e5e5ea;
  color: #000;
  border-radius: 18px 18px 18px 4px;
}

.player-message {
  align-self: flex-end;
  background-color: #007aff;
  color: #fff;
  border-radius: 18px 18px 4px 18px;
}

.system-message {
  align-self: center;
  background-color: transparent;
  color: #8e8e93;
  font-size: 12px;
  text-align: center;
  max-width: 90%;
  padding: 4px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 20px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: #8e8e93;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

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

/* Input Dock */
.input-dock {
  background-color: #f9f9f9;
  border-top: 1px solid #e5e5e5;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}

.progress-bar-container {
  width: 100%;
  height: 3px;
  background-color: #e5e5ea;
}

.progress-line {
  height: 100%;
  width: 100%;
  background-color: #007aff;
  transform-origin: left;
}

.progress-line.active {
  width: 0%;
  transition: width 10s linear;
}

.progress-line.warning {
  background-color: #ff3b30;
}

.input-form {
  display: flex;
  padding: 10px 16px;
  align-items: center;
  gap: 12px;
}

#word-input {
  flex: 1;
  height: 36px;
  border-radius: 18px;
  border: 1px solid #c8c8cc;
  padding: 0 16px;
  font-size: 15px;
  outline: none;
  background-color: #fff;
}

#word-input:disabled {
  background-color: #f2f2f7;
  color: #8e8e93;
}

#send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #007aff;
  color: #fff;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

#send-btn:disabled {
  background-color: #c8c8cc;
  cursor: default;
}

#send-btn svg {
  width: 16px;
  height: 16px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Game Over Overlay */
.game-over-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-over-card {
  background-color: #fff;
  width: 80%;
  max-width: 320px;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-over-card h2 {
  margin-bottom: 8px;
  color: #000;
}

.game-over-card p {
  color: #8e8e93;
  margin-bottom: 20px;
  font-size: 14px;
}

.final-score,
.high-score-container {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.game-over-buttons {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  padding: 12px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.btn.primary {
  background-color: #007aff;
  color: #fff;
}

.btn.secondary {
  background-color: #e5e5ea;
  color: #007aff;
}

/* Menu specific styles */
.header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #007aff;
  padding: 4px;
}

.menu-btn svg {
  width: 24px;
  height: 24px;
}

.menu-card {
  position: relative;
  text-align: center;
  padding: 32px 24px 24px 24px;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  color: #8e8e93;
  cursor: pointer;
  line-height: 1;
}

.menu-section {
  margin-bottom: 24px;
}

.menu-section:last-child {
  margin-bottom: 0;
}

.menu-section h2 {
  font-size: 20px;
  margin-bottom: 12px;
  color: #000;
}

.rules-box {
  background-color: #f2f2f7;
  padding: 16px;
  border-radius: 16px;
  text-align: left;
}

.rules-box p {
  color: #000;
  margin-bottom: 8px;
  font-size: 14px;
}

.rules-box p:last-child {
  margin-bottom: 0;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #f2f2f7;
  padding: 16px;
  border-radius: 16px;
  text-align: left;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: #000;
  border-bottom: 1px solid #e5e5ea;
  padding-bottom: 8px;
}

.stat-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.stat-item span {
  color: #8e8e93;
}

.github-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  width: 100%;
}