/* Rivalové — game UI components (Fáze 4: HUD, building cards, progress) */

/* ---- Resource HUD chips ---- */

#rmenu ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.resource-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface, #18241e);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.3rem 0.6rem;
  color: var(--ink, #eef5f0);
  font-family: var(--font-ui, "DM Sans", sans-serif);
  font-size: 0.9rem;
  line-height: 1.2;
  box-shadow: 0 4px 16px rgba(5, 10, 7, 0.35);
}

.resource-chip__icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex: none;
}

.resource-chip__value {
  font-weight: 600;
  color: var(--ink, #eef5f0);
  white-space: nowrap;
}

.resource-chip--level {
  background: var(--forest, #1b4a35);
  border-color: var(--forest, #1b4a35);
}

.resource-chip--level .resource-chip__value {
  color: #ffffff;
  font-family: var(--font, "Archivo Black", sans-serif);
  font-weight: 400;
  letter-spacing: 0.02em;
}

.resource-chip--full {
  border-color: var(--danger, #e85d4c);
  background: rgba(232, 93, 76, 0.15);
}

.resource-chip--full .resource-chip__value {
  color: var(--danger, #e85d4c);
  font-weight: 700;
}

@media (max-width: 480px) {
  .resource-chip {
    font-size: 0.82rem;
    padding: 0.28rem 0.5rem;
  }
}

/* ---- Building cards ---- */

.building-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.building-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface, #18241e);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  box-shadow: 0 4px 16px rgba(5, 10, 7, 0.25);
}

.building-card__icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: none;
}

.building-card__icon--placeholder {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft, #b8e6c8);
  flex: none;
}

.building-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.building-card__title {
  font-family: var(--font-ui, "DM Sans", sans-serif);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink, #eef5f0);
  text-decoration: none;
}

.building-card__title:hover {
  color: var(--accent, #2f9e5f);
}

.building-card__status {
  font-size: 0.8rem;
  color: var(--muted, #9aafa3);
}

.building-card--done .building-card__status {
  color: var(--accent, #2f9e5f);
  font-weight: 600;
}

.building-card--building {
  border-color: var(--accent, #2f9e5f);
}

.building-card--building .building-card__status {
  color: var(--accent, #2f9e5f);
  font-weight: 600;
}

.game-countdown--inline {
  margin: 0.15rem 0 0;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.building-card--affordable {
  border-color: var(--accent-soft, #8fd4a8);
  box-shadow: 0 0 0 1px var(--accent-soft, #8fd4a8), 0 4px 16px rgba(5, 10, 7, 0.25);
}

.building-card__afford {
  color: var(--accent, #2f9e5f);
  font-weight: 600;
}

.building-card--action {
  justify-content: center;
  text-align: center;
  background: var(--forest, #1b4a35);
}

.building-card--action a {
  color: #ffffff !important;
  font-family: var(--font, "Archivo Black", sans-serif);
  font-weight: 400;
  text-decoration: none;
  width: 100%;
}

/* ---- Progress bar ---- */

.game-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2, #1e2e26);
  overflow: hidden;
}

.game-progress__bar {
  height: 100%;
  border-radius: 999px;
  background: var(--accent, #2f9e5f);
}

/* ---- Countdown ---- */

.game-countdown {
  background: var(--surface, #18241e);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.6rem 0.85rem;
  margin: 0.75rem 0;
  font-size: 0.85rem;
  color: var(--muted, #9aafa3);
}

.game-countdown .odpocetbudov li {
  list-style: none;
  margin: 0;
  padding: 0.15rem 0;
}

.game-countdown .odpocetbudov b {
  color: var(--ink, #eef5f0);
}

.game-countdown.is-ending {
  border-color: var(--accent, #2f9e5f);
  box-shadow: 0 0 0 1px var(--accent, #2f9e5f), 0 4px 16px rgba(5, 10, 7, 0.35);
  animation: rival-pulse 1.6s ease-in-out infinite;
}

@keyframes rival-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

.game-countdown.is-done {
  animation: none;
  border-color: var(--accent, #2f9e5f);
}

.game-countdown.is-done .odp-tick {
  color: var(--accent, #2f9e5f);
  font-weight: 700;
}

/* ---- Pozemek hotspots ---- */
/* Clickable building links wrap transparent hotspot images layered over
   the base pozemek art — outline the hotspot's own box on hover/focus,
   coordinates/markup stay untouched. */

.pozemek-stage-inner a img {
  outline: 2px solid transparent;
  outline-offset: 2px;
  border-radius: 6px;
  transition: outline-color 0.15s ease, filter 0.15s ease;
}

body.game-body .pozemek-stage-inner a:hover img,
body.game-body .pozemek-stage-inner a:focus img {
  outline: 2px solid var(--accent-soft, #8fd4a8);
  outline-offset: 2px;
  filter: brightness(1.08);
}

/* ---- Generic content card (Fáze 5) ---- */
/* Reusable wrapper for the many admin.php ?v= sub-views and standalone
   pages that were plain tables/inline styles — same visual language as
   .building-card without assuming a building/progress-bar shape. */

.game-card {
  background: var(--surface, #18241e);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin: 0 0 0.75rem;
  box-shadow: 0 4px 16px rgba(5, 10, 7, 0.25);
}

.game-card__title {
  font-family: var(--font, "Archivo Black", sans-serif);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--ink, #eef5f0);
  margin: 0 0 0.6rem;
}

.game-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.game-list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.game-list__row:last-child {
  border-bottom: none;
}

.game-list__label {
  font-weight: 600;
  color: var(--ink, #eef5f0);
}

.game-list__value {
  color: var(--muted, #9aafa3);
  text-align: right;
}

.game-list__row a {
  color: var(--accent-soft, #8fd4a8);
  text-decoration: none;
}

.game-list__row a:hover {
  color: var(--accent, #2f9e5f);
}

.game-empty {
  color: #5a6f63;
  font-style: italic;
  padding: 0.5rem 0;
}

.game-btn {
  display: inline-block;
  background: var(--forest, #1b4a35);
  color: #ffffff !important;
  font-family: var(--font-ui, "DM Sans", sans-serif);
  font-weight: 600;
  text-decoration: none !important;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.game-btn:hover {
  background: var(--accent, #2f9e5f);
}

.game-list__icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  object-fit: contain;
}

.game-card-img {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  margin: 0 0 0.75rem;
}

/* ---- Wall composer (post form, tabs loaded via zmen()) ---- */

table.wall-composer {
  width: 100% !important;
  max-width: 500px;
  background: var(--surface, #18241e);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.75rem;
  margin: 0 0 0.75rem;
  box-shadow: 0 2px 8px rgba(5, 10, 7, 0.25);
  border-collapse: separate;
}

.wall-composer textarea,
.wall-composer input[type="text"],
.wall-composer input[type="file"] {
  width: 100%;
  background: var(--surface-2, #121a16);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0.5rem;
  color: var(--ink, #eef5f0);
  font-family: var(--font-ui, "DM Sans", sans-serif);
}

.wall-composer__tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.wall-composer__tabs td {
  flex: 1;
  cursor: pointer;
  background: var(--surface-2, #121a16);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.4rem 0.3rem;
  font-size: 0.8rem;
  text-align: center;
  color: var(--muted, #9aafa3);
}

.wall-composer__tabs td:hover {
  background: var(--accent-soft, #b8e6c8);
  color: #12261c;
}

.wall-composer__tabs td b {
  color: var(--accent-soft, #b8e6c8);
}

/* ---- Wall feed (nástěnka posts) ---- */

.wall-feed {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.wall-post {
  display: flex;
  gap: 0.65rem;
  background: var(--surface, #18241e);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  box-shadow: 0 4px 16px rgba(5, 10, 7, 0.25);
}

.wall-post__avatar {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
  flex: none;
}

.wall-post__body {
  flex: 1;
  min-width: 0;
}

.wall-post__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted, #9aafa3);
  margin-bottom: 0.25rem;
}

.wall-post__meta strong {
  color: var(--ink, #eef5f0);
  font-size: 0.9rem;
}

.wall-post__actions a {
  color: #b42318;
}

.wall-post__content {
  color: var(--ink, #eef5f0);
  word-break: break-word;
}

.wall-post__content--media iframe {
  max-width: 100%;
  border-radius: 8px;
}

.wall-feed__more {
  text-align: center;
  padding: 0.5rem 0;
}

/* ---- Character avatar (layered PNG sprite, all layers share the same
   canvas size — same composite trick used on vyridit_ucty/postava/profil) ---- */

.game-card__cols {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.avatar-stage {
  position: relative;
  width: 274px;
  height: 565px;
  max-width: 100%;
  flex: none;
  margin: 0 auto;
}

.avatar-stage img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 100%;
}

/* ---- Global lever (Fáze 5) ---- */
/* .nadpis-admin is the shared section-heading class used ~30x across
   admin.php ?v= views — restyling it once modernizes every view's
   heading without touching each PHP block individually. Same idea for
   #content links and a light-touch fallback for any legacy <table> not
   individually converted to .game-card. */

.nadpis-admin {
  font-family: var(--font, "Archivo Black", sans-serif);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--forest, #1b4a35);
  text-align: center;
  margin: 0 0 0.75rem;
  padding: 0;
}

#content a {
  color: var(--forest-2, #266348);
}

#content a:hover {
  color: var(--accent, #2f9e5f);
}

#content table:not(.wall-composer):not(.map-table) {
  font-family: var(--font-ui, "DM Sans", "Avenir Next", "Segoe UI", sans-serif);
  border-collapse: collapse;
  max-width: 100%;
}

#content table:not(.wall-composer):not(.map-table) td {
  padding: 0.35rem 0.5rem;
}

/* ---- Alertify popup readability ----
   .alertify-dialog background is white but sets no text color, so it
   inherits body's (light) game-theme color — near-white text on white.
   Force a dark, readable color regardless of the page theme. */

.alertify-text,
.alertify-text a {
  color: #1f1f1f;
}

.alertify-text a {
  text-decoration: underline;
}

/* ---- Onboarding spotlight tour ---- */

[data-onboarding-root] {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
}

.onboarding-spotlight__box {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: 320px;
  background: var(--surface, #18241e);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  color: var(--ink, #eef5f0);
  box-shadow: 0 8px 28px rgba(5, 10, 7, 0.5);
  pointer-events: auto;
  z-index: 2147483000;
}

.onboarding-spotlight__box p {
  margin: 0 0 0.6rem;
  color: var(--ink, #eef5f0);
}

.onboarding-spotlight__box button {
  margin-top: 0.5rem;
  margin-right: 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.4rem 0.8rem;
  font-family: var(--font-ui, "DM Sans", sans-serif);
  cursor: pointer;
}

.onboarding-spotlight__skip {
  background: transparent;
  color: var(--muted, #9aafa3);
}

.onboarding-spotlight__target {
  outline: 3px solid var(--accent, #2f9e5f);
  outline-offset: 3px;
  border-radius: 8px;
  position: relative;
  z-index: 2147483000;
}

/* ---- Contextual help + next-step hint ---- */

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--muted, #9aafa3);
  color: var(--surface, #18241e);
  font-size: 0.75rem;
  font-weight: bold;
  text-decoration: none;
  margin-left: 0.35rem;
  cursor: pointer;
}

.game-hint {
  background: var(--surface, #18241e);
  border: 1px dashed var(--accent-soft, #8fd4a8);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0;
  font-size: 0.85rem;
  color: var(--ink, #eef5f0);
}
