@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'munro';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/munro.ttf') format('truetype'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

@keyframes animatedBackground {
    from { background-position:  0 -10000px; }
    to { background-position:  0 -100px; }
}

h1, h3, meta, #timer, p {
  font-family: 'munro';
}

meta {
  font-size: 12px;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-direction: row;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  background-color: #ebe1ed;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%2394ac92' fill-opacity='0.14'%3E%3Cpath d='M0 38.59l2.83-2.83 1.41 1.41L1.41 40H0v-1.41zM0 1.4l2.83 2.83 1.41-1.41L1.41 0H0v1.41zM38.59 40l-2.83-2.83 1.41-1.41L40 38.59V40h-1.41zM40 1.41l-2.83 2.83-1.41-1.41L38.59 0H40v1.41zM20 18.6l2.83-2.83 1.41 1.41L21.41 20l2.83 2.83-1.41 1.41L20 21.41l-2.83 2.83-1.41-1.41L18.59 20l-2.83-2.83 1.41-1.41L20 18.59z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  animation: animatedBackground 800s linear infinite;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.container {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(4px);
  border-radius: 40px;
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.image-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.image-stack {
  position: relative;
  width: 100%;
}

.image-bottom {
  width: 100%;
}

.image-top {
  position: absolute;
  width: 36%;
  left: 50%;
  top: -12%; 
  transform-style: preserve-3d;
  transform-origin: center bottom;
  z-index: 2;
  animation: float3D 6s ease-in-out infinite;
  filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1));
}

.image-top img {
  backface-visibility: visible;
  transform-style: preserve-3d;
}

img {
  width: 100%;
  height: auto;
  display: block;
}

.box {
  margin-top: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

#form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 1rem 0;
}

input {
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  font-family: 'munro';
  text-align: center;
  font-size: 1rem;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 200px;
}

input:focus {
  outline: none;
  border-color: #ff00e1;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
  transform: translateY(-2px);
}

input::placeholder {
  color: #999;
  opacity: 0.7;
}

button#send {
  padding: 12px 30px;
  background: linear-gradient(45deg, #ffffff, #fde6f6);
  border: none;
  border-radius: 12px;
  color: rgb(0, 0, 0);
  font-family: 'munro';
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

button#send:hover {
  transform: translateY(-1px);
}

button#send:active {
  transform: translateY(0);
}

#info {
  margin: 1rem 0;
  padding: 8px;
  font-family: 'munro';
  color: #666;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  display: inline-block;
}

#count {
  color: #ff69b4;
  font-weight: bold;
}

#status {
  font-weight: bold;
  position: relative;
}

#status.disconnected {
  color: #ff4757;
}

#status.connected {
  color: #87ceeb;
}

#status::after {
  content: '🎈';
  margin-left: 5px;
  animation: float 2s ease-in-out infinite;
}

.error {
  color: #ff4757;
  font-family: 'munro';
  background: rgba(255, 71, 87, 0.1);
  border-radius: 8px;
  transition: all 0.3s ease;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.username{
  color: red;
  word-break: break-all;
}

.text-message{
  word-break: break-all;
}

#messages {
  font-family: 'munro';
  max-height: none;
  overflow-y: visible;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.msg {
  background: rgba(255, 255, 255, 0.8);
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  animation: slideIn 0.3s ease;
}

.msg:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.main-page-button {
  font-family: 'munro';
  text-decoration: none;
  color: black;
  position: fixed;
  top: 25px;
  left: 25px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  z-index: 1000;
}

.main-page-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.9);
}

.msg .meta {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 5px;
}

.countdown {
  padding: 12px 0px;
  display: inline-block;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 600;
  margin-top: 8px;
}

.countdown[aria-live] {
  font-size: 2rem;
}


@keyframes slideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float3D {
    0% { 
        transform: translateX(-50%) translateY(0) rotateY(0deg) rotateX(10deg) rotateZ(0deg);
    }
    25% { 
        transform: translateX(-50%) translateY(-10px) rotateY(80deg) rotateX(-5deg) rotateZ(5deg);
    }
    50% { 
        transform: translateX(-50%) translateY(0) rotateY(200deg) rotateX(10deg) rotateZ(0deg);
    }
    75% { 
        transform: translateX(-50%) translateY(-10px) rotateY(260deg) rotateX(-5deg) rotateZ(-5deg);
    }
    100% { 
        transform: translateX(-50%) translateY(0) rotateY(360deg) rotateX(10deg) rotateZ(0deg);
    }
}

@media screen and (max-width: 850px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 1rem;
  }

  #text {
    width: 100%;
    min-width: unset;
  }

  .countdown[aria-live]{
    font-size: 0.9rem;
  }

  input::placeholder {
    color: #999;
    opacity: 0.7;
    font-size: 13px;
  }

  .main-page-button {
    top: 10px;
    left: 10px;
    padding: 8px 15px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.95);
  }

  input {
    width: 100%;
    min-width: unset;
  }

  .box {
    margin-top: 1rem;
    padding: 1rem;
  }
}
