/* Home page and the two-player tables (tablić, sedmica, tač). Builds on lore.css. */

/* Text in three languages: show only the page's language (Serbian before the script runs). */
html:not([lang="en"]):not([lang="fi"]) [data-l]:not([data-l="sr"]),
html[lang="en"] [data-l]:not([data-l="en"]),
html[lang="fi"] [data-l]:not([data-l="fi"]) { display: none; }

/* --- home ------------------------------------------------------------------------ */

.home {
  max-width: 980px;
  min-height: 100%;
  margin: 0 auto;
  padding: 32px 16px 48px;
}
.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.home-head h1 { margin: 0; font-size: 34px; letter-spacing: .01em; }
.home-head p { margin: 6px 0 0; color: var(--muted); }
.home .langs { position: static; }

.game-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.game-tile {
  display: flex;
  gap: 16px;
  height: 100%;
  padding: 18px;
  border-radius: 14px;
  background: radial-gradient(ellipse at 20% 30%, #2a7a52 0%, var(--felt) 55%, var(--felt-dark) 100%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .3);
  color: var(--ink);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.game-tile:hover { transform: translateY(-3px); box-shadow: inset 0 0 40px rgba(0, 0, 0, .35), 0 0 0 2px var(--gold), 0 8px 20px rgba(0, 0, 0, .35); }
.tile-card {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 82px;
  border-radius: 7px;
  background: var(--card-face);
  color: var(--card-black);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
  transform: rotate(-6deg);
  line-height: 1;
}
.tile-card.red { color: var(--card-red); }
.tile-card b { font-size: 22px; }
.tile-card i { font-size: 30px; font-style: normal; }
.tile-text { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #d6e2da; }
.tile-text strong { font-size: 20px; color: var(--ink); }
.tile-text small { margin-top: auto; color: var(--muted); }

/* --- two-player table frame ------------------------------------------------------- */

.home-link { align-self: flex-start; margin-bottom: 10px; color: var(--muted); font-size: 13px; text-decoration: none; }
.home-link:hover { color: var(--gold); }
.board-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.duo .seat-top .hand.backs { --cw: calc(var(--card) * .8); }
.duo .status { bottom: calc(var(--big) * 1.42 + 100px); }
.duo .seat-top .hand.backs .card + .card { margin-left: calc(var(--cw) * -.55); }
.duo .plate .pile { background: rgba(255, 255, 255, .08); }
.tablas { color: var(--gold); font-weight: 800; letter-spacing: 2px; }

.deck {
  position: absolute;
  left: 22px;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
}
.deck .card { --cw: var(--card); }

.table-area {
  position: absolute;
  left: 50%;
  top: 46%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(78%, calc(var(--card) * 9.5));
  transform: translate(-50%, -50%);
}
.table-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: calc(var(--card) * 1.6); --cw: calc(var(--card) * 1.12); }
.table-cards .card.selectable { cursor: pointer; box-shadow: 0 0 0 2px rgba(243, 201, 105, .55), 0 4px 10px rgba(0, 0, 0, .25); }
.table-cards .card.chosen { transform: translateY(-10px); box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(243, 201, 105, .7); }
.table-cards .card.taking { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(243, 201, 105, .8); }
.take-actions { display: flex; gap: 8px; }
.btn:disabled { opacity: .45; cursor: default; }
.board header .btn { white-space: nowrap; }

.hand.own .card.selected { transform: translateY(-22%); box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(243, 201, 105, .6); }
.shown { display: flex; gap: 4px; align-items: center; }

/* Sedmica: the trick, cards overlapping in the order played. */
.trick { display: flex; justify-content: center; min-height: calc(var(--big) * 1.6); padding-top: 16px; --cw: var(--big); }
.trick .card + .card { margin-left: calc(var(--cw) * -.45); }
.trick .theirs { transform: translateY(-14px) rotate(3deg); }
.trick .mine { transform: translateY(10px) rotate(-3deg); }

/* --- Tač -------------------------------------------------------------------------------- */

.tac-row {
  position: absolute;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
}
.tac-them { left: clamp(66px, var(--x), calc(100% - 66px)); top: var(--y); transform: translate(-50%, -50%); gap: 6px; }
.tac-them.small .tac-piles { --cw: calc(var(--card) * .78); gap: 14px; }
.tac-left tr.on-turn td { color: var(--gold); }
.tac-me { bottom: 14px; flex-direction: column-reverse; }
.tac-row.active .plate { background: rgba(243, 201, 105, .22); box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(243, 201, 105, .5); }
.tac-piles { display: flex; align-items: flex-end; gap: 22px; }
.tac-them .tac-piles { --cw: var(--card); }
.tac-me .tac-piles { --cw: var(--big); position: relative; gap: calc(var(--cw) * .5); }

.pile-slot { position: relative; width: var(--cw); height: calc(var(--cw) * 1.42); border-radius: calc(var(--cw) * .09); }
.pile-slot .card { position: absolute; inset: 0; }
.empty-slot { position: absolute; inset: 0; border: 2px dashed rgba(255, 255, 255, .22); border-radius: inherit; }
.slot-count {
  position: absolute;
  right: -8px;
  bottom: -8px;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  font-size: 12px;
  text-align: center;
  z-index: 2;
}
.slot-label { position: absolute; left: 0; right: 0; top: -20px; color: var(--muted); font-size: 12px; text-align: center; }
.pile-slot.playable { cursor: pointer; }
.pile-slot.playable:hover { transform: translateY(-4px); }
.pile-slot.playable .card, .pile-slot.playable .empty-slot { box-shadow: 0 0 0 2px rgba(243, 201, 105, .6), 0 4px 10px rgba(0, 0, 0, .3); }
.pile-slot.selected .card { box-shadow: 0 0 0 3px var(--gold), 0 0 20px rgba(243, 201, 105, .7); transform: translateY(-10px); }
.pile-slot.target { cursor: pointer; animation: target-pulse 1s ease-in-out infinite; border-radius: calc(var(--cw) * .09); }
.drawn-card { position: absolute; inset: 0; z-index: 3; transform: translate(26%, -18%) rotate(6deg); }
.drawn-card .card { position: absolute; inset: 0; }
.drawn-card.playable { cursor: pointer; }
.drawn-card.selected .card { box-shadow: 0 0 0 3px var(--gold), 0 0 20px rgba(243, 201, 105, .7), 0 6px 14px rgba(0, 0, 0, .4); }

.tac-centre {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 28px;
  --cw: var(--big);
  transform: translate(-50%, -55%);
}
.btn.tach-btn {
  position: absolute;
  left: 100%;
  top: 50%;
  margin: calc(var(--cw) * -.35) 0 0 calc(var(--cw) * .45);
  white-space: nowrap;
  padding: 22px 40px;
  border-radius: 999px;
  background: #c62828;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: .03em;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .15), 0 8px 22px rgba(0, 0, 0, .45);
  animation: tach-pulse .7s ease-in-out infinite alternate;
}
.btn.tach-btn:hover { background: #e53935; }

.tac-left { margin-bottom: 6px; border: 1px solid var(--board-line); border-radius: 10px; }

@keyframes target-pulse { 50% { box-shadow: 0 0 0 4px var(--gold), 0 0 24px rgba(243, 201, 105, .8); } }
@keyframes tach-pulse { to { transform: scale(1.08); } }

@media (max-width: 900px) {
  .table-area { width: 92%; }
  .deck { left: 8px; }
}

/* Phones: the banner keeps only the game name; the rules are on the home page and the scoreboard. */
@media (max-width: 600px) {
  .btn.tach-btn { margin-left: 12px; padding: 14px 18px; font-size: 22px; }
  .felt .status { max-width: 94%; white-space: normal; text-align: center; border-radius: 14px; }
  .tac-them .plate { font-size: 12px; }
  .banner { max-width: 45%; }
  .banner span:not(.deal-no) { display: none; }
}

/* --- home: code entry, who you are, the game you are in ---------------------------- */

.home-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; margin-bottom: 20px; }
.code-form { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; }
.code-row { display: flex; gap: 8px; }
.code-input, .stack-form input {
  padding: 9px 12px;
  border: 1px solid var(--board-line);
  border-radius: 8px;
  background: #0f1216;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.code-input { width: 9.5em; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 20px; letter-spacing: .12em; text-transform: uppercase; }
.code-input:focus, .stack-form input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.who { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 14px; }
.who small { color: var(--muted); }
.who-link, .home-link { color: var(--gold); }
.flash { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; background: #26303a; }
.flash-alert { background: #4a2a2a; }
.current-game { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 20px; padding: 12px 16px; border: 1px solid var(--gold); border-radius: 12px; }
.current-game > span { flex: 1 1 260px; }
.inline-form, .tile-form { display: inline; margin: 0; }
.tile-form { display: block; height: 100%; }
button.game-tile { width: 100%; border: 0; font: inherit; text-align: left; cursor: pointer; }
.game-page > .flash { position: fixed; top: 12px; left: 50%; z-index: 30; transform: translateX(-50%); }

/* --- account ------------------------------------------------------------------------- */

.account .intro { max-width: 640px; color: #d6e2da; }
.account-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.panel-box { padding: 18px 20px; border: 1px solid var(--board-line); border-radius: 14px; background: #1c2128; }
.panel-box h2 { margin: 0 0 8px; font-size: 20px; }
.panel-box .note, .lobby .note { color: var(--muted); font-size: 14px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 10px; }
.stack-form label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

/* --- lobby and the game code --------------------------------------------------------------- */

.code-box { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border: 1px solid var(--gold); border-radius: 14px; background: rgba(10, 14, 18, .55); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.code-box span { color: var(--muted); }
.code-box strong { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 34px; letter-spacing: .14em; }
.lobby-seats { margin: 0; padding-left: 22px; line-height: 1.8; text-align: left; }
.lobby-seats .free { color: var(--muted); font-style: italic; }
.lobby-seats small { color: var(--gold); }
.copy-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--board-line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.copy-btn.big { width: 40px; height: 40px; }
.copy-btn.big svg { width: 22px; height: 22px; }
.copy-btn:hover { border-color: var(--gold); color: var(--gold); }
.copy-btn.copied { border-color: var(--good); color: var(--good); }
.code-chip { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; color: var(--muted); font-size: 13px; }
.code-chip strong { color: var(--ink); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 15px; letter-spacing: .1em; }
.overlay.notice { z-index: 40; }

@media (max-width: 600px) {
  .who { align-items: flex-start; }
  .code-box strong { font-size: 26px; }
}
.game-page > .flash { animation: flash-out 5s forwards; }
@keyframes flash-out { 80% { opacity: 1; } to { opacity: 0; visibility: hidden; } }
.account .intro { margin: 0 0 18px; }
.panel-box .note { margin: 0 0 12px; }

/* --- the waiting room: the table with a shuffling deck, rules on the left ------------------- */

.lore.lobby-table { grid-template-columns: minmax(300px, 1fr) 2fr; }
.rules-board { order: -1; border-left: 0; border-right: 1px solid var(--board-line); overflow: auto; }
.rules { color: #d6e2da; font-size: 14px; line-height: 1.5; }
.rules p { margin: 0 0 10px; }
.rules h4 { margin: 16px 0 6px; color: var(--gold); font-size: 14px; }
.rules ul { margin: 0 0 8px; padding-left: 18px; }
.rules li { margin-bottom: 5px; }

.lobby-seat { position: absolute; left: var(--x); top: var(--y); z-index: 2; transform: translate(-50%, -50%); }
.lobby-seat .plate { padding: 6px 14px; flex-direction: column; gap: 0; border-radius: 14px; }
.lobby-seat .plate small { color: var(--gold); font-size: 12px; }
.lobby-seat.free .plate { background: rgba(0, 0, 0, .18); border: 1px dashed rgba(255, 255, 255, .25); }
.lobby-seat.free .name, .lobby-seat.free small { color: var(--muted); font-weight: 500; }
.lobby-seat.add .plate { border: 2px dashed rgba(243, 201, 105, .6); background: rgba(243, 201, 105, .08); color: var(--gold); font: inherit; font-size: 14px; cursor: pointer; }
.lobby-seat.add .plate:hover { background: rgba(243, 201, 105, .2); }
.seat-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #4a2a2a;
  color: var(--ink);
  font-size: 15px;
  line-height: 22px;
  cursor: pointer;
}
.seat-remove:hover { background: #c62828; }
.seat-stepper { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; }
.seat-stepper .btn { width: 38px; padding: 4px 0; font-size: 20px; }
.seat-stepper small { color: var(--muted); }

.lobby-centre {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(62%, 470px);
  transform: translate(-50%, -52%);
  text-align: center;
}
.lobby-centre > .note { margin: 0; color: #d6e2da; font-size: 13px; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.lobby-panel { width: 100%; padding: 14px 18px; border-radius: 14px; background: rgba(10, 14, 18, .55); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.lobby-panel .note { margin: 8px 0; }
.lobby-panel .form-actions { justify-content: center; }
.lobby-count { display: flex; align-items: flex-start; justify-content: center; gap: 22px; }
.lobby-count h3 { margin: 0 0 4px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.lobby-count .vs { align-self: center; color: var(--gold); font-size: 26px; font-weight: 700; }
.bot-count { margin: 0; font-size: 34px; font-weight: 750; line-height: 1.2; }
.btn.start-now { padding: 12px 28px; font-size: 18px; }

/* A deck being riffled: the halves split left and right, lift, and fall back in turn. */
.shuffle { position: relative; width: var(--card); height: calc(var(--card) * 1.42); margin: 4px 0; --cw: var(--card); }
.shuffle .card {
  position: absolute;
  inset: 0;
  transform: translateY(calc(var(--i) * -1px));
  animation: riffle-left 2.4s cubic-bezier(.45, 0, .3, 1) infinite;
  animation-delay: calc(var(--i) * 45ms);
}
.shuffle .card:nth-child(even) { animation-name: riffle-right; }
@keyframes riffle-left {
  0%, 12% { transform: translateY(calc(var(--i) * -1px)); }
  32% { transform: translate(-75%, -6px) rotate(-12deg); }
  52% { transform: translate(-70%, -16px) rotate(-6deg); }
  72%, 100% { transform: translateY(calc(var(--i) * -1px)); }
}
@keyframes riffle-right {
  0%, 12% { transform: translateY(calc(var(--i) * -1px)); }
  32% { transform: translate(75%, -6px) rotate(12deg); }
  52% { transform: translate(70%, -16px) rotate(6deg); }
  72%, 100% { transform: translateY(calc(var(--i) * -1px)); }
}
@media (prefers-reduced-motion: reduce) { .shuffle .card { animation: none; } }

@media (max-width: 900px) {
  .lore.lobby-table { grid-template-columns: 1fr; grid-template-rows: minmax(600px, 85vh) auto; }
  .rules-board { order: 0; border-right: 0; border-top: 1px solid var(--board-line); }
  .lobby-centre { width: 92%; gap: 8px; transform: translate(-50%, -50%); }
  .lobby-seat { display: none; } /* phones: the panel lists the players and sizes the table */
}

/* --- landing ------------------------------------------------------------------------------ */
.landing .pilot-box { max-width: 480px; }
.contact-kind { margin-top: -6px; color: var(--muted); font-size: 13px; }
.contact-kind [data-kind] { display: none; }
.contact-kind[data-show="email"] [data-kind="email"],
.contact-kind[data-show="phone"] [data-kind="phone"],
.contact-kind[data-show="none"] [data-kind="none"],
.contact-kind:not([data-show]) [data-kind="none"] { display: inline; }
.contact-kind[data-show="phone"] { color: var(--good); }
