* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 30px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-family: Arial, sans-serif;

  background:
    radial-gradient(circle at top, #ffffff 0%, #f3f3f3 55%, #e9e9e9 100%);

  color: #222;
}


/* Main card */

main {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 38px;

  background: white;

  border: 1px solid #ddd;
  border-radius: 18px;

  box-shadow:
    0 12px 35px rgba(0, 0, 0, 0.08);
}


/* Logo */

.logo {
  text-align: center;
}

.dice {
  width: 58px;
  height: 58px;

  margin: 0 auto 14px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 14px;

  background: #222;
  color: white;

  font-size: 32px;

  box-shadow:
    0 5px 0 #000;
}

h1 {
  margin: 0;

  font-size: 34px;
  line-height: 1.1;

  letter-spacing: -1px;
}

h1 span {
  color: #e63946;
}

.subtitle {
  margin: 12px 0 30px;

  color: #777;

  text-align: center;
  font-size: 15px;
}


/* Room selection */

.room-selection {
  display: flex;
  flex-direction: column;
  gap: 12px;
}


/* Room buttons */

.room-option {
  width: 100%;
  min-height: 86px;

  display: flex;
  align-items: center;

  padding: 15px 18px;

  border: 2px solid #e3e3e3;
  border-radius: 13px;

  background: #fff;

  color: #222;

  text-align: left;

  cursor: pointer;

  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.room-option:hover {
  border-color: #222;

  background: #fafafa;

  transform: translateY(-2px);

  box-shadow:
    0 6px 15px rgba(0, 0, 0, 0.07);
}

.room-option:active {
  transform: translateY(0);
}


/* Icons */

.room-icon {
  width: 48px;
  height: 48px;

  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 11px;

  background: #f0f0f0;

  font-size: 28px;
  font-weight: bold;
}

.room-option:first-child .room-icon {
  background: #ffe4e6;
  color: #e63946;
}

.room-option:nth-child(2) .room-icon {
  background: #e4f1ff;
  color: #2474d2;
}


/* Text */

.room-option-content {
  flex: 1;

  display: flex;
  flex-direction: column;

  margin-left: 15px;
}

.room-option-content strong {
  margin-bottom: 5px;

  font-size: 17px;
}

.room-option-content small {
  color: #777;

  font-size: 13px;
  line-height: 1.3;
}


/* Arrow */

.arrow {
  margin-left: 12px;

  color: #aaa;

  font-size: 28px;

  transition: transform 0.15s ease;
}

.room-option:hover .arrow {
  color: #222;
  transform: translateX(3px);
}


/* Forms */

.room-form {
  animation: slide-in 0.2s ease-out;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.room-form h2 {
  margin: 22px 0 8px;

  font-size: 25px;
}

.form-description {
  margin: 0 0 25px;

  color: #777;

  font-size: 14px;
  line-height: 1.5;
}


/* Back button */

.back-button {
  padding: 0;

  border: 0;

  background: transparent;

  color: #777;

  font-size: 14px;

  cursor: pointer;
}

.back-button:hover {
  color: #222;
}


/* Form layout */

form {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

label {
  margin-top: 7px;

  font-size: 14px;
  font-weight: bold;
}

input {
  width: 100%;

  padding: 13px 14px;

  border: 1px solid #ccc;
  border-radius: 9px;

  background: #fff;

  font-family: inherit;
  font-size: 16px;

  outline: none;

  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

input:focus {
  border-color: #222;

  box-shadow:
    0 0 0 3px rgba(0, 0, 0, 0.07);
}

input::placeholder {
  color: #aaa;
}


/* Room code */

.room-code-input {
  text-align: center;

  font-size: 22px;
  font-weight: bold;

  letter-spacing: 5px;
  text-transform: uppercase;
}


/* Main action */

.primary-button {
  margin-top: 15px;

  padding: 13px 18px;

  border: 0;
  border-radius: 9px;

  background: #222;

  color: white;

  font-size: 16px;
  font-weight: bold;

  cursor: pointer;

  transition:
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.primary-button:hover {
  background: #e63946;

  transform: translateY(-1px);

  box-shadow:
    0 5px 12px rgba(230, 57, 70, 0.25);
}

.primary-button:active {
  transform: translateY(0);
}


/* Utility */

.hidden {
  display: none !important;
}


/* Game */

#canvas-container {
  margin-top: 20px;
}

#connection-status {
  padding: 10px;

  display: none;

  border-radius: 7px;
}

#connection-status.connecting {
  background: #eee;
  display: flex;
}

#connection-status.connected {
  background: #dff5df;
  display: flex;
}

#connection-status.disconnected {
  background: #ffdede;
  display: flex;
}

#messages {
  height: 350px;

  margin: 20px 0;
  padding: 15px 15px 15px 35px;

  overflow-y: auto;

  border: 1px solid #ccc;
  border-radius: 8px;

  background: #fafafa;
}

#messages li {
  margin-bottom: 8px;
}

#messages li.system {
  color: #666;
  font-style: italic;
}


/* Mobile */

@media (max-width: 600px) {
  body {
    padding: 15px;
  }

  main {
    padding: 25px 20px;
    border-radius: 14px;
  }

  h1 {
    font-size: 30px;
  }

  .room-option {
    min-height: 80px;
    padding: 13px;
  }

  .room-icon {
    width: 43px;
    height: 43px;

    font-size: 24px;
  }

  .room-option-content {
    margin-left: 12px;
  }

  .room-option-content strong {
    font-size: 16px;
  }

  .room-option-content small {
    font-size: 12px;
  }
}