/* © Элвис · Telegram: @ElvisOnlyDev · ofdev.net */

:root {
  --bg: #f4ece3;
  --bg-deep: #efe3d6;
  --panel: rgba(255, 252, 248, 0.86);
  --panel-solid: #fffaf4;
  --ink: #4a3f3a;
  --ink-soft: #8a7c72;
  --accent: #ff7a6b;
  --accent-deep: #f25c4a;
  --indigo: #5b5b9f;
  --indigo-soft: #8a8ad0;
  --line: rgba(120, 100, 90, 0.16);
  --ok: #6fcf97;
  --shadow: 0 12px 40px rgba(90, 60, 50, 0.18);
  --radius: 18px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(120% 120% at 50% 0%, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 30;
}

.card-login {
  width: min(420px, 100%);
  background: var(--panel-solid);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 34px 30px;
  border: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.brand-dot {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), var(--indigo));
  box-shadow: 0 6px 18px rgba(242, 92, 74, 0.35);
}
.brand h1 { font-size: 19px; margin: 0; letter-spacing: -0.01em; }
.lead { color: var(--ink-soft); font-size: 14px; line-height: 1.5; margin: 10px 0 22px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 122, 107, 0.14);
}

.btn {
  width: 100%;
  margin-top: 8px;
  padding: 13px 16px;
  border: none;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(242, 92, 74, 0.32);
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: progress; transform: none; }

.error {
  color: var(--accent-deep);
  font-size: 13px;
  min-height: 18px;
  margin-top: 10px;
}
.hint { color: var(--ink-soft); font-size: 12px; margin-top: 14px; line-height: 1.45; }

#game { position: fixed; inset: 0; }
#canvas-wrap { position: absolute; inset: 0; }
#canvas-wrap canvas { display: block; }

#sidebar {
  position: absolute;
  top: 16px; left: 16px;
  width: 268px;
  max-height: calc(100% - 32px);
  overflow: auto;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px;
  z-index: 10;
}
.sb-title { font-size: 13px; font-weight: 700; color: var(--ink); margin: 2px 4px 12px; display:flex; justify-content:space-between; align-items:center; }
.sb-title small { color: var(--ink-soft); font-weight: 500; }

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  cursor: grab;
  transition: background 0.12s;
}
.member-row:hover { background: rgba(255, 122, 107, 0.08); }
.member-row:active { cursor: grabbing; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; background: #e7ddd2; flex: none;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.member-meta { min-width: 0; flex: 1; }
.member-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-sub { font-size: 11px; color: var(--ink-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.typing { background: var(--accent); box-shadow: 0 0 0 3px rgba(255,122,107,0.2); }
.dot.online { background: var(--ok); }
.dot.idle { background: #c9bcae; }

.rooms-drop { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 12px; }
.room-slot {
  font-size: 11px; text-align: center; padding: 8px 4px; border-radius: 10px;
  border: 1px dashed var(--line); color: var(--ink-soft); transition: all 0.12s;
}
.room-slot.over { border-color: var(--accent); color: var(--accent-deep); background: rgba(255,122,107,0.1); }

#hud {
  position: absolute;
  top: 16px; right: 16px;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 9px 14px;
  font-size: 13px;
  z-index: 10;
}
.live { display: flex; align-items: center; gap: 7px; font-weight: 700; color: var(--accent-deep); }
.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100%{ opacity:1; transform:scale(1);} 50%{opacity:0.4; transform:scale(1.5);} }
.hud-sep { width: 1px; height: 18px; background: var(--line); }

#card {
  position: absolute;
  bottom: 16px; left: 50%; transform: translateX(-50%) translateY(20px);
  width: min(440px, calc(100% - 32px));
  background: var(--panel-solid);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
#card.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.card-head { display: flex; align-items: center; gap: 12px; }
.card-name { font-size: 16px; font-weight: 700; }
.card-status { font-size: 12px; color: var(--ink-soft); }
.card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 17px; }
.stat span { font-size: 10.5px; color: var(--ink-soft); }
.card-close { position: absolute; top: 12px; right: 14px; cursor: pointer; color: var(--ink-soft); font-size: 18px; border:none; background:none; }

.label-tag {
  display: flex; align-items: center; gap: 6px;
  background: var(--panel-solid);
  padding: 3px 9px 3px 3px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(80,50,40,0.18);
  font-size: 11.5px; font-weight: 600; color: var(--ink);
  white-space: nowrap;
  border: 1px solid var(--line);
  user-select: none;
}
.label-tag img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; background:#e7ddd2; }

.bubble {
  max-width: 220px;
  background: #fff;
  border-radius: 14px;
  padding: 9px 12px;
  box-shadow: 0 8px 24px rgba(80,50,40,0.22);
  font-size: 12.5px; line-height: 1.4; color: var(--ink);
  border: 1px solid var(--line);
  position: relative;
  animation: pop 0.22s ease;
}
.bubble::after {
  content: ""; position: absolute; bottom: -7px; left: 22px;
  width: 14px; height: 14px; background: #fff; transform: rotate(45deg);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.bubble .to { display:flex; align-items:center; gap:6px; font-size: 10.5px; color: var(--ink-soft); margin-bottom: 4px; }
.bubble .to img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
@keyframes pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (max-width: 640px) {
  #sidebar { width: calc(100% - 32px); max-height: 40%; }
  #hud { top: auto; bottom: 16px; right: 16px; }
  #card { bottom: 80px; }
}
