* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f7fb;
  color: #1b1f2a;
}

.app-wrapper {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem;
}

.panel {
  background: #fff;
  border: 1px solid #dbe2ef;
  border-radius: 12px;
  padding: 1rem;
}

.hidden {
  display: none;
}

.stack-form {
  display: grid;
  gap: 0.55rem;
}

label {
  font-weight: 600;
}

input,
select,
textarea,
button {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid #c6cfdf;
  border-radius: 8px;
  font: inherit;
}

button {
  width: auto;
  cursor: pointer;
  background: #2356d8;
  color: #fff;
  border: none;
}

button:hover {
  background: #1d46af;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.75;
  background: #6f85c2;
}

.links-panel {
  margin-top: 1rem;
  border-top: 1px solid #e3e9f5;
  padding-top: 0.9rem;
}

.links-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.links-item {
  border: 1px solid #dbe2ef;
  border-radius: 8px;
  background: #f9fbff;
  padding: 0.55rem 0.65rem;
  display: grid;
  gap: 0.2rem;
}

.links-item a {
  color: #174ea6;
  word-break: break-all;
}

.muted {
  color: #586078;
}

.tick-tempo-controls {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.tick-tempo-controls #tick-tempo-value {
  color: #3f4a66;
  font-weight: 600;
}

.player-chat-log {
  border: 1px solid #dbe2ef;
  border-radius: 10px;
  background: #fafcff;
  min-height: 320px;
  max-height: 520px;
  overflow-y: auto;
  padding: 0.75rem;
  margin: 0.8rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.chat-entry {
  max-width: min(76%, 760px);
  padding: 0.6rem 0.75rem;
  border: 1px solid #dbe2ef;
}

.chat-entry .meta {
  font-size: 0.78rem;
  color: #586078;
  margin-bottom: 0.3rem;
}

.chat-entry .chat-content {
  white-space: pre-wrap;
}

.chat-entry.role-self {
  align-self: flex-end;
  border-color: #cdddfd;
  background: #eef4ff;
  border-radius: 20px 20px 8px 20px;
}

.chat-entry.role-other {
  align-self: flex-start;
  border-radius: 20px 20px 20px 8px;
  background: #fff;
}

.chat-entry.role-moderator {
  align-self: center;
  width: min(84%, 860px);
  border-color: #dbe2ef;
  background: #ffffff;
  border-radius: 8px;
}

.typing-entry {
  opacity: 0.92;
}

.tick-countdown-entry {
  opacity: 0.95;
  border-style: dashed;
  background: #f7f9ff;
}

.tick-countdown-entry .chat-content strong {
  font-size: 1.05rem;
}

.typing-content {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.typing-spinner {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  border: 2px solid #9ab0e5;
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status {
  margin: 0 1rem 1rem;
  font-weight: 600;
}

.build-meta-footer {
  margin: 0 1rem 1rem;
}

.build-meta {
  margin: 0;
  padding: 0.5rem 0.7rem;
  border: 1px solid #dbe2ef;
  border-radius: 8px;
  background: #ffffff;
  color: #3f4a66;
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  .chat-entry {
    max-width: 92%;
  }

  .chat-entry.role-moderator {
    width: 100%;
  }
}
