/* =====================================================================
   Laufende Partie (app/resume-game.js, running-game-view.js):
   - Karte rechts neben dem Duell-Titel: ein Klick zurueck aufs Brett.
   - Rueckfrage beim Start einer neuen Partie (running-game-prompt.js).
   Farbsprache wie der Zurueck-Slot der Seitenleiste: Teal = Partie laeuft,
   Gold = du bist am Zug. Zwei Rauten zeigen die Voelker (Koenigs-Portraits).
   ===================================================================== */

/* ---------- Kopf der Duell-Seite: Titel links, Karte rechts ---------- */
.playPage .duell-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px 28px;
  max-width: none;
}
.playPage .duell-head-text { min-width: 0; }
.duell-run[hidden] { display: none; }
.duell-run { flex: 0 1 auto; min-width: 0; padding-bottom: 4px; }

/* ---------- Rauten (Voelker) ----------------------------------------- */
.run-dia {
  --rim: 1.5px;
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: var(--mp-gold-3);
  flex-shrink: 0;
}
.run-dia::before,
.run-dia > img {
  position: absolute;
  inset: var(--rim);
  width: calc(100% - 2 * var(--rim));
  height: calc(100% - 2 * var(--rim));
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.run-dia::before { content: ""; background: linear-gradient(135deg, #2a313e, #14171f); }
.run-dia > img { object-fit: cover; object-position: 50% 22%; }
.run-dia.opp { background: rgba(77, 208, 196, .55); }

/* ---------- Karte ---------------------------------------------------- */
@keyframes runIn {
  from { opacity: 0; transform: translateX(14px); }
}
@keyframes runLive {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.run-card {
  --run-accent: var(--mp-teal-1);
  --run-line: rgba(77, 208, 196, .28);
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 100%;
  padding: 11px 18px 11px 12px;
  font: inherit;
  text-align: left;
  color: inherit;
  background: linear-gradient(90deg, rgba(35, 155, 149, .1), rgba(11, 13, 18, .78) 72%);
  border: 1px solid var(--run-line);
  cursor: var(--mp-cur-pointer);
  animation: runIn .55s cubic-bezier(.22, .8, .24, 1) .2s both;
  transition: border-color .22s ease, background .22s ease, transform .22s ease;
}
.run-card::before,
.run-card::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1px solid var(--run-accent);
  opacity: .7;
  pointer-events: none;
  transition: border-color .22s ease;
}
.run-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.run-card::after { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.run-card.is-your-turn {
  --run-accent: var(--mp-gold-1);
  --run-line: rgba(216, 177, 90, .42);
  background: linear-gradient(90deg, rgba(216, 177, 90, .12), rgba(11, 13, 18, .78) 72%);
}
.run-card:hover,
.run-card:focus-visible {
  outline: none;
  border-color: var(--run-accent);
  transform: translateY(-1px);
}

.run-duo { position: relative; display: block; width: 56px; height: 34px; flex-shrink: 0; }
.run-duo .run-dia { position: absolute; top: 0; }
.run-duo .run-dia.you { left: 0; z-index: 1; }
.run-duo .run-dia.opp { left: 22px; transition: transform .3s cubic-bezier(.22, .8, .24, 1); }
.run-card:hover .run-duo .run-dia.opp { transform: translateX(2px); }

.run-text { display: flex; flex: 1 1 auto; flex-direction: column; gap: 3px; min-width: 0; }
.run-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mp-serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1.4px;
  color: var(--mp-bone);
  white-space: nowrap;
  min-width: 0;
}
.run-live {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--run-accent);
  box-shadow: 0 0 8px var(--run-accent);
  animation: runLive 2.4s ease-in-out infinite;
}
.run-meta {
  font-size: 11px;
  letter-spacing: .4px;
  color: var(--mp-ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.run-go {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--run-accent);
  white-space: nowrap;
  flex-shrink: 0;
}
.run-go svg { transition: transform .2s cubic-bezier(.22, .8, .24, 1); }
.run-card:hover .run-go svg { transform: translateX(4px); }

/* Schmaler Inhalt: Karte unter den Titel, volle Breite. */
@media (max-width: 1100px) {
  .playPage .duell-head { flex-direction: column; align-items: stretch; }
  .duell-run { padding-bottom: 0; }
  .run-card { width: 100%; }
  .run-go { margin-left: auto; }
}
body.mp-phone .run-card { padding: 10px 14px 10px 10px; gap: 12px; }
/* Handy: nur der Pfeil — die ganze Karte ist der Knopf. */
@media (max-width: 560px) {
  .run-go-label { display: none; }
  .run-go { margin-left: 0; }
}

/* ---------- Rueckfrage ----------------------------------------------- */
@keyframes rgpFade { from { opacity: 0; } }
@keyframes rgpOut { to { opacity: 0; } }
@keyframes rgpRise { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes rgpFromLeft { from { opacity: 0; transform: translateX(-12px); } }
@keyframes rgpFromRight { from { opacity: 0; transform: translateX(12px); } }
@keyframes rgpVs { from { opacity: 0; transform: rotate(45deg) scale(.6); } }

.rgp-ov {
  position: fixed;
  inset: 0;
  z-index: 1350;
  display: grid;
  place-items: center;
  padding: 20px 12px;
  overflow-y: auto;
  background: rgba(7, 8, 11, .82);
  backdrop-filter: blur(10px);
  animation: rgpFade .22s ease both;
}
.rgp-ov.is-leaving { animation: rgpOut .2s ease both; pointer-events: none; }

.rgp {
  position: relative;
  width: min(400px, calc(100vw - 24px));
  box-sizing: border-box;
  padding: 30px 28px 26px;
  text-align: center;
  background:
    linear-gradient(90deg, transparent, rgba(77, 208, 196, .55) 30%, rgba(216, 177, 90, .55) 70%, transparent) top / 100% 1px no-repeat,
    radial-gradient(ellipse 90% 55% at 50% 0%, rgba(77, 208, 196, .07), transparent 60%),
    linear-gradient(180deg, rgba(20, 23, 31, .97) 0%, rgba(9, 11, 15, .98) 100%);
  border: 1px solid rgba(216, 177, 90, .3);
  box-shadow: 0 40px 90px -20px rgba(0, 0, 0, .85), inset 0 0 0 1px rgba(216, 177, 90, .07);
  animation: rgpRise .32s cubic-bezier(.2, .8, .3, 1) both;
}
.rgp::before,
.rgp::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1px solid var(--mp-gold-2);
  pointer-events: none;
}
.rgp::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.rgp::after { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.rgp-x { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; }

.rgp-match {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 2px 0 18px;
}
.rgp-match .run-dia { width: 64px; height: 64px; --rim: 2px; }
.rgp-match .run-dia.you { animation: rgpFromLeft .5s cubic-bezier(.22, .8, .24, 1) .08s both; }
.rgp-match .run-dia.opp { animation: rgpFromRight .5s cubic-bezier(.22, .8, .24, 1) .08s both; }
.rgp-vs {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--mp-gold-3);
  transform: rotate(45deg);
  animation: rgpVs .45s cubic-bezier(.22, .8, .24, 1) .22s both;
}
.rgp-vs > span {
  transform: rotate(-45deg);
  font-family: var(--mp-serif);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--mp-gold-1);
}

.rgp-title {
  margin: 0 0 8px;
  font-family: var(--mp-serif);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 1.5px;
  line-height: 1.1;
  color: var(--mp-bone);
}
.rgp-meta {
  margin: 0;
  font-size: 12px;
  letter-spacing: .5px;
  color: var(--mp-ink);
}
.rgp-meta.is-ranked { color: var(--mp-gold-1); }

.rgp-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.rgp-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 18px;
  font-family: var(--mp-sans);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: var(--mp-cur-pointer);
  transition: color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.rgp-btn.primary {
  color: #0c0e13;
  background: linear-gradient(180deg, #f0d27a 0%, #d8b15a 40%, #b08530 100%);
  border-color: #f0d27a;
  box-shadow: 0 0 0 1px rgba(216, 177, 90, .25), 0 0 28px rgba(216, 177, 90, .2), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.rgp-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(216, 177, 90, .4), 0 6px 34px rgba(216, 177, 90, .38), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.rgp-btn.ghost {
  color: var(--mp-ink);
  background: transparent;
  border-color: rgba(216, 177, 90, .22);
}
.rgp-btn.ghost:hover { color: var(--mp-bone); border-color: rgba(216, 177, 90, .5); }
.rgp-btn:focus-visible { outline: 1px solid var(--mp-teal-1); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .run-card, .run-live, .rgp-ov, .rgp-ov.is-leaving, .rgp,
  .rgp-match .run-dia.you, .rgp-match .run-dia.opp, .rgp-vs { animation: none; }
  .run-card, .run-go svg, .run-duo .run-dia.opp, .rgp-btn { transition: none; }
  .run-card:hover, .rgp-btn.primary:hover { transform: none; }
}
