* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: Arial, sans-serif;
  background: #f4f5f7;
  overflow: hidden;
}

/* --- Оверлей входа --- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 50, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
/* [hidden] и .overlay/#app имеют одинаковую специфичность в CSS — без этого
   правила элементы с display:flex остаются видимыми даже с атрибутом hidden. */
[hidden] { display: none !important; }
.join-card {
  background: #fff;
  border-radius: 12px;
  padding: 32px 36px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.join-card h1 { font-size: 20px; margin: 0 0 8px; color: #1c3f94; }
.join-card p { font-size: 13px; color: #555; margin: 0 0 16px; }
.join-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 15px;
  margin-bottom: 12px;
}
.join-card button {
  width: 100%;
  padding: 11px;
  background: #1c3f94;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}
.join-card button:hover { background: #16317a; }
.error { color: #c0392b; font-size: 12px; min-height: 16px; }

/* --- Приложение --- */
#app { height: 100%; display: flex; flex-direction: column; }

.topbar {
  height: 48px;
  background: #1c3f94;
  color: #fff;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.topbar-title { font-weight: bold; font-size: 15px; }
.status { font-size: 12px; opacity: 0.85; }
.user-count { margin-left: auto; font-size: 13px; background: rgba(255,255,255,0.15); padding: 4px 10px; border-radius: 12px; }

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 16px;
  min-height: 0;
}

.board-wrapper {
  position: relative;
}

.board {
  position: relative;
  width: 1500px;
  height: 760px;
  background: #fffdf6;
  background-image:
    linear-gradient(#eee 1px, transparent 1px),
    linear-gradient(90deg, #eee 1px, transparent 1px);
  background-size: 40px 40px;
  border: 1px solid #ddd;
  border-radius: 10px;
  transform-origin: top left;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.curve-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#curve-path {
  fill: none;
  stroke: #1c3f94;
  stroke-width: 4;
  stroke-linecap: round;
}

.zone-labels {
  position: absolute;
  top: 670px;
  left: 0;
  width: 1500px;
  display: flex;
  pointer-events: none;
}
.zone-labels .zone {
  width: 244px;
  margin-left: 234px;
  font-size: 15px;
  font-weight: 600;
  color: #888;
  text-align: center;
  line-height: 1.25;
}
.zone-labels .zone:first-child { margin-left: 234px; }
.zone-labels .zone:not(:first-child) { margin-left: 0; }

.deck-label {
  position: absolute;
  left: 50px;
  top: 405px;
  font-size: 14px;
  color: #999;
  font-style: italic;
}

.cards-layer {
  position: absolute;
  inset: 0;
}

.card {
  position: absolute;
  width: 230px;
  min-height: 150px;
  background: #fff;
  border: 1px solid #c9ceda;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.15s;
}
.card:active { cursor: grabbing; }
.card.dragging {
  box-shadow: 0 8px 22px rgba(0,0,0,0.25);
  z-index: 50;
}
.card-title {
  font-size: 17px;
  font-weight: bold;
  color: #1c3f94;
  margin-bottom: 6px;
  line-height: 1.25;
}
.card-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.3;
}
.card-note-row {
  margin-top: 8px;
  border-top: 1px dashed #d8dce5;
  padding-top: 6px;
}
.card-note-row.locked {
  border-top-width: 2px;
  border-top-style: solid;
}
.card-note-text {
  font-size: 12.5px;
  color: #a8631a;
  font-style: italic;
  line-height: 1.3;
  cursor: text;
  white-space: pre-wrap;
  word-break: break-word;
}
.card-note-text.empty {
  color: #b7bcc9;
}
.card-note-text.live-typing {
  color: #333;
  cursor: default;
}
.card-note-edit {
  width: 100%;
  font-size: 12.5px;
  font-family: inherit;
  border: 1px solid #1c3f94;
  border-radius: 5px;
  padding: 4px 6px;
  resize: none;
  box-sizing: border-box;
}
.typing-badge {
  display: inline-block;
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 8px;
  margin-bottom: 4px;
  white-space: nowrap;
}

.cursors-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.cursor {
  position: absolute;
  transform: translate(-2px, -2px);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: left 0.05s linear, top 0.05s linear;
}
.cursor-dot {
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.cursor-name {
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 10px;
  white-space: nowrap;
}

