html{
--ui-text-shadow: 0 3px 2px #000;
background: #3b3b3b;
}

@media screen and (min-width: 800px) {
html{
background: #3b3b3b url('/assets/body.webp') center center;
    background-size: auto 100%;

}

}

html::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.12);
    pointer-events: none;
    z-index: 0;
}

/* В бою общий фон остаётся спокойной тёмной рамкой вокруг canvas. */
html.battle-active::before {
    background: rgba(0, 0, 0, 0.78);
}


      body {
        padding: 0px; margin: 0px;
      }
      body {
        padding: 0px; margin: 0px;
      }
body, html
 {
    height: 100%;
    width: 100%;
    overflow: hidden;
    touch-action: none;
    text-align: center;
    margin: 0 auto;
    max-width: 700px;
}

.tap-feedback {
  position: fixed;
  z-index: 2147483647;
  width: 1px;
  height: 1px;
  pointer-events: none;
  animation: tap-feedback-life .65s linear forwards;
}
.tap-feedback::before,
.tap-feedback::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  border: 3px solid rgba(220, 251, 255, .96);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(84, 211, 255, .9), inset 0 0 7px rgba(118, 225, 255, .7);
  animation: tap-feedback-ring .48s cubic-bezier(.16, .75, .25, 1) forwards;
}
.tap-feedback::after {
  width: 16px;
  height: 16px;
  border-width: 2px;
  border-color: rgba(95, 207, 255, .85);
  animation-delay: .05s;
}
.tap-feedback > i {
  position: absolute;
  left: -3px;
  top: -5px;
  width: 6px;
  height: 10px;
  border-radius: 50% 50% 50% 0;
  background: linear-gradient(135deg, #f5ffff 8%, var(--tap-color, #9deaff) 52%, #279edb 100%);
  box-shadow: 0 0 5px rgba(61, 186, 255, .95);
  animation: tap-feedback-spark .43s ease-out forwards;
}
@keyframes tap-feedback-ring {
  from { opacity: 1; transform: translate(-50%, -50%) scale(.35); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(2.3); }
}
@keyframes tap-feedback-spark {
  from { opacity: .98; transform: translate(0, 0) rotate(calc(var(--tap-angle) - 135deg)) scale(.85); }
  to { opacity: 0; transform: translate(var(--tap-x), var(--tap-y)) rotate(calc(var(--tap-angle) - 135deg)) scale(.25); }
}
@keyframes tap-feedback-life {
  0%, 98% { opacity: 1; }
  100% { opacity: 0; }
}

    /* Всплывающая форма входа */
    #login-modal {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.7);
      justify-content: center;
      align-items: center;
      z-index: 1000;
    }

    #login-form {
      background: #222;
      padding: 24px;
      border-radius: 12px;
      box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
      width: 300px;
      color: white;
    }

    #login-form h2 {
      text-align: center;
      margin-bottom: 20px;
      font-family: monospace;
    }

    .input-group {
      margin-bottom: 16px;
    }

    .input-group label {
      display: block;
      margin-bottom: 6px;
      font-family: monospace;
    }

    .input-group input {
      width: 100%;
      padding: 8px;
      border: 1px solid #444;
      background: #111;
      color: white;
      border-radius: 4px;
      font-family: monospace;
      box-sizing: border-box;
    }

    #login-submit, #login-cancel {
      width: 48%;
      padding: 10px;
      margin: 8px 1%;
      border: none;
      border-radius: 4px;
      font-family: monospace;
      cursor: pointer;
    }

    #login-submit {
      background: #37B700;
      color: white;
    }

    #login-cancel {
      background: #666;
      color: white;
    }



.game-button {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 160px;
  height: 50px;
  font-family: monospace;
  font-size: 20px;
  color: white;
  text-decoration: none;
  border: none;
  cursor: pointer;
  border-radius: 8px;

  /* Градиентная зелёная заливка */
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}


/* Анимированная точка — "бегающий пульс" по периметру */
.game-button::before {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  z-index: 2;
  animation: orbitButton 4s linear infinite;
}

/* Ключевые кадры анимации: точка движется по квадрату */
@keyframes orbitButton {
  0% { top: -4px; left: -4px; }
  25% { top: -4px; right: -4px; left: auto; }
  50% { bottom: -4px; right: -4px; top: auto; left: auto; }
  75% { bottom: -4px; left: -4px; right: auto; top: auto; }
  100% { top: -4px; left: -4px; bottom: auto; right: auto; }
}


.game-shell {
  position: relative;
  height: 100%;
}

#game {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--game-width, 100vw);
  height: var(--game-height, 100vh);
  max-width: 700px;
  margin: 0 auto;
  overflow: hidden;
}

/* Ключевое правило: */
#game canvas {display: block;width: 100%;height: auto;}



/* Кнопка полного экрана */
#fullscreen-btn {
  display: none;
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  z-index: 1000000;
}

#fix_dop {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: var(--game-width, 100vw);
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

/* Показываем только на десктопе */
@media (min-width: 768px) {
  #fullscreen-btn {
    display: block;
  }
}

.err {
  min-height: 26px;
  font-size: 17px;
  color: #ffb4b4;
  text-shadow: 0 2px 3px #000;
}

.fix_dop {position:absolute;height:100%;width:100%;z-index:666666;}

.login-layout {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: clamp(50px, 8vh, 90px);
  color: #fff;
}

.login-logo {
  width: 100%;
  height: clamp(130px, 26vh, 230px);
  flex: 0 0 auto;
  background: url("/assets/logo.webp") center / contain no-repeat;
}

.login-panel {
  width: 100%;
  margin: 0 auto;
  padding: 18px 18px 28px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(25, 27, 23, .86), rgba(7, 9, 7, .76));
  border-top: 1px solid rgba(155, 132, 83, .48);
  border-bottom: 1px solid rgba(69, 91, 51, .62);
  box-shadow: inset 0 1px rgba(255, 235, 184, .08), 0 10px 28px rgba(0, 0, 0, .55);
}

button {background-color:transparent;border-style:none;}
/* Тот же отклик, что у Phaser-кнопок. Отдельный scale сохраняет позицию иконок. */
:is(button, input[type="submit"], .game-button, .game-btn) {
  transition: scale .09s ease-out;
  transform-origin: center;
}
@media (hover: hover) {
  :is(button, input[type="submit"], .game-button, .game-btn):not(:disabled):not([aria-disabled="true"]):hover {
    scale: 1.05;
  }
}
:is(button, input[type="submit"], .game-button, .game-btn):not(:disabled):not([aria-disabled="true"]):active {
  scale: 1.1;
}

.submit2 {
  width: 58%;
  min-width: 220px;
  font: bold 27px Georgia, "Times New Roman", serif;
  line-height: 78px;
  text-align: center;
  cursor: pointer;
  background-image: url("/assets/submit.png");
  background-size: 100% 90%;
  background-position: center;
  background-repeat: no-repeat;
  max-width: 256px;
}

.submit2 span {
  display: inline-block;
  transform: translateY(2px);
  color: #fff0bd;
  -webkit-text-fill-color: #fff0bd;
  -webkit-text-stroke: 3px #3a1b08;
  paint-order: stroke fill;
  letter-spacing: .5px;
  text-shadow: var(--ui-text-shadow);
}

.input_t {
  display: block;
  width: 92%;
  max-width: 350px;
  height: 46px;
  margin: 13px auto;
  padding: 0 15px;
  box-sizing: border-box;
  font: 16px Montserrat, "Segoe UI", sans-serif;
  color: #e6efdc;
  caret-color: #a9e85c;
  background: linear-gradient(180deg, #272a25, #151714);
  border: 1px solid #596052;
  border-left-color: #7b806e;
  border-radius: 2px;
  box-shadow: inset 0 1px rgba(255, 255, 255, .06), inset 0 -5px 10px rgba(0, 0, 0, .35), 0 3px 8px rgba(0, 0, 0, .35);
  transition: border-color .18s, box-shadow .18s, background .18s;
}

.input_t::placeholder {color:#8f9589;opacity:1;}

.input_t:focus {
  background: linear-gradient(180deg, #2d3229, #181c16);
  border-color: #8fbd47;
  box-shadow: inset 0 1px rgba(225, 255, 188, .10), 0 0 0 1px rgba(143, 189, 71, .28), 0 0 13px rgba(105, 178, 42, .36);
}
input:focus, select:focus, textarea:focus, button:focus { outline: none; }

/* Блокирующее окно при потере связи. Оно находится вне Phaser,
   поэтому остаётся поверх игры и любых открытых сцен. */
#connection-indicator[hidden],
#connection-modal[hidden] { display: none !important; }

#connection-indicator {
  position: fixed;
  z-index: 1999999;
  left: 50%;
  top: 50%;
  width: 82px;
  height: 82px;
  box-sizing: border-box;
  pointer-events: none;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    url('/assets/ui/connection_indicator_v1.webp') center / contain no-repeat,
    radial-gradient(circle, #090b09 0 43%, rgba(20, 19, 14, .98) 44% 54%, rgba(5, 6, 5, .88) 60%, transparent 70%);
  filter: brightness(1.12) contrast(1.16) drop-shadow(0 7px 11px rgba(0, 0, 0, .9));
}

#connection-indicator::before {
  content: "";
  position: absolute;
  inset: 24px;
  border: 4px solid rgba(115, 98, 51, .52);
  border-top-color: #ffd568;
  border-right-color: #e8aa30;
  border-radius: 50%;
  box-shadow: inset 0 0 8px rgba(255, 202, 78, .34), 0 0 9px rgba(238, 172, 42, .48);
  animation: connectionSpin 1.05s linear infinite;
}

#connection-indicator::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f0bb42;
  box-shadow: 0 0 6px #ffe18a, 0 0 16px rgba(240, 174, 42, .95);
  animation: connectionCorePulse 1.15s ease-in-out infinite alternate;
}

@keyframes connectionSpin { to { transform: rotate(360deg); } }
@keyframes connectionCorePulse {
  from { transform: translate(-50%, -50%) scale(.72); opacity: .62; }
  to { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
}

#connection-modal {
  position: fixed;
  inset: 0;
  z-index: 2000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  box-sizing: border-box;
  background: rgba(5, 7, 5, .72);
  -webkit-backdrop-filter: blur(4px) saturate(.7);
  backdrop-filter: blur(4px) saturate(.7);
  font-family: Montserrat, "Segoe UI", Arial, sans-serif;
}

.connection-panel {
  position: relative;
  width: min(520px, calc(100vw - 28px), calc(var(--game-width, 100vw) - 28px));
  min-height: 380px;
  box-sizing: border-box;
  overflow: visible;
  color: #e8dfbf;
  text-align: left;
  border-style: solid;
  border-color: transparent;
  border-width: 76px 34px 60px;
  border-image-source: url('/assets/ui/fallout_modal_frame_v1.webp');
  border-image-slice: 170 82 165 82 fill;
  border-image-width: 76px 34px 60px;
  border-image-repeat: stretch;
  filter: drop-shadow(0 12px 25px rgba(0, 0, 0, .8));
}

.wasteland-heading,
.connection-title,
.game-dialog-title,
.communication-title {
  font-family: WastelandCondensed, ExoGame, Arial, sans-serif;
  font-style: normal;
  font-weight: 600;
  color: #f0c665;
  text-shadow: var(--ui-text-shadow);
}

.connection-title {
  position: absolute;
  z-index: 2;
  top: -69px;
  left: 0;
  width: 100%;
  height: 59px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 0 10px;
  box-sizing: border-box;
  font-size: clamp(20px, 4.6vw, 26px);
  letter-spacing: 1.4px;
}

.connection-warning {
  display: grid;
  place-items: center;
  flex: 0 0 31px;
  height: 31px;
  color: #17140d;
  font: 900 22px Arial, sans-serif;
  border: 2px solid #4e3615;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe08a, #d68120 72%);
  box-shadow: 0 0 10px rgba(226, 142, 38, .4);
}

.connection-body {
  padding: 10px 6px 8px;
  text-align: center;
}

.connection-message {
  margin: 0;
  font-size: clamp(16px, 3.7vw, 20px);
  line-height: 1.48;
  color: #ddd8c8;
  text-shadow: 0 1px 2px #000;
}

.connection-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  margin: 20px 0 22px;
  color: #a9c77e;
  font-size: clamp(14px, 3.3vw, 17px);
}

.connection-status::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #b1e45e;
  box-shadow: 0 0 9px #90d33b;
  animation: connectionPulse 1s ease-in-out infinite;
}

@keyframes connectionPulse {
  50% { opacity: .25; transform: scale(.7); }
}

.fallout-action-button {
  position: relative;
  min-width: 0;
  min-height: 70px;
  padding: 0 50px 3px;
  cursor: pointer;
  color: #f4d77c;
  font: bold 22px Georgia, "Times New Roman", serif;
  letter-spacing: 1px;
  text-shadow: var(--ui-text-shadow);
  border: 0;
  background: transparent url('/assets/ui/action_button_v1.webp') center / 100% 100% no-repeat;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, .62));
}
.fallout-action-button:disabled { cursor: wait; filter: grayscale(.45); opacity: .72; }
#connection-retry { width: min(300px, 82%); }

/* Общий каркас информационных окон, подтверждений и форм героя. */
.game-dialog {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  box-sizing: border-box;
  overflow-y: auto;
  pointer-events: auto;
  background: rgba(3, 6, 5, .76);
  -webkit-backdrop-filter: blur(5px) saturate(.65);
  backdrop-filter: blur(5px) saturate(.65);
  font-family: Montserrat, "Segoe UI", Arial, sans-serif;
}

.game-dialog .game-dialog-panel {
  position: relative;
  flex: 0 0 auto;
  width: min(480px, 100%, calc(var(--game-width, 100vw) - 28px));
  margin: auto 0;
  box-sizing: border-box;
  color: #e8dfbf;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .72);
}

.game-dialog-title {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 72px;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(171, 148, 91, .3);
  background: linear-gradient(180deg, rgba(204, 162, 81, .06), transparent);
  font-size: clamp(25px, 5vw, 30px);
  letter-spacing: 1.2px;
  text-align: center;
}
.game-dialog-title.wasteland-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, max-content) minmax(0, 1fr);
  gap: 12px;
}
.game-dialog-title > span { min-width: 0; overflow-wrap: anywhere; }

.game-dialog-close {
  position: absolute;
  z-index: 2;
  top: 17px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  cursor: pointer;
  color: #edc67b;
  text-shadow: var(--ui-text-shadow);
}
.game-dialog-close::before {
  content: '×';
  font: 38px/1 Arial, sans-serif;
}

.game-dialog-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}
.game-dialog-message { margin: 0; font-size: 17px; line-height: 1.5; white-space: pre-line; }
.game-dialog-actions { display: flex; justify-content: center; gap: 12px; padding: 0 24px 24px; }
.game-dialog-actions .game-dialog-button { flex: 0 1 240px; min-width: 0; white-space: normal; }
.game-dialog-button.is-secondary { color: #c6c4b5; }
.experience-details { display: grid; gap: 16px; width: 100%; }
.experience-details p { margin: 0; font-size: 16px; line-height: 1.5; }
.experience-details .experience-value { color: #f0c665; font: 600 25px WastelandCondensed, sans-serif; text-shadow: var(--ui-text-shadow); }
.experience-progress { width: 100%; height: 12px; appearance: none; border: 1px solid #726443; border-radius: 4px; background: #0c120f; overflow: hidden; }
.experience-progress::-webkit-progress-bar { background: #0c120f; }
.experience-progress::-webkit-progress-value { background: linear-gradient(#efd08a, #99712e); }
.experience-progress::-moz-progress-bar { background: linear-gradient(#efd08a, #99712e); }
.experience-bonus { padding-top: 16px; border-top: 1px solid rgba(171, 148, 91, .3); color: #b9b9a7; }
.experience-bonus-line { display: flex; align-items: center; justify-content: center; gap: 7px; }
.experience-health { display: inline-block; width: 28px; height: 28px; flex: 0 0 28px; object-fit: contain; }

.profile-auth-field {
  width: 100%;
  height: 54px;
  margin: 0;
  padding: 0 16px;
  box-sizing: border-box;
  color: #eee5c9;
  caret-color: #e8bd57;
  outline: 0;
  border: 1px solid #6f735d;
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(28, 36, 29, .98), rgba(13, 18, 14, .98));
  box-shadow: inset 0 0 12px rgba(0, 0, 0, .72), 0 1px 0 rgba(207, 177, 96, .18);
  font: 17px Montserrat, Arial, sans-serif;
}

.profile-auth-field:focus {
  border-color: #c69a45;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, .72), 0 0 9px rgba(198, 154, 69, .32);
}

.profile-auth-field::placeholder { color: #85897b; }
.game-dialog-error { color: #e59178; font-size: 15px; line-height: 1.4; }
.game-dialog-error:empty { display: none; }

.game-dialog-button {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(240px, 100%);
  min-height: 54px;
  padding: 10px 20px;
  box-sizing: border-box;
  cursor: pointer;
  color: #f4d77c;
  font: 600 23px/1.2 WastelandCondensed, ExoGame, Arial, sans-serif;
  letter-spacing: 1px;
  text-shadow: var(--ui-text-shadow);
  text-align: center;
  white-space: nowrap;
}
/* Цветной слой сохраняет рисунок и бронзовый кант общей текстуры. */
.game-dialog-button:is(.is-success, .is-danger)::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 5px;
  border-radius: 4px;
  pointer-events: none;
  background: var(--button-tint);
}
.game-dialog-button.is-success {
  --button-tint: linear-gradient(180deg, rgba(74, 122, 38, .68), rgba(23, 63, 22, .52));
  color: #e4edba;
}
.game-dialog-button.is-danger {
  --button-tint: linear-gradient(180deg, rgba(148, 48, 31, .7), rgba(79, 22, 17, .58));
  color: #ffe0c0;
}
.game-dialog-button:disabled { cursor: wait; filter: grayscale(.45); opacity: .72; }
.game-dialog button:not(:disabled):hover,
.game-dialog button:not(:disabled):focus-visible { filter: brightness(1.15); }
.game-dialog button:not(:disabled):active { filter: brightness(.9); }

@media (max-height: 430px) {
  .connection-panel {
    min-height: 320px;
    border-width: 58px 28px 46px;
    border-image-width: 58px 28px 46px;
  }

  .connection-title {
    top: -53px;
    height: 46px;
    font-size: 19px;
  }

  .connection-warning { flex-basis: 26px; height: 26px; font-size: 18px; }
  .connection-body { padding: 3px 4px; }
  .connection-message { font-size: 15px; line-height: 1.3; }
  .connection-status { min-height: 34px; margin: 9px 0 11px; font-size: 13px; }
  #connection-retry { min-height: 46px; font-size: 18px; }

  .game-dialog-title { min-height: 64px; padding-top: 10px; padding-bottom: 10px; font-size: 24px; }
  .game-dialog-close { top: 10px; }
  .game-dialog-content { gap: 12px; padding: 16px 20px; }
  .profile-auth-field { height: 46px; font-size: 16px; }
  .game-dialog-error { font-size: 14px; }
  .game-dialog-button { min-height: 46px; font-size: 21px; }
  .game-dialog-actions { gap: 10px; padding: 0 20px 16px; }
  .game-dialog-message { font-size: 16px; line-height: 1.4; }
  .experience-details { gap: 10px; }
  .experience-bonus { padding-top: 10px; }
}

@media (max-width: 699px) {
  /* Клавиатура занимает нижнюю половину экрана: форму держим сверху,
     чтобы оба поля пароля и кнопка оставались доступными. */
  .profile-auth-modal {
    align-items: flex-start;
    padding-top: max(18px, env(safe-area-inset-top));
  }
  .profile-auth-modal .game-dialog-panel { margin: 0; }
  .game-dialog-content { padding-left: 18px; padding-right: 18px; }
  .game-dialog-title { padding-left: 62px; padding-right: 62px; }
  .game-dialog-close { right: 12px; }

  .login-layout {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .login-logo {
    height: clamp(170px, 28vh, 270px);
  }
}

@media (max-width: 699px) and (max-height: 620px) {
  .login-layout { padding-bottom: 10px; }
  .login-logo { height: 130px; }
  .login-panel { padding-top: 10px; padding-bottom: 14px; }
  .input_t { margin-top: 8px; margin-bottom: 8px; }
}

/* Универсальное окно чата, поддержки и будущих каналов сообщений. */
.communication-modal {
  --window-border: #77765a;
  --window-surface: linear-gradient(115deg, #232b22, #111914 75%);
  --window-header-height: 88px;
  --window-gutter: 20px;
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  box-sizing: border-box;
  pointer-events: auto;
  background: rgba(2, 5, 4, .76);
  font-family: Montserrat, "Segoe UI", Arial, sans-serif;
}

.communication-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(700px, var(--game-width, 100vw));
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
  color: #e7dfc6;
  text-align: left;
  border: 1px solid #494d3d;
  padding: calc(var(--window-header-height) + 12px) var(--window-gutter) max(14px, env(safe-area-inset-bottom));
  isolation: isolate;
  background: #0c120f;
}

/* Под шапкой берём только тёмную часть картинки и землю у нижнего края. */
.communication-panel::before {
  content: '';
  position: absolute;
  inset: var(--window-header-height) 0 0;
  z-index: -1;
  pointer-events: none;
  border-image: url('/assets/ui/wasteland_window_bg_v1.webp') 384 0 320 0 fill
    / 0 0 clamp(110px, 24vh, 290px) 0 stretch;
}

.communication-title {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--window-header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 78px;
  box-sizing: border-box;
  font-size: clamp(30px, 5vw, 42px);
  border-bottom: 1px solid var(--window-border);
  background: #0c120f url('/assets/ui/wasteland_window_bg_v1.webp') center top / 100% auto no-repeat;
  letter-spacing: 1.5px;
  text-align: center;
  pointer-events: none;
}

.wasteland-heading {
  gap: clamp(11px, 2.4vw, 22px);
}
.wasteland-heading::before,
.wasteland-heading::after {
  content: '';
  flex: 0 1 98px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #a48a50);
}
.wasteland-heading::after { transform: scaleX(-1); }
.forum-title-image,
.chat-title-image {
  width: auto;
  object-fit: contain;
  filter: drop-shadow(var(--ui-text-shadow));
}
.forum-title-image { height: clamp(38px, 5vw, 46px); }
.chat-title-image { height: clamp(31px, 4vw, 37px); }

.communication-close {
  position: absolute;
  z-index: 3;
  top: calc((var(--window-header-height) - 52px) / 2);
  right: var(--window-gutter);
  width: 52px;
  height: 52px;
  padding: 0;
  cursor: pointer;
  border: 1px solid #b59a61;
  border-radius: 7px;
  color: #edc67b;
  background: var(--window-surface);
  box-shadow: 0 2px 5px #080b08;
  text-shadow: var(--ui-text-shadow);
}
.communication-close::before {
  content: '×';
  font: 46px/1 Arial, sans-serif;
}
.communication-close:hover { border-color: #f0c665; }

/* Общая поверхность небольших окон и кнопок из той же текстуры, что у профиля. */
.wasteland-surface,
.communication-modal :is(.communication-close, .communication-emoji-toggle, .communication-send,
  .forum-back, .forum-new-topic, .forum-topic-actions button) {
  border: 1px solid transparent;
  border-image: url('/assets/ui/wasteland_panel_v1.webp') 32 fill / 16px stretch;
  background: transparent;
  box-shadow: 0 2px 4px #080b08;
}
.communication-close { display: grid; place-items: center; }

/* Одна поверхность вместо картинок с рамками для сообщений и тем. */
.communication-modal :is(.communication-message, .forum-topic-card, .forum-post) {
  border: 1px solid var(--window-border);
  border-radius: 7px;
  background: var(--window-surface);
  box-shadow: inset 0 1px rgba(237, 221, 167, .06);
}

.communication-support-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin: 3px 5px 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(145, 118, 60, .5);
}
.communication-support-toolbar[hidden],
.communication-composer[hidden],
.communication-channels[hidden],
.communication-emoji-panel[hidden],
.communication-edit-cancel[hidden] { display: none !important; }

.communication-support-back {
  min-height: 34px;
  padding: 5px 12px;
  cursor: pointer;
  color: #e7c56e;
  font: bold 12px ExoGame, sans-serif;
  border: 1px solid #796438;
  border-radius: 3px;
  background: linear-gradient(#303522, #171d14);
  box-shadow: inset 0 0 0 2px rgba(12, 15, 10, .72);
}

.communication-support-login {
  min-width: 0;
  overflow: hidden;
  color: #e8c263;
  text-shadow: var(--ui-text-shadow);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.communication-channels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  flex: 0 0 auto;
  margin: 0 5px 8px;
  padding: 2px 0 9px;
  border-bottom: 1px solid rgba(151, 122, 60, .62);
}
.communication-channels button:disabled { cursor: default; opacity: .42; pointer-events: none; }

.communication-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #8d733d #11160f;
  padding: 2px 5px 12px;
  touch-action: pan-y;
}

.communication-support-thread {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  margin: 0 0 8px;
  padding: 9px 10px;
  cursor: pointer;
  border: 1px solid rgba(105, 103, 73, .56);
  border-left: 3px solid #6d6b4b;
  border-radius: 3px;
  background: linear-gradient(100deg, rgba(16, 26, 19, .96), rgba(23, 29, 20, .82));
  box-shadow: inset 0 1px rgba(255, 232, 163, .035), 0 2px 5px rgba(0, 0, 0, .25);
}

.communication-support-thread:hover {
  border-color: rgba(181, 143, 66, .82);
  border-left-color: #c59235;
  background: linear-gradient(100deg, rgba(37, 35, 18, .98), rgba(25, 31, 20, .9));
  box-shadow: inset 0 0 16px rgba(174, 132, 51, .1), 0 2px 5px rgba(0, 0, 0, .25);
}

.communication-support-thread.is-unread {
  border-color: rgba(81, 181, 222, .92);
  border-left: 5px solid #58c7ef;
  background:
    linear-gradient(100deg, rgba(12, 43, 55, .98), rgba(19, 35, 37, .92));
  box-shadow:
    inset 0 0 22px rgba(73, 190, 233, .14),
    0 0 9px rgba(57, 171, 218, .28),
    0 2px 5px rgba(0, 0, 0, .3);
}

.communication-support-thread.is-unread::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 11px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #73d9ff;
  box-shadow: 0 0 8px #48bde9;
}

.communication-support-thread.is-unread .communication-message-meta {
  padding-right: 18px;
}

.communication-support-thread.is-unread .communication-message-meta time {
  color: #8edcff;
}

.communication-support-thread.is-unread .communication-avatar {
  filter: drop-shadow(0 0 5px rgba(50, 166, 207, .5));
}

.communication-support-thread-content { min-width: 0; }

.communication-support-preview {
  min-height: 22px;
  margin: 4px 0 0;
  overflow: hidden;
  color: #c8c4b4;
  font-size: 14px;
  line-height: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.communication-support-preview .wasteland-emoji {
  width: 22px;
  height: 22px;
  margin: 0 2px;
  vertical-align: middle;
}

.communication-empty {
  position: absolute;
  top: 42%;
  left: 50%;
  width: min(420px, 78%);
  transform: translate(-50%, -50%);
  color: #898b79;
  font-size: 17px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}

.communication-message {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  margin: 0 0 8px;
  padding: 9px 10px;
  border: 1px solid rgba(105, 103, 73, .5);
  border-left: 3px solid #6d6b4b;
  border-radius: 3px;
  background: linear-gradient(100deg, rgba(16, 26, 19, .96), rgba(23, 29, 20, .82));
  box-shadow: inset 0 1px rgba(255, 232, 163, .035), 0 2px 5px rgba(0, 0, 0, .25);
}

.communication-message.is-own {
  border-left-color: #a77d32;
  background: linear-gradient(100deg, rgba(31, 31, 18, .96), rgba(25, 31, 20, .82));
}
.communication-modal.is-chat .communication-message.is-own,
.communication-modal.is-support .communication-message.is-own {
  background:
    radial-gradient(circle at 0 0, rgba(167, 125, 50, .12), transparent 38%),
    linear-gradient(100deg, rgba(31, 31, 18, .98), rgba(25, 31, 20, .9));
}
.communication-message.is-actionable { cursor: pointer; }
.communication-message.is-actionable:hover,
.communication-message.is-selected {
  border-color: rgba(181, 143, 66, .82);
  box-shadow: inset 0 0 16px rgba(174, 132, 51, .09), 0 2px 5px rgba(0, 0, 0, .25);
}

.communication-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  color: #e4bc5c;
  font: bold 21px ExoGame, sans-serif;
  border: 0;
  background: transparent;
}

.communication-avatar::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: url('/assets/ui/communication_icons_v9.webp') 100% 0 / 300% 300% no-repeat;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .55));
}

.communication-avatar img {
  position: absolute;
  z-index: 1;
  inset: 13%;
  width: 74%;
  height: 74%;
  object-fit: cover;
}

.communication-message-content { min-width: 0; }
.communication-message-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.communication-message-meta strong {
  overflow: hidden;
  color: #efb752;
  text-shadow: var(--ui-text-shadow);
  font: bold 16px ExoGame, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.communication-message-meta strong.is-staff { color: #e99158; }
.communication-message-meta time {
  flex: 0 0 auto;
  color: #858776;
  font-size: 11px;
}
.communication-message p {
  margin: 5px 0 0;
  color: #e5e0d0;
  font-size: 16px;
  line-height: 1.38;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.communication-icon {
  --icon-column: 0;
  --icon-row: 0;
  display: inline-block;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  background: url('/assets/ui/communication_icons_v9.webp') no-repeat;
  background-size: 300% 300%;
  background-position: calc(var(--icon-column) * 50%) calc(var(--icon-row) * 50%);
}
.communication-icon.is-send { --icon-column: 0; --icon-row: 0; }
.communication-icon.is-reply { --icon-column: 1; --icon-row: 0; }
.communication-icon.is-edit { --icon-column: 0; --icon-row: 1; }
.communication-icon.is-delete { --icon-column: 1; --icon-row: 1; }
.communication-reply-target {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0 6px 3px 0;
  padding: 2px 7px;
  color: #a5a793;
  font-size: .85em;
  font-weight: bold;
  line-height: 1.25;
  border-left: 2px solid #666b58;
  border-radius: 2px;
  background: rgba(71, 76, 59, .24);
}
.communication-reply-target .communication-icon { width: 18px; height: 18px; }
.communication-reply-target.is-me {
  color: #f1cd6c;
  border-left-color: #d09b3e;
  background: rgba(139, 101, 38, .25);
  text-shadow: 0 1px 2px #000;
}
.communication-input .communication-reply-target {
  margin-bottom: 0;
  color: #d6bd74;
  border-left-color: #a27d3b;
  background: rgba(118, 89, 39, .28);
}

.communication-message-actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  width: max-content;
  margin: 8px 0 0 auto;
}
.communication-message-actions button {
  display: grid;
  place-items: center;
  width: 43px;
  height: 38px;
  padding: 0;
  cursor: pointer;
  border: 1px solid #645737;
  border-radius: 2px;
  background: linear-gradient(#3a3b2e, #181d16);
  box-shadow: inset 0 0 0 1px #11140f, 0 1px 2px #000;
}
.communication-message-actions button:hover {
  border-color: #c19647;
  background: linear-gradient(#4a4935, #20271c);
  filter: brightness(1.12);
}
.communication-message-actions .is-delete { border-color: #754638; }
.communication-message-actions .communication-icon { width: 31px; height: 31px; }

.communication-composer {
  position: relative;
  flex: 0 0 auto;
  margin-top: auto;
  padding: 10px 5px 2px;
  border-top: 1px solid rgba(151, 122, 60, .62);
  background: linear-gradient(180deg, rgba(13, 18, 13, .72), rgba(7, 11, 8, .96));
}
.communication-input-row { display: flex; align-items: stretch; gap: 7px; }
.communication-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 62px;
  padding: 10px 12px;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  color: #eee7d2;
  caret-color: #e8bd57;
  border: 1px solid #686d58;
  border-radius: 6px;
  outline: 0;
  background: linear-gradient(180deg, #1c241d, #0d120e);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, .65);
  font: 16px Montserrat, "Segoe UI Emoji", sans-serif;
  line-height: 1.45;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.communication-input:focus { border-color: #bd9140; }
.communication-input:empty::before {
  content: attr(data-placeholder);
  color: #7e8277;
  pointer-events: none;
}
.communication-emoji-toggle {
  flex: 0 0 56px;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  border: 1px solid #a48a50;
  border-radius: 6px;
  background: var(--window-surface);
}
.communication-emoji-toggle:hover { filter: brightness(1.15); }
.communication-edit-cancel {
  flex: 0 0 48px;
  cursor: pointer;
  color: #e7c25f;
  font: 32px/1 ExoGame, Arial, sans-serif;
  border: 1px solid #75613b;
  border-radius: 3px;
  background: linear-gradient(#3b3022, #1d1711);
}
.communication-send {
  flex: 0 0 56px;
  cursor: pointer;
  border: 1px solid #b18b42;
  border-radius: 6px;
  background: var(--window-surface);
  box-shadow: inset 0 1px rgba(255, 226, 133, .15);
}
.communication-send:hover { filter: brightness(1.12); }
.communication-send .communication-icon { width: 42px; height: 42px; }
.communication-send:disabled { opacity: .55; cursor: wait; }
.communication-emoji-panel {
  position: absolute;
  z-index: 20;
  right: 5px;
  bottom: calc(100% + 5px);
  left: 5px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin: 0;
  padding: 6px;
  max-height: min(230px, 32vh);
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-color: #9b7a37 #11160f;
  scrollbar-width: auto;
  border: 1px solid #5d583d;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(30, 33, 23, .99), rgba(10, 15, 11, .99));
  box-shadow: 0 -7px 20px rgba(0, 0, 0, .78), inset 0 0 0 2px #191c14;
}
.communication-emoji-panel button {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 54px;
  padding: 1px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 3px;
}
.communication-emoji-panel button:hover {
  border-color: #8e7138;
  background: rgba(104, 88, 48, .28);
}
.wasteland-emoji {
  --emoji-column: 0;
  --emoji-row: 0;
  display: inline-block;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  vertical-align: middle;
  background-image: url('/assets/ui/wasteland_emojis_v2.webp?v=4');
  background-repeat: no-repeat;
  background-size: 500% 600%;
  background-position:
    calc(var(--emoji-column) * 25%)
    calc(var(--emoji-row) * 20%);
}
.communication-emoji-toggle .wasteland-emoji { width: 38px; height: 38px; }
.communication-message p .wasteland-emoji {
  width: 36px;
  height: 36px;
  margin: 2px;
  vertical-align: middle;
}
.communication-input .wasteland-emoji {
  width: 38px;
  height: 38px;
  margin: -7px 2px -10px;
}

.communication-error { padding-top: 4px; color: #e69a83; font-size: 12px; text-align: center; }
.communication-error:empty { display: none; }
.communication-panel.is-loading .communication-messages { opacity: .58; }

/* Форум использует общий фон и заголовок чата. */
.forum-panel.is-loading .forum-content { opacity: .55; pointer-events: none; }
.forum-sections {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  flex: 0 0 auto;
  margin: 0 0 8px;
  padding: 2px 0 9px;
  border-bottom: 1px solid rgba(151, 122, 60, .62);
}
.forum-sections button,
.communication-channels button,
.forum-back,
.forum-new-topic,
.forum-delete-topic,
.forum-poll > button {
  min-height: 36px;
  padding: 5px 10px;
  cursor: pointer;
  color: #c8c2aa;
  font: 400 14px WastelandCondensed, ExoGame, sans-serif;
  letter-spacing: .7px;
  border: 1px solid #61583a;
  border-radius: 6px;
  background: linear-gradient(#303226, #141a13);
  box-shadow: inset 0 0 0 1px #10130e;
}
.forum-sections button,
.communication-channels button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 58px;
  padding: 7px 9px 9px;
  overflow: hidden;
  color: #969a88;
  font-family: WastelandCondensed, ExoGame, sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 1.2px;
  border-color: #4f5945 #343a2f #77704b;
  background:
    linear-gradient(115deg, rgba(255, 239, 179, .06), transparent 28%),
    linear-gradient(#30372d, #151c16 56%, #0c120e);
  border-radius: 6px;
  box-shadow: inset 0 1px rgba(224, 218, 169, .12);
  text-shadow: var(--ui-text-shadow);
}
.forum-sections button:hover,
.forum-sections button.is-active,
.communication-channels button:hover,
.communication-channels button.is-active {
  color: #f1ce70;
  border-color: #ae863d #685328 #ba8d3d;
  background:
    radial-gradient(circle at 50% 115%, rgba(205, 156, 53, .27), transparent 52%),
    linear-gradient(#4b4a32, #282c1d 60%, #171d13);
  box-shadow:
    inset 0 1px rgba(255, 226, 133, .2),
    inset 0 0 12px rgba(196, 146, 43, .1),
    0 2px 3px #050705;
}
.forum-sections button::after,
.communication-channels button::after {
  content: '';
  position: absolute;
  right: 7px;
  bottom: 2px;
  left: 7px;
  height: 4px;
  opacity: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, #6e4712, #ffd36a 18%, #b87919 78%, #5d3b0f);
  box-shadow: 0 -1px 5px rgba(255, 184, 48, .48), 0 0 8px rgba(235, 158, 30, .38);
  transition: opacity .15s ease;
}
.forum-sections button.is-active::after,
.communication-channels button.is-active::after { opacity: 1; }
.forum-section-icon {
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  opacity: .38;
  background: center / contain no-repeat;
  filter: saturate(.45);
}
.forum-section-icon.is-news { background-image: url('/assets/ui/forum_section_news_v1.svg'); }
.forum-section-icon.is-help { background-image: url('/assets/ui/forum_section_help_v1.svg'); }
.forum-section-icon.is-clan { background-image: url('/assets/ui/forum_section_clan_v1.svg'); }
.forum-section-icon.is-talk { background-image: url('/assets/ui/forum_section_talk_v1.svg'); }
.forum-sections button:hover .forum-section-icon,
.forum-sections button.is-active .forum-section-icon {
  opacity: 1;
  filter: saturate(1) drop-shadow(0 0 4px rgba(221, 157, 39, .35));
}
.forum-toolbar {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 178px;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 39px;
  margin-bottom: 7px;
}
.forum-toolbar [hidden],
.forum-editor[hidden],
.forum-topic-title[hidden],
.forum-replying[hidden],
.forum-poll-toggle[hidden],
.forum-poll-editor[hidden] { display: none !important; }

.forum-view-title {
  display: flex;
  grid-column: 2;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 0;
  overflow: hidden;
  color: #e5c05f;
  font: 400 22px WastelandCondensed, ExoGame, sans-serif;
  letter-spacing: 4px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: var(--ui-text-shadow);
}
.forum-view-title > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.forum-view-title::before,
.forum-view-title::after {
  content: '';
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border: 1px solid #8f7037;
  background: #39371f;
  box-shadow: inset 0 0 0 1px #171a11, 0 1px 2px #000;
  transform: rotate(45deg);
}
.forum-back,
.forum-new-topic {
  box-sizing: border-box;
  border: 1px solid #a48a50;
  border-radius: 6px;
  background: var(--window-surface);
  text-shadow: var(--ui-text-shadow);
}
.forum-back {
  position: relative;
  grid-column: 1;
  width: 48px;
  min-height: 48px;
  padding: 0;
  color: #bdb596;
}
.forum-back::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-bottom: 3px solid #c9a454;
  border-left: 3px solid #c9a454;
  filter: drop-shadow(0 1px 1px #000);
  transform: translate(-35%, -50%) rotate(45deg);
}
.forum-back:hover { color: #e6c66f; border-color: #9b7b3d; filter: brightness(1.08); }
.forum-new-topic {
  grid-column: 3;
  position: relative;
  width: 178px;
  min-width: 178px;
  min-height: 48px;
  padding: 5px 16px 6px 46px;
  overflow: hidden;
  color: #f1ce72;
  font-family: WastelandCondensed, ExoGame, sans-serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 1.4px;
  white-space: nowrap;
  border-radius: 3px;
}
.forum-new-topic::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 11px;
  width: 28px;
  height: 28px;
  border: 1px solid #9c7939;
  border-radius: 50%;
  background:
    linear-gradient(#f2ca63, #b8872d) center / 13px 2px no-repeat,
    linear-gradient(#f2ca63, #b8872d) center / 2px 13px no-repeat,
    radial-gradient(circle at 42% 35%, #4b5130, #182015 72%);
  box-shadow: inset 0 0 0 2px #11170f, 0 1px 3px #000;
  transform: translateY(-50%);
}
.forum-new-topic:hover {
  color: #ffe294;
  border-color: #bb8e40;
  filter: brightness(1.1);
}
.forum-delete-topic {
  color: #e79a7f;
  border-color: #754536;
  background: linear-gradient(#43291f, #211711);
}
.forum-delete-topic:hover { color: #ffc0a8; border-color: #a75e46; filter: brightness(1.1); }
.forum-topic-actions {
  display: flex;
  grid-column: 3;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.forum-topic-actions button {
  position: relative;
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  box-sizing: border-box;
  padding: 0;
  cursor: pointer;
  color: #b8ad83;
  border: 7px solid transparent;
  border-image-source: url('/assets/ui/forum_button_frame_v2.png');
  border-image-slice: 24 fill;
  border-image-width: 7px;
  border-image-repeat: stretch;
  border-radius: 2px;
  background: transparent;
}
.forum-topic-actions button:hover,
.forum-topic-actions button.is-active { color: #eac35c; border-color: #a17b38; filter: brightness(1.12); }
.forum-topic-actions .communication-icon { width: 27px; height: 27px; }
.forum-topic-icon {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  color: currentColor;
}
.forum-topic-icon.is-pin,
.forum-topic-icon.is-unpin,
.forum-topic-icon.is-lock,
.forum-topic-icon.is-unlock {
  background: center / contain no-repeat;
}
.forum-topic-icon.is-pin { background-image: url('/assets/ui/forum_pin_v1.svg'); }
.forum-topic-icon.is-unpin { background-image: url('/assets/ui/forum_unpin_v1.svg'); }
.forum-topic-icon.is-lock { background-image: url('/assets/ui/forum_lock_v1.svg'); }
.forum-topic-icon.is-unlock { background-image: url('/assets/ui/forum_unlock_v1.svg'); }
.forum-topic-actions .forum-topic-icon.is-pin,
.forum-topic-actions .forum-topic-icon.is-unpin,
.forum-topic-actions .forum-topic-icon.is-lock,
.forum-topic-actions .forum-topic-icon.is-unlock { width: 29px; height: 29px; }
.forum-status { flex: 0 0 auto; color: #e49178; font-size: 12px; text-align: center; }
.forum-status:empty { display: none; }
.forum-content {
  flex: 1 1 auto;
  min-height: 0;
  padding: 1px 4px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #8d733d #11160f;
  touch-action: pan-y;
}
.forum-empty {
  margin: 80px auto;
  color: #8e917f;
  font-size: 16px;
  text-align: center;
}
.forum-topic-card {
  display: grid;
  grid-template-columns: 55px minmax(0, 1fr);
  gap: 9px;
  margin-bottom: 9px;
  padding: 10px;
  cursor: pointer;
  box-sizing: border-box;
}
.forum-topic-card:hover {
  border-color: #aa813d;
  background: linear-gradient(100deg, rgba(39, 37, 21, .98), rgba(26, 32, 21, .92));
}
.forum-topic-card.is-pinned {
  background: linear-gradient(100deg, rgba(46, 42, 20, .98), rgba(25, 31, 20, .92));
}
.forum-topic-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #d39c39;
  font-size: 14px;
  line-height: 1;
  border-right: 1px solid #424c3d;
}
.forum-topic-marker b { margin: 3px 0; color: #e8dfc6; font-size: 18px; }
.forum-topic-flags { display: flex; gap: 2px; margin-top: 4px; color: #d5a746; }
.forum-topic-flags .forum-topic-icon { width: 16px; height: 16px; flex-basis: 16px; transform: scale(.75); }
.forum-topic-card-body { min-width: 0; }
.forum-topic-card h3 {
  margin: 0 0 5px;
  overflow: hidden;
  color: #eee5cf;
  font: 24px/1.25 WastelandCondensed, ExoGame, sans-serif;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
}
.forum-topic-card p { margin: 0 0 4px; color: #d2ad55; font-size: 12px; text-shadow: var(--ui-text-shadow); }
.forum-topic-card small { color: #888b7c; font-size: 11px; }
.forum-post {
  position: relative;
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  min-height: 168px;
  margin-bottom: 12px;
  padding: 4px;
  box-sizing: border-box;
}
.forum-post > aside {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 17px 8px 12px;
  border-right: 1px solid rgba(113, 103, 65, .42);
  background: linear-gradient(90deg, rgba(35, 38, 27, .52), rgba(20, 26, 19, .28));
  box-shadow: inset -1px 0 rgba(8, 11, 8, .72);
}
.forum-post > aside .communication-avatar {
  width: 68px;
  height: 68px;
}
.forum-post > aside strong {
  max-width: 100%;
  overflow: hidden;
  color: #e4bc57;
  text-shadow: var(--ui-text-shadow);
  font: 400 17px WastelandCondensed, ExoGame, sans-serif;
  letter-spacing: .5px;
  text-overflow: ellipsis;
}
.forum-post > aside small { color: #818679; font-size: 10px; }
.forum-post-body {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  margin: 3px;
  padding: 12px 13px 10px;
  flex-direction: column;
  border: 1px solid rgba(98, 96, 68, .44);
  background: linear-gradient(120deg, rgba(13, 21, 15, .7), rgba(23, 27, 19, .42));
  box-shadow: inset 0 0 0 1px rgba(7, 11, 8, .7);
}
.forum-post-meta { margin-bottom: 10px; color: #96978a; font-size: 11px; text-align: right; }
.forum-post blockquote {
  margin: 0 0 9px;
  padding: 6px 9px;
  overflow: hidden;
  color: #aeb1a1;
  font-size: 12px;
  line-height: 1.35;
  border-left: 3px solid #7c724b;
  background: rgba(67, 72, 55, .22);
  white-space: pre-wrap;
}
.forum-post-text {
  min-height: 48px;
  flex: 1 1 auto;
  color: #e5dfcd;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.forum-post-text .wasteland-emoji {
  width: 36px;
  height: 36px;
  margin: 1px 2px;
  vertical-align: middle;
}
.forum-post blockquote .wasteland-emoji { width: 28px; height: 28px; vertical-align: middle; }
.forum-post-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: auto;
  padding-top: 14px;
}
.forum-post-actions > button {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 38px;
  box-sizing: border-box;
  padding: 0 7px;
  cursor: pointer;
  color: #c7c2aa;
  border: 7px solid transparent;
  border-image-source: url('/assets/ui/forum_button_frame_v2.png');
  border-image-slice: 24 fill;
  border-image-width: 7px;
  border-image-repeat: stretch;
  border-radius: 2px;
  background: transparent;
}
.forum-post-actions > button:hover { border-color: #b1843d; filter: brightness(1.12); }
.forum-post-actions .communication-icon { width: 25px; height: 25px; }
.forum-post-actions .forum-reaction {
  display: inline-flex;
  grid-template: none;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 44px;
  padding: 0 4px;
}
.forum-reaction-icon {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  background: center / contain no-repeat;
}
.forum-reaction.is-up .forum-reaction-icon { background-image: url('/assets/ui/forum_reaction_up_v1.svg'); }
.forum-reaction.is-down .forum-reaction-icon { background-image: url('/assets/ui/forum_reaction_down_v1.svg'); }
.forum-post-actions .forum-reaction b {
  min-width: 9px;
  color: #a9a489;
  font: bold 10px ExoGame, sans-serif;
}
.forum-post-actions .forum-reaction.is-up.is-active {
  border-color: #af8b3e;
  box-shadow: inset 0 0 7px rgba(212, 169, 65, .3), 0 0 4px rgba(202, 151, 42, .26);
}
.forum-post-actions .forum-reaction.is-down.is-active {
  border-color: #9b543c;
  box-shadow: inset 0 0 7px rgba(157, 60, 39, .34), 0 0 4px rgba(144, 50, 35, .24);
}
.forum-post-actions .forum-reaction.is-active b { color: #efd079; }
.forum-poll {
  position: relative;
  margin: 0 0 12px;
  padding: 14px 13px 12px;
  border: 1px solid #9b7939;
  border-top-width: 3px;
  background:
    radial-gradient(circle at 50% 0, rgba(135, 117, 55, .2), transparent 48%),
    linear-gradient(135deg, #252a1e, #101710 58%, #0a100b);
  box-shadow: inset 0 0 0 2px #11150f, inset 0 0 24px #050806, 0 3px 8px rgba(0, 0, 0, .52);
}
.forum-poll::before,
.forum-poll::after {
  content: '';
  position: absolute;
  top: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a8813c;
  box-shadow: inset 0 1px #e0bd68, 0 1px 2px #000;
}
.forum-poll::before { left: 7px; }
.forum-poll::after { right: 7px; }
.forum-poll h3 {
  margin: 0 7px 11px;
  padding: 1px 0 9px;
  color: #ecc65f;
  font: bold 17px ExoGame, sans-serif;
  border-bottom: 1px solid rgba(159, 125, 56, .52);
  text-shadow: var(--ui-text-shadow);
}
.forum-poll > .forum-poll-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  margin-bottom: 6px;
  padding: 6px 10px;
  box-sizing: border-box;
  overflow: hidden;
  color: #d7d1bc;
  border: 1px solid #4e583e;
  border-left: 3px solid #665f39;
  background: linear-gradient(90deg, rgba(16, 24, 17, .96), rgba(9, 15, 10, .9));
  box-shadow: inset 0 1px rgba(223, 207, 140, .04);
}
.forum-poll > .forum-poll-option:hover { border-color: #817342; }
.forum-poll > .forum-poll-option i {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 0;
  background: linear-gradient(90deg, rgba(113, 137, 50, .5), rgba(88, 112, 40, .2));
  box-shadow: inset -1px 0 rgba(210, 193, 91, .32);
}
.forum-poll > .forum-poll-option span {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  font-size: 14px;
  text-shadow: 0 1px 2px #000;
}
.forum-poll > .forum-poll-option input {
  position: relative;
  z-index: 1;
  appearance: none;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 0;
  cursor: pointer;
  border: 2px solid #807548;
  border-radius: 50%;
  background: radial-gradient(circle, #141b13 45%, #070b08 48%);
  box-shadow: inset 0 0 0 2px #0b0f0b, 0 1px 2px #000;
}
.forum-poll > .forum-poll-option input:checked {
  border-color: #d0a447;
  background: radial-gradient(circle, #f0c557 0 28%, #7f6728 32% 48%, #11170f 52%);
  box-shadow: 0 0 7px rgba(216, 177, 74, .48);
}
.forum-poll > .forum-poll-option:has(input:checked) { color: #f1cf70; border-color: #ac873e; }
.forum-poll > .forum-poll-option.is-selected {
  color: #f1cf70;
  border-color: #b18a3e;
  border-left-color: #e0b14d;
  background: linear-gradient(90deg, rgba(72, 69, 32, .72), rgba(19, 25, 16, .94));
}
.forum-poll > button {
  min-width: 145px;
  min-height: 40px;
  margin-top: 5px;
  padding: 5px 15px;
  color: #f0cf72;
  text-shadow: var(--ui-text-shadow);
  border: 2px solid #8e6b35;
  background: linear-gradient(#46542b, #1d2c16);
  box-shadow: inset 0 0 0 2px #161d11, 0 2px 3px #000;
}
.forum-poll > button:hover { filter: brightness(1.14); }
.forum-editor {
  position: relative;
  flex: 0 0 auto;
  padding: 9px 5px 2px;
  border-top: 1px solid rgba(151, 122, 60, .62);
  background: linear-gradient(180deg, rgba(18, 24, 17, .98), rgba(7, 11, 8, .99));
}
.forum-topic-title,
.forum-poll-editor input,
.forum-text {
  width: 100%;
  box-sizing: border-box;
  color: #e9e2cd;
  outline: 0;
  border: 1px solid #626853;
  border-radius: 2px;
  background: linear-gradient(#1c241d, #0d120e);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, .6);
  font: 14px Montserrat, sans-serif;
}
.forum-topic-title,
.forum-poll-editor input { height: 38px; margin-bottom: 6px; padding: 0 10px; }
.forum-input-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  height: 105px;
}
.forum-input-row .forum-text {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 100%;
  padding: 9px 10px;
  overflow-x: hidden;
  overflow-y: auto;
  resize: none;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.forum-text:empty::before {
  content: attr(data-placeholder);
  color: #777d72;
  pointer-events: none;
}
.forum-text .wasteland-emoji {
  width: 34px;
  height: 34px;
  margin: 0 2px;
  vertical-align: middle;
}
.forum-topic-title:focus,
.forum-poll-editor input:focus,
.forum-text:focus { border-color: #b78b3d; }
.forum-replying { margin-bottom: 6px; padding: 5px 9px; color: #e5c467; border-left: 3px solid #b2843a; background: rgba(101, 76, 32, .22); }
.forum-bb-toolbar { position: relative; display: flex; align-items: center; gap: 5px; margin-bottom: 5px; }
.forum-bb-toolbar > button,
.forum-bb-toolbar > label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 31px;
  padding: 0 7px;
  box-sizing: border-box;
  cursor: pointer;
  color: #dfc16a;
  font: 12px ExoGame, sans-serif;
  border: 1px solid #655a39;
  background: #20251b;
}
.forum-bb-toolbar > label { gap: 5px; }
.forum-bb-toolbar input[type="color"] { width: 22px; height: 22px; padding: 0; border: 0; background: none; }
.forum-emoji-toggle .wasteland-emoji { width: 27px; height: 27px; }
.forum-emoji-panel {
  /* Как в чате: над всем редактором, чтобы название и текст оставались видны. */
  right: 0;
  left: 0;
  max-height: min(210px, 32vh);
}
.forum-poll-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 35px;
  margin: 7px 0 5px;
  padding: 4px 11px 4px 6px;
  box-sizing: border-box;
  cursor: pointer;
  color: #d8cfb1;
  font: bold 12px ExoGame, sans-serif;
  border: 1px solid #5e593c;
  border-radius: 2px;
  background: linear-gradient(#2b2f23, #141a13);
  box-shadow: inset 0 0 0 1px #0e120d, 0 1px 3px #000;
  user-select: none;
}
.forum-poll-toggle:hover { color: #efd076; border-color: #94743b; }
.forum-poll-toggle input {
  appearance: none;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin: 0;
  border: 2px solid #736943;
  border-radius: 3px;
  background: linear-gradient(#111811, #080d09);
  box-shadow: inset 0 0 0 2px #080b08, 0 1px 2px #000;
}
.forum-poll-toggle input::after {
  content: '✓';
  color: #f0c75c;
  font: bold 19px/1 Arial, sans-serif;
  opacity: 0;
  transform: scale(.55);
  transition: opacity .12s, transform .12s;
  text-shadow: 0 0 5px #c99a35;
}
.forum-poll-toggle input:checked {
  border-color: #b58b3d;
  background: radial-gradient(circle, #405326, #182114 72%);
}
.forum-poll-toggle input:checked::after { opacity: 1; transform: scale(1); }
.forum-poll-editor {
  margin-bottom: 6px;
  padding: 8px 8px 2px;
  border: 1px solid #5d593c;
  background: rgba(13, 19, 14, .78);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, .52);
}
.forum-editor-actions {
  display: flex;
  flex: 0 0 52px;
  flex-direction: column;
  gap: 5px;
  margin: 0;
}
.forum-editor-actions button {
  display: grid;
  flex: 1 1 0;
  place-items: center;
  width: 52px;
  min-height: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px #11140e, 0 1px 3px #000;
}
.forum-submit {
  border: 2px solid #8e6b35;
  background: radial-gradient(circle at 50% 40%, #45522e, #1b2618 74%);
}
.forum-editor-cancel {
  border: 1px solid #754637;
  background: linear-gradient(#48291f, #211511);
}
.forum-editor-actions button:hover { filter: brightness(1.14); }
.forum-editor-actions .communication-icon { width: 33px; height: 33px; }
.forum-editor-cancel .communication-icon { width: 28px; height: 28px; }
.forum-error { min-height: 16px; padding-top: 3px; color: #e49178; font-size: 12px; text-align: center; }
.forum-error:empty { display: none; }

@media (max-width: 699px) {
  .forum-sections { gap: 5px; }
  .forum-sections button { min-width: 0; gap: 4px; padding: 6px 2px; font-size: 13px; letter-spacing: .2px; }
  .forum-section-icon { width: 20px; height: 20px; flex-basis: 20px; }
  .forum-toolbar { grid-template-columns: 48px minmax(0, 1fr) 132px; padding: 0 3px; }
  .forum-view-title { font-size: 14px; }
  .forum-view-title.is-topic-title { letter-spacing: 2px; }
  .forum-view-title.is-topic-title::before,
  .forum-view-title.is-topic-title::after { display: none; }
  .forum-new-topic { width: 132px; min-width: 0; min-height: 46px; padding: 5px 6px 7px 35px; font-size: 12px; }
  .forum-new-topic::before { left: 6px; }
  .forum-topic-actions { gap: 2px; }
  .forum-topic-actions button { width: 38px; height: 38px; }
  .forum-topic-card { grid-template-columns: 45px minmax(0, 1fr); padding: 8px; }
  .forum-topic-card h3 { font-size: 18px; }
  .forum-post { grid-template-columns: 76px minmax(0, 1fr); min-height: 136px; }
  .forum-post > aside { padding: 9px 4px; }
  .forum-post > aside .communication-avatar { width: 48px; height: 48px; }
  .forum-post > aside strong { font-size: 11px; }
  .forum-post-body { padding: 8px; }
  .forum-post-text { font-size: 15px; }
  .forum-post-actions { flex-wrap: wrap; }
  .forum-input-row { height: 88px; }
  .forum-editor-actions { flex-basis: 46px; }
  .forum-editor-actions button { width: 46px; }
}

@media (max-width: 520px) {
  .game-dialog-title { font-size: 22px; padding-left: 20px; padding-right: 64px; }
  .game-dialog-title.wasteland-heading { gap: 8px; }
  .wasteland-heading::before,
  .wasteland-heading::after { display: none; }
  .game-dialog-title.wasteland-heading::before,
  .game-dialog-title.wasteland-heading::after { display: block; }
  .forum-title-image { height: 38px; }
  .chat-title-image { height: 31px; }
}



@media (max-width: 699px) {
  .communication-modal { --window-header-height: 74px; --window-gutter: 10px; }
  .communication-message { grid-template-columns: 48px minmax(0, 1fr); gap: 8px; padding: 8px; }
  .communication-avatar { width: 44px; height: 44px; }
  .communication-message-meta strong { font-size: 16px; }
  .communication-message p { font-size: 17px; }
  .communication-message-actions button { width: 42px; height: 36px; font-size: 23px; }
  .communication-input { height: 58px; font-size: 16px; }
  .communication-emoji-toggle { flex-basis: 48px; }
  .communication-send { flex-basis: 52px; font-size: 25px; }
  .communication-emoji-panel { grid-template-columns: repeat(auto-fit, minmax(50px, 1fr)); max-height: min(205px, 30vh); }
  .communication-emoji-panel button { min-height: 52px; }
  .wasteland-emoji { width: 46px; height: 46px; }
  .communication-message p .wasteland-emoji { width: 38px; height: 38px; }
}

@media (max-height: 500px) {
  .communication-modal { --window-header-height: 58px; --window-gutter: 10px; }
  .communication-title { font-size: 28px; }
  .communication-close { top: 7px; width: 44px; height: 44px; }
  .communication-message { margin-bottom: 5px; padding-top: 6px; padding-bottom: 6px; }
  .communication-input { height: 48px; }
  .communication-composer { padding-top: 6px; }
}
