:root {
  --teal-dark: #0d5c63;
  --teal-mid: #1a8a91;
  --teal-light: #bfe6e4;
  --cream: #f4ecd8;
  --beige: #e4d6ad;
  --beige-dark: #b9a568;
  --bubble-green-light: #b7e4a1;
  --bubble-green-dark: #4f9a3f;
  --bubble-pink-light: #f3a6b3;
  --bubble-pink-dark: #c14f66;
  --ink: #1a1a1a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Comic Sans MS", "Comic Sans", "Chalkboard SE", cursive, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--teal-dark) 0%, var(--teal-mid) 45%, var(--teal-light) 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  padding: 24px 12px 48px;
}

.page {
  width: 100%;
  max-width: 760px;
}

.masthead {
  text-align: center;
  color: var(--cream);
  text-shadow: 2px 2px 0 var(--teal-dark);
  margin-bottom: 16px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.logo-icon img {
  display: block;
}

.logo h1 {
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  letter-spacing: 1px;
  margin: 0;
}

.logo .tld {
  color: var(--beige);
}

.tagline {
  margin: 6px 0 0;
  font-size: 1rem;
  font-style: italic;
}

.match-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--cream);
  text-shadow: 1px 1px 0 var(--teal-dark);
  font-size: 0.85rem;
  font-weight: bold;
}

.story-dropdown {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
}

.story-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: bold;
  text-align: left;
  color: var(--ink);
  background: linear-gradient(180deg, var(--beige) 0%, var(--beige-dark) 100%);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 6px 10px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.story-dropdown-trigger-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-dropdown-trigger::after {
  content: "\25BE";
  flex: 0 0 auto;
}

.story-dropdown-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}

.story-dropdown-list[hidden] {
  display: none;
}

.story-dropdown-option {
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: bold;
  line-height: 1.35;
  white-space: normal;
  cursor: pointer;
  color: var(--ink);
}

.story-dropdown-option:hover,
.story-dropdown-option:focus {
  background: var(--beige);
  outline: none;
}

.story-dropdown-option--selected {
  background: linear-gradient(180deg, var(--beige) 0%, var(--beige-dark) 100%);
}

.chat-window {
  background: var(--teal-light);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.35);
  overflow: hidden;
  margin-bottom: 20px;
}

.chat-scroll {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 220px;
}

.loading {
  text-align: center;
  font-style: italic;
  color: var(--teal-dark);
}

.bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  opacity: 0;
  transform: translateY(8px);
  animation: bluff-reveal 0.35s ease forwards;
}

.bubble-row--right {
  flex-direction: row-reverse;
}

@keyframes bluff-reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.avatar {
  flex: 0 0 auto;
  border-radius: 50%;
  padding: 4px;
  overflow: hidden;
}

.avatar img {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.bubble {
  position: relative;
  margin: 0;
  padding: 12px 16px;
  border-radius: 16px;
  border: 2px solid var(--ink);
  max-width: 75%;
  font-size: 0.95rem;
  line-height: 1.4;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}

.bubble--green {
  background: linear-gradient(180deg, var(--bubble-green-light) 0%, var(--bubble-green-dark) 100%);
  border-bottom-left-radius: 2px;
}

.bubble--pink {
  background: linear-gradient(180deg, var(--bubble-pink-light) 0%, var(--bubble-pink-dark) 100%);
  border-bottom-right-radius: 2px;
}

.site-footer {
  text-align: center;
  color: var(--cream);
  text-shadow: 1px 1px 0 var(--teal-dark);
  font-size: 0.8rem;
  line-height: 1.5;
}

.visitor-counter {
  font-weight: bold;
}

#hit-count {
  background: var(--ink);
  color: #39ff6a;
  font-family: "Courier New", monospace;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 2px;
}

.badge {
  display: inline-block;
  background: var(--beige);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  text-shadow: none;
}
