/* «Печать и воск» — оформление. Цвета — токены сайта из style.css;
   свои — только бумага и воск, которых на остальном сайте нет. */

.pc-igra {
  --bumaga: #efe2c4; --bumaga-2: #dcc9a0; --chernila: #3a2614; --chernila-2: #6a4a2a;
  --vosk: #b3342b;
  position: relative; scroll-margin-top: calc(var(--nav-h) + 8px);
}

/* ---------- Режимы и панель ---------- */
.pc-verh { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.pc-rezhimy { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); }
.pc-rezhimy button {
  min-height: 42px; padding: 8px 16px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2);
  font-weight: 600; font-size: .92rem; transition: background .2s, color .2s;
}
.pc-rezhimy button:hover { color: var(--text); background: var(--surface-2); }
.pc-rezhimy button[aria-selected="true"] { color: #1a1206; background: linear-gradient(135deg, var(--gold-2), var(--gold)); }
.pc-rezhimy button:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }

.pc-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 16px 0; min-height: 42px; }
.pc-prim { color: var(--text-2); font-size: .92rem; line-height: 1.5; max-width: 70ch; }
.pc-glavy { display: grid; grid-template-columns: repeat(10, 40px); gap: 6px; }
.pc-glava {
  height: 40px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  font-family: var(--font-display); font-weight: 600; font-variant-numeric: lining-nums; color: var(--text-2);
}
.pc-glava:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.pc-glava.is-gotovo { color: var(--gold-2); border-color: rgba(232,147,76,.45); }
.pc-glava.is-tek { color: #1a1206; background: linear-gradient(135deg, var(--gold-2), var(--gold)); border-color: var(--gold); }
.pc-glava:disabled { opacity: .35; cursor: not-allowed; }
.pc-glava:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
@media (max-width: 560px) { .pc-glavy { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; width: 100%; } .pc-glava { height: 38px; font-size: .9rem; } }

.pc-urovni { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-chip { position: relative; cursor: pointer; }
.pc-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pc-chip span {
  display: inline-flex; align-items: center; min-height: 42px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: .92rem; transition: background .2s;
}
.pc-chip:hover span { background: var(--surface-2); }
.pc-chip input:checked + span { border-color: var(--gold); color: #1a1206; background: linear-gradient(135deg, var(--gold-2), var(--gold)); font-weight: 600; }
.pc-chip input:focus-visible + span { outline: 2px solid var(--gold-2); outline-offset: 2px; }

/* ---------- Стол ---------- */
.pc-stol {
  position: relative; display: grid; gap: 16px 22px; align-items: start;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  grid-template-areas: "rasp rabota" "rasp lotok" "rasp knopki";
  padding: clamp(12px, 2.2vw, 24px); border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: #1a130f center / cover no-repeat; box-shadow: var(--shadow);
}
.pc-rasp { grid-area: rasp; }
.pc-rabota { grid-area: rabota; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pc-lotok { grid-area: lotok; }
.pc-knopki { grid-area: knopki; }
@media (max-width: 900px) {
  .pc-stol { grid-template-columns: minmax(0, 1fr); grid-template-areas: "rasp" "rabota" "knopki" "lotok"; }
}
.pc-stol.is-zhdyom > :not(.pc-zagruzka) { opacity: .35; pointer-events: none; }
.pc-stol.is-tryas { animation: pc-tryas .45s ease; }
@keyframes pc-tryas { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* ---------- Распоряжение ---------- */
.pc-rasp {
  padding: 18px 16px 14px; border-radius: var(--radius-sm); border: 1px solid rgba(232,147,76,.28);
  background: linear-gradient(180deg, rgba(38,30,48,.96), rgba(24,19,32,.96));
}
.pc-rasp-shapka { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pc-kancler { width: 56px; height: 56px; border-radius: 50%; flex: none; }
.pc-kancler[hidden] { display: none; }
.pc-rasp-h { font-size: 1.22rem; line-height: 1.25; }
.pc-meta { color: var(--gold-2); font-size: .8rem; letter-spacing: .03em; margin-top: 2px; }
.pc-meta:empty { display: none; }
.pc-istoriya { font-style: italic; color: var(--text-2); font-size: .93rem; line-height: 1.55; padding: 10px 12px; margin-bottom: 10px; border-left: 2px solid var(--gold); background: rgba(232,147,76,.06); border-radius: 0 8px 8px 0; }
.pc-istoriya[hidden] { display: none; }
.pc-usloviya { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; counter-reset: none; }
.pc-usl-b {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 8px 8px; min-height: 44px;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); font-size: .95rem; line-height: 1.45;
  transition: background .2s, border-color .2s, opacity .2s;
}
.pc-usl-b:hover { background: rgba(255,255,255,.04); }
.pc-usl-b:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 1px; }
.pc-usl-n {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px;
  font-family: var(--font-display); font-size: .82rem; font-weight: 700; color: var(--gold-2); border: 1px solid rgba(232,147,76,.5);
  font-variant-numeric: lining-nums;
}
.pc-usl.is-uchteno .pc-usl-b { opacity: .5; }
.pc-usl.is-uchteno .pc-usl-t { text-decoration: line-through; text-decoration-color: rgba(240,180,111,.6); }
.pc-usl.is-podsvet .pc-usl-b { border-color: var(--gold); background: rgba(232,147,76,.12); opacity: 1; }
.pc-usl.is-narusheno .pc-usl-b { border-color: rgba(240,90,70,.75); background: rgba(192,80,58,.16); opacity: 1; }
.pc-usl.is-narusheno .pc-usl-n { background: var(--ember); color: #fff; border-color: var(--ember); }

/* ---------- Конверты ---------- */
.pc-konverty { display: flex; flex-direction: column; gap: 8px; }
.pc-konvert {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px;
  padding: 8px 10px; border-radius: 12px; background: var(--bumaga) center / 100% 100% no-repeat;
  color: var(--chernila); box-shadow: 0 6px 18px rgba(0,0,0,.35); transition: transform .3s;
}
.pc-kto { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pc-portret { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.pc-kto b { font-family: var(--font-display); font-size: 1.08rem; font-weight: 700; color: var(--chernila); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-sloty { display: flex; gap: 6px; }
.pc-slot {
  position: relative; width: 58px; height: 58px; padding: 0; display: grid; place-items: center;
  border-radius: 12px; border: 2px dashed rgba(90,58,28,.45); background: rgba(255,250,235,.35); color: var(--chernila-2);
  transition: border-color .15s, background .15s, box-shadow .15s, transform .15s; touch-action: none;
}
.pc-slot:hover:not(:disabled) { background: rgba(255,250,235,.6); }
.pc-slot:focus-visible { outline: 3px solid var(--violet-2); outline-offset: 2px; }
.pc-slot.is-polno { border-style: solid; border-color: rgba(90,58,28,.3); background: rgba(255,250,235,.5); cursor: grab; }
.pc-slot.is-cel { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,147,76,.25); animation: pc-zhdu 1.2s ease-in-out infinite; }
.pc-slot.is-nad { border-color: var(--gold); background: rgba(240,180,111,.55); transform: scale(1.06); animation: none; }
.pc-slot.is-vybran, .pc-slot.is-tyanut { box-shadow: 0 0 0 3px var(--violet-2); }
.pc-slot.is-tyanut .pc-kart { opacity: .35; }
.pc-slot.is-oshibka { border-color: var(--ember); box-shadow: 0 0 0 3px rgba(192,80,58,.45); }
.pc-slot.is-podskazka { border-color: var(--gold); border-style: solid; box-shadow: 0 0 0 3px rgba(232,147,76,.45); }
.pc-slot:disabled { cursor: default; }
.pc-slot-p { font-size: .6rem; font-weight: 600; opacity: .75; }
@keyframes pc-zhdu { 50% { box-shadow: 0 0 0 5px rgba(232,147,76,.12); } }

.pc-pometki { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 0; }
.pc-pometki:empty { display: none; }
.pc-pometki-l { font-size: .74rem; font-style: italic; color: var(--chernila-2); margin-right: 2px; }

.pc-konvert.is-zapechatan { position: relative; }
.pc-konvert.is-zapechatan::after {
  content: ""; position: absolute; right: -6px; top: -6px; width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e0645a, var(--vosk) 55%, #6e1712); box-shadow: 0 2px 6px rgba(0,0,0,.4);
  animation: pc-shtamp .35s ease-out both;
}
.pc-konvert:nth-child(2).is-zapechatan::after { animation-delay: .08s; }
.pc-konvert:nth-child(3).is-zapechatan::after { animation-delay: .16s; }
.pc-konvert:nth-child(4).is-zapechatan::after { animation-delay: .24s; }
.pc-konvert:nth-child(5).is-zapechatan::after { animation-delay: .32s; }
@keyframes pc-shtamp { from { transform: scale(2.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Жетоны ---------- */
.pc-kart { display: grid; place-items: center; width: 46px; height: 46px; pointer-events: none; }
.pc-kart img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.pc-kart.is-yarlyk { background: center / contain no-repeat; }
.pc-kart.is-yarlyk b { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: var(--chernila); transform: translate(3px, 5px); }
.pc-kart.is-mal { width: 22px; height: 22px; position: relative; }
.pc-kart.is-mal.is-yarlyk b { font-size: .6rem; transform: translate(1px, 2px); }
.pc-kart.is-ne { opacity: .8; }
.pc-kart.is-ne::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 2px; background: var(--ember); transform: rotate(-35deg); border-radius: 2px; }
.pc-kart.is-karandash { opacity: .38; filter: grayscale(.4); }

.pc-lotok {
  display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 12px; border-radius: var(--radius-sm);
  background: rgba(12,10,19,.82); border: 1px solid var(--border-strong); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: border-color .2s;
}
.pc-lotok.is-vozvrat { border-color: var(--violet-2); border-style: dashed; }
.pc-lotok.is-pusto .pc-lotok-r::after { content: "пусто"; color: var(--text-3); font-size: .82rem; font-style: italic; align-self: center; }
.pc-lotok-gr { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pc-lotok-l { font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.pc-lotok-r { display: flex; flex-wrap: wrap; gap: 6px; min-height: 54px; }
.pc-zheton {
  width: 54px; height: 54px; padding: 0; display: grid; place-items: center; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface-2); touch-action: none; cursor: grab;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.pc-zheton:hover { border-color: rgba(240,180,111,.5); }
.pc-zheton:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.pc-zheton.is-vybran { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,147,76,.4); transform: translateY(-3px); }
.pc-zheton.is-tyanut { opacity: .35; }
.pc-zheton[hidden] { display: none; }
.pc-prizrak { position: fixed; left: 0; top: 0; z-index: 90; width: 60px; height: 60px; pointer-events: none; filter: drop-shadow(0 10px 14px rgba(0,0,0,.5)); }

/* На телефоне лоток прилипает к низу экрана, пока стол на виду: жетоны всегда
   под пальцем, а условия и конверты листаются над ними (иначе жетон пришлось бы
   нести через два экрана). На компьютере стол помещается целиком — там не нужно. */
@media (max-width: 900px) {
  .pc-lotok { position: sticky; bottom: 8px; z-index: 5; box-shadow: 0 -8px 30px rgba(0,0,0,.45); padding: 8px 10px; gap: 6px 14px; }
  .pc-zheton { width: 48px; height: 48px; }
  .pc-lotok-r { min-height: 48px; gap: 5px; }
  .pc-kart { width: 40px; height: 40px; }
  .pc-slot .pc-kart { width: 42px; height: 42px; }
}
/* Лоток на телефоне — ряд на признак, подпись слева: так он ниже вдвое и не
   закрывает собой полэкрана. */
@media (max-width: 560px) {
  .pc-lotok { flex-direction: column; gap: 4px; padding: 6px 8px; }
  .pc-lotok-gr { flex-direction: row; align-items: center; gap: 6px; }
  .pc-lotok-l { flex: none; width: 54px; font-size: .56rem; letter-spacing: .06em; line-height: 1.2; white-space: normal; }
  .pc-lotok-r { min-height: 42px; gap: 4px; flex-wrap: nowrap; }
  .pc-lotok .pc-zheton { width: 42px; height: 42px; border-radius: 10px; }
  .pc-lotok .pc-kart { width: 34px; height: 34px; }
}
@media (max-width: 420px) {
  .pc-konvert { padding: 6px 8px; gap: 4px 6px; }
  .pc-slot { width: 52px; height: 52px; }
  .pc-sloty { gap: 5px; }
  .pc-portret { width: 34px; height: 34px; }
  .pc-kto { gap: 6px; }
  .pc-kto b { font-size: .95rem; }
}
/* Три признака (Тайный советник) на узком экране: портрет над именем, мельче —
   иначе три слота по 52 px не оставляют имени места. */
@media (max-width: 420px) {
  .pc-konverty.is-tri .pc-kto { flex-direction: column; align-items: flex-start; gap: 2px; }
  .pc-konverty.is-tri .pc-portret { width: 28px; height: 28px; }
  .pc-konverty.is-tri .pc-kto b { font-size: .86rem; max-width: 100%; }
}

/* ---------- Кнопки, поля, статус ---------- */
.pc-knopki { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.pc-zapechatat.is-gotov { animation: pc-gotov 1.6s ease-in-out infinite; }
@keyframes pc-gotov { 50% { box-shadow: 0 0 0 6px rgba(232,147,76,.18), 0 14px 40px rgba(232,180,92,.3); } }
.pc-cena { font-size: .78rem; color: var(--gold-2); margin-left: 4px; font-weight: 500; }
.pc-cena:empty { display: none; }
.pc-status { flex-basis: 100%; min-height: 1.5em; color: var(--text-2); font-size: .9rem; line-height: 1.5; }
.pc-knopki button:disabled { opacity: .45; cursor: not-allowed; }

.pc-polya {
  position: relative; padding: 12px 14px 12px 16px; border-radius: 10px; background: rgba(239,226,196,.95); color: var(--chernila);
  border-left: 4px solid var(--gold); font-size: .93rem; line-height: 1.5; box-shadow: 0 6px 18px rgba(0,0,0,.3);
}
.pc-polya[hidden] { display: none; }
.pc-polya-h { display: block; font-family: var(--font-display); font-style: italic; font-size: 1rem; margin-bottom: 4px; color: var(--chernila-2); }
.pc-polya-itog { margin-top: 6px; font-weight: 600; }

/* ---------- Ожидание и итог ---------- */
.pc-zagruzka { position: absolute; inset: 0; display: grid; place-items: center; z-index: 6; }
.pc-zagruzka[hidden] { display: none; }
.pc-zagruzka span { padding: 12px 20px; border-radius: 999px; background: rgba(12,10,19,.9); border: 1px solid var(--border-strong); font-style: italic; color: var(--text-2); }

.pc-itog {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px;
  background: rgba(9,7,14,.72); border-radius: var(--radius); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .3s;
}
.pc-itog.is-on { opacity: 1; }
.pc-itog[hidden] { display: none; }
.pc-itog-in {
  position: relative; max-width: 480px; width: 100%; padding: 34px 24px 22px; text-align: center; border-radius: var(--radius);
  background: linear-gradient(180deg, #2a2136, #1a1422); border: 1px solid rgba(232,147,76,.4); box-shadow: var(--shadow);
}
.pc-itog-pechat {
  position: absolute; left: 50%; top: -30px; width: 60px; height: 60px; margin-left: -30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e0645a, var(--vosk) 55%, #6e1712); box-shadow: 0 6px 16px rgba(0,0,0,.5);
  animation: pc-shtamp .45s ease-out both;
}
.pc-itog-pechat::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; border: 3px solid rgba(80,15,12,.6); }
.pc-itog h2 { font-size: 1.6rem; margin-bottom: 10px; }
.pc-itog h2:focus { outline: none; }
.pc-itog-t { color: var(--text); font-style: italic; line-height: 1.6; }
.pc-itog-m { color: var(--gold-2); font-size: .92rem; line-height: 1.5; margin-top: 12px; }
.pc-itog-k { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }

/* ---------- Правила ---------- */
.pc-pravila { margin-top: 26px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); }
.pc-pravila summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; cursor: pointer; list-style: none;
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 600;
}
.pc-pravila summary::-webkit-details-marker { display: none; }
.pc-pravila summary svg { width: 20px; height: 20px; transition: transform .2s; }
.pc-pravila[open] summary svg { transform: rotate(180deg); }
.pc-pravila summary:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; border-radius: var(--radius); }
.pc-pravila-in { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 32px; padding: 0 20px 20px; }
@media (max-width: 760px) { .pc-pravila-in { grid-template-columns: 1fr; } }
.pc-pravila h3 { font-family: var(--font-display); font-size: 1.02rem; color: var(--gold-2); margin: 14px 0 6px; }
.pc-pravila p { color: var(--text-2); font-size: .93rem; line-height: 1.6; }
.pc-pravila p + p { margin-top: 8px; }
.pc-pravila kbd { font: inherit; font-size: .82rem; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface-2); }

@media (max-width: 560px) {
  .pc-rezhimy { width: 100%; }
  .pc-rezhimy button { flex: 1; padding: 8px 6px; font-size: .86rem; }
  .pc-rasp { padding: 14px 10px 10px; }
  .pc-usl-b { font-size: .92rem; padding: 7px 4px; }
  .pc-knopki .btn-sm { padding: 9px 12px; font-size: .85rem; }
  .pc-zapechatat { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .pc-stol.is-tryas, .pc-slot.is-cel, .pc-zapechatat.is-gotov, .pc-konvert.is-zapechatan::after, .pc-itog-pechat { animation: none; }
  .pc-itog, .pc-slot, .pc-zheton, .pc-usl-b { transition: none; }
}
