/* ============ ВРАТА МИРА — тёмное фэнтези, свечение по контуру ============ */
@property --ga { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

:root {
  --bg: #0b0a10;
  --panel: rgba(28, 25, 40, .72);
  --violet: #8a5fc0;
  --violet-dim: #5a3d85;
  --gold: #e8b64c;
  --rose: #e0607f;
  --text: #ece7f4;
  --muted: #9a93ab;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0; padding: 26px 18px 40px;
  font-family: 'Segoe UI', -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

input, textarea { user-select: text; }

/* фон: арт актов проявляется только внутри диагональной световой полосы,
   скользящей слева направо; остальной экран — монотонный тёмный */
.bg-stars, .bg-glow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
#bg-art, #bg-art2 {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-size: cover; background-position: center;
  image-rendering: pixelated; image-rendering: crisp-edges;
  opacity: 0; transition: opacity 2.2s ease;
  /* маска-щель задаётся из JS: Chrome не инвалидирует mask-image по var() */
  -webkit-mask-image: linear-gradient(115deg, transparent 0%, transparent 100%);
  mask-image: linear-gradient(115deg, transparent 0%, transparent 100%);
}
/* ободок щели: тонкая линия + мягкий ореол; маски задаёт JS */
.beam {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  -webkit-mask-image: linear-gradient(115deg, transparent 0%, transparent 100%);
  mask-image: linear-gradient(115deg, transparent 0%, transparent 100%);
}
/* тонкая резкая линия: поверх палитры — «окно яркости», бегущее вдоль полосы */
.beam-line {
  background-image:
    linear-gradient(25deg, rgba(0,0,0,.95) 0%, rgba(0,0,0,.95) 32%,
      rgba(0,0,0,0) 44%, rgba(0,0,0,0) 56%,
      rgba(0,0,0,.95) 68%, rgba(0,0,0,.95) 100%),
    repeating-linear-gradient(115deg,
      #8a5fc0 0px, #e8b64c 130px, #e0607f 260px, #8a5fc0 390px);
  background-size: 100% 320%, auto;
  background-repeat: no-repeat, repeat;
}
/* размытый ореол вокруг линии */
.beam-glow {
  background: repeating-linear-gradient(115deg,
      #8a5fc0 0px, #e8b64c 130px, #e0607f 260px, #8a5fc0 390px);
  filter: blur(16px); opacity: .5;
}
.bg-stars {
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff8 0, transparent 100%),
    radial-gradient(1px 1px at 68% 8%, #cfd0ff88 0, transparent 100%),
    radial-gradient(1.4px 1.4px at 82% 32%, #e8b64c55 0, transparent 100%),
    radial-gradient(1px 1px at 30% 62%, #fff6 0, transparent 100%),
    radial-gradient(1.2px 1.2px at 55% 80%, #b8a0e044 0, transparent 100%),
    radial-gradient(1px 1px at 90% 70%, #fff5 0, transparent 100%);
}
.bg-glow {
  background:
    radial-gradient(60% 40% at 50% 108%, #6b3fa033, transparent 70%),
    radial-gradient(50% 30% at 50% -8%, #2a1f4411, transparent 70%);
}

#app { position: relative; z-index: 1; }
.screen { max-width: 480px; margin: 0 auto; }
.hidden { display: none !important; }
.fade { animation: fadeUp .45s cubic-bezier(.2,.8,.3,1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

h1 {
  font-size: 26px; margin: 6px 0 2px; letter-spacing: .06em;
  background: linear-gradient(120deg, #fff 20%, #c9a6f0 55%, #e8b64c 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
h2 {
  font-size: 19px; margin: 0 0 6px; letter-spacing: .04em;
  background: linear-gradient(120deg, #fff, #c9a6f0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- hero сезона ---------- */
.hero { text-align: center; padding: 22px 6px 6px; }
.hero-glyph {
  font-size: 40px; color: var(--violet);
  text-shadow: 0 0 24px #8a5fc088, 0 0 60px #8a5fc044;
  animation: glyphFloat 5s ease-in-out infinite;
}
@keyframes glyphFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.banner-chip {
  display: inline-block; margin-top: 10px; padding: 5px 14px;
  border-radius: 999px; font-size: 12px; letter-spacing: .05em;
  color: var(--gold); border: 1px solid #e8b64c44;
  background: linear-gradient(90deg, #e8b64c12, #e8b64c05);
}
.lore {
  margin: 18px 0; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid #8a5fc033;
  background: linear-gradient(160deg, #6b3fa014, #120f1c 60%);
  box-shadow: inset 0 1px 0 #ffffff10, 0 8px 30px #00000040;
  font-style: italic; white-space: pre-wrap; line-height: 1.55;
  color: #d8d2e6;
}

/* ---------- карточка заявки ---------- */
.card {
  background: var(--panel); border-radius: var(--radius); padding: 6px 16px;
  border: 1px solid #ffffff10;
  box-shadow: 0 10px 34px #00000050, inset 0 1px 0 #ffffff12;
  backdrop-filter: blur(6px);
}
.row { padding: 9px 0; border-bottom: 1px solid #ffffff09; }
.row:last-child { border: none; }
.badge {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; margin: 8px 0 12px;
}
.badge.pending  { background: #3d3210; color: var(--gold);  box-shadow: 0 0 18px #e8b64c33; }
.badge.approved { background: #14301f; color: #5ce08a;      box-shadow: 0 0 18px #4fd67a33; }
.badge.rejected { background: #3d1520; color: var(--rose);  box-shadow: 0 0 18px #e0607f33; }

/* ---------- поля ---------- */
.field { margin: 14px 0; }
.field label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; letter-spacing: .04em; color: var(--muted);
  margin-bottom: 7px; text-transform: uppercase;
}
.field input, .field select {
  width: 100%; padding: 13px 14px; border-radius: 11px;
  border: 1px solid #ffffff14; outline: none;
  background: #14101f; color: var(--text); font-size: 15px;
  transition: border-color .2s;
  position: relative; z-index: 1;
}
.field input::placeholder { color: #5b5470; }
.field input:focus, .field select:focus { border-color: transparent; }

/* ── Свечение по контуру (вращающийся градиент) ── */
.glow { position: relative; border-radius: 11px; }
.glow::before {
  content: ""; position: absolute; inset: -1px; border-radius: 12px; padding: 1.5px;
  background: conic-gradient(from var(--ga),
    transparent 0%, transparent 55%,
    var(--violet) 68%, var(--gold) 80%, var(--rose) 88%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .25s;
  animation: spinGa 2.6s linear infinite paused;
  pointer-events: none;
}
.glow:hover::before, .glow:focus-within::before { opacity: 1; animation-play-state: running; }
@keyframes spinGa { to { --ga: 360deg; } }
/* запасной вариант для браузеров без @property — статичное свечение */
@supports not (background: conic-gradient(from var(--ga), red, blue)) {
  .glow:hover::before, .glow:focus-within::before { background: linear-gradient(90deg, var(--violet), var(--gold)); }
}

/* ---------- hint «i» ---------- */
.hint {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  font-size: 10px; font-style: italic; font-weight: 700;
  color: #b7a8dd; border: 1px solid #8a5fc077; background: #8a5fc01c;
  cursor: help; user-select: none; flex: none;
  transition: background .15s, color .15s;
}
.hint:hover, .hint.open { background: var(--violet); color: #fff; }
.tip-pop {
  position: fixed; z-index: 50; max-width: 270px;
  background: #1c1728; border: 1px solid #8a5fc066; border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.45; color: #d8d2e6;
  box-shadow: 0 10px 34px #00000090, 0 0 22px #8a5fc022;
  opacity: 0; pointer-events: none; transform: translateY(6px);
  transition: opacity .18s, transform .18s;
}
.tip-pop.show { opacity: 1; transform: none; }

/* ---------- файл ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.file-btn {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 14px 16px; border-radius: 11px; cursor: pointer;
  border: 1px dashed #8a5fc088;
  background: linear-gradient(120deg, #6b3fa018, #1c1728);
  transition: transform .12s, border-color .2s; overflow: hidden;
}
.file-btn:hover { border-color: #c9a6f0; }
.file-btn:active { transform: scale(.985); }
.file-btn-icon {
  font-size: 19px; width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px; background: #8a5fc022; border: 1px solid #8a5fc044;
}
.file-btn-text { color: var(--muted); font-size: 14px; }
.file-btn.has-file .file-btn-text { color: var(--text); }
.file-btn::before {
  content: ""; position: absolute; inset: -1px; border-radius: 12px; padding: 1.5px;
  background: conic-gradient(from var(--ga), transparent 55%, var(--violet) 70%, var(--gold) 84%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .25s; animation: spinGa 2.6s linear infinite paused;
}
.file-btn:hover::before { opacity: 1; animation-play-state: running; }
#photo-prev img { max-width: 100%; border-radius: 11px; margin-top: 10px; border: 1px solid #8a5fc044; box-shadow: 0 8px 30px #00000060; }

/* ---------- карта мира с меткой ---------- */
.map-box {
  position: relative; border-radius: 11px; overflow: hidden;
  border: 1px solid #8a5fc044; cursor: crosshair; touch-action: none;
  background: #0d0a14;
}
.map-box img { display: block; width: 100%; user-select: none; -webkit-user-drag: none; }
.map-mark {
  position: absolute; transform: translate(-50%, -100%);
  font-size: 30px; line-height: 1; pointer-events: none;
  filter: drop-shadow(0 2px 6px #000000cc);
  animation: markPop .25s ease-out;
}
@keyframes markPop { from { transform: translate(-50%,-100%) scale(0); } to { transform: translate(-50%,-100%) scale(1); } }
.map-ok { margin-top: 10px; padding: 11px; font-size: 14px; }
.map-ok.done { background: #2f7d4633; border-color: #4caf7d; color: #9fe0b8; }

input[type=color] { height: 46px; padding: 5px; cursor: pointer; }
.glow-color input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.glow-color input[type=color]::-webkit-color-swatch { border: none; border-radius: 8px; }

/* ---------- главная кнопка ---------- */
.btn {
  position: relative; width: 100%; margin-top: 22px; padding: 15px;
  border: none; border-radius: 12px; cursor: pointer; overflow: hidden;
  background: linear-gradient(120deg, #7a4bb0, #5a3d85 60%, #7a4bb0);
  color: #fff; font-size: 15.5px; font-weight: 700; letter-spacing: .06em;
  box-shadow: 0 8px 26px #6b3fa055, inset 0 1px 0 #ffffff28;
  transition: transform .12s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 30px #8a5fc077, inset 0 1px 0 #ffffff30; }
.btn:active { transform: translateY(0) scale(.985); }
.btn:disabled { opacity: .5; }
/* вращающееся свечение-окантовка: кольцо 2px по краю, центр закрыт */
.glow-btn::after {
  content: ""; position: absolute; inset: 0; border-radius: 12px; padding: 2px;
  background: conic-gradient(from var(--ga),
    transparent 0%, transparent 50%,
    var(--violet) 62%, var(--gold) 78%, #fff 84%, var(--rose) 90%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spinGa 3s linear infinite;
  pointer-events: none;
}
/* у «Подтвердить метку» та же окантовка; после подтверждения — зелёная */
.map-ok::after {
  content: ""; position: absolute; inset: 0; border-radius: 12px; padding: 2px;
  background: conic-gradient(from var(--ga),
    transparent 0%, transparent 50%,
    var(--violet) 62%, #c9a6f0 80%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spinGa 3s linear infinite;
  pointer-events: none;
}
.map-ok.done::after {
  background: conic-gradient(from var(--ga),
    transparent 0%, transparent 50%,
    #4caf7d 62%, #9fe0b8 80%, transparent 100%);
}

.err { color: var(--rose); margin-top: 12px; font-size: 13px; }

/* ---------- выбор знамени ---------- */
.swatch-box { border-radius: 11px; }
.sw-current {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 14px; border: none; border-radius: 11px; cursor: pointer;
  background: #14101f; color: var(--text); font-size: 14px; text-align: left;
}
.sw-current .sw-arrow { margin-left: auto; color: var(--muted); }
.sw {
  display: inline-block; width: 26px; height: 26px; flex: none; border-radius: 50%;
  background: var(--i, #555);
  box-shadow: inset 0 0 0 5px var(--o, #333), 0 0 0 1px #ffffff22, 0 2px 8px #00000060;
}
.sw-grid {
  display: none; grid-template-columns: repeat(auto-fill, 44px);
  gap: 9px; padding: 12px 14px 14px; max-height: 240px; overflow-y: auto;
}
.sw-grid.open { display: grid; }
.sw-item {
  width: 44px; height: 44px; padding: 0; border: none; border-radius: 9px;
  cursor: pointer; background: #00000030; position: relative;
  transition: transform .12s;
}
.sw-item:hover { transform: scale(1.12); }
.sw-item::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  background: var(--i); box-shadow: inset 0 0 0 7px var(--o), 0 0 0 1px #ffffff18;
}
.sw-item.sel { outline: 2px solid var(--gold); outline-offset: 2px; background: #e8b64c22; }

/* тонкий скроллбар с переливающимся градиентом */
.sw-grid { scrollbar-width: thin; scrollbar-color: var(--violet) transparent; }
.sw-grid::-webkit-scrollbar { width: 7px; }
.sw-grid::-webkit-scrollbar-track { background: #ffffff08; border-radius: 8px; }
.sw-grid::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: linear-gradient(180deg, var(--violet), var(--gold), var(--rose), var(--violet));
  background-size: 100% 300%;
  animation: swScroll 4s ease-in-out infinite;
  box-shadow: 0 0 8px #8a5fc066;
}
.sw-grid::-webkit-scrollbar-thumb:hover { box-shadow: 0 0 12px #b18fff; }
@keyframes swScroll {
  0%, 100% { background-position: 0 0; }
  50%      { background-position: 0 100%; }
}
.sw-grid::-webkit-scrollbar-button { display: none; }

/* ---------- змейка «время ожидания» ---------- */
.snake-box { margin-top: 18px; }
.snake-title {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--muted); margin-bottom: 8px;
}
.snake-title b { color: var(--gold); font-size: 15px; }
#snake-cv, .snake-cv {
  display: block; width: 100%; border-radius: 14px;
  background: radial-gradient(ellipse at center, #171026 0%, #0b0812 100%);
  border: 1px solid #ffffff14;
  box-shadow: 0 0 18px #7a4dff22, inset 0 0 30px #00000055;
  touch-action: none;
}
.snake-pad {
  display: flex; flex-direction: column; align-items: center;
  gap: 7px; margin-top: 10px; user-select: none; -webkit-user-select: none;
}
.snake-pad .row { display: flex; gap: 7px; }
.snake-btn {
  width: 58px; height: 44px; border: 1px solid #ffffff1c; border-radius: 12px;
  background: #14101f; color: var(--gold); font-size: 18px; cursor: pointer;
  /* то же двухцветное свечение, что у полей формы */
  box-shadow: 0 0 10px #8a5fc055, 0 0 18px #e8b64c22;
  transition: box-shadow .15s, transform .08s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.snake-btn:active {
  transform: scale(.92);
  box-shadow: 0 0 16px #8a5fc0, 0 0 28px #e8b64c66;
}

/* ---------- выбор тира ---------- */
.tier-icon { width: 34px; height: 34px; flex: none; image-rendering: pixelated; }
.tier-list { display: none; padding: 8px; }
.tier-list.open { display: block; }
.tier-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border: none; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--text); font-size: 14px; text-align: left;
}
.tier-item:hover { background: #8a5fc022; }
.tier-item.sel { background: #e8b64c1e; outline: 1px solid #e8b64c88; }
.tier-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tier-text b { font-weight: 600; }
.tier-desc { font-style: normal; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.tier-item.locked { opacity: .42; cursor: not-allowed; }
.tier-item.locked:hover { background: transparent; }
.tier-lock { font-size: 12px; }




.rune-pulse {
  font-size: 52px; text-align: center; margin: 26px 0 10px;
  animation: runePulse 2.4s ease-in-out infinite;
}
@keyframes runePulse {
  0%,100% { transform: scale(1); filter: drop-shadow(0 0 10px #8a5fc066); }
  50% { transform: scale(1.07); filter: drop-shadow(0 0 26px #8a5fc0cc); }
}

select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23b7a8dd' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}

/* ссылка в админ-панель — только у админа */
.admin-link {
  display: block; margin: 16px auto 0; text-align: center;
  color: var(--gold); text-decoration: none; font-size: 13px;
  border: 1px solid #e8b64c44; border-radius: 999px;
  padding: 9px 18px; max-width: 240px;
  background: #e8b64c10;
}
.admin-link:hover { background: #e8b64c22; }

/* ---------- выбор расы ---------- */
.race-ico { width: 34px; height: 34px; flex: none; image-rendering: pixelated;
  border-radius: 6px; }
.race-grid { display: none; padding: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px; max-height: 300px; overflow-y: auto; scrollbar-width: thin; }
.race-grid.open { display: grid; }
.race-item { display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 4px 7px; border: none; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--text); font-size: 11.5px; text-align: center; }
.race-item img { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 6px; }
.race-item .race-none { width: 40px; height: 40px; display: block; }
.race-item:hover { background: #8a5fc022; }
.race-item.sel { background: #e8b64c1e; outline: 1px solid #e8b64c88; }
.race-grid { scrollbar-width: thin; scrollbar-color: var(--violet) transparent; }
.race-grid::-webkit-scrollbar { width: 7px; }
.race-grid::-webkit-scrollbar-track { background: #ffffff08; border-radius: 8px; }
.race-grid::-webkit-scrollbar-thumb {
  border-radius: 8px; background: #8a5fc077;
  box-shadow: 0 0 8px #8a5fc055 inset;
}
.race-grid::-webkit-scrollbar-thumb:hover { box-shadow: 0 0 12px #b18fff; }
.race-grid::-webkit-scrollbar-button { display: none; }

/* занятые точки перевыбора на карте врат */
.rl-x {
  position: absolute; transform: translate(-50%,-50%);
  color: #ff5a5a; font-weight: 900; font-size: 15px; line-height: 1;
  pointer-events: none; text-shadow: 0 0 3px #000, 0 0 3px #000;
}
.rl-x.mine { color: #ffd75a; }

/* черновая метка — игрок прямо сейчас тычет в карту, но не подтвердил */
.rl-d {
  position: absolute; transform: translate(-50%,-50%);
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid #ffb84d; background: rgba(255,184,77,.35);
  pointer-events: none; box-shadow: 0 0 6px #000;
  animation: rlPulse 1.2s ease-in-out infinite;
}
@keyframes rlPulse { 50% { transform: translate(-50%,-50%) scale(1.5); } }
