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

body {
  font-family: 'Trebuchet MS', 'Lucida Grande', Arial, sans-serif;
  font-size: 14px;
  background: #fff;
  color: #333;
}

#wrapper {
  width: 100%;
  min-height: 100vh;
}

/* ---- Header ---- */

header {
  background: linear-gradient(135deg, #1a0533 0%, #2d1b69 30%, #1a3a5c 60%, #0d4a3a 100%);
  padding: 18px 20px 16px;
  border-bottom: 3px solid #2a1040;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255,255,255,0.03) 2px,
    rgba(255,255,255,0.03) 4px
  );
  pointer-events: none;
}

.logo-area {
  position: relative;
  display: inline-block;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.logo-text {
  font-family: 'Fredoka One', 'Hobo Std', 'Comic Sans MS', cursive;
  font-size: 52px;
  font-weight: 400;
  -webkit-text-stroke: 2px rgba(0,0,0,0.4);
  text-shadow:
    3px 3px 0px rgba(0,0,0,0.5),
    -1px -1px 0px rgba(255,255,255,0.1);
  letter-spacing: 2px;
  display: inline-block;
}

.logo-chat { color: #fff; }
.logo-hole-text { color: #f0a0b0; }

.logo-hole-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.logo-hole {
  width: 68px;
  height: 48px;
  margin: 0 -3px;
  vertical-align: middle;
  filter: drop-shadow(2px 3px 0px rgba(0,0,0,0.4));
}

/* sparkles */

.sparkle {
  position: absolute;
  color: #ffcc00;
  font-size: 18px;
  animation: twinkle 1.5s ease-in-out infinite;
  z-index: 2;
  text-shadow: 0 0 6px #ffcc00;
}

.s1 { top: 4px; right: -30px; animation-delay: 0s; }
.s2 { top: -2px; right: -10px; animation-delay: 0.5s; font-size: 12px; }
.s3 { bottom: 2px; right: -24px; animation-delay: 1s; font-size: 14px; }

@keyframes twinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.6); }
}

/* ---- Content ---- */

#content {
  padding: 16px 20px;
}

/* ---- Intro screen ---- */

#intro-screen {
  padding: 8px 0;
}

.intro-text {
  margin-bottom: 20px;
  line-height: 1.6;
  color: #444;
  font-size: 14px;
}

.intro-text a {
  color: #3b7bb5;
  font-weight: bold;
}

.intro-text a:hover {
  color: #2a5f8f;
}

.rainbow-text {
  font-weight: bold;
  animation: rainbow 3s infinite;
}

@keyframes rainbow {
  0%, 100% { color: #ff3333; }
  16% { color: #ff9900; }
  33% { color: #eecc00; }
  50% { color: #33cc33; }
  66% { color: #3399ff; }
  83% { color: #cc33ff; }
}

.shrug {
  display: inline-block;
  animation: wiggle 2s ease-in-out infinite;
  cursor: default;
}

.shrug:hover {
  animation: spin 0.5s ease-in-out;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(5deg); }
  75% { transform: rotate(-5deg); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.intro-box {
  background: #f0f6fb;
  border: 2px solid #b8d4ea;
  border-radius: 8px;
  padding: 16px 20px;
}

.intro-field {
  margin-bottom: 12px;
}

.intro-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #333;
}

#username-input {
  width: 100%;
  max-width: 280px;
  padding: 7px 10px;
  border: 2px solid #b8d4ea;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #fff;
}

#username-input:focus {
  border-color: #3b7bb5;
}

#start-btn {
  background: linear-gradient(to bottom, #5cb85c, #449d44);
  color: #fff;
  border: 2px solid #398439;
  padding: 9px 22px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 15px;
  font-weight: bold;
  font-family: inherit;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}

#start-btn:hover {
  background: linear-gradient(to bottom, #449d44, #398439);
}

#start-btn:active {
  background: #398439;
}

/* ---- Buttons ---- */

.btn-disconnect {
  background: linear-gradient(to bottom, #d9534f, #c9302c);
  color: #fff;
  border: 2px solid #ac2925;
  padding: 7px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  font-family: inherit;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}

.btn-disconnect:hover {
  background: linear-gradient(to bottom, #c9302c, #ac2925);
}

.btn-new {
  background: linear-gradient(to bottom, #5cb85c, #449d44);
  color: #fff;
  border: 2px solid #398439;
  padding: 7px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  font-family: inherit;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}

.btn-new:hover {
  background: linear-gradient(to bottom, #449d44, #398439);
}

.btn-send {
  background: linear-gradient(to bottom, #5bc0de, #46b8da);
  color: #fff;
  border: 2px solid #3aa9cc;
  padding: 7px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  font-family: inherit;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.15);
  white-space: nowrap;
}

.btn-send:hover {
  background: linear-gradient(to bottom, #46b8da, #3aa9cc);
}

.btn-send:disabled {
  background: #bbb;
  border-color: #aaa;
  cursor: default;
  text-shadow: none;
}

/* ---- Chat screen ---- */

#chat-screen {
  display: flex;
  flex-direction: column;
}

#chat-log {
  border: 2px solid #b8d4ea;
  border-radius: 6px;
  background: #fff;
  height: 420px;
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
}

/* Messages */

.msg {
  margin-bottom: 3px;
  word-wrap: break-word;
}

.msg-you .msg-label {
  color: #0000ff;
  font-weight: bold;
}

.msg-stranger .msg-label {
  color: #cc0000;
  font-weight: bold;
}

.msg-system {
  color: #888;
  font-style: italic;
  font-size: 13px;
}

/* Typing indicator */

#typing-indicator {
  padding: 4px 12px;
  font-size: 13px;
  color: #888;
  font-style: italic;
  height: 24px;
}

.stranger-label {
  color: #cc0000;
  font-weight: bold;
  font-style: normal;
}

.typing-dots {
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* Chat controls */

#chat-controls {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#chat-buttons {
  display: flex;
  gap: 8px;
}

#chat-input-area {
  display: flex;
  gap: 8px;
}

#chat-input {
  flex: 1;
  padding: 7px 10px;
  border: 2px solid #b8d4ea;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Trebuchet MS', 'Lucida Grande', Arial, sans-serif;
  resize: none;
  outline: none;
  background: #fff;
}

#chat-input:focus {
  border-color: #3b7bb5;
}

#chat-input:disabled {
  background: #f0f0f0;
  color: #999;
  border-color: #ccc;
}

/* ---- Footer ---- */

footer {
  border-top: 1px solid #ddd;
  padding: 12px 20px;
  margin-top: 24px;
  text-align: center;
  font-size: 11px;
  color: #aaa;
}

/* ---- Utilities ---- */

.hidden {
  display: none !important;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
  #chat-log {
    height: 300px;
  }

  .intro-controls {
    flex-direction: column;
  }
}
