/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  min-height: 100vh;
  color: #333;
  line-height: 1.5;
}

#app {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
}

/* Accessibility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Views */
.view {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.view.hidden {
  display: none;
  opacity: 0;
  transform: translateY(20px);
}

/* Header */
header {
  text-align: center;
  margin-bottom: 24px;
}

header h1 {
  font-size: 2rem;
  color: #d63384;
  margin-bottom: 8px;
}

.subtitle {
  color: #666;
  font-size: 1rem;
}

/* Category section */
.category-section {
  text-align: center;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
}

.category-section h2 {
  font-size: 1.1rem;
  color: #d63384;
  margin-bottom: 8px;
}

.hint {
  color: #888;
  font-size: 0.9rem;
  font-style: italic;
}

/* Phrase board */
.board-section {
  margin-bottom: 24px;
}

.phrase-board {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tile {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: #333;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.25s ease, background 0.25s ease;
}

.tile.hidden-letter {
  background: #e9ecef;
  border-bottom: 3px solid #adb5bd;
}

.tile.revealed {
  background: #fff;
  color: #d63384;
}

.tile.space {
  background: transparent;
  box-shadow: none;
  width: 24px;
}

/* Tile animations */
.tile.pop {
  animation: pop 0.3s ease;
}

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); background: #ffd6e7; }
  100% { transform: scale(1); }
}

/* Input section */
.input-section {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

input[type="text"] {
  flex: 1;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  border-color: #d63384;
}

button {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #d63384;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

button:hover:not(:disabled) {
  background: #c22874;
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

button:focus {
  outline: 3px solid rgba(214, 51, 132, 0.4);
  outline-offset: 2px;
}

/* Feedback */
.feedback {
  text-align: center;
  min-height: 24px;
  margin-bottom: 16px;
  font-weight: 500;
  transition: color 0.2s;
}

.feedback.success {
  color: #198754;
}

.feedback.error {
  color: #dc3545;
}

.feedback.neutral {
  color: #6c757d;
}

/* Found words */
.found-words-section {
  margin-bottom: 24px;
}

.found-words-section h3 {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 8px;
  text-align: center;
}

.found-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 32px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
}

.chip {
  padding: 6px 12px;
  font-size: 0.85rem;
  background: #d63384;
  color: #fff;
  border-radius: 16px;
  animation: chipIn 0.3s ease;
}

@keyframes chipIn {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Guess section */
.guess-section {
  text-align: center;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
}

.guess-section p {
  margin-bottom: 12px;
  color: #666;
  font-size: 0.95rem;
}

.guess-section input {
  width: 100%;
  margin-bottom: 12px;
}

.guess-section button {
  background: #6c757d;
}

.guess-section button:hover:not(:disabled) {
  background: #5a6268;
}

/* Reveal button section */
.reveal-section {
  text-align: center;
}

#revealBtn {
  padding: 16px 48px;
  font-size: 1.2rem;
}

#revealBtn:not(:disabled) {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(214, 51, 132, 0.4); }
  50% { box-shadow: 0 0 0 15px rgba(214, 51, 132, 0); }
}

/* Reveal view */
#revealView {
  text-align: center;
  padding-top: 40px;
}

.reveal-content {
  animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(30px); }
  100% { opacity: 1; transform: translateY(0); }
}

.reveal-title {
  font-size: 2.5rem;
  color: #d63384;
  margin-bottom: 24px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.photo-container {
  margin-bottom: 24px;
}

.photo-container img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.reveal-message {
  font-size: 1.3rem;
  color: #333;
  margin-bottom: 8px;
}

.reveal-date {
  font-size: 1rem;
  color: #666;
  margin-bottom: 32px;
}

#playAgainBtn {
  background: #6c757d;
}

#playAgainBtn:hover {
  background: #5a6268;
}

/* Intro view */
.intro-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.intro-content {
  text-align: center;
  animation: fadeInUp 0.8s ease;
}

.intro-tiles {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.intro-tile {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: bold;
  color: #d63384;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: bounce 1.5s ease-in-out infinite;
}

.intro-tile:nth-child(1) { animation-delay: 0s; }
.intro-tile:nth-child(2) { animation-delay: 0.1s; }
.intro-tile:nth-child(3) { animation-delay: 0.2s; }
.intro-tile:nth-child(4) { animation-delay: 0.3s; }
.intro-tile:nth-child(5) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.intro-title {
  font-size: 2.8rem;
  color: #d63384;
  margin-bottom: 12px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.intro-subtitle {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 40px;
}

#startBtn {
  padding: 18px 60px;
  font-size: 1.3rem;
  background: linear-gradient(135deg, #d63384 0%, #e91e8c 100%);
  box-shadow: 0 4px 20px rgba(214, 51, 132, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

#startBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(214, 51, 132, 0.5);
}

#startBtn:active {
  transform: translateY(0);
}

/* Game view entrance animation */
#gameView.entering {
  animation: slideIn 0.5s ease forwards;
}

@keyframes slideIn {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile responsive */
@media (max-width: 480px) {
  #app {
    padding: 16px;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .tile {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .tile.space {
    width: 18px;
  }

  .input-section {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .reveal-title {
    font-size: 2rem;
  }

  .intro-title {
    font-size: 2rem;
  }

  .intro-tile {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .intro-tiles {
    gap: 8px;
  }
}
