/* Улица друзей — оформление. Набор (kit.css) даёт кнопки, меню и окна; здесь небо, город и свои панели. */

/* Верх фона (--bg-top) повторён в <meta name="theme-color">. */
:root,
:root[data-theme="dark"] {
  --bg-top: #2fa9f2;
  --bg-mid: #63c4f7;
  --bg-bottom: #b6e6ff;
  --glow-a: rgba(255, 246, 176, 0.65);
  --glow-b: rgba(120, 220, 255, 0.4);
  --frame: #2a93ea;
  --frame-lip: #0b3585;
  --pit: #103c92;
  --shade-rgb: 4, 28, 84;
  --deep-rgb: 8, 40, 112;
  --title-hi: #d8f2ff;
  --coin: #ffc93c;
  --coin-lo: #d48a00;
}

/* ---------- Меню: городок из глянцевых домиков ---------- */

.town {
  position: relative;
  width: 220px;
  height: 128px;
  animation: k-bob 2.8s ease-in-out infinite alternate;
}

.town i {
  position: absolute;
  bottom: 18px;
  border-radius: 10px 10px 6px 6px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), inset 0 -5px 0 rgba(0, 0, 0, 0.14), 0 6px 10px rgba(var(--shade-rgb), 0.35);
  animation: k-pop-in 0.5s cubic-bezier(0.3, 1.7, 0.5, 1) both;
}

.town i::before {
  /* крыша */
  content: '';
  position: absolute;
  left: -7px;
  right: -7px;
  bottom: 100%;
  height: 26px;
  border-radius: 6px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, #ff7a85, #e8384b);
}

.town i b {
  /* окна */
  position: absolute;
  left: 22%;
  right: 22%;
  top: 22%;
  height: 34%;
  border-radius: 5px;
  background: linear-gradient(180deg, #fff6c2, #ffd75a);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.town .h1 { left: 4px; width: 50px; height: 58px; background: linear-gradient(162deg, #96beff, #2d7dff 46%, #235ac8); }
.town .h2 { left: 58px; width: 46px; height: 86px; background: linear-gradient(162deg, #ffe68c, #ffcc1a 46%, #ba9324); animation-delay: 70ms; }
.town .h2::before { background: linear-gradient(180deg, #8ce1f8, #19a6e0); }
.town .h3 { left: 110px; width: 54px; height: 66px; background: linear-gradient(162deg, #9ae3ac, #34c759 46%, #288f51); animation-delay: 140ms; }
.town .h3::before { background: linear-gradient(180deg, #d0a6ff, #8a3ff0); }
.town .h4 { left: 170px; width: 44px; height: 48px; background: linear-gradient(162deg, #ff9d9d, #ff3b3b 46%, #ba2a3b); animation-delay: 210ms; }
.town .h4::before { background: linear-gradient(180deg, #ffe68c, #ffb81f); }

.town s {
  position: absolute;
  left: -14px;
  right: -14px;
  bottom: 0;
  height: 22px;
  border-radius: 11px;
  background: linear-gradient(180deg, #7fe06a, #44b83a);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 6px 10px rgba(var(--shade-rgb), 0.3);
  text-decoration: none;
}

.menu .title {
  margin-top: 30px;
}

.menu-street {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 0;
  padding: 7px 16px;
  border-radius: 17px;
  background: var(--deep);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

.menu-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.menu-row .btn {
  flex: 1;
}

.menu-net {
  margin: 14px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  text-align: center;
}

/* ---------- Игровой экран: улица на весь экран ---------- */

.app {
  padding: 0;
  gap: 0;
}

.app .top {
  position: absolute;
  z-index: 5;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  width: auto;
  max-width: none;
  gap: 8px;
}

.pill {
  border: 0;
  color: #fff;
  font-family: inherit;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.22), 0 3px 0 rgba(var(--deep-rgb), 0.35);
}

.coins {
  flex: 1;
  max-width: 170px;
  justify-content: flex-start;
  font-size: 19px;
}

.coins.bump {
  animation: bump 0.35s cubic-bezier(0.3, 1.7, 0.5, 1);
}

@keyframes bump {
  40% { transform: scale(1.12); }
}

.coin {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(60% 60% at 35% 30%, #fff6c8 0%, var(--coin) 55%, var(--coin-lo) 100%);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 1px 0 rgba(0, 0, 0, 0.2);
  position: relative;
}

.coin::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px solid rgba(160, 90, 0, 0.45);
}

.mult b {
  font-weight: 900;
  color: #b9ff8a;
}

.stage {
  position: absolute;
  inset: 0;
  display: block;
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
}

.street-name {
  position: absolute;
  z-index: 4;
  top: calc(max(10px, env(safe-area-inset-top)) + 52px);
  left: 0;
  right: 0;
  margin: 0 auto;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 5px 14px;
  border-radius: 14px;
  background: rgba(var(--deep-rgb), 0.55);
  font-size: 14px;
  font-weight: 800;
  pointer-events: none;
  text-align: center;
}

.net-lost,
.no-gl {
  position: absolute;
  z-index: 6;
  left: 16px;
  right: 16px;
  top: 40%;
  margin: 0 auto;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 18px;
  background: rgba(var(--deep-rgb), 0.9);
  font-weight: 800;
  text-align: center;
}

/* Подписи поверх 3D: монетки, часы стройки, «помочь», таблички участков. */
.tags {
  position: absolute;
  z-index: 3; /* свой слой: подписи не выходят поверх шапки, панели и листов */
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.tag {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-weight: 900;
  will-change: transform;
}

.tag-coin {
  pointer-events: auto;
  height: 30px;
  padding: 0 10px 0 4px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(180deg, #fff3b0, #ffcf3f);
  color: #6a3b00;
  font-size: 15px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 3px 0 #c98400, 0 6px 10px rgba(var(--shade-rgb), 0.35);
  animation: float 1.6s ease-in-out infinite alternate;
}

.tag-coin .coin {
  width: 22px;
  height: 22px;
}

.tag-coin.full {
  background: linear-gradient(180deg, #c6ff9a, #57d23e);
  color: #0f4a12;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 3px 0 #2f8c22, 0 6px 10px rgba(var(--shade-rgb), 0.35);
}

@keyframes float {
  from { margin-top: -3px; }
  to { margin-top: 3px; }
}

.tag-time {
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  background: rgba(var(--deep-rgb), 0.82);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 0 rgba(var(--shade-rgb), 0.4);
}

.tag-time i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #ffc93c;
  border-right-color: transparent;
  animation: spin 1s linear infinite;
}

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

.tag-help {
  pointer-events: auto;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #5cd0ff, #1f9ef6);
  color: #fff;
  font-size: 14px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 3px 0 #0c62b8, 0 6px 10px rgba(var(--shade-rgb), 0.35);
  animation: float 1.2s ease-in-out infinite alternate;
}

.tag-help::before {
  content: '';
  width: 16px;
  height: 16px;
  background: #fff;
  -webkit-mask: radial-gradient(circle at 50% 70%, #000 45%, transparent 47%) , linear-gradient(#000, #000) 50% 0 / 4px 60% no-repeat;
  mask: radial-gradient(circle at 50% 70%, #000 45%, transparent 47%), linear-gradient(#000, #000) 50% 0 / 4px 60% no-repeat;
}

.tag-lot {
  height: 30px;
  padding: 0 10px 0 3px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.92);
  color: #1d2a44;
  font-size: 13px;
  box-shadow: 0 3px 0 rgba(var(--shade-rgb), 0.25);
  --ava: 24px;
}

.tag-lot .k-ava {
  width: 24px;
  height: 24px;
}

.tag-lot u {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  text-decoration: none;
}

.tag-lot.me {
  background: linear-gradient(180deg, #fff6c8, #ffd75a);
}

.tag-free {
  pointer-events: auto;
  height: 30px;
  padding: 0 12px;
  border: 2px dashed rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  background: rgba(var(--deep-rgb), 0.45);
  color: #fff;
  font-size: 13px;
}

.fly {
  position: absolute;
  z-index: 8;
  left: 0;
  top: 0;
  font-size: 22px;
  font-weight: 900;
  color: #ffe066;
  text-shadow: 0 2px 0 #9a5a00, 0 4px 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  animation: fly 0.9s ease-out both;
}

@keyframes fly {
  from { opacity: 0; transform: translate(var(--x), var(--y)) scale(0.6); }
  20% { opacity: 1; transform: translate(var(--x), calc(var(--y) - 12px)) scale(1.15); }
  to { opacity: 0; transform: translate(var(--x), calc(var(--y) - 60px)) scale(1); }
}

/* ---------- Нижняя панель ---------- */

.dock {
  position: absolute;
  z-index: 5;
  left: 10px;
  right: 10px;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
}

.dock-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 66px;
  border: 0;
  border-radius: 20px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.06s ease-out, box-shadow 0.06s ease-out;
  --lo: #0c62b8;
  background: linear-gradient(180deg, #5cd0ff 0%, #1f9ef6 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 5px 0 var(--lo), 0 10px 16px rgba(var(--shade-rgb), 0.35);
}

.dock-btn:active {
  transform: translateY(4px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 1px 0 var(--lo), 0 3px 6px rgba(var(--shade-rgb), 0.35);
}

.dock-btn:disabled {
  filter: saturate(0.5);
  opacity: 0.75;
}

.dock-btn i {
  width: 28px;
  height: 28px;
  background: #fff;
  -webkit-mask: var(--m) center / contain no-repeat;
  mask: var(--m) center / contain no-repeat;
}

.dock-btn b {
  position: absolute;
  top: -8px;
  right: -4px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: #ff3b52;
  font-size: 13px;
  line-height: 24px;
  box-shadow: 0 2px 0 #a4142a;
}

.dock-btn b:empty {
  display: none;
}

.d-collect {
  --lo: #c97b00;
  background: linear-gradient(180deg, #ffe066 0%, #ffbf1f 100%);
  color: #5a3100;
  text-shadow: none;
}

.d-collect i { background: #6a3b00; }
.d-collect b { background: #2fbf4f; box-shadow: 0 2px 0 #187a2e; color: #fff; }

.d-project { --lo: #8a2fd0; background: linear-gradient(180deg, #d79bff 0%, #a04dff 100%); }
.d-friends { --lo: #1f8f45; background: linear-gradient(180deg, #8ef0a2 0%, #2fbf5a 100%); }

.d-collect i { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cellipse cx='12' cy='7' rx='8' ry='3.5'/%3E%3Cpath d='M4 9.5c0 1.9 3.6 3.5 8 3.5s8-1.6 8-3.5V12c0 1.9-3.6 3.5-8 3.5S4 13.9 4 12z'/%3E%3Cpath d='M4 14.5c0 1.9 3.6 3.5 8 3.5s8-1.6 8-3.5V17c0 1.9-3.6 3.5-8 3.5S4 18.9 4 17z'/%3E%3C/svg%3E"); }
.d-project i { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2c.6 0 1 .4 1 1v1.1c3.9.5 7 3.8 7 7.9h-16c0-4.1 3.1-7.4 7-7.9V3c0-.6.4-1 1-1z'/%3E%3Crect x='3' y='13.5' width='18' height='2.5' rx='1'/%3E%3Cpath d='M6 17.5h3v4H6zM15 17.5h3v4h-3z'/%3E%3C/svg%3E"); }
.d-friends i { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='8.5' cy='8' r='3.5'/%3E%3Ccircle cx='16.5' cy='9' r='3'/%3E%3Cpath d='M2 20c0-3.6 2.9-6.5 6.5-6.5S15 16.4 15 20z'/%3E%3Cpath d='M14.6 14.2c.6-.2 1.2-.3 1.9-.3 3 0 5.5 2.5 5.5 5.6V20h-5.4c0-2.3-.8-4.3-2-5.8z'/%3E%3C/svg%3E"); }
.d-invite i { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='9' cy='8' r='4'/%3E%3Cpath d='M1.5 20.5c0-4 3.4-7 7.5-7s7.5 3 7.5 7z'/%3E%3Cpath d='M18 6.5h2v3h3v2h-3v3h-2v-3h-3v-2h3z'/%3E%3C/svg%3E"); }

/* ---------- Нижние листы (постройка, стройка, соседи) ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-back {
  position: absolute;
  inset: 0;
  background: rgba(var(--shade-rgb), 0.35);
  animation: fade 0.18s ease-out both;
}

@keyframes fade {
  from { opacity: 0; }
}

.sheet-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(var(--vh, 100vh) - 70px);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 18px 16px max(22px, env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: linear-gradient(180deg, #3a8ff0 0%, #2266d6 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 -10px 30px rgba(var(--shade-rgb), 0.4);
  animation: rise 0.28s cubic-bezier(0.25, 1.3, 0.5, 1) both;
}

@keyframes rise {
  from { transform: translateY(100%); }
}

.sheet-card h2 {
  margin: 0 40px 4px 0;
  font-size: 23px;
  font-weight: 900;
  line-height: 1.15;
}

.sheet-card .lead {
  margin: 0 0 12px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-2);
}

.sheet-x {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  padding: 9px;
}

.sheet-card .btn {
  width: 100%;
  min-width: 0;
  margin-top: 10px;
}

.sheet-card .btn small {
  font-weight: 800;
}

.btn .coin {
  width: 22px;
  height: 22px;
}

/* Карточки построек */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.card-b {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px 12px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #e8f1ff 100%);
  color: #1d2a44;
  box-shadow: inset 0 -4px 0 rgba(30, 70, 140, 0.15), 0 4px 0 rgba(var(--shade-rgb), 0.35);
  transition: transform 0.06s ease-out;
}

.card-b:active {
  transform: translateY(3px);
}

.card-b[aria-disabled="true"] {
  opacity: 0.62;
}

.card-b .art {
  width: 64px;
  height: 56px;
}

.card-b strong {
  font-size: 16px;
  font-weight: 900;
}

.card-b .eff {
  font-size: 12.5px;
  font-weight: 800;
  color: #2a7a2a;
}

.card-b .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
}

.card-b .meta span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.card-b .meta .coin {
  width: 16px;
  height: 16px;
}

.card-b .meta .coin::after {
  inset: 3px;
  border-width: 1.5px;
}

.card-b .lock {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: rgba(20, 50, 120, 0.86);
  color: #fff;
  font-size: 13.5px;
  font-weight: 900;
  text-align: center;
  padding: 10px;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 6px 0 4px;
}

.info-row .art {
  flex: none;
  width: 84px;
  height: 74px;
  padding: 6px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #e8f1ff);
  box-shadow: inset 0 -4px 0 rgba(30, 70, 140, 0.15);
}

.stars {
  display: flex;
  gap: 3px;
  margin: 2px 0 6px;
}

.stars i {
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.28);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.stars i.on {
  background: #ffd23f;
}

.facts {
  display: grid;
  gap: 6px;
  font-size: 15px;
  font-weight: 800;
}

.facts span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(var(--deep-rgb), 0.35);
}

.facts em {
  font-style: normal;
  color: #b9ff8a;
}

.bar {
  position: relative;
  height: 26px;
  margin: 8px 0 4px;
  border-radius: 13px;
  background: rgba(var(--deep-rgb), 0.55);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

.bar i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 13px;
  background: linear-gradient(180deg, #c6ff9a, #47c93a);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5);
  transition: width 0.4s ease-out;
}

.bar span {
  position: relative;
  display: block;
  text-align: center;
  line-height: 26px;
  font-size: 14px;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.chips .btn {
  height: 50px;
  margin: 0;
  padding: 0 6px;
  font-size: 16px;
}

/* Соседи и рейтинг */
.people {
  display: grid;
  gap: 8px;
  margin: 6px 0 4px;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border-radius: 18px;
  background: rgba(var(--deep-rgb), 0.35);
  --ava: 38px;
}

.person .k-ava {
  width: 38px;
  height: 38px;
  box-shadow: 0 0 0 3px var(--lot, #fff);
}

.person .who {
  flex: 1;
  min-width: 0;
}

.person .who strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15.5px;
}

.person .who small {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}

.person .num {
  font-size: 16px;
  font-weight: 900;
}

.person.mine {
  background: rgba(255, 210, 63, 0.3);
}

.rank {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 900;
}

.rank.r1 { background: linear-gradient(180deg, #ffe066, #ffbf1f); color: #5a3100; }
.rank.r2 { background: linear-gradient(180deg, #f1f3fb, #b4bbd6); color: #2a3150; }
.rank.r3 { background: linear-gradient(180deg, #ffc08a, #d97a33); color: #4a1f00; }

.feed {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-2);
}

.feed li b {
  color: #fff;
}

.sheet-card h3 {
  margin: 16px 0 6px;
  font-size: 16px;
  font-weight: 900;
}

.code-input {
  width: 100%;
  height: 64px;
  margin: 8px 0 0;
  border: 0;
  border-radius: 20px;
  background: #fff;
  color: #1d2a44;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  box-shadow: inset 0 -4px 0 rgba(30, 70, 140, 0.15);
}

.code-big {
  margin: 4px 0;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0.25em;
  text-align: center;
}

.how-list {
  display: grid;
  gap: 8px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
  font-weight: 700;
}

.how-list li {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(var(--deep-rgb), 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .tag-coin, .tag-help, .town { animation: none; }
  .sheet-card { animation-duration: 0.01s; }
}
