/* TeoCards - style wspolne (Android / dotyk) */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  font-family: "Segoe UI", Roboto, system-ui, sans-serif;
  background:
    radial-gradient(120% 90% at 50% 0%, #1d8a55 0%, #11653a 45%, #0a4428 100%);
  color: #fff;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}

button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(0, 0, 0, 0.18);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  font-size: 20px;
  letter-spacing: 1px;
  flex: 1;
}

.back {
  text-decoration: none;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  font-size: 26px;
  line-height: 1;
  padding: 6px 14px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status {
  font-size: 13px;
  color: #ffe9a8;
  text-align: right;
}

@media (orientation: landscape) and (max-height: 600px) {
  .topbar { padding: 4px 10px; padding-top: calc(4px + env(safe-area-inset-top)); }
  .topbar h1 { font-size: 16px; }
}

/* ---------- KARTY ---------- */
.card {
  --cw: 64px;
  --ch: 90px;
  width: var(--cw);
  height: var(--ch);
  border-radius: 8px;
  background: #fff;
  position: relative;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
  display: inline-block;
  vertical-align: top;
  overflow: hidden;
}

.card.s { --cw: 46px; --ch: 65px; border-radius: 6px; }
.card.m { --cw: 66px; --ch: 92px; }
.card.l { --cw: 88px; --ch: 124px; }

.card.red .rk, .card.red .sy, .card.red .rank-big, .card.red .fig-letter { color: #d02430; }
.card.black .rk, .card.black .sy, .card.black .rank-big, .card.black .fig-letter { color: #1c2530; }

.card .corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
  font-weight: 700;
  padding: 3px 4px;
}

.card .corner .rk { font-size: calc(var(--cw) * 0.24); }
.card .corner .sy { font-size: calc(var(--cw) * 0.21); }
.card .corner.tl { top: 0; left: 0; }
.card .corner.br { bottom: 0; right: 0; transform: rotate(180deg); }

.card .rank-big {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cw) * 0.52);
  font-weight: 800;
  font-style: italic;
}

.card .fig {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card .fig-img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

.card .fig-letter {
  font-size: calc(var(--cw) * 0.5);
  font-weight: 800;
  font-style: italic;
  align-items: center;
  justify-content: center;
}

.card.f-down {
  background: linear-gradient(160deg, #2f7dd1, #1b4d9e);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

.card.f-down .back {
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background:
    repeating-linear-gradient(45deg,
      rgba(255, 255, 255, 0.22) 0 6px, transparent 6px 14px,
      rgba(255, 255, 255, 0.12) 14px 20px, transparent 20px 28px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card.f-down .back span {
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.card.sel {
  box-shadow: 0 0 0 4px #ffd54f, 0 6px 12px rgba(0, 0, 0, 0.45);
  transform: translateY(-6px);
}

.card.ghost {
  opacity: 0.45;
}

/* ---------- MENU (hub) ---------- */
.menu {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px 30px;
  max-width: 520px;
  margin: 0 auto;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(160deg, #ffb03a, #f5821f);
  border-radius: 22px;
  padding: 24px 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.08s;
}

.menu-card:active { transform: scale(0.97); }
.menu-card.blue { background: linear-gradient(160deg, #43a5ff, #245fd6); }

.menu-card .big-glyph {
  font-size: 52px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.25);
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-card .title { font-size: 26px; font-weight: 800; letter-spacing: 1px; }
.menu-card .desc { font-size: 14px; opacity: 0.95; text-align: center; }

.info {
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.5;
}

.info h2 { font-size: 15px; margin-bottom: 6px; color: #ffe9a8; }
.info code { background: rgba(0, 0, 0, 0.3); padding: 1px 6px; border-radius: 6px; }

/* ---------- PRZYCISKI ---------- */
.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(160deg, #37b26a, #1d8a4d);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  min-height: 48px;
  cursor: pointer;
}

.btn:active { transform: scale(0.96); }
.btn.gold { background: linear-gradient(160deg, #ffb03a, #f5821f); }
.btn.red { background: linear-gradient(160deg, #ff6a6a, #d0292f); }
.btn.blue { background: linear-gradient(160deg, #43a5ff, #245fd6); }
.btn.gray { background: linear-gradient(160deg, #7a8aa0, #55657a); }
.btn:disabled { filter: grayscale(0.7) brightness(0.8); }

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.pill-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  min-height: 44px;
  cursor: pointer;
}

.pill-btn.on {
  background: #ffd54f;
  color: #3a2c00;
}

/* ---------- PASJANS PAJAK ---------- */
.spider-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

.spider-toolbar {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.18);
  scrollbar-width: none;
}

.spider-toolbar::-webkit-scrollbar { display: none; }
.spider-toolbar .pill-btn { flex-shrink: 0; font-size: 13px; padding: 8px 12px; min-height: 38px; }
.spider-toolbar .stats { margin-left: auto; font-size: 13px; color: #ffe9a8; white-space: nowrap; flex-shrink: 0; }

.spider-board {
  flex: 1;
  overflow: auto;
  padding: 10px;
  -webkit-overflow-scrolling: touch;
}

#tableau {
  position: relative;
  min-height: 100%;
}

.pile {
  position: absolute;
  top: 0;
  border-radius: 10px;
}

.pile-hint {
  outline: 3px dashed rgba(255, 255, 255, 0.35);
  outline-offset: -3px;
}

.pile-hover {
  outline: 3px solid rgba(255, 213, 79, 0.9);
  outline-offset: -3px;
  border-radius: 10px;
}

/* poziomy ruch po karcie = przeciaganie, pionowy = przewijanie planszy */
.pile .card { touch-action: pan-y; }

.drag-run {
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.pile .card { position: absolute; left: 0; }

.stock-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0 8px;
  font-size: 14px;
  color: #ffe9a8;
  flex-shrink: 0;
}

#stockBtn {
  cursor: pointer;
  transition: transform 0.08s;
}

#stockBtn:active { transform: scale(0.95); }

.stock-pile {
  display: flex;
  flex-direction: column;
}

/* karty dokladaja sie na siebie, zeby stos byl niski (~50px, nie 320px) */
.stock-pile .mini + .mini { margin-top: -25px; }

.stock-pile .mini {
  --cw: 22px; --ch: 30px;
  border-radius: 3px;
}

/* widocznosc planszy > reszty: w poziomie maksymalnie sciagnij pasek dolny i topbar */
@media (orientation: landscape) and (max-height: 600px) {
  .spider-toolbar .pill-btn { padding: 4px 8px; font-size: 12px; min-height: 30px; }
  .spider-toolbar { padding: 4px 6px; }
  .stock-zone { padding: 2px 0 4px; }
  .stock-pile .mini { --cw: 18px; --ch: 22px; }
  .stock-pile .mini + .mini { margin-top: -20px; }
  .spider-board { padding: 6px; }
}

/* ---------- KIERKI ---------- */
.hearts-app {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
}

.h-score {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
}

.h-score .pl {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 6px 4px;
  text-align: center;
  font-size: 12px;
}

.h-score .pl.you { background: rgba(255, 213, 79, 0.28); }
.h-score .pl .pts { font-size: 17px; font-weight: 800; display: block; }
.h-score .pl .pts.bad { color: #ff8f8f; }
.h-score .pl .nm { font-size: 11px; opacity: 0.9; }

.h-roundinfo {
  text-align: center;
  font-size: 13px;
  color: #ffe9a8;
  padding: 2px 10px 6px;
}

.h-table {
  flex: 1;
  position: relative;
  min-height: 240px;
}

.trick {
  position: absolute;
  inset: 70px 16px 80px;
}

.trick-slot {
  position: absolute;
  width: 88px;
  height: 124px;
}

.trick-slot .card.l { --cw: 88px; --ch: 124px; }
.trick-slot .lab {
  text-align: center;
  font-size: 11px;
  color: #ffe9a8;
  margin-top: 4px;
}

.trick-slot.p0 { left: 50%; transform: translateX(-50%); bottom: 0; }
.trick-slot.p1 { left: 0; top: 50%; transform: translateY(-50%); }
.trick-slot.p2 { left: 50%; transform: translateX(-50%); top: 0; }
.trick-slot.p3 { right: 0; top: 50%; transform: translateY(-50%); }

.trick-slot.win .card { box-shadow: 0 0 0 4px #ffd54f, 0 6px 12px rgba(0,0,0,0.4); }

.opp {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
}

.opp.top { top: 8px; left: 0; right: 0; }
.opp.left { left: 8px; top: 50%; transform: translateY(-50%); flex-direction: column; }
.opp.right { right: 8px; top: 50%; transform: translateY(-50%); flex-direction: column; }
.opp .opp-label { font-size: 11px; color: #ffe9a8; text-align: center; }
.opp .mini { --cw: 24px; --ch: 34px; border-radius: 4px; }

.opp.turn .opp-label { color: #ffd54f; font-weight: 800; }

.hand-area {
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.18);
}

.hand {
  display: flex;
  align-items: flex-end;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 2px;
  padding: 8px 4px 14px;
  min-height: 96px;
}

.hand .card {
  cursor: pointer;
  flex: 0 0 auto;
  transition: transform 0.08s;
}

/* centrowanie gdy karty sie mieszcza, przewijanie gdy nie mieszcza sie */
.hand .card:first-child { margin-left: auto; }
.hand .card:last-child { margin-right: auto; }

.hand .card.illegal { opacity: 0.35; }
.hand .card:active { transform: translateY(-10px); }

.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 4px 0;
}

/* ---------- OVERLAY / TOAST ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.overlay .panel {
  background: linear-gradient(170deg, #ffffff, #eef4ee);
  color: #223;
  border-radius: 22px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

.overlay .panel h2 { font-size: 26px; margin-bottom: 10px; }
.overlay .panel p { font-size: 15px; margin: 6px 0; line-height: 1.45; }
.overlay .panel .btn-row { margin-top: 16px; }
.overlay .panel .diff-label { font-size: 14px; margin: 14px 0 6px; color: #556; }

.diff-row { display: flex; gap: 8px; justify-content: center; }

.diff-row .pill-btn {
  background: #dde6dd;
  color: #334;
}

.diff-row .pill-btn.on {
  background: #f5821f;
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  background: rgba(20, 25, 30, 0.9);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  z-index: 60;
  pointer-events: none;
  animation: toastIn 2.6s ease forwards;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes toastIn {
  0% { opacity: 0; transform: translate(-50%, 12px); }
  12% { opacity: 1; transform: translate(-50%, 0); }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

.big-banner {
  position: fixed;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  padding: 16px 34px;
  border-radius: 999px;
  z-index: 40;
  pointer-events: none;
  animation: toastIn 1.4s ease forwards;
  text-align: center;
  max-width: 90vw;
}

/* media: szerokie ekrany */
@media (min-width: 700px) {
  .menu-card .big-glyph { font-size: 60px; width: 110px; height: 110px; }
}
