/* ==========================================================
   «Устат» → Игры: общие стили игровых страниц.
   Подключается после assets/css/style.css.
   ========================================================== */

.game-page { padding-top: 22px; padding-bottom: 12px; }
.game-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; margin-bottom: 14px; }
.game-head h1 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); margin: 0; }
.game-head .lead { color: var(--text-muted); margin: 4px 0 0; max-width: 760px; }

.gk-rules { background: var(--yellow-soft); border-left: 4px solid var(--yellow); border-radius: var(--radius-sm); padding: 10px 16px; margin-bottom: 14px; }
.gk-rules summary { cursor: pointer; font-weight: 800; }
.gk-rules ul, .gk-rules ol { margin: 8px 0 4px; padding-left: 22px; }
.gk-rules li { margin: 3px 0; }

/* Обёртка игры — именно она уходит в полноэкранный режим */
#game-wrap {
  position: relative; border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden;
}
#game-wrap:fullscreen { border-radius: 0; border: 0; display: flex; flex-direction: column; overflow: auto; background: #1d1640; }
#game-wrap:-webkit-full-screen { border-radius: 0; display: flex; flex-direction: column; overflow: auto; width: 100%; height: 100%; }

.gk-bar {
  display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--text);
}
.gk-bar .select, .gk-bar .input { width: auto; min-width: 150px; padding: 8px 12px; }
.gk-bar label { display: inline-flex; align-items: center; gap: 8px; }
.gk-bar .gk-spacer { flex: 1; }
.gk-bar .btn { padding: 8px 16px; font-size: .95rem; }
.gk-extra { display: contents; }
.gk-icon-btn { min-width: 44px; }

/* Сцена: яркий праздничный фон, крупный шрифт для проектора */
.game-stage {
  --g1: #2c1f6b; --g2: #5b2c91; --g3: #b23a7c;
  position: relative; color: #fff;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.10) 0 2px, transparent 3px) 0 0 / 46px 46px,
    linear-gradient(135deg, var(--g1), var(--g2) 55%, var(--g3));
  min-height: 540px; padding: clamp(14px, 2.6vw, 34px);
  font-size: clamp(1.1rem, 1.5vw, 1.45rem); line-height: 1.4;
}
#game-wrap:fullscreen .game-stage { flex: 1; font-size: clamp(1.3rem, 2vw, 2.1rem); }
#game-wrap:-webkit-full-screen .game-stage { flex: 1; font-size: clamp(1.3rem, 2vw, 2.1rem); }
.game-stage h2, .game-stage h3 { color: #fff; }
.stage-title { font-family: var(--font-display); font-size: 1.6em; text-align: center; margin: 0 0 .5em; text-shadow: 0 3px 0 rgba(0,0,0,.18); }
.stage-sub { text-align: center; opacity: .85; margin: 0 0 1em; }
.stage-center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; min-height: 460px; }

/* «Конфетные» кнопки игры */
.gbtn {
  --c: #ffd23f; --c2: #e0a800; --tc: #3a2600;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: .55em 1.25em; border: 0; border-radius: 18px; cursor: pointer;
  font-family: var(--font); font-weight: 800; font-size: 1em; color: var(--tc);
  background: var(--c); box-shadow: 0 6px 0 var(--c2), 0 10px 18px rgba(0,0,0,.25);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease; touch-action: manipulation; user-select: none;
}
.gbtn:hover { filter: brightness(1.06); }
.gbtn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--c2), 0 4px 8px rgba(0,0,0,.25); }
.gbtn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.gbtn:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.gbtn-green { --c: #3ccf7a; --c2: #23995a; --tc: #fff; }
.gbtn-red { --c: #ff5d6c; --c2: #c53241; --tc: #fff; }
.gbtn-blue { --c: #46a3ff; --c2: #2370c4; --tc: #fff; }
.gbtn-pink { --c: #ff6fb5; --c2: #c93f84; --tc: #fff; }
.gbtn-purple { --c: #9b6bff; --c2: #6a3fd0; --tc: #fff; }
.gbtn-white { --c: #ffffff; --c2: #c9c2e0; --tc: #2b2340; }
.gbtn-lg { font-size: 1.25em; padding: .6em 1.5em; border-radius: 22px; }
.gbtn-sm { font-size: .8em; padding: .4em .9em; border-radius: 12px; box-shadow: 0 4px 0 var(--c2); }

/* Белая карточка на сцене */
.gk-card {
  background: #fff; color: #2b2340; border-radius: 24px; padding: clamp(16px, 2.4vw, 30px);
  box-shadow: 0 10px 0 rgba(0,0,0,.14), 0 20px 40px rgba(0,0,0,.2);
}

/* Команды и счёт */
.teams { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.team {
  --tc: #ffd23f;
  min-width: 150px; padding: 10px 16px; border-radius: 18px; text-align: center;
  background: rgba(255,255,255,.12); border: 3px solid var(--tc); color: #fff;
  transition: transform .2s ease, background .2s ease;
}
.team.active { background: rgba(255,255,255,.26); transform: translateY(-4px) scale(1.04); box-shadow: 0 0 0 4px rgba(255,255,255,.25); }
.team-name { font-weight: 800; font-size: .9em; }
.team-score { font-family: var(--font-display); font-size: 1.9em; font-weight: 700; line-height: 1.1; }

/* Перетаскивание */
.gk-dragging { position: relative; z-index: 60; pointer-events: none; opacity: .95; transition: none !important; box-shadow: 0 16px 30px rgba(0,0,0,.35) !important; }
.gk-over { outline: 4px dashed #fff; outline-offset: 3px; }
.gk-selected { outline: 4px solid #ffd23f; outline-offset: 3px; }

/* Экран победы */
.gk-win {
  position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(20, 10, 45, .62); animation: gkFade .3s ease both;
}
.gk-win-box {
  background: linear-gradient(160deg, #fff7d6, #ffe08a); color: #3a2600; border-radius: 30px; padding: 30px 36px;
  max-width: 620px; width: 100%; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.4); animation: gkPop .45s cubic-bezier(.2,1.6,.4,1) both;
}
.gk-win-emoji { font-size: 5rem; line-height: 1; animation: float 2.4s ease-in-out infinite; }
.gk-win h2 { font-size: clamp(2rem, 4vw, 3rem); margin: 10px 0 6px; color: #3a2600; }
.gk-win p { font-size: 1.3rem; margin: 0 0 20px; }
.gk-win-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
@keyframes gkFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gkPop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes gkShake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-10px); } 40%,80% { transform: translateX(10px); } }
@keyframes gkPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.gk-shake { animation: gkShake .45s ease; }
.gk-pulse { animation: gkPulse 1s ease-in-out infinite; }

.gk-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 400; max-width: none; }

/* Редактор своих вопросов */
.gk-editor textarea { min-height: 260px; font-family: ui-monospace, Consolas, monospace; font-size: .95rem; line-height: 1.5; }
.gk-editor .hint { font-size: .92rem; color: var(--text-muted); background: var(--bg-alt); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 12px; }
.gk-editor .hint code { background: var(--surface); padding: 1px 6px; border-radius: 6px; }
.gk-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.modal h3 { margin-top: 0; }

.gk-empty { text-align: center; padding: 60px 20px; }

/* Свои наборы вопросов (game-sets.js) */
.modal.gs-modal { max-width: 860px; }
.gs-note { background: var(--yellow-soft, #fff6d6); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: .93rem; }
.gs-note.ok { background: var(--primary-soft); }
.gs-note span { flex: 1 1 260px; }
.gs-sets { display: grid; gap: 8px; margin-bottom: 12px; }
.gs-set { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.gs-set.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.gs-set-info { min-width: 0; flex: 1 1 220px; }
.gs-set-title { font-weight: 800; overflow-wrap: anywhere; }
.gs-set-meta { font-size: .85rem; }
.gs-set-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.gs-set-btns .btn { min-width: 40px; }
.gs-del.danger { background: #e5484d; color: #fff; }
.gs-mgr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gs-err { color: #c62828; font-weight: 700; margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.gs-err:empty { display: none; }
.gs-help { font-size: .92rem; margin: 0 0 6px; }
.gs-where { font-size: .85rem; color: var(--text-muted); margin-bottom: 10px; }
.gs-title-f { display: grid; gap: 4px; margin-bottom: 12px; font-weight: 700; }
.gs-rows { list-style: decimal; padding-left: 28px; margin: 0; display: grid; gap: 8px; }
.gs-row { display: flex; gap: 6px; align-items: flex-start; }
.gs-row::marker { font-weight: 800; color: var(--text-muted); }
.gs-row-body { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 6px; }
.gs-row-body > .gs-multi, .gs-row-body > .gs-choice { grid-column: 1 / -1; }
.gs-row-tools { display: flex; gap: 2px; }
.gs-row-tools .btn { padding: 4px 8px; min-width: 32px; }
.gs-in { padding: 8px 10px; font-size: .95rem; }
textarea.gs-in { min-height: 0; resize: vertical; }
.gs-multi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.gs-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.gs-opt { display: flex; align-items: center; gap: 6px; }
.gs-opt input[type=radio] { width: 20px; height: 20px; flex: none; accent-color: #2e9e5b; }
.gs-list-foot { display: flex; align-items: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.gs-bulk-box { margin-top: 6px; }
.gs-bulk-box summary { cursor: pointer; font-weight: 700; }
.gs-bulk-box p { font-size: .88rem; margin: 6px 0; overflow-wrap: anywhere; }
.gs-bulk { width: 100%; margin-bottom: 6px; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
.gs-jp { display: grid; gap: 8px; }
.gs-jp-cat { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }
.gs-jp-cat summary { cursor: pointer; padding: 4px 0; overflow-wrap: anywhere; }
.gs-jp-cat .field { display: grid; gap: 4px; margin: 6px 0 10px; font-size: .9rem; }
.gs-jp-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.gs-jp-v { flex: none; width: 48px; font-weight: 800; color: #b8860b; padding-top: 8px; }
.gs-sort .field { display: grid; gap: 4px; margin-bottom: 10px; }
.gs-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 10px; }
.gs-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; display: grid; gap: 6px; }
.gs-group-head { display: flex; gap: 6px; }
.gs-class-info { font-weight: 700; margin: 10px 0 0; }
.jp-members { font-size: .72em; opacity: .85; max-width: 220px; margin: 2px auto 0; overflow-wrap: anywhere; line-height: 1.3; }
.rc-members { display: grid; gap: 4px; margin: 10px 0 0; font-size: .85em; overflow-wrap: anywhere; }
.rc-members > div { border-left: 4px solid var(--tc); padding-left: 8px; }
@media (max-width: 640px) {
  /* длинные названия своих наборов в списках панели не вылезают за край */
  .gk-bar label { max-width: 100%; min-width: 0; }
  .gk-bar label .select { min-width: 0; max-width: 100%; flex: 1 1 auto; text-overflow: ellipsis; }
  .modal.gs-modal { padding: 16px 12px; }
  .gs-row-body, .gs-choice { grid-template-columns: minmax(0, 1fr); }
  .gs-multi { grid-template-columns: minmax(0, 1fr); }
  .gs-row { flex-direction: column; }
  .gs-row-tools { align-self: flex-end; }
  .gs-rows { padding-left: 20px; }
  .gs-jp-row { flex-direction: column; gap: 2px; }
  .gs-jp-v { padding-top: 0; }
  .gs-set-btns { width: 100%; }
}

@media (max-width: 640px) {
  .game-stage { min-height: 420px; }
  .gk-bar .select { min-width: 0; flex: 1; }
}
/* узкие экраны: ссылки подвала переносятся, без горизонтальной прокрутки */
.site-footer .container > div:last-child { display: flex; flex-wrap: wrap; row-gap: 4px; }

@media print {
  #game-wrap { box-shadow: none; border: 0; }
}
