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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

/* Container */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem;
}

/* Header */
header h1 {
  text-align: center;
  color: #333;
  margin-bottom: 1rem;
}

/* Instructions */
.info {
  background-color: #fff;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.info h3 {
  margin-bottom: 0.5rem;
}

.info p {
  color: #555;
}

/* Upload Form */
.upload {
  margin-bottom: 1.5rem;
}

.upload form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.upload textarea {
  flex: 1;
  min-width: 200px;
  min-height: 80px;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
}

.upload button {
  padding: 0.5rem 1.5rem;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.upload button:hover {
  background-color: #0056b3;
}

/* Main Grid - Story and Poem side by side */
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Story Section */
.story-section {
  background-color: aliceblue;
  padding: 1rem;
  border-radius: 4px;
}

.story-section h3 {
  padding-top: 0;
  margin-bottom: 0.5rem;
}

.story-section .subtitle {
  font-weight: normal;
  font-size: 0.9rem;
  color: #666;
}

.story {
  font-size: 18px;
  margin-top: 5px;
  line-height: 1.8;
}

/* Poem Section */
.poem-section {
  padding: 1rem;
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.poem-section h3 {
  margin-bottom: 0.5rem;
}

.poem {
  font-size: 28px;
  line-height: 1.4;
  color: #222;
}

/* Token Spans - Base styles for clickable elements */
span.token {
  opacity: 1;
  transition: opacity 0.5s ease-in-out, background 0.5s ease-in-out;
  border-radius: 4px;
  cursor: pointer;
  padding: 1px 2px;
}

span.token:hover:not(.blocked):not(.faded) {
  background-color: #fffacd;
}

/* Word tokens */
span.token.word {
  border-radius: 4px;
}

/* Punctuation tokens - slightly different style */
span.token.punctuation {
  border-radius: 2px;
  padding: 1px 1px;
}

span.token.punctuation:hover:not(.blocked):not(.faded) {
  background-color: #ffe4b5;
}

/* Marked - selected for poem */
.marked {
  background-color: yellow;
}

/* Blocked - blacked out */
.blocked {
  background-color: #222222;
  color: #222222;
  transition: background-color 0.5s ease-in-out, opacity 0.5s ease-in-out;
  border-radius: 4px;
}

/* Faded - completely hidden */
.faded {
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  border-radius: 4px;
}

/* Menu */
.menu {
  background: #CCCCCC;
  padding: 1rem;
  border: 1px solid #999;
  border-radius: 4px;
}

.menu p {
  margin-bottom: 0.5rem;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid #999;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.btn:hover {
  background-color: #e0e0e0;
}

.btn.reset {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.btn.reset:hover {
  background: #c82333;
}

.btn.blockout {
  background: #333;
  color: white;
  border-color: #333;
}

.btn.blockout:hover {
  background: #555;
}

.btn.clear {
  background: #ffc107;
  color: #333;
  border-color: #ffc107;
}

.btn.clear:hover {
  background: #e0a800;
}

/* Headings */
h3 {
  padding-top: 1em;
}

/* Responsive */
@media (max-width: 600px) {
  .upload form {
    flex-direction: column;
  }

  .upload button {
    width: 100%;
  }

  .buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .poem {
    font-size: 22px;
  }
}
