* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Press Start 2P', cursive, monospace;
  background: radial-gradient(circle at center, #1a0033 0%, #000000 100%);
  color: #f0f0f0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-attachment: fixed;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 90%;
  max-width: 800px;
  background: linear-gradient(135deg, #1a0033, #330066);
  border: 2px solid #ff00ff;
  border-radius: 12px;
  box-shadow: 0 0 20px #ff00ff, 0 0 40px #00ffff;
  overflow: hidden;
}

.header {
  background: linear-gradient(to right, #ff0080, #7928ca);
  color: #fff;
  text-align: center;
  font-size: 1.2em;
  font-weight: bold;
  padding: 20px;
  text-shadow: 0 0 8px #00ffff;
  flex-shrink: 0;
  letter-spacing: 2px;
}

.chat-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 20px;
  background: repeating-linear-gradient(
    0deg,
    #0d001a,
    #0d001a 2px,
    #1a0033 2px,
    #1a0033 4px
  );
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 12px;
  background-color: rgba(255, 0, 255, 0.1);
  border: 1px solid #ff00ff;
  color: #00ffff;
  font-size: 1.1em;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.message.system {
  align-self: center;
  background-color: rgba(0, 255, 255, 0.1);
  border: 1px dashed #00ffff;
  color: #ff00ff;
  font-style: italic;
  padding: 10px;
}

.message.self {
  align-self: flex-end;
  background-color: rgba(0, 255, 255, 0.1);
  border: 1px solid #00ffff;
  color: #ff00ff;
}

.username {
  font-weight: bold;
  color: #ff00ff;
  display: block;
  margin-bottom: 6px;
  font-size: 0.7em;
  text-shadow: 0 0 4px #ff00ff;
}

.message-form {
  display: flex;
  padding: 16px;
  border-top: 2px solid #ff00ff;
  background-color: #0d001a;
  flex-shrink: 0;
}

.message-form textarea {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #00ffff;
  background-color: #1a0033;
  color: #ffffff;
  border-radius: 12px;
  font-size: 0.9em;
  font-family: 'Press Start 2P', monospace;
  outline: none;
  box-shadow: 0 0 5px #00ffff;
  resize: none;
  overflow-y: hidden;
  min-height: 46px;
  line-height: 1.2;
  min-width: 50%;
}

.message-form button {
  padding: 12px 18px;
  margin-left: 12px;
  background-color: #ff00ff;
  color: #000000;
  border: none;
  border-radius: 12px;
  font-size: 0.9em;
  font-family: 'Press Start 2P', monospace;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 8px #ff00ff;
}

.message-form button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px #00ffff;
}

a {
  color: #00ffff;
  text-decoration: underline;
}

a:hover {
  color: #ff00ff;
  text-shadow: 0 0 5px #ff00ff;
}

.message img {
  cursor: zoom-in;
}

#lightbox {
  cursor: zoom-out;
}

.messages::-webkit-scrollbar {
  width: 12px;
}

.messages::-webkit-scrollbar-track {
  background: #1a0033;
  border-left: 2px solid #ff00ff;
}

.messages::-webkit-scrollbar-thumb {
  background: #00ffff;
  border: 2px solid #ff00ff;
  border-radius: 8px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: #ff00ff;
  border-color: #00ffff;
}

.reply-preview {
  background-color: rgba(255, 255, 255, 0.05);
  border-left: 3px solid #ff00ff;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-size: 0.8em;
  font-style: italic;
  color: #ccccff;
  border-radius: 8px;
  text-shadow: 0 0 3px #000;
  max-height: 60px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cancel-reply-btn {
  float: right;
  background: none;
  border: none;
  color: #ff9999;
  font-size: 1em;
  cursor: pointer;
  margin-left: 10px;
}

.cancel-reply-btn:hover {
  color: #ff4444;
}

.reply-preview {
  font-size: 0.9em;
  margin-bottom: 5px;
  color: #aaa;
}

.reply-preview img {
  border: 1px solid #444;
  padding: 2px;
  background: #222;
}

#replyBanner {
  padding: 5px 10px;
  background: #333;
  color: #eee;
  font-size: 0.9em;
  border-left: 4px solid #888;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#cancelReplyBtn:hover {
  color: #fff;
}

.reply-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #000;
  border: 1px solid #0f0;
  color: #0f0;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  box-shadow: 2px 2px 0 #555;
  z-index: 10;
  opacity: .2;
}

.reply-btn:hover {
  opacity: 1;
}

.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #1a0033;
  padding: 24px;
  border: 2px solid #ff00ff;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 0 20px #ff00ff, 0 0 40px #00ffff;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #ff00ff;
  padding-bottom: 10px;
}

.modal-header h2 {
  margin: 0;
  color: #ff00ff;
  font-size: 0.9em;
  text-shadow: 0 0 8px #00ffff;
}

.close-modal {
  font-size: 28px;
  font-weight: bold;
  color: #00ffff;
  cursor: pointer;
  transition: color 0.2s;
}

.close-modal:hover {
  color: #ff00ff;
}

.image-drop-zone {
  border: 2px dashed #00ffff;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  background-color: rgba(0, 255, 255, 0.05);
  transition: all 0.3s;
  color: #00ffff;
  font-size: 0.8em;
  outline: none;
}

.image-drop-zone:hover,
.image-drop-zone:focus {
  background-color: rgba(0, 255, 255, 0.1);
  border-color: #ff00ff;
}

.image-drop-zone.drag-over {
  border-color: #ff00ff;
  background-color: rgba(255, 0, 255, 0.15);
  box-shadow: 0 0 15px #ff00ff;
}

.image-preview {
  margin: 20px 0;
  text-align: center;
  min-height: 0;
}

.image-preview img {
  max-width: 300px;
  max-height: 300px;
  border-radius: 8px;
  border: 2px solid #00ffff;
  box-shadow: 0 0 10px #00ffff;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.btn-primary,
.btn-secondary {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7em;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background-color: #ff00ff;
  color: #000;
  box-shadow: 0 0 8px #ff00ff;
}

.btn-primary:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 0 15px #ff00ff;
}

.btn-primary:disabled {
  background-color: #666;
  box-shadow: 0 0 4px #666;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-secondary {
  background-color: #333;
  color: #00ffff;
  border: 1px solid #00ffff;
  box-shadow: 0 0 5px #00ffff;
}

.btn-secondary:hover {
  background-color: #444;
  box-shadow: 0 0 10px #00ffff;
}

#imageBtn {
  padding: 12px 12px;
  margin-right: 4px;
  margin-left: 16px;
  background-color: #00ffff;
  color: #000;
  border: none;
  border-radius: 12px;
  font-size: 0.9em;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 8px #00ffff;
  font-family: 'Press Start 2P', monospace;
}

#imageBtn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px #ff00ff;
  background-color: #ff00ff;
}