/* ── PokerQuest: Popielny Trakt ─────────────────────────────
   Paleta z plansz: kamień grobowca, łupkowe sukno, świece.   */
:root {
  --night: #101114;
  --slate: #1e2126;
  --slate-deep: #16181c;
  --stone: #7d7465;
  --stone-light: #a99f8c;
  --bone: #e7ddc4;
  --bone-dim: #b0a68d;
  --candle: #e39b3b;
  --flame: #f6c56b;
  --blood: #a03227;
  --warp: #8b64c9;
  --felt: #23282c;
  --display: "Grenze Gotisch", "Georgia", serif;
  --body: "Alegreya", "Georgia", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body, #app { height: 100%; }

body {
  background: var(--night);
  color: var(--bone);
  font-family: var(--body);
  overflow: hidden;
}

.stage { height: 100%; display: flex; flex-direction: column; }

h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: .02em; }

button { font-family: inherit; }

/* ── boot / loading ── */
.boot {
  height: 100%; display: grid; place-items: center; align-content: center; gap: 18px;
  color: var(--bone-dim); font-family: var(--body); font-style: italic;
}
.boot-card {
  width: 74px; height: 104px; border-radius: 8px;
  background: url("../gfx/cards/card_back.png") center/cover, var(--slate);
  border: 1px solid var(--stone);
  animation: boot-flip 1.4s ease-in-out infinite;
}
@keyframes boot-flip { 50% { transform: rotateY(180deg); } }

/* ── buttons ── */
.btn {
  background: var(--slate);
  color: var(--bone);
  border: 1px solid var(--stone);
  border-radius: 6px;
  padding: 10px 22px;
  font-size: 1.05rem;
  font-family: var(--display);
  letter-spacing: .04em;
  cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s;
}
.btn:hover:not(:disabled) { border-color: var(--candle); transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--flame); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary {
  background: linear-gradient(180deg, #5a4420, #43331a);
  border-color: var(--candle);
  color: var(--flame);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #6b5126, #4d3a1e); }
.btn-small { padding: 6px 12px; font-size: .92rem; }
.btn img { height: 1em; vertical-align: -0.12em; }

/* ── title screen ── */
.title-screen {
  flex: 1; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(227, 155, 59, .12), transparent 55%),
    radial-gradient(ellipse at 50% 110%, rgba(0,0,0,.7), transparent 60%),
    url("../gfx/backgrounds/combat_grave_table.png") center/cover no-repeat, var(--night);
}
.title-table {
  text-align: center; max-width: 560px; padding: 46px 40px 40px;
  background: rgba(16, 17, 20, .82);
  border: 1px solid var(--stone);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,.7);
  backdrop-filter: blur(3px);
}
.title-cards { display: flex; justify-content: center; margin-bottom: 6px; }
.tcard {
  width: 64px; border-radius: 6px; border: 1px solid var(--stone);
  box-shadow: 0 8px 18px rgba(0,0,0,.6);
}
.tcard-l { transform: rotate(-12deg) translateX(12px) translateY(6px); }
.tcard-c { z-index: 1; transform: translateY(-2px); }
.tcard-r { transform: rotate(12deg) translateX(-12px) translateY(6px); }
.game-title {
  font-size: clamp(3rem, 9vw, 4.6rem);
  color: var(--flame);
  text-shadow: 0 0 26px rgba(227, 155, 59, .35);
  line-height: 1.05;
}
.game-subtitle { font-family: var(--display); color: var(--stone-light); font-size: 1.25rem; margin-top: 2px; }
.game-intro { margin: 18px auto 26px; max-width: 40ch; color: var(--bone-dim); font-size: 1.06rem; line-height: 1.55; }
.title-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ── shared bars & stats ── */
.bar {
  position: relative; height: 18px; min-width: 130px; flex: 1;
  background: var(--slate-deep);
  border: 1px solid var(--stone);
  border-radius: 9px; overflow: hidden;
}
.bar-fill { height: 100%; transition: width .35s ease; }
.bar-fill.hp { background: linear-gradient(180deg, #4f8a4a, #2f5e2c); }
.bar-fill.enemy { background: linear-gradient(180deg, #b4453a, #7c241c); }
.bar-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: .78rem; font-weight: 700; letter-spacing: .05em;
  color: var(--bone); text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.stat {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .95rem; color: var(--bone-dim);
}
.stat img { height: 18px; }
.stat.corruption { color: var(--warp); }
.stat.rattle { color: var(--stone-light); }

/* ── world screen ── */
.world-screen {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(227,155,59,.06), transparent 50%),
    linear-gradient(180deg, #14161a, var(--night));
}
.world-hud {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(22, 24, 28, .9);
  border-bottom: 1px solid var(--slate);
}
.hud-hp { display: flex; align-items: center; gap: 8px; min-width: 220px; }
.hp-label { font-family: var(--display); color: var(--stone-light); }
.hp-num { font-size: .9rem; color: var(--bone-dim); }
.hud-inventory { display: flex; gap: 14px; flex-wrap: wrap; }
.inv-item { display: inline-flex; align-items: center; gap: 4px; color: var(--bone-dim); font-size: .95rem; }
.inv-item img { height: 18px; }
.inv-item em { font-style: normal; color: var(--stone-light); }

.world-map { flex: 1; min-height: 0; padding: 8px 10px; }
.world-map svg { width: 100%; height: 100%; }

.road {
  stroke: var(--stone); stroke-width: .45; stroke-dasharray: 1.4 1.2;
  opacity: .65;
}
.node { cursor: pointer; }
.node-ring { fill: none; stroke: var(--stone); stroke-width: .5; }
.node-core { fill: var(--slate); stroke: var(--stone-light); stroke-width: .25; }
.node-glyph {
  text-anchor: middle; font-size: 2.6px; fill: var(--bone);
  pointer-events: none;
}
.node-name {
  text-anchor: middle; font-size: 2.1px; fill: var(--bone-dim);
  font-family: var(--body); pointer-events: none;
  paint-order: stroke; stroke: rgba(16,17,20,.85); stroke-width: .6px;
}
.node:hover .node-core { stroke: var(--candle); }
.node.current .node-ring { stroke: var(--flame); stroke-width: .7; animation: pulse 2.4s ease-in-out infinite; }
.node.current .node-core { fill: #43331a; stroke: var(--candle); }
.node.current { cursor: default; }
@keyframes pulse { 50% { opacity: .45; } }
.node.gate .node-core { fill: #351712; stroke: var(--blood); }
.node.gate .node-glyph { fill: #e0a49d; }
.node.resource .node-core { fill: #1e2a22; }
.node.resource .node-glyph { fill: #c9b458; }
.node.story .node-core { fill: #241d31; }
.node.story .node-glyph { fill: var(--warp); }

.world-panel {
  display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap;
  padding: 14px 18px 16px;
  background: rgba(22, 24, 28, .92);
  border-top: 1px solid var(--slate);
}
.here { flex: 1; min-width: 260px; }
.here h2 { color: var(--flame); font-size: 1.5rem; }
.here p { color: var(--bone-dim); margin: 4px 0 10px; }
.world-message {
  max-width: 34ch; font-style: italic; color: var(--stone-light);
  border-left: 2px solid var(--stone); padding-left: 12px; font-size: .95rem;
}

/* ── combat screen ── */
.combat-screen {
  position: relative;
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  background:
    linear-gradient(180deg, rgba(16,17,20,.78), rgba(16,17,20,.55) 45%, rgba(16,17,20,.85)),
    url("../gfx/backgrounds/combat_dungeon.png") center/cover no-repeat, var(--night);
}

.enemy-zone {
  display: flex; align-items: center; justify-content: center; gap: 22px;
  padding: 14px 16px 6px;
}
.enemy-plate { min-width: 260px; max-width: 420px; flex: 1; }
.enemy-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.enemy-name { font-size: 1.7rem; color: #dfa9a0; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.intent {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .88rem; color: var(--bone-dim); font-style: italic;
}
.intent img { height: 22px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.8)); }
.enemy-bar { margin-top: 6px; }
.chips-row { margin-top: 6px; display: flex; gap: 14px; }
.enemy-portrait {
  width: 108px; height: 108px; object-fit: cover; border-radius: 50%;
  border: 2px solid var(--stone);
  box-shadow: 0 0 0 4px rgba(0,0,0,.5), 0 14px 34px rgba(0,0,0,.7);
}
.enemy-sigil {
  width: 96px; height: 96px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-size: 3rem; color: var(--blood);
  background: radial-gradient(circle at 35% 30%, #2a2126, #17141a);
  border: 2px solid var(--stone);
  box-shadow: 0 0 0 4px rgba(0,0,0,.5), 0 14px 34px rgba(0,0,0,.7);
}

.mid-zone {
  display: flex; gap: 16px; align-items: stretch;
  padding: 4px 16px; min-height: 0;
}
.log {
  flex: 1; min-width: 220px; max-height: 118px; overflow-y: auto;
  padding: 8px 12px;
  background: rgba(16,17,20,.72);
  border: 1px solid var(--slate);
  border-radius: 8px;
  font-size: .9rem; color: var(--bone-dim); line-height: 1.45;
}
.log p + p { margin-top: 2px; }
.powers { display: flex; gap: 16px; flex-wrap: wrap; align-content: flex-start; }
.power-group h3 {
  font-size: 1rem; color: var(--stone-light); margin-bottom: 6px;
  display: flex; align-items: center; gap: 5px;
}
.power-group h3 img { height: 16px; }
.power-group .btn { margin: 0 6px 6px 0; }
.sleight { border-color: var(--warp); color: #cbb7ea; }
.sleight.tainted { border-color: var(--blood); color: #dfa9a0; }
.locked-hint { font-size: .85rem; font-style: italic; color: var(--stone); }

.table-zone {
  margin-top: auto;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse at 50% 130%, rgba(227,155,59,.10), transparent 60%),
    linear-gradient(180deg, rgba(35,40,44,.35), rgba(23,26,29,.97) 30%);
  border-top: 1px solid #33383d;
}
.player-hud { display: flex; align-items: center; gap: 16px; max-width: 640px; margin: 0 auto 10px; }

.hand {
  display: flex; justify-content: center; align-items: flex-end;
  min-height: 132px; padding: 6px 0 2px;
}
.pcard {
  position: relative;
  width: 82px; height: 118px; margin: 0 -9px;
  border-radius: 8px;
  background: linear-gradient(168deg, #f1e8d3, #d9cdb0);
  border: 1px solid #9a8f78;
  box-shadow: 0 6px 16px rgba(0,0,0,.55);
  cursor: pointer;
  transform: rotate(var(--rot, 0deg));
  transform-origin: 50% 115%;
  transition: transform .16s ease, box-shadow .16s ease;
  display: flex; flex-direction: column; align-items: center;
  padding: 6px; color: #2c2c34; text-align: center;
}
.pcard:hover { transform: rotate(var(--rot, 0deg)) translateY(-10px); z-index: 3; }
.pcard:focus-visible { outline: 2px solid var(--flame); outline-offset: 2px; z-index: 3; }
.pcard.selected {
  transform: rotate(0deg) translateY(-22px);
  box-shadow: 0 0 0 2px var(--candle), 0 14px 26px rgba(0,0,0,.6);
  z-index: 4;
}
.pcard-corner {
  position: absolute; top: 5px; left: 7px;
  display: flex; align-items: center; gap: 2px;
  font-weight: 700; font-size: 1.02rem;
}
.pcard-suit { font-size: 1.05rem; line-height: 1; }
.pcard.red-suit .pcard-corner { color: #9c2b20; }
.pcard.black-suit .pcard-corner { color: #23232b; }
.pcard-pip { margin: auto; }
.pcard-pip img { height: 34px; opacity: .9; }
.pcard-name {
  margin-top: 24px; font-family: var(--display);
  font-size: .86rem; line-height: 1.1; color: #4a3413;
}
.pcard-ability { font-size: .62rem; line-height: 1.25; color: #5d5545; margin-top: 3px; }
.pcard.tag-skill { background: linear-gradient(168deg, #f4e6c4, #e0c98e); border-color: var(--candle); }
.pcard.tag-tainted { background: linear-gradient(168deg, #e3d3e8, #c3aacb); border-color: var(--warp); }
.pcard.tag-warped { background: linear-gradient(168deg, #d9d3ec, #b3a9d6); border-color: var(--warp); }
.pcard.tag-wild { background: linear-gradient(168deg, #f6eecd, #ead9a0); border-color: var(--flame); }

.actions {
  display: flex; justify-content: center; align-items: center; gap: 14px;
  flex-wrap: wrap; margin-top: 10px;
}
.hint { color: var(--stone-light); font-style: italic; font-size: .95rem; }
.attention { animation: attention 1.6s ease-in-out infinite; }
@keyframes attention {
  50% { box-shadow: 0 0 0 4px rgba(227, 155, 59, .25), 0 0 18px rgba(227, 155, 59, .35); }
}

/* ── overlays ── */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgba(10, 10, 12, .78);
  animation: fade-in .3s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.overlay-card {
  text-align: center; padding: 34px 44px;
  background: var(--slate-deep);
  border: 1px solid var(--stone);
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0,0,0,.8);
  max-width: min(440px, 92vw);
}
.overlay-card img { height: 110px; margin-bottom: 8px; filter: drop-shadow(0 6px 18px rgba(0,0,0,.7)); }
.overlay-card h2 { font-size: 2.2rem; }
.overlay-card.won h2 { color: var(--flame); }
.overlay-card.lost h2 { color: #cf7d72; }
.overlay-card p { color: var(--bone-dim); margin: 8px 0 0; }
.overlay-card .reward { color: var(--warp); }
.overlay-card .btn { margin-top: 22px; }

/* ── finale ── */
.finale {
  flex: 1; display: grid; place-items: center; align-content: center; gap: 12px;
  text-align: center; padding: 24px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(227,155,59,.16), transparent 55%),
    var(--night);
}
.finale-glyph { height: 150px; filter: drop-shadow(0 10px 30px rgba(0,0,0,.8)); }
.finale h1 { font-size: 3rem; color: var(--flame); }
.finale p { color: var(--bone-dim); font-size: 1.15rem; }
.finale .btn { margin-top: 16px; }

/* ── blazor error bar ── */
#blazor-error-ui {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--blood); color: var(--bone);
  padding: 10px 16px; font-size: .95rem;
}
#blazor-error-ui a { color: var(--flame); margin-left: 10px; }

/* ── responsive ── */
@media (max-width: 720px) {
  .mid-zone { flex-direction: column; }
  .log { max-height: 76px; }
  .enemy-zone { gap: 14px; }
  .enemy-portrait, .enemy-sigil { width: 76px; height: 76px; }
  .enemy-name { font-size: 1.3rem; }
  .pcard { width: 68px; height: 100px; margin: 0 -11px; }
  .pcard-name { font-size: .74rem; margin-top: 20px; }
  .world-panel { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
