/* СТРАЖ — мобильный прототип, портрет */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: Georgia, 'Times New Roman', serif;
  background: #14100c;
  color: #e8dcc0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ---------- Сплэш и жребий ---------- */
#splash, #dice-screen {
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #2a2118 0%, #14100c 70%);
  text-align: center; padding: 24px;
}
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; max-width: 340px; }
.splash-card { width: 130px; border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.7); transform: rotate(-4deg); }
h1 { font-size: 54px; letter-spacing: 14px; text-indent: 14px; color: #d9b96c; text-shadow: 0 2px 12px rgba(217,185,108,.35); }
h2 { font-size: 34px; color: #d9b96c; letter-spacing: 4px; }
.tagline { font-size: 15px; line-height: 1.5; opacity: .8; font-style: italic; }
.hint { font-size: 13px; opacity: .5; }
.btn-big {
  font-family: inherit; font-size: 19px; padding: 13px 42px;
  background: linear-gradient(#a3813e, #7a5c24); color: #fff8e8;
  border: 1px solid #d9b96c; border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.5); cursor: pointer;
}
.btn-big:active { transform: translateY(2px); }

#dice-row { display: flex; gap: 14px; justify-content: center; min-height: 92px; }
.die { text-align: center; }
.die .cube {
  width: 52px; height: 52px; border-radius: 10px; background: #f3ead2; color: #221a10;
  font-size: 30px; font-weight: bold; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,.5); margin-bottom: 6px;
}
.die.rolling .cube { animation: shake .45s infinite; }
.die.winner .cube { outline: 3px solid #d9b96c; }
.die.out { opacity: .35; }
.die .who { font-size: 12px; opacity: .8; }
@keyframes shake { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
#dice-result { min-height: 24px; font-size: 16px; color: #d9b96c; }

/* ---------- Стол ---------- */
#table { background: radial-gradient(ellipse at 50% 42%, #35452c 0%, #22301c 55%, #17220f 100%); }

#topbar {
  display: flex; justify-content: space-between; align-items: stretch;
  padding: 6px 10px 2px; gap: 8px; flex: 0 0 auto; position: relative; z-index: 8;
}
#banner { display: flex; align-items: center; gap: 8px; }
#banner-flag {
  width: 34px; height: 46px; background: #555;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  border-top: 3px solid #d9b96c; box-shadow: 0 3px 8px rgba(0,0,0,.45);
}
#banner-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; opacity: .6; }
#banner-suit { font-size: 18px; color: #f3e6bd; }
#status { text-align: right; font-size: 13px; }
#score-line b { font-size: 18px; color: #d9b96c; }
#round-line { opacity: .75; margin-top: 2px; }
#dir-arrow { display: inline-block; margin-left: 4px; font-size: 15px; transition: transform .4s; }
#mult-badge { margin-left: 6px; color: #ff9d5c; font-weight: bold; }

/* ---------- Игровое поле ---------- */
#board { flex: 1 1 auto; position: relative; min-height: 0; z-index: 1; }

/* Соперники с веерами */
.seat { position: absolute; text-align: center; transition: filter .3s, transform .3s; z-index: 3; }
#seat-2 { left: 50%; transform: translateX(-50%); top: 0; }
#seat-1 { left: 2px; top: 34%; }
#seat-3 { right: 2px; top: 34%; }
.seat-name { font-size: 12px; opacity: .85; white-space: nowrap; }
#seat-1 .seat-name, #seat-3 .seat-name { margin-bottom: 26px; }
.seat.active { filter: drop-shadow(0 0 8px #ffd97a); }
.seat.active .seat-name { color: #ffd97a; }
.seat.trade-target { animation: pulse .8s infinite; cursor: pointer; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
#seat-2.trade-target { animation: none; outline: 2px dashed #7fd992; border-radius: 8px; }

.fan-wrap { position: relative; display: inline-block; margin-top: 2px; }
.fan { position: relative; width: 100px; height: 66px; }
#fan-2 { transform: rotate(180deg); }
#fan-1 { transform: rotate(90deg); }
#fan-3 { transform: rotate(-90deg); }
.fback {
  position: absolute; left: 50%; top: 0; width: 38px; height: 62px;
  margin-left: -19px; border-radius: 4px;
  background-image: url('img/web/rubaha.webp'); background-size: cover;
  box-shadow: -1px 1px 3px rgba(0,0,0,.55); border: 1px solid rgba(0,0,0,.4);
  transform-origin: 50% 150%;
}
.cnt {
  position: absolute; right: -6px; bottom: -8px; background: #d9b96c; color: #221a10;
  font-size: 11px; font-weight: bold; min-width: 19px; height: 19px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; z-index: 4; padding: 0 3px;
}

/* Куча в центре и сбросы */
#trick-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.tcard {
  position: absolute; width: 96px; border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.55);
}
.tcard.pile-top { box-shadow: 0 0 16px rgba(255,217,122,.55), 0 4px 12px rgba(0,0,0,.55); }

#time-stack {
  position: absolute; left: 8px; bottom: 8px; font-size: 22px; z-index: 5;
  background: rgba(0,0,0,.4); padding: 6px 10px; border-radius: 10px;
  border: 1px solid rgba(255,217,122,.4);
}
#time-stack span { font-size: 11px; display: block; color: #ffd97a; }

.trick-pile { position: absolute; font-size: 11px; opacity: .7; background: rgba(0,0,0,.3); padding: 3px 8px; border-radius: 8px; z-index: 5; }
#tricks-us { right: 8px; bottom: 8px; }
#tricks-them { right: 8px; top: 76px; }
.trick-pile b { color: #d9b96c; }

#toast {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  max-width: 88%; text-align: center; font-size: 13px; color: #ffe9b0;
  background: rgba(20,14,6,.88); padding: 6px 14px; border-radius: 14px;
  opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 7; white-space: pre-line;
}
#toast.show { opacity: 1; }

/* ---------- Рука-веер ---------- */
#hand-area { flex: 0 0 auto; position: relative; z-index: 6; padding-bottom: 4px; }
#turn-hint { text-align: center; font-size: 13px; min-height: 18px; color: #ffd97a; }
#btn-trade {
  position: absolute; top: -46px; left: 50%; transform: translateX(-50%);
  font-family: inherit; font-size: 14px; padding: 8px 16px; z-index: 7;
  background: linear-gradient(#3f7a4a, #2a5433); color: #eaffec;
  border: 1px solid #7fd992; border-radius: 20px; box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
#hand { position: relative; height: 158px; }
.hcard {
  position: absolute; width: 92px; bottom: 6px; left: 50%;
  transition: transform .18s, filter .18s;
  transform-origin: 50% 120%;
  touch-action: none;
}
.hcard img { width: 100%; border-radius: 7px; box-shadow: -3px 2px 8px rgba(0,0,0,.5); display: block; pointer-events: none; }
.hcard.illegal { filter: grayscale(.9) brightness(.5); }
.hcard.dragging { transition: none; z-index: 30 !important; }
.hcard.dragging img { box-shadow: 0 14px 30px rgba(0,0,0,.7); }

/* Просмотр карты */
#preview {
  position: fixed; left: 50%; bottom: 190px; transform: translateX(-50%);
  z-index: 25; filter: drop-shadow(0 18px 40px rgba(0,0,0,.8));
  animation: pop .18s ease-out;
}
#preview img { width: 220px; border-radius: 14px; display: block; }
@keyframes pop { from { transform: translateX(-50%) scale(.5); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* ---------- Слой анимаций ---------- */
#fx { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.fly {
  position: fixed; width: 96px; will-change: transform, opacity;
  transform-style: preserve-3d; perspective: 600px;
}
.fly .inner { position: relative; width: 100%; transform-style: preserve-3d; transition: transform .001s; }
.fly .face, .fly .back {
  width: 100%; border-radius: 8px; backface-visibility: hidden; display: block;
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.fly .face { transform: rotateY(180deg); position: absolute; inset: 0; }
.fly.small { width: 44px; }

/* ---------- Модалка ---------- */
#modal {
  position: fixed; inset: 0; background: rgba(8,5,2,.82); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#modal-box {
  background: linear-gradient(#2b2115, #1c150c); border: 1px solid #d9b96c66;
  border-radius: 14px; padding: 22px 20px; max-width: 360px; width: 100%;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.8);
  max-height: 86vh; overflow-y: auto;
}
#modal-content h3 { color: #d9b96c; font-size: 22px; margin-bottom: 12px; letter-spacing: 1px; }
#modal-content p { font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
#modal-content table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 14px; }
#modal-content td, #modal-content th { padding: 5px 8px; border-bottom: 1px solid rgba(217,185,108,.2); }
#modal-content th { color: #d9b96c; font-weight: normal; font-size: 12px; text-transform: uppercase; }
#modal-content .big { font-size: 30px; color: #ffd97a; }
#modal-content .race-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
#modal-content .race-cell { padding: 10px 6px; border-radius: 10px; font-size: 14px; }
#modal-content .race-cell .who { font-size: 11px; opacity: .8; display: block; }
#modal-btn { margin-top: 6px; }
.flagline { display: inline-block; width: 14px; height: 20px; margin-right: 6px; vertical-align: -4px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }
